:root {
  --navy: #073556;
  --teal: #15908e;
  --teal-dark: #0c6f6d;
  --gold: #f4b91d;
  --white: #ffffff;
  --light: #f3f7f8;
  --error: #e6534e;
  --success: #8ea98f;
  --muted: #607483;
  --border: #dce5e8;
  --surface: #ffffff;
  --header-bg: rgba(255, 255, 255, 0.92);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--light);
  color: var(--navy);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  width: 100%;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.site-nav {
  width: 100%;
  margin: 0;
  padding: 0;
}

.site-nav-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 16px;
  height: 56px;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.site-nav-brand {
  font-weight: 850;
  font-size: 20px;
  letter-spacing: -0.5px;
  color: var(--navy);
  text-decoration: none;
  flex: 0 0 auto;
}

.site-nav-brand span {
  color: var(--teal);
}

.site-nav-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 4px;
  align-items: stretch;
  height: 100%;
}

.site-nav-links li {
  display: flex;
  align-items: stretch;
}

.site-nav-links a {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  text-decoration: none;
  font-weight: 650;
  font-size: 14px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.site-nav-links a:hover {
  color: var(--navy);
  background: transparent;
}

.site-nav-links a[aria-current="page"] {
  color: var(--navy);
  border-bottom-color: var(--teal);
  background: transparent;
  font-weight: 750;
}

.site-nav-links a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: -2px;
  border-radius: 4px;
}

main {
  max-width: 880px;
  margin: 0 auto;
  padding: 20px 16px 48px;
  min-height: calc(100vh - 56px);
}

.page-docs {
  background:
    radial-gradient(1200px 400px at 50% -80px, rgba(21, 144, 142, 0.08), transparent 60%),
    var(--light);
}

.page-docs .docs-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 16px 24px;
  min-height: calc(100vh - 120px);
}

.docs-intro {
  margin: 0 0 22px;
}

.docs-kicker {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
}

.docs-intro h1 {
  margin: 0 0 10px;
  font-size: 28px;
  letter-spacing: -0.4px;
  line-height: 1.2;
}

.docs-lede,
.topic-lede {
  margin: 0;
  max-width: 54ch;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.topic-index {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 28px rgba(7, 53, 86, 0.06);
}

.topic-index-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.topic-index-list li + li {
  border-top: 1px solid var(--border);
}

.topic-index-link {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--navy);
  transition: background 0.12s ease;
}

.topic-index-link:hover {
  background: #f0f7f8;
}

.topic-index-link:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: -2px;
}

.topic-index-id {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--teal);
  text-transform: uppercase;
}

.topic-index-name {
  font-weight: 700;
  font-size: 15px;
}

.topic-index-chevron {
  color: var(--muted);
  font-size: 14px;
  opacity: 0.7;
}

.topic-index-link:hover .topic-index-chevron {
  color: var(--teal-dark);
  opacity: 1;
}

.topic-detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 28px 24px;
  box-shadow: 0 8px 28px rgba(7, 53, 86, 0.06);
}

.topic-crumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
  font-size: 13px;
  font-weight: 650;
  color: var(--muted);
}

.topic-crumb a {
  color: var(--teal-dark);
  text-decoration: none;
  font-weight: 750;
}

.topic-crumb a:hover {
  text-decoration: underline;
}

.topic-detail .docs-intro {
  margin-bottom: 8px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.topic-detail .docs-intro h1 {
  font-size: 26px;
}

.topic-section {
  margin: 22px 0 0;
}

.topic-section h2 {
  margin: 0 0 10px;
  font-size: 16px;
  letter-spacing: -0.2px;
}

.topic-section ul {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.topic-section li {
  position: relative;
  margin: 0 0 10px;
  padding-left: 18px;
  color: var(--navy);
  line-height: 1.5;
}

.topic-section li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  opacity: 0.85;
}

.topic-section li:last-child {
  margin-bottom: 0;
}

.topic-section p {
  margin: 0 0 10px;
}

.trap {
  margin-top: 12px;
  padding: 10px 14px;
  background: #fff8e6;
  border-left: 4px solid var(--gold);
  border-radius: 0 10px 10px 0;
}

.trap-title {
  margin: 0 0 6px;
  font-weight: 750;
  font-size: 13px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #8a6a10;
}

.trap ul {
  margin: 0;
}

.guide-links {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.guide-links a {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  text-decoration: none;
  color: var(--navy);
  background: var(--light);
}

.guide-links a:hover {
  border-color: var(--teal);
  background: #eaf7f6;
}

.guide-links strong {
  display: block;
  margin-bottom: 4px;
}

.guide-links span {
  color: var(--muted);
  font-size: 14px;
}

.fictional-banner {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid #e7b4b2;
  border-radius: 12px;
  background: #fdecea;
  color: #7a241f;
  font-weight: 650;
}

.opinion {
  margin-top: 8px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fbfcfd;
}

.law-note {
  margin: 8px 0 0;
  font-size: 13px;
  color: #0c6f6d;
}

.topic-pager {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: start;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.topic-pager-link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-decoration: none;
  color: var(--navy);
  min-width: 0;
}

.topic-pager-link-next {
  text-align: right;
  justify-self: end;
}

.topic-pager-dir {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--teal);
}

.topic-pager-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.topic-pager-link:hover .topic-pager-title {
  color: var(--teal-dark);
  text-decoration: underline;
}

.topic-pager-home {
  align-self: center;
  justify-self: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 8px;
}

.topic-pager-home:hover {
  color: var(--navy);
  background: #eef5f6;
}

.topic-pager-spacer {
  display: block;
}

.site-footer {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px 36px;
}

.site-footer p {
  margin: 0;
  font-size: 12px;
  text-align: center;
  color: #708590;
}

.card {
  background: var(--white);
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 14px 40px rgba(7, 53, 86, 0.1);
}

.brand {
  font-weight: 850;
  font-size: 28px;
  letter-spacing: -0.8px;
}

.brand span {
  color: var(--teal);
}

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

h2 {
  margin: 8px 0 16px;
  font-size: 20px;
  line-height: 1.35;
}

.muted {
  color: var(--muted);
  margin: 0 0 8px;
}

.section {
  margin: 22px 0;
}

.label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--navy);
}

