:root {
  color-scheme: dark;
  --bg: #070a12;
  --panel: #101622;
  --panel-2: #151d2b;
  --ink: #f5f1e8;
  --muted: #aeb7c5;
  --line: rgba(255, 255, 255, .13);
  --accent: #c7a66a;
  --glow: #5f87a8;
  --paper: #10142b;
  --theme-ink: #f8f3e8;
  --danger: #ee8a7d;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); scroll-behavior: smooth; }
body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px),
    var(--bg);
  background-size: 64px 64px;
}
button, a { font: inherit; }
button { color: inherit; }
a { color: inherit; }
button, [href], summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 75%, #fff); outline-offset: 3px; }

.home-link {
  position: fixed;
  z-index: 20;
  top: 14px;
  left: 14px;
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 9px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(7, 10, 18, .9);
  color: #d9dfeb;
  text-decoration: none;
  backdrop-filter: blur(12px);
}
.site-header {
  width: min(1220px, calc(100% - 40px));
  min-height: 78px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 12px; font-weight: 900; text-decoration: none; }
.brand img { border-radius: 8px; }
.header-note { color: var(--muted); font-size: 13px; }
.app-shell { width: min(1220px, calc(100% - 40px)); margin: 0 auto; }
.screen { display: none; }
.screen.active { display: block; animation: reveal .42s ease both; }

