:root {
  color-scheme: light dark;
  --bg: #f4f6f1;
  --surface: #fbfcf8;
  --panel: #fffefb;
  --ink: #17211d;
  --muted: #66736d;
  --line: #d9e0d6;
  --line-strong: #b8c4ba;
  --accent: #0b6b5b;
  --accent-strong: #074d42;
  --accent-soft: #e2f1ec;
  --blue: #285a86;
  --blue-soft: #e6eef6;
  --amber: #9a650d;
  --amber-soft: #f7ead1;
  --red: #a6423f;
  --red-soft: #f4dfdc;
  --focus: #315fd8;
  --shadow: 0 14px 34px rgb(30 42 36 / 0.08);
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111815;
    --surface: #151f1b;
    --panel: #19241f;
    --ink: #edf3ed;
    --muted: #a6b3ac;
    --line: #304038;
    --line-strong: #53645b;
    --accent: #4bc0a8;
    --accent-strong: #8bdccf;
    --accent-soft: #18352f;
    --blue: #9bc7f0;
    --blue-soft: #182838;
    --amber: #e3b45c;
    --amber-soft: #3a2c17;
    --red: #e18a84;
    --red-soft: #3f2220;
    --focus: #9bb8ff;
    --shadow: 0 16px 36px rgb(0 0 0 / 0.28);
  }
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, var(--surface) 0, var(--bg) 360px),
    var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
select {
  font: inherit;
}

button {
  touch-action: manipulation;
}

button:focus-visible,
select:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.app-shell {
  width: min(1380px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 22px 0 32px;
}

a {
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--blue);
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.88rem;
}

.breadcrumb a {
  color: var(--muted);
  font-weight: 800;
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--accent-strong);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  gap: 24px;
  align-items: end;
  padding: 8px 0 18px;
}

.hub-topbar {
  min-height: 310px;
  align-items: center;
}

.title-block {
  min-width: 0;
  max-width: 790px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  max-width: 820px;
  font-size: clamp(2rem, 4.2vw, 4rem);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 10px;
  font-size: 0.98rem;
  line-height: 1.25;
  letter-spacing: 0;
}

.intro-copy {
  max-width: 720px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.control-row {
  display: grid;
  min-width: 0;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  box-shadow: var(--shadow);
  padding: 14px;
}

.hub-card {
  align-content: start;
  gap: 10px;
}

.hub-card strong {
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.1;
}

.contact-email {
  font-size: clamp(1rem, 2vw, 1.2rem) !important;
  overflow-wrap: anywhere;
}

.primary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 42px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: #fbfffc;
  padding: 0 17px;
  text-decoration: none;
}

.primary-link:hover {
  background: var(--accent-strong);
  color: #fbfffc;
}

.select-wrap {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  padding: 10px 12px;
}

.trust-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
}

.trust-strip div {
  min-width: 0;
  padding: 14px 18px;
}

.trust-strip div + div {
  border-left: 1px solid var(--line);
}

.trust-strip strong,
.trust-strip span {
  display: block;
}

.trust-strip strong {
  margin-bottom: 4px;
  color: var(--accent-strong);
  font-size: 0.9rem;
}

.trust-strip span {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.support-section {
  margin-top: 18px;
  padding-top: 4px;
}

.support-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.support-card,
.support-copy {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel) 88%, var(--blue-soft));
  padding: 18px;
}

.support-card h2,
.support-copy h2 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.support-card p,
.support-copy p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.52;
}

.support-card ul {
  display: grid;
  gap: 6px;
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.42;
}

.support-card li {
  overflow-wrap: anywhere;
}

.support-card a,
.support-card span {
  display: inline-flex;
  margin-top: 14px;
}

.support-card span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 850;
}

.detail-link {
  align-items: center;
  color: var(--accent-strong);
  font-size: 0.9rem;
  line-height: 1.3;
}

.answer-block,
.source-block,
.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.answer-block {
  margin-bottom: 16px;
  padding: 20px;
  border-left: 4px solid var(--accent);
}

.answer-block h2,
.source-block h2,
.section-heading {
  margin-bottom: 8px;
  font-size: 1rem;
}

.answer-block p,
.source-block p,
.source-block li {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.answer-block p,
.source-block p {
  margin-bottom: 0;
}

.table-wrap {
  overflow-x: auto;
}

.fact-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 0.94rem;
}

.fact-table th,
.fact-table td {
  border-bottom: 1px solid var(--line);
  padding: 13px 15px;
  text-align: left;
  vertical-align: top;
}

