:root {
  --ink: #16212f;
  --muted: #657384;
  --line: #d7e0e7;
  --paper: #ffffff;
  --soft: #fbf6ea;
  --blue: #14395f;
  --blue-2: #24699e;
  --green: #11836e;
  --gold: #ffcf5a;
  --orange: #e66a32;
  --mint: #dff5eb;
  --sky: #e9f4ff;
  --red: #c94343;
  --rose: #ffe9df;
  --shadow: 0 18px 42px rgba(20, 57, 95, 0.14);
  --tight-shadow: 0 9px 22px rgba(20, 57, 95, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(20, 57, 95, 0.045) 1px, transparent 1px),
    linear-gradient(180deg, rgba(20, 57, 95, 0.045) 1px, transparent 1px),
    linear-gradient(180deg, #fffaf0 0%, #eff8f5 46%, #fff7e8 100%);
  background-size: 34px 34px, 34px 34px, auto;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid rgba(20, 57, 95, 0.12);
  padding: 10px max(18px, calc((100vw - 1180px) / 2));
  background: rgba(255, 250, 240, 0.94);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 900;
}

.brand img {
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(20, 57, 95, 0.16);
}

.brand-copy {
  display: grid;
  gap: 0;
  line-height: 1.05;
}

.brand-copy strong {
  font-size: 1rem;
}

.brand-copy small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.topbar nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.topbar nav a,
.footer-links a {
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 800;
}

.topbar nav a:hover,
.footer-links a:hover {
  color: var(--blue);
  background: #eef5fb;
}

#app {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0 52px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: 18px;
  align-items: stretch;
  min-height: 430px;
}

.hero > div,
.hero-panel,
.page-title,
.legal,
.quiz-intro,
.quiz-sidecard,
.quiz-player,
.section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.hero > div,
.page-title,
.legal,
.quiz-intro,
.quiz-sidecard,
.quiz-player,
.section {
  padding: clamp(20px, 4vw, 42px);
}

.hero > div {
  display: grid;
  align-content: center;
  border-top: 6px solid var(--gold);
  background:
    linear-gradient(135deg, rgba(255, 207, 90, 0.34), rgba(255, 255, 255, 0) 42%),
    linear-gradient(90deg, rgba(20, 57, 95, 0.045) 1px, transparent 1px),
    linear-gradient(180deg, rgba(20, 57, 95, 0.045) 1px, transparent 1px),
    linear-gradient(180deg, #ffffff, #f7fbf8);
  background-size: auto, 28px 28px, 28px 28px, auto;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 820px;
  margin-bottom: 14px;
  font-size: 4.2rem;
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  font-size: 1.85rem;
  letter-spacing: 0;
}

.hero > div > p,
.page-title p,
.quiz-intro p,
.legal p {
  max-width: 760px;
  color: var(--muted);
  font-size: 1.04rem;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 22px;
}

.stat-row span {
  min-height: 76px;
  border: 1px solid rgba(23, 59, 99, 0.12);
  border-radius: 8px;
  padding: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.78);
  font-size: 0.9rem;
  font-weight: 800;
}

.stat-row strong {
  display: block;
  color: var(--blue);
  font-size: 1.5rem;
  line-height: 1.1;
}

.hero-actions,
.result-actions,
.section-head,
.quiz-meta,
.answer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.btn {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 16px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 900;
}

.btn.primary {
  border-color: var(--blue);
  color: white;
  background: var(--blue);
}

.btn.primary:hover {
  background: #0f2f52;
}

.btn.ghost {
  color: var(--blue);
  background: white;
}

.btn.ghost:hover {
  border-color: rgba(35, 103, 162, 0.35);
  background: #f4f9fd;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.hero-panel {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: clamp(20px, 3vw, 32px);
  color: white;
  background:
    linear-gradient(135deg, rgba(255, 207, 90, 0.18), transparent 44%),
    linear-gradient(180deg, rgba(14, 143, 115, 0.2), transparent),
    var(--blue);
}

.board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.board-head > span {
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  padding: 6px 8px;
  color: var(--gold);
  font-weight: 900;
}

.hero-panel .panel-kicker {
  margin: 0;
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.answer-sheet {
  display: grid;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 14px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px),
    rgba(255, 255, 255, 0.08);
  background-size: 18px 18px;
}

.answer-sheet strong {
  color: white;
  font-size: 0.9rem;
}