.choice {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice label {
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
  font-weight: 700;
  cursor: pointer;
  transition: 0.15s ease;
  background: var(--white);
}

.choice input:checked + label {
  border-color: var(--teal);
  background: #eaf7f6;
  color: #0c6f6d;
}

.choice input:focus-visible + label {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

select {
  width: 100%;
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--white);
  color: var(--navy);
  font: inherit;
  font-weight: 650;
}

button {
  font: inherit;
  cursor: pointer;
}

.primary,
.secondary {
  border: 0;
  border-radius: 12px;
  padding: 14px 16px;
  font-weight: 800;
}

.primary {
  background: var(--navy);
  color: var(--white);
  width: 100%;
  margin-top: 8px;
}

.primary:hover {
  background: #0a466f;
}

.primary:disabled {
  opacity: 0.55;
  cursor: default;
}

.secondary {
  background: #e8f2f3;
  color: var(--navy);
}

.secondary:hover {
  background: #d7eaec;
}

.answer {
  display: block;
  width: 100%;
  margin: 8px 0;
  padding: 14px 16px;
  text-align: left;
  border-radius: 12px;
  border: 2px solid transparent;
  background: var(--light);
  color: var(--navy);
  font-weight: 650;
}

.answer:hover:not(:disabled) {
  border-color: var(--teal);
}

.answer.correct {
  background: #e5f2e7;
  border-color: var(--success);
}

.answer.wrong {
  background: #fde8e7;
  border-color: var(--error);
}

.answer:disabled {
  cursor: default;
}

.hidden {
  display: none !important;
}

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

.progress {
  height: 8px;
  background: #dce8eb;
  border-radius: 8px;
  overflow: hidden;
  margin: 14px 0 20px;
}

.progress span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--gold);
  transition: width 0.2s ease;
}

.topic {
  font-size: 12px;
  font-weight: 800;
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.feedback {
  min-height: 1.4em;
  font-weight: 700;
  margin: 14px 0;
  color: var(--navy);
}

.feedback.ok {
  color: #3f6b48;
}

.feedback.bad {
  color: #b33a36;
}

.score {
  font-size: 48px;
  font-weight: 850;
  color: var(--teal);
  margin: 12px 0;
}

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

.actions .primary,
.actions .secondary {
  width: auto;
  flex: 1 1 160px;
  margin-top: 0;
}

.status {
  margin-top: 14px;
  padding: 12px 14px;
  border-left: 4px solid var(--gold);
  background: #fff9df;
  border-radius: 8px;
  color: #415766;
}

.status.error-text {
  border-left-color: var(--error);
  background: #fde8e7;
  color: #7a2a27;
}

.loading-box,
.error-box {
  text-align: center;
  padding: 40px 20px;
}

.spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto 16px;
  border: 3px solid var(--border);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.oral-reveal {
  background: var(--light);
  border-radius: 12px;
  padding: 16px;
  margin-top: 8px;
}

.oral-reveal p {
  margin: 8px 0 0;
}

.oral-reveal ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.oral-block {
  margin-top: 14px;
}

.oral-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.oral-actions button {
  flex: 1 1 140px;
}

.btn-known {
  background: var(--success);
  color: var(--white);
  border: 0;
  border-radius: 12px;
  padding: 14px 16px;
  font-weight: 800;
}

.btn-unknown {
  background: var(--error);
  color: var(--white);
  border: 0;
  border-radius: 12px;
  padding: 14px 16px;
  font-weight: 800;
}

.empty-note {
  margin-top: 16px;
  padding: 16px;
  background: var(--light);
  border-radius: 12px;
  color: var(--muted);
  font-weight: 650;
}

.topic-breakdown {
  margin: 20px 0 8px;
}

.topic-breakdown-title {
  margin: 0 0 10px;
  font-size: 16px;
}

.topic-breakdown-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.topic-breakdown-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  font-weight: 650;
}

.topic-breakdown-list li:last-child {
  border-bottom: 1px solid var(--border);
}

.topic-breakdown-name {
  color: var(--navy);
}

.topic-breakdown-score {
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.footer {
  font-size: 12px;
  text-align: center;
  margin-top: 18px;
  color: #708590;
}

#next-btn {
  width: 100%;
}

@media (max-width: 720px) {
  .site-nav-inner,
  .site-nav-links {
    flex-wrap: wrap;
  }
}

@media (max-width: 520px) {
  .card {
    padding: 20px;
  }

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

  .score {
    font-size: 40px;
  }
}


@media (max-width: 520px) {
  .topic-detail {
    padding: 20px 16px 18px;
  }

  .docs-intro h1,
  .topic-detail .docs-intro h1 {
    font-size: 22px;
  }

  .topic-pager {
    grid-template-columns: 1fr;
  }

  .topic-pager-link-next {
    text-align: left;
    justify-self: start;
  }

  .topic-pager-home {
    order: -1;
    justify-self: start;
    padding-left: 0;
  }
}