.fact-table th {
  width: 34%;
  color: var(--accent-strong);
  font-weight: 850;
}

.fact-table tr:last-child th,
.fact-table tr:last-child td {
  border-bottom: 0;
}

.source-block {
  margin-top: 14px;
  padding: 18px;
}

.source-block ul {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding-left: 18px;
}

.source-block a {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.site-footer {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 24px clamp(24px, 4vw, 52px);
  margin-top: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface) 86%, var(--accent-soft)) 0%, var(--panel) 58%),
    var(--panel);
  box-shadow: 0 10px 28px rgb(30 42 36 / 0.06);
  padding: clamp(20px, 3vw, 30px);
  color: var(--muted);
}

.footer-brand {
  max-width: 560px;
}

.footer-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.footer-logo:hover {
  color: var(--ink);
  text-decoration: none;
}

.footer-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: var(--radius);
  box-shadow: 0 8px 18px rgb(11 107 91 / 0.18);
}

.footer-logo strong {
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 1rem;
}

.footer-kicker {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.footer-brand p {
  margin: 14px 0 0;
  font-size: 0.88rem;
  line-height: 1.58;
}

.footer-links {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(140px, 0.65fr);
  gap: 22px;
  align-self: start;
}

.footer-heading {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.2;
  text-transform: uppercase;
}

.footer-link-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.footer-link-list a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 82%, var(--accent-soft));
  padding: 7px 10px;
  color: var(--accent-strong);
  font-size: 0.9rem;
  font-weight: 850;
  line-height: 1.15;
  text-decoration: none;
}

.footer-link-list--compact a {
  width: 100%;
}

.footer-link-list a:hover,
.footer-link-list a:focus-visible {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}

.footer-disclaimer {
  grid-column: 1 / -1;
  margin: 0;
  border-top: 1px solid var(--line);
  padding-top: 16px;
  font-size: 0.84rem;
  line-height: 1.5;
}

.section-heading {
  color: var(--accent-strong);
}

.muted-card {
  background: color-mix(in srgb, var(--panel) 88%, var(--amber-soft));
}

.support-copy {
  margin-top: 14px;
  max-width: 900px;
}

.support-copy p + p {
  margin-top: 10px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(230px, 0.72fr) minmax(460px, 1.72fr) minmax(280px, 0.86fr);
  gap: 14px;
  align-items: start;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.status-panel,
.review-panel {
  display: grid;
  gap: 18px;
  padding: 18px;
  position: sticky;
  top: 16px;
}

.question-panel {
  min-height: 590px;
  padding: clamp(20px, 2.4vw, 30px);
}

.metric-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.metric-label,
.timer span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.metric-row strong,
.timer strong {
  font-size: 1.5rem;
  line-height: 1;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 70%, transparent);
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 160ms ease;
}

.timer {
  display: flex;
  align-items: end;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.topic-list {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
}

.topic-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 11px 0;
  font-size: 0.9rem;
}

.topic-item span {
  color: var(--muted);
  font-weight: 800;
}

.question-head,
.review-head,
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.question-head {
  margin-bottom: 24px;
}

.pill,
.draft-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: 4px 10px;
  font-size: 0.76rem;
  font-weight: 850;
}

.pill.muted {
  border-color: color-mix(in srgb, var(--amber) 35%, transparent);
  background: var(--amber-soft);
  color: var(--amber);
  text-transform: capitalize;
}

.draft-badge {
  white-space: nowrap;
}

.counter {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

#questionStem {
  min-height: 104px;
  margin-bottom: 22px;
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1.3;
  letter-spacing: 0;
}

.choices {
  display: grid;
  gap: 10px;
}

.choice {
  width: 100%;
  min-height: 62px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 13px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  transition:
    transform 120ms ease,
    border-color 120ms ease,
    background-color 120ms ease;
}

.choice:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.choice:active {
  transform: translateY(0);
}

.choice[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.choice.correct {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.choice.incorrect {
  border-color: var(--red);
  background: var(--red-soft);
}

.choice-key {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--line) 58%, transparent);
  color: var(--ink);
  font-weight: 900;
}

.choice.correct .choice-key {
  background: var(--accent);
  color: var(--panel);
}

.choice.incorrect .choice-key {
  background: var(--red);
  color: var(--panel);
}

.feedback {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: color-mix(in srgb, var(--surface) 68%, var(--panel));
  line-height: 1.52;
}