.answer-sheet div,
.mini-dots {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.answer-sheet span,
.mini-dots span {
  aspect-ratio: 1;
  border: 2px solid rgba(255, 255, 255, 0.38);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.answer-sheet span.filled,
.mini-dots span.filled {
  border-color: var(--gold);
  background: var(--gold);
}

.answer-sheet.compact {
  border-color: rgba(20, 57, 95, 0.12);
  background: #f8fbfd;
}

.answer-sheet.compact span,
.mini-dots span {
  border-color: rgba(20, 57, 95, 0.22);
  background: white;
}

.answer-sheet.compact span.filled,
.mini-dots span.filled {
  border-color: var(--green);
  background: var(--green);
}

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

.spotlight-link {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.09);
  color: white;
  text-decoration: none;
}

.spotlight-link:hover {
  background: rgba(255, 255, 255, 0.15);
}

.spotlight-link span {
  display: grid;
  min-height: 42px;
  place-items: center;
  border-radius: 8px;
  color: var(--blue);
  background: var(--gold);
  font-size: 0.8rem;
  font-weight: 900;
}

.spotlight-link strong {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.2;
}

.section {
  margin-top: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(250, 253, 252, 0.96));
}

.section-head {
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-head a,
.back-link {
  color: var(--blue-2);
  font-weight: 900;
}

.page-title {
  position: relative;
  overflow: hidden;
}

.page-title::after,
.legal::after {
  position: absolute;
  right: 22px;
  bottom: 18px;
  width: 96px;
  height: 32px;
  border-top: 2px solid rgba(20, 57, 95, 0.08);
  border-bottom: 2px solid rgba(20, 57, 95, 0.08);
  content: "";
}

.page-title-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 240px);
  gap: 20px;
  align-items: center;
}

.title-card {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(20, 57, 95, 0.12);
  border-radius: 8px;
  padding: 16px;
  background: linear-gradient(180deg, var(--sky), #ffffff);
  box-shadow: var(--tight-shadow);
}

.title-card strong {
  color: var(--blue);
  font-size: 2.6rem;
  line-height: 1;
}

.title-card span,
.title-card a {
  color: var(--muted);
  font-weight: 900;
}

.title-card a {
  color: var(--blue-2);
}

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

.category-grid.wide {
  margin-top: 18px;
}

.quiz-card,
.category-card {
  position: relative;
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 196px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background:
    linear-gradient(180deg, #ffffff, #fbfcfd);
  overflow: hidden;
  text-decoration: none;
  transition: transform 0.16s, border-color 0.16s, box-shadow 0.16s;
}

.quiz-card::after,
.category-card::after {
  position: absolute;
  right: -24px;
  bottom: -28px;
  width: 92px;
  height: 92px;
  border: 2px solid rgba(20, 57, 95, 0.06);
  border-radius: 999px;
  content: "";
  pointer-events: none;
}

.card-line {
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, var(--gold), var(--green), var(--orange));
  pointer-events: none;
}

.quiz-card > :not(.card-line),
.category-card > * {
  position: relative;
  z-index: 1;
}

.quiz-card:hover,
.category-card:hover {
  border-color: rgba(35, 103, 162, 0.38);
  box-shadow: 0 10px 24px rgba(23, 59, 99, 0.1);
  transform: translateY(-2px);
}

.quiz-card h3,
.category-card strong {
  margin: 0;
  font-size: 1.12rem;
  line-height: 1.2;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-mark,
.title-mark {
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(23, 59, 99, 0.12);
  border-radius: 8px;
  color: var(--blue);
  background: linear-gradient(135deg, var(--gold), var(--mint));
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0;
}

.card-mark {
  width: 54px;
  min-height: 42px;
  padding: 0 6px;
}

.title-mark {
  width: fit-content;
  min-width: 58px;
  margin-right: 12px;
  padding: 8px;
  vertical-align: middle;
}

.quiz-card p,
.category-card p,
.quiz-card small,
.category-card > span:not(.card-mark) {
  margin: 0;
  color: var(--muted);
}

.card-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.card-foot span {
  border: 1px solid rgba(20, 57, 95, 0.09);
  border-radius: 8px;
  padding: 5px 7px;
  background: #f8fbfd;
  color: var(--muted);
}

.chip,
.quiz-meta span {
  width: fit-content;
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--blue);
  background: var(--sky);
  font-size: 0.78rem;
  font-weight: 900;
}

.quiz-meta {
  margin: 16px 0;
}

.quiz-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  gap: 18px;
  align-items: stretch;
}

.quiz-sidecard {
  display: grid;
  align-content: start;
  gap: 12px;
  background:
    linear-gradient(180deg, #ffffff, #f7fbfd);
}

.quiz-sidecard strong {
  color: var(--blue);
  font-size: 1.25rem;
  line-height: 1.15;
}

.quiz-sidecard p {
  margin: 0;
  color: var(--muted);
}

.quiz-player {
  display: none;
  margin-top: 18px;
}

.quiz-player.active {
  display: block;
}

.player-shell {
  display: grid;
  gap: 14px;
}

.progress {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #e8edf3;
}

.progress span {
  display: block;
  width: var(--progress, 0%);
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--gold));
  transition: width 0.2s;
}

.question-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-weight: 900;
}

