:root {
  color-scheme: light;
  --ink: #17211c;
  --muted: #66736c;
  --line: #d9e0dc;
  --panel: #ffffff;
  --soft: #f5f7f4;
  --accent: #2f6f4e;
  --accent-dark: #20543b;
  --accent-soft: #e5f0e8;
  --warn: #8d5b18;
  --shadow: 0 18px 45px rgba(33, 50, 40, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #eef2ed;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
}

.sidebar {
  background: #18241e;
  color: #f7faf6;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: #244332;
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 5px;
  color: #8ab89c;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 24px;
}

.progress-card {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  padding: 16px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  color: #dce7df;
  font-size: 14px;
}

.progress-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

#progressBar {
  height: 100%;
  width: 0;
  background: #8bc59d;
  transition: width 180ms ease;
}

.question-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
}

.question-nav button {
  width: 100%;
  text-align: left;
  color: #d7e2db;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 12px;
  cursor: pointer;
}

.question-nav button.active {
  color: #ffffff;
  border-color: rgba(139, 197, 157, 0.8);
  background: rgba(139, 197, 157, 0.14);
}

.question-nav span {
  display: block;
  color: #8ab89c;
  font-size: 12px;
  margin-bottom: 4px;
}

.workspace {
  padding: 32px;
  display: grid;
  gap: 22px;
  align-content: start;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.topbar h2 {
  font-size: 30px;
  line-height: 1.24;
  max-width: 940px;
  margin-bottom: 0;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  background: var(--panel);
  cursor: pointer;
  font-size: 20px;
}

.question-panel,
.recent-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.question-panel {
  padding: 28px;
}

.question-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.question-meta span {
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 700;
}

#questionCount {
  background: var(--soft);
  color: var(--muted);
}

.coverage-card {
  border: 1px solid var(--line);
  background: #fbfcfb;
  padding: 14px;
  margin-bottom: 18px;
}

.coverage-card > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.coverage-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.coverage-card strong {
  color: var(--accent-dark);
  font-size: 24px;
}

.coverage-track {
  height: 9px;
  background: #e5ebe7;
  overflow: hidden;
}

#coverageBar {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 180ms ease;
}

.coverage-card p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

#questionTitle {
  font-size: 26px;
  line-height: 1.26;
  margin-bottom: 10px;
}

.question-copy {
  color: var(--muted);
  line-height: 1.6;
  font-size: 16px;
  margin-bottom: 18px;
}

.known-box {
  border: 1px solid #bad0c1;
  background: #f0f7f2;
  padding: 15px;
  margin-bottom: 14px;
}

.known-box span {
  display: block;
  color: var(--accent-dark);
  font-weight: 800;
  font-size: 13px;
  margin-bottom: 7px;
}

.known-box p {
  color: #31453a;
  line-height: 1.55;
  margin-bottom: 0;
}

.hint-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.hint-grid > div {
  background: var(--soft);
  border: 1px solid var(--line);
  padding: 14px;
}

.hint-grid span {
  display: block;
  color: var(--accent-dark);
  font-weight: 800;
  font-size: 13px;
  margin-bottom: 7px;
}

.hint-grid p {
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 0;
}

.answer-form {
  display: grid;
  gap: 16px;
}

.answer-form label {
  display: grid;
  gap: 8px;
  font-weight: 800;
}

.edit-current {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: end;
  border: 1px solid #d6e2db;
  background: #f8fbf9;
  padding: 14px;
}

.edit-current textarea {
  min-height: 110px;
}

.edit-help {
  grid-column: 1 / -1;
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 12px 13px;
}

textarea {
  resize: vertical;
  min-height: 180px;
  line-height: 1.55;
}

.upload-box {
  border: 1px dashed #a8b6ad;
  background: #fbfcfb;
  padding: 16px;
}

.upload-box label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
}

.upload-box span {
  color: var(--muted);
  font-weight: 500;
}

#fileList {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.message {
  min-height: 24px;
  color: var(--accent-dark);
  font-weight: 700;
}

.message.error {
  color: #9a321f;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.primary,
.secondary {
  border: 1px solid transparent;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 800;
}

.primary {
  background: var(--accent);
  color: white;
}

.primary:disabled {
  opacity: 0.62;
  cursor: wait;
}

.secondary {
  background: white;
  color: var(--ink);
  border-color: var(--line);
}

.recent-panel {
  padding: 22px;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-title h3 {
  margin-bottom: 0;
  font-size: 20px;
}

.section-title p {
  margin-bottom: 0;
  color: var(--muted);
}

#recentList {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

#recentList li {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  color: var(--muted);
}

#recentList strong {
  display: block;
  color: var(--ink);
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .question-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace {
    padding: 20px;
  }

  .topbar h2 {
    font-size: 24px;
  }

  .hint-grid {
    grid-template-columns: 1fr;
  }

  .edit-current {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .question-nav {
    grid-template-columns: 1fr;
  }

  .question-panel {
    padding: 18px;
  }

  .form-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .primary,
  .secondary {
    width: 100%;
  }
}