.feedback strong {
  display: block;
  margin-bottom: 6px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
}

.result-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 70%, var(--panel));
  padding: 16px;
}

.result-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.result-card strong {
  font-size: clamp(1.5rem, 2.3vw, 2rem);
}

.result-note {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--amber);
  border-radius: var(--radius);
  color: var(--muted);
  padding: 12px 14px;
  line-height: 1.45;
}

.actions {
  margin-top: 24px;
  justify-content: flex-end;
}

.feedback-link {
  display: inline-flex;
  width: fit-content;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 850;
}

.feedback-link:hover {
  color: var(--accent-strong);
}

.primary-button,
.secondary-button {
  min-height: 42px;
  border-radius: var(--radius);
  padding: 0 17px;
  font-weight: 850;
  cursor: pointer;
  transition:
    transform 120ms ease,
    border-color 120ms ease,
    background-color 120ms ease;
}

.primary-button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fbfffc;
}

.secondary-button {
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--ink);
}

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

.primary-button:not(:disabled):active,
.secondary-button:not(:disabled):active {
  transform: translateY(0);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  border-color: var(--line);
  background: color-mix(in srgb, var(--line) 32%, var(--panel));
  color: var(--muted);
}

.note {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

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

.question-map {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.question-map-button {
  display: grid;
  place-items: center;
  min-width: 0;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 850;
  cursor: pointer;
}

.question-map-button.correct {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.question-map-button.incorrect {
  border-color: var(--red);
  background: var(--red-soft);
  color: var(--red);
}

.question-map-button.current {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.review-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  font-size: 0.88rem;
  line-height: 1.35;
}

.review-item.correct {
  border-left: 4px solid var(--accent);
}

.review-item.incorrect {
  border-left: 4px solid var(--red);
}

.empty-review {
  color: var(--muted);
  font-size: 0.9rem;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: minmax(220px, 0.85fr) minmax(420px, 1.55fr);
  }

  .review-panel {
    grid-column: 1 / -1;
    position: static;
  }

  .question-map {
    grid-template-columns: repeat(10, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .app-shell {
    width: calc(100vw - 20px);
    max-width: 690px;
    padding-top: 14px;
  }

  .topbar {
    grid-template-columns: 1fr;
    gap: 16px;
    align-items: stretch;
  }

  h1 {
    font-size: clamp(2rem, 11vw, 3rem);
    line-height: 1;
  }

  .intro-copy {
    font-size: 0.96rem;
  }

  .trust-strip {
    grid-template-columns: 1fr;
  }

  .trust-strip div {
    padding: 12px 0;
  }

  .trust-strip div + div {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

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

  .site-footer {
    grid-template-columns: 1fr;
    margin-top: 30px;
    padding: 18px;
  }

  .footer-links {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .footer-link-list a,
  .footer-link-list--compact a {
    flex: 1 1 132px;
    justify-content: center;
  }

  .support-card,
  .support-copy {
    padding: 15px;
  }

  .primary-link {
    width: 100%;
  }

  .workspace {
    display: flex;
    flex-direction: column;
  }

  .question-panel {
    order: -1;
    width: 100%;
    min-height: 0;
  }

  .status-panel,
  .review-panel {
    width: 100%;
    position: static;
  }

  .question-head,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .question-head {
    gap: 10px;
  }

  .actions {
    margin-top: 20px;
  }

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

  .feedback-link {
    width: 100%;
    justify-content: center;
  }

  #questionStem {
    min-height: 0;
    font-size: clamp(1.3rem, 6vw, 1.65rem);
  }

  .choice {
    grid-template-columns: 34px minmax(0, 1fr);
    padding: 12px;
  }

  .choice-key {
    width: 30px;
    height: 30px;
  }

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

  .table-wrap {
    overflow-x: visible;
  }

  .fact-table {
    min-width: 0;
  }

  .fact-table,
  .fact-table tbody,
  .fact-table thead,
  .fact-table tr,
  .fact-table th,
  .fact-table td {
    display: block;
    width: 100%;
  }

  .fact-table thead {
    display: none;
  }

  .fact-table tr {
    border-bottom: 1px solid var(--line);
    padding: 11px 0;
  }

  .fact-table th,
  .fact-table td {
    border-bottom: 0;
    padding: 2px 14px;
  }

  .fact-table td + td {
    margin-top: 8px;
  }

  .fact-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 850;
  }

  .question-map {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}