.question-card {
  border: 1px solid rgba(20, 57, 95, 0.1);
  border-radius: 8px;
  padding: clamp(16px, 3vw, 26px);
  background:
    linear-gradient(90deg, rgba(20, 57, 95, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, rgba(20, 57, 95, 0.04) 1px, transparent 1px),
    #ffffff;
  background-size: 24px 24px;
}

.question-card h2 {
  margin-bottom: 0;
}

.option-list {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.option {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--ink);
  background: linear-gradient(180deg, #ffffff, #fbfdff);
  cursor: pointer;
  text-align: left;
  box-shadow: 0 2px 0 rgba(20, 57, 95, 0.04);
  transition: border-color 0.16s, background 0.16s, transform 0.16s;
}

.option:hover,
.option.selected {
  border-color: var(--blue-2);
  background: #f1f7fc;
}

.option:hover {
  transform: translateY(-1px);
}

.option b {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 2px solid var(--blue);
  border-radius: 999px;
  color: var(--blue);
  background: white;
}

.option.selected b {
  color: white;
  background: var(--blue);
}

.answer-actions {
  justify-content: space-between;
}

.result-box {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(18px, 4vw, 34px);
  background:
    linear-gradient(135deg, rgba(255, 207, 90, 0.16), transparent 45%),
    #fbfcfd;
  overflow: hidden;
}

.result-stamp {
  position: absolute;
  top: 18px;
  right: 18px;
  border: 2px solid rgba(20, 57, 95, 0.16);
  border-radius: 8px;
  padding: 6px 9px;
  color: var(--blue);
  background: white;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.score-big {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  color: var(--blue);
  font-size: 4.4rem;
  font-weight: 900;
  line-height: 1;
}

.score-big small {
  color: var(--muted);
  font-size: 1.1rem;
}

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

.review-item {
  border-left: 4px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: white;
  box-shadow: 0 2px 0 rgba(20, 57, 95, 0.04);
}

.review-item.correct {
  border-left-color: var(--green);
}

.review-item.wrong {
  border-left-color: var(--red);
}

.legal {
  position: relative;
  max-width: 860px;
  margin: 0 auto;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(20, 57, 95, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, #ffffff, #fbfdfd);
  background-size: 28px 28px, auto;
}

.legal h2 {
  margin-top: 28px;
}

.legal-body {
  position: relative;
  z-index: 1;
}

.legal ul {
  display: grid;
  gap: 8px;
  margin: 0 0 18px;
  padding-left: 22px;
  color: var(--muted);
}

.legal li::marker {
  color: var(--green);
}

.footer {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.2fr);
  gap: 18px;
  align-items: start;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 34px;
  border: 1px solid rgba(20, 57, 95, 0.1);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--tight-shadow);
}

.footer-panel {
  display: grid;
  gap: 8px;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--blue);
  text-decoration: none;
}

.footer-brand span {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--gold), var(--mint));
  font-weight: 900;
}

.footer-panel p {
  max-width: 430px;
  margin: 0;
  color: var(--muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

@media (max-width: 900px) {
  .hero,
  .page-title-split,
  .quiz-stage,
  .footer,
  .quiz-grid,
  .category-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  h1 {
    font-size: 3.1rem;
  }

  h2 {
    font-size: 1.65rem;
  }

  .stat-row {
    grid-template-columns: 1fr;
  }

  .footer-links {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  body {
    overflow-x: hidden;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 10px;
  }

  .topbar nav {
    width: 100%;
  }

  .topbar nav a {
    flex: 1 1 calc(50% - 8px);
    text-align: center;
  }

  #app {
    width: min(calc(100% - 20px), 1180px);
    padding-top: 16px;
  }

  .hero > div,
  .page-title,
  .legal,
  .quiz-intro,
  .quiz-sidecard,
  .quiz-player,
  .section {
    padding: 18px;
  }

  .hero-panel {
    padding: 18px;
  }

  h1 {
    overflow-wrap: anywhere;
    font-size: 2.25rem;
    line-height: 1.04;
  }

  h2 {
    font-size: 1.45rem;
  }

  .score-big {
    font-size: 3rem;
  }

  .title-mark {
    display: grid;
    margin: 0 0 10px;
  }

  .card-top,
  .section-head,
  .question-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .quiz-card,
  .category-card {
    min-height: auto;
  }

  .spotlight-link {
    grid-template-columns: 46px minmax(0, 1fr);
  }

  .stat-row span {
    min-height: auto;
  }

  .title-card strong {
    font-size: 2rem;
  }

  .result-stamp {
    position: static;
    width: fit-content;
    margin-bottom: 10px;
  }

  .footer {
    width: min(calc(100% - 20px), 1180px);
    padding: 14px;
  }

  .hero-actions .btn,
  .answer-actions .btn,
  .result-actions .btn {
    width: 100%;
  }

  .answer-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .option {
    padding: 12px;
  }
}
