:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --ink: #15202b;
  --muted: #64748b;
  --line: #d9e2ec;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --good: #167c3b;
  --bad: #b42318;
  --warn: #9a5b00;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

button,
select {
  font: inherit;
}

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

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.05;
  letter-spacing: 0;
  max-width: 760px;
}

.scorebox {
  min-width: 136px;
  display: grid;
  gap: 4px;
  justify-items: end;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

#score {
  font-size: 22px;
  font-weight: 800;
}

#accuracy {
  color: var(--muted);
  font-weight: 700;
}

.controls {
  display: grid;
  grid-template-columns: minmax(150px, 190px) minmax(150px, 1fr) minmax(170px, 1fr) minmax(140px, 180px) auto auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.ad-slot {
  display: grid;
  justify-items: center;
  gap: 6px;
  margin: 14px 0;
}

.ad-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.ad-slot a {
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
  text-decoration: none;
}

.ad-slot a:hover,
.ad-slot a:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.2);
  border-color: var(--accent);
}

.ad-mobile {
  display: none;
}

.ad-study {
  justify-items: stretch;
  margin: 16px 0 0;
}

.ad-card {
  display: grid;
  align-items: center;
  justify-items: center;
  color: var(--ink);
  text-align: center;
}

.ad-card img {
  display: block;
  max-width: 100%;
  height: auto;
}

.ad-card span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
}

.ad-card strong {
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 900;
}

.ad-card-wide {
  width: min(728px, 100%);
  min-height: 90px;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  padding: 14px 18px;
  text-align: left;
}

.ad-card-compact {
  width: min(300px, 100%);
  gap: 10px;
  padding: 18px;
}

.ad-card-compact {
  min-height: 132px;
}

.ad-card-study {
  width: 100%;
  min-height: 74px;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  padding: 14px 16px;
  text-align: left;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

select,
button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
}

select {
  padding: 0 12px;
}

button {
  padding: 0 16px;
  cursor: pointer;
  font-weight: 800;
}

button:disabled,
select:disabled {
  cursor: default;
  opacity: 0.55;
}

button:hover,
button:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.2);
  border-color: var(--accent);
}

[hidden] {
  display: none !important;
}

.path-panel {
  margin-bottom: 14px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.path-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.path-heading h2 {
  margin-bottom: 0;
}

.stage-score {
  min-width: 118px;
  display: grid;
  justify-items: end;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

#stageProgress {
  color: var(--ink);
  font-size: 22px;
  font-weight: 900;
}

.stage-description {
  max-width: 820px;
  margin: 14px 0 16px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.stage-report {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid rgba(22, 124, 59, 0.28);
  border-radius: 8px;
  background: #eef9f1;
  color: #14532d;
  font-weight: 800;
}

.stage-report span {
  color: #166534;
}

.stage-report span:last-child {
  margin-left: auto;
  font-size: 20px;
  font-weight: 900;
}

.stage-map {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(76px, 1fr));
  gap: 8px;
}

.stage-chip {
  min-height: 62px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 3px;
  padding: 8px 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.1;
}

.stage-chip[data-domain="preliminary"] {
  border-color: #c8d7ec;
  background: #f5f8fd;
}

.stage-chip[data-domain="plan"] {
  border-color: #c9ded8;
  background: #f2faf7;
}

.stage-chip[data-domain="design"] {
  border-color: #d8d0ea;
  background: #f8f5fd;
}

.stage-chip[data-domain="deploy"] {
  border-color: #ead4c2;
  background: #fff7ef;
}

.stage-chip span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e8eef5;
  color: var(--ink);
  font-weight: 900;
}

.stage-chip strong {
  font-size: 12px;
}

.stage-chip.active {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: #f0fdfa;
}

.stage-chip.active span {
  background: var(--accent);
  color: #ffffff;
}

.stage-chip.done span {
  background: var(--good);
  color: #ffffff;
}

.path-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.card {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

#domainTag {
  color: var(--accent-dark);
}

h2 {
  margin: 0 0 22px;
  font-size: 24px;
  line-height: 1.32;
  letter-spacing: 0;
}

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

