:root {
  --bg: #eef3f8;
  --bg-strong: #dbe8f4;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: #ffffff;
  --text: #1b1b1b;
  --muted: #5e6a75;
  --line: rgba(0, 90, 158, 0.14);
  --accent: #0067b8;
  --accent-strong: #005a9e;
  --accent-soft: rgba(0, 103, 184, 0.1);
  --good: #107c10;
  --good-soft: rgba(31, 107, 69, 0.12);
  --bad: #d13438;
  --bad-soft: rgba(155, 45, 32, 0.1);
  --shadow: 0 18px 42px rgba(0, 48, 87, 0.12);
  --radius: 24px;
  --font-display: "Segoe UI Variable Display", "Segoe UI", "Helvetica Neue", sans-serif;
  --font-body: "Segoe UI Variable Text", "Segoe UI", "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.92), transparent 28%),
    linear-gradient(135deg, #f5f9fc 0%, #eaf2f9 45%, #ddebf7 100%);
}

button,
input {
  font: inherit;
}

.page-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 40px 0 56px;
}

.hero {
  padding: 12px 6px 24px;
}

.eyebrow,
.section-label,
.overview-label {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--accent);
}

.hero h1,
.workspace-card h2 {
  margin: 0;
  font-family: var(--font-display);
  line-height: 1;
  letter-spacing: -0.04em;
}

.hero h1 {
  font-size: clamp(2.6rem, 5vw, 5rem);
  max-width: 10ch;
}

.hero-copy {
  max-width: 52rem;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.7;
}

.hero-actions {
  margin-top: 20px;
}

.app-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
}

.overview-card,
.workspace-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.overview-card {
  padding: 24px;
  align-self: start;
  position: sticky;
  top: 20px;
}

.overview-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.overview-stats div {
  padding: 18px;
  border-radius: 18px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
}

.overview-stats span {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.overview-stats small,
.chapter-chip small,
.score-badge small,
.review-meta,
.progress-label {
  color: var(--muted);
}

.chapter-list {
  display: grid;
  gap: 10px;
}

.chapter-chip {
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(242, 247, 252, 0.98));
  border: 1px solid var(--line);
}

.chapter-chip-row,
.selector-card-footer {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
}

.chapter-chip strong {
  display: block;
  margin-bottom: 4px;
}

.chapter-action {
  width: 100%;
  margin-top: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 103, 184, 0.08);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill.live {
  background: rgba(0, 103, 184, 0.12);
  color: var(--accent-strong);
}

.status-pill.done {
  background: var(--good-soft);
  color: var(--good);
}

.workspace-card {
  padding: 30px;
}

.panel,
.panel-state {
  min-height: 600px;
}

.panel-state,
.panel {
  animation: rise 280ms ease;
}

.panel-state {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.selector-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin-top: 24px;
}

.selector-card {
  padding: 22px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 248, 252, 0.98));
}

.selector-card h3 {
  margin: 0 0 10px;
  font-size: 1.3rem;
}

.selector-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.selector-card-footer {
  margin-top: 18px;
  align-items: end;
}

.selector-card-footer small {
  display: block;
  max-width: 16rem;
  line-height: 1.5;
}

.hidden {
  display: none;
}

.question-topline,
.results-header,
.nav-row,
.results-actions {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: flex-start;
}

.progress-label {
  margin: 4px 0 0;
  white-space: nowrap;
}

.progress-track {
  width: 100%;
  height: 14px;
  margin: 22px 0 26px;
  border-radius: 999px;
  background: rgba(0, 103, 184, 0.12);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-strong), #2b88d8);
  transition: width 220ms ease;
}

.question-docs {
  margin-top: 18px;
}

.choice-list {
  display: grid;
  gap: 14px;
}

.choice-option {
  position: relative;
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 14px;
  align-items: start;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  cursor: pointer;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease;
}

.choice-option:hover {
  transform: translateY(-1px);
  border-color: rgba(0, 103, 184, 0.3);
}

.choice-option.selected {
  background: var(--accent-soft);
  border-color: rgba(0, 103, 184, 0.38);
}

.choice-option input {
  margin-top: 2px;
}

.choice-text {
  white-space: pre-line;
  line-height: 1.6;
}

.nav-row,
.results-actions {
  margin-top: 26px;
}

.primary-button,
.secondary-button {
  border: none;
  border-radius: 999px;
  padding: 14px 22px;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 180ms ease,
    opacity 180ms ease,
    background-color 180ms ease;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

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

.secondary-button {
  background: rgba(0, 103, 184, 0.08);
  color: var(--accent-strong);
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.score-badge {
  min-width: 170px;
  padding: 18px 20px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(0, 103, 184, 0.14), rgba(0, 103, 184, 0.04));
  border: 1px solid rgba(0, 103, 184, 0.18);
  text-align: right;
}

.score-badge span {
  display: block;
  font-size: 2rem;
  font-weight: 800;
}

.review-list {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}

.password-form {
  max-width: 460px;
  margin-top: 24px;
}

.password-label {
  display: block;
  margin-bottom: 10px;
  font-weight: 700;
}

.password-input {
  width: 100%;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--text);
}

.password-message {
  min-height: 1.5rem;
  color: var(--bad);
}

.answer-sets {
  display: grid;
  gap: 28px;
  margin-top: 24px;
}

.answer-set-header h3 {
  margin: 0;
  font-size: 1.4rem;
}

.review-card {
  padding: 20px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
}

.review-card.correct {
  background: linear-gradient(180deg, rgba(31, 107, 69, 0.08), rgba(255, 252, 247, 0.95));
  border-color: rgba(31, 107, 69, 0.28);
}

.review-card.incorrect {
  background: linear-gradient(180deg, rgba(155, 45, 32, 0.06), rgba(255, 252, 247, 0.95));
  border-color: rgba(155, 45, 32, 0.25);
}

.review-card h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.review-meta {
  margin-bottom: 14px;
  font-size: 0.92rem;
}

.review-answer-label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.review-answer {
  margin: 0 0 12px;
  white-space: pre-line;
  line-height: 1.55;
}

.review-card.correct .review-answer-label {
  color: var(--good);
}

.review-card.incorrect .review-answer-label {
  color: var(--bad);
}

.review-link {
  display: inline-flex;
  margin-top: 4px;
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration: none;
}

.review-link:hover {
  text-decoration: underline;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .overview-card {
    position: static;
  }

  .question-topline,
  .results-header {
    flex-direction: column;
  }

  .score-badge {
    text-align: left;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100vw - 20px, 1180px);
    padding-top: 20px;
  }

  .workspace-card,
  .overview-card {
    padding: 20px;
  }

  .nav-row {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .chapter-chip-row,
  .selector-card-footer {
    flex-direction: column;
    align-items: flex-start;
  }

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