.intro-screen.active {
  min-height: calc(100vh - 78px);
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(360px, .88fr);
  gap: 48px;
  align-items: center;
  padding: 56px 0 46px;
}
.intro-copy { max-width: 710px; }
.eyebrow {
  margin: 0 0 12px;
  color: color-mix(in srgb, var(--accent) 84%, #fff);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .13em;
  line-height: 1.35;
  text-transform: uppercase;
}
h1, h2, h3, p { overflow-wrap: anywhere; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; letter-spacing: 0; }
.intro-copy h1 {
  max-width: 760px;
  margin: 0;
  font-size: 64px;
  line-height: 1.02;
  font-weight: 700;
}
.intro-copy h1 span { color: var(--accent); font-style: italic; }
.lead, .section-lead { color: var(--muted); font-size: 18px; line-height: 1.7; }
.lead { max-width: 700px; margin: 24px 0 0; }
.intro-actions { margin-top: 30px; }
.button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 12px 18px;
  font-weight: 850;
  line-height: 1.25;
  text-decoration: none;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, background .18s ease, opacity .18s ease;
}
.button:hover { transform: translateY(-2px); }
.button:disabled { opacity: .38; cursor: not-allowed; transform: none; }
.button.primary { background: var(--accent); color: #0c1016; }
.button.secondary { border-color: var(--line); background: rgba(255,255,255,.045); color: var(--ink); }
.button.text-button { background: transparent; color: var(--muted); }
.intro-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 38px 0 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--line);
}
.intro-facts div { padding: 16px; background: #0b101b; }
.intro-facts dt { color: var(--accent); font: 700 30px/1 Georgia, serif; }
.intro-facts dd { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.disclaimer { margin: 20px 0 0; color: #8993a3; font-size: 12px; line-height: 1.6; }
.intro-art { position: relative; min-width: 0; color: var(--accent); }
.intro-art svg { display: block; width: 100%; height: auto; max-height: 650px; }
.art-caption { position: absolute; inset: 0; }
.art-caption span { position: absolute; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.art-caption span:nth-child(1) { top: 15%; left: 8%; }
.art-caption span:nth-child(2) { top: 20%; right: 4%; }
.art-caption span:nth-child(3) { bottom: 17%; left: 3%; }
.art-caption span:nth-child(4) { right: 7%; bottom: 12%; }

.chooser-screen, .quiz-screen, .result-screen { padding: 50px 0 70px; }
.section-heading, .quiz-bar { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.section-heading h2 { margin: 0; font-size: 48px; }
.section-lead { max-width: 760px; margin: 18px 0 30px; }
.icon-button {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255,255,255,.045);
  cursor: pointer;
  font-size: 20px;
}
.tradition-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tradition-card {
  position: relative;
  min-width: 0;
  min-height: 286px;
  padding: 22px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--card-paper) 90%, #111927), #0b101a);
  transition: transform .2s ease, border-color .2s ease;
}
.tradition-card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--card-accent) 62%, var(--line)); }
.tradition-card::after {
  content: "";
  position: absolute;
  width: 170px;
  height: 170px;
  right: -75px;
  top: -75px;
  border: 1px solid color-mix(in srgb, var(--card-accent) 35%, transparent);
  border-radius: 50%;
}
.tradition-symbol { width: 58px; height: 58px; color: var(--card-accent); }
.tradition-symbol svg { display: block; width: 100%; height: 100%; }
.tradition-card h3 { margin: 22px 0 8px; font: 700 25px/1.12 Georgia, serif; }
.tradition-card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.tradition-meta { margin: 14px 0 20px; color: color-mix(in srgb, var(--card-accent) 80%, #fff); font-size: 11px; font-weight: 800; }
.tradition-card .button { align-self: flex-start; margin-top: auto; background: var(--card-accent); color: #07100f; }
.culture-note { margin: 24px 0 0; padding-top: 18px; border-top: 1px solid var(--line); color: #8993a3; font-size: 12px; line-height: 1.6; }

.quiz-screen { max-width: 900px; margin: 0 auto; }
.quiz-bar { min-height: 60px; }
.quiz-bar .eyebrow { margin-bottom: 5px; }
.question-counter { margin: 0; color: var(--muted); font-size: 13px; }
.progress-track { height: 4px; margin: 18px 0 48px; overflow: hidden; background: rgba(255,255,255,.08); }
.progress-fill { width: 0; height: 100%; background: var(--accent); transition: width .3s ease; }
.question-stage { min-height: 530px; }
.question-category { margin: 0 0 13px; color: color-mix(in srgb, var(--accent) 82%, #fff); font-size: 12px; font-weight: 850; text-transform: uppercase; letter-spacing: .12em; }
.question-stage h2 { max-width: 870px; margin: 0; font-size: 38px; line-height: 1.25; }
.answer-list { display: grid; gap: 10px; margin-top: 30px; }
.answer-option {
  width: 100%;
  min-height: 64px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 13px;
  align-items: start;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255,255,255,.035);
  color: #e8eaf0;
  text-align: left;
  line-height: 1.5;
  cursor: pointer;
}
.answer-option:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); background: rgba(255,255,255,.055); }
.answer-option[aria-checked="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, #0d1320); }
.answer-key { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); font-size: 12px; font-weight: 900; }
.answer-option[aria-checked="true"] .answer-key { border-color: var(--accent); background: var(--accent); color: #0b1117; }
.quiz-nav { display: flex; justify-content: space-between; gap: 12px; padding-top: 24px; border-top: 1px solid var(--line); }

.result-screen { --result-max: 1080px; }
.result-hero {
  min-height: 580px;
  display: grid;
  grid-template-columns: minmax(360px, .9fr) minmax(0, 1.1fr);
  gap: 56px;
  align-items: center;
  padding-bottom: 54px;
  border-bottom: 1px solid var(--line);
}
.result-art {
  position: relative;
  aspect-ratio: 4 / 5;
  width: 100%;
  max-height: 560px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--line));
  border-radius: 8px;
  background: var(--paper);
}
.result-art svg { display: block; width: 100%; height: 100%; }
.result-art .art-mark {
  position: absolute;
  left: 8%;
  top: 6%;
  color: color-mix(in srgb, var(--accent) 72%, #fff);
  font: 700 54px/1 Georgia, serif;
}
.art-symbols {
  position: absolute;
  inset: auto 8% 7%;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.art-symbols span {
  padding: 6px 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--line));
  border-radius: 4px;
  color: var(--theme-ink);
  background: rgba(4, 7, 12, .62);
  font-size: 11px;
}
.result-main h1 { margin: 0; color: var(--theme-ink); font-size: 70px; line-height: 1; }
.result-status { margin: 12px 0 0; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .1em; }
.result-subtitle { margin: 22px 0 0; color: var(--accent); font: 700 25px/1.35 Georgia, serif; }
.match-line { display: flex; align-items: center; gap: 16px; margin-top: 24px; }
.match-line strong { color: var(--accent); font: 700 50px/1 Georgia, serif; }
.match-line span { max-width: 270px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.result-summary { margin: 24px 0 0; color: #d9dde5; font-size: 18px; line-height: 1.7; }
.result-content { width: min(var(--result-max), 100%); margin: 0 auto; }
.result-section {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 22px;
  padding: 46px 0;
  border-bottom: 1px solid var(--line);
}
.result-section.two-columns { grid-template-columns: 58px minmax(0, 1fr) minmax(0, 1fr); gap: 32px; }
.section-index { margin: 4px 0 0; color: var(--accent); font: 700 16px/1 Georgia, serif; }
.result-section h2 { margin: 0 0 18px; font-size: 31px; line-height: 1.2; }
.result-section p, .result-section li { color: #c7cdd8; font-size: 16px; line-height: 1.72; }
.result-section ul { margin: 0; padding-left: 20px; }
.result-section li + li { margin-top: 10px; }
.why-traits { display: grid; gap: 12px; }
.why-item { display: grid; grid-template-columns: minmax(120px, 180px) minmax(0, 1fr); gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.why-item:first-child { border-top: 0; padding-top: 0; }
.why-item strong { color: var(--theme-ink); }
.why-item span { color: var(--muted); line-height: 1.55; }
.story-section p { max-width: 850px; }
.source-caution { padding-left: 15px; border-left: 2px solid var(--accent); color: #929dab !important; font-size: 13px !important; }
.fact-list { columns: 2; column-gap: 48px; }
.fact-list li { break-inside: avoid; margin-bottom: 12px; }
.runner-section { background: color-mix(in srgb, var(--paper) 55%, transparent); margin-inline: -24px; padding-inline: 24px; }
.runner-section .eyebrow { margin-bottom: 8px; }
.sources-panel { margin: 34px 0 0; border-block: 1px solid var(--line); }
.sources-panel summary { min-height: 54px; display: flex; align-items: center; cursor: pointer; color: #d9dfe8; font-weight: 800; }
.sources-panel ul { margin: 0 0 24px; padding-left: 20px; }
.sources-panel li { margin-top: 8px; color: var(--muted); }
.sources-panel a { color: color-mix(in srgb, var(--accent) 76%, #fff); }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 32px 0 20px; }

.resume-dialog {
  width: min(520px, calc(100% - 28px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #111824;
  box-shadow: 0 30px 90px rgba(0,0,0,.58);
}
.resume-dialog::backdrop { background: rgba(2,5,10,.78); backdrop-filter: blur(7px); }
.resume-dialog form { padding: 25px; }
.resume-dialog h2 { margin: 0; font-size: 29px; }
.resume-dialog p:not(.eyebrow) { color: var(--muted); line-height: 1.6; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.toast {
  position: fixed;
  z-index: 40;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 18px);
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #171e2b;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes reveal { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

@media (max-width: 960px) {
  .intro-screen.active { grid-template-columns: 1fr; min-height: auto; padding-top: 70px; }
  .intro-copy { max-width: 820px; }
  .intro-art { width: min(520px, 86%); margin: -40px auto 0; }
  .tradition-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .result-hero { grid-template-columns: minmax(280px, .82fr) minmax(0, 1.18fr); gap: 34px; }
  .result-main h1 { font-size: 54px; }
}

@media (max-width: 680px) {
  .site-header, .app-shell { width: min(100% - 24px, 1220px); }
  .site-header { min-height: 68px; padding-left: 58px; }
  .brand img { width: 38px; height: 38px; }
  .header-note { display: none; }
  .home-link { top: 12px; left: 12px; width: 44px; padding: 0; justify-content: center; font-size: 0; }
  .home-link span { font-size: 20px; }
  .intro-screen.active { gap: 18px; padding: 44px 0 34px; }
  .intro-copy h1 { font-size: 43px; line-height: 1.06; }
  .lead, .section-lead { font-size: 16px; line-height: 1.62; }
  .intro-facts div { padding: 13px 10px; }
  .intro-facts dt { font-size: 25px; }
  .intro-facts dd { font-size: 10px; }
  .intro-art { width: 100%; margin-top: -24px; }
  .chooser-screen, .quiz-screen, .result-screen { padding: 34px 0 54px; }
  .section-heading h2 { font-size: 37px; }
  .tradition-grid { grid-template-columns: 1fr; }
  .tradition-card { min-height: 250px; }
  .progress-track { margin: 14px 0 34px; }
  .question-stage { min-height: 0; }
  .question-stage h2 { font-size: 28px; line-height: 1.3; }
  .answer-list { margin-top: 24px; }
  .answer-option { min-height: 60px; padding: 13px; font-size: 14px; }
  .quiz-nav { position: sticky; bottom: 0; z-index: 8; margin: 24px -12px -20px; padding: 14px 12px 20px; background: rgba(7,10,18,.94); backdrop-filter: blur(12px); }
  .quiz-nav .button { flex: 1 1 0; }
  .result-hero { min-height: 0; grid-template-columns: 1fr; gap: 30px; }
  .result-art { max-height: none; }
  .result-main h1 { font-size: 48px; }
  .result-subtitle { font-size: 22px; }
  .match-line strong { font-size: 43px; }
  .result-summary { font-size: 16px; }
  .result-section, .result-section.two-columns { grid-template-columns: 38px minmax(0, 1fr); gap: 12px; padding: 34px 0; }
  .result-section.two-columns > div:last-child { grid-column: 2; }
  .result-section h2 { font-size: 26px; }
  .result-section p, .result-section li { font-size: 15px; }
  .why-item { grid-template-columns: 1fr; gap: 5px; }
  .fact-list { columns: 1; }
  .runner-section { margin-inline: -12px; padding-inline: 12px; }
  .result-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .result-actions .button { width: 100%; }
  .result-actions .text-button { grid-column: 1 / -1; }
}

@media (max-width: 390px) {
  .intro-copy h1 { font-size: 37px; }
  .intro-facts { grid-template-columns: 1fr; }
  .intro-facts div { display: flex; align-items: baseline; gap: 10px; }
  .intro-facts dd { margin: 0; font-size: 12px; }
  .question-stage h2 { font-size: 25px; }
  .result-main h1 { font-size: 41px; }
  .result-actions { grid-template-columns: 1fr; }
  .result-actions .text-button { grid-column: auto; }
}

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