.answer {
  width: 100%;
  min-height: 58px;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  align-items: center;
  text-align: left;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  font-weight: 650;
}

.answer .letter {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e6f4f1;
  color: var(--accent-dark);
  font-weight: 900;
}

.answer.correct {
  border-color: rgba(22, 124, 59, 0.45);
  background: #eef9f1;
}

.answer.correct .letter {
  background: var(--good);
  color: white;
}

.answer.wrong {
  border-color: rgba(180, 35, 24, 0.45);
  background: #fff1f0;
}

.answer.wrong .letter {
  background: var(--bad);
  color: white;
}

.answer:disabled {
  cursor: default;
  opacity: 1;
}

.explanation {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding: 16px;
  border-left: 4px solid var(--accent);
  background: #f0fdfa;
  color: #164e4a;
  line-height: 1.45;
}

.explanation-answer,
.explanation-category {
  display: grid;
  gap: 3px;
}

.explanation-answer span,
.explanation-category span {
  color: #0f766e;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.explanation-answer strong,
.explanation-category strong {
  color: #123f3c;
  font-size: 15px;
  line-height: 1.35;
}

.explanation-category {
  padding: 10px 12px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
}

.explanation-why {
  margin: 0;
  color: #1f5f5a;
}

.actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
}

.summary {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.summary > div {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.summary-value {
  font-size: 24px;
  font-weight: 900;
}

.summary-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.resource-panel {
  margin-top: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.resource-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.resource-copy {
  max-width: 860px;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.text-button {
  min-height: 40px;
  display: inline-grid;
  place-items: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.text-button:hover,
.text-button:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.2);
  border-color: var(--accent);
}

.guide-viewer {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.guide-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef4f8;
}

.guide-tab {
  min-height: 40px;
  padding: 0 10px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
}

.guide-tab[aria-selected="true"] {
  border-color: var(--line);
  background: var(--panel);
  color: var(--accent-dark);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.guide-tab-panel {
  min-height: 188px;
  padding: 4px 2px 2px;
}

.guide-tab-panel:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.2);
  border-radius: 8px;
}

.guide-panel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.guide-panel-span {
  grid-column: 1 / -1;
}

.guide-viewer h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.guide-viewer ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.5;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 18px;
  padding: 12px 2px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.site-footer p {
  margin: 0;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

.site-footer a,
.back-link {
  color: var(--accent-dark);
  font-weight: 900;
  text-decoration: none;
}

.site-footer a:hover,
.site-footer a:focus-visible,
.back-link:hover,
.back-link:focus-visible {
  text-decoration: underline;
}

.legal-page {
  max-width: 900px;
}

.back-link {
  display: inline-block;
  margin: 8px 0 0;
}

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

.legal-grid article {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.legal-grid h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.legal-grid h2 {
  margin: 0 0 8px;
  font-size: 17px;
}

.legal-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

@media (max-width: 760px) {
  .shell {
    width: min(100vw - 20px, 1040px);
    padding-top: 14px;
  }

  .topbar,
  .controls {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .scorebox {
    width: 100%;
    justify-items: start;
  }

  .ad-leaderboard {
    display: none;
  }

  .ad-mobile {
    display: grid;
  }

  .ad-card-study {
    grid-template-columns: auto 1fr;
    align-items: center;
  }

  .ad-card-study strong {
    grid-column: 2;
  }

  .card {
    padding: 18px;
  }

  .path-panel {
    padding: 18px;
  }

  .path-heading {
    display: grid;
  }

  .stage-score {
    justify-items: start;
  }

  .stage-map {
    grid-template-columns: repeat(4, 1fr);
  }

  h2 {
    font-size: 20px;
  }

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

  .resource-heading,
  .legal-grid {
    grid-template-columns: 1fr;
  }

  .resource-heading {
    display: grid;
  }

  .resource-panel {
    padding: 18px;
  }

  .guide-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .guide-panel-grid {
    grid-template-columns: 1fr;
  }

  .site-footer {
    display: grid;
  }

  .site-footer nav {
    justify-content: flex-start;
  }

}
