/* ================================================================
   PRAG TRINITY — three worlds: neutral / strict (white construct) /
   ai (cyan hologram). All theming hangs off html[data-mode].
   ================================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --font-sans: 'Inter', -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Code', Consolas, monospace;
  --ease-out: cubic-bezier(.22,.9,.3,1);
  --ease-spring: cubic-bezier(.34,1.45,.5,1);
}

html[data-mode="neutral"] {
  --bg0: #0a0d0f;
  --bg1: #10161a;
  --panel: rgba(16, 22, 26, .84);
  --panel-solid: #10161a;
  --ink: #dbe5df;
  --dim: #8fa39a;
  --faint: #5c6b64;
  --line: rgba(219, 229, 223, .14);
  --line-strong: rgba(219, 229, 223, .32);
  --acc: #7fceaa;
  --acc-ink: #0a0d0f;
  --glow: rgba(127, 206, 170, .25);
  --danger: #e06060;
  --ok: #7fceaa;
  --radius: 10px;
  --shadow: 0 12px 40px rgba(0, 0, 0, .5);
  --mark-bg: rgba(127, 206, 170, .22);
  --mark-ink: #c8efdc;
}

html[data-mode="strict"] {
  --bg0: #f7f5ef;
  --bg1: #fffdf9;
  --panel: #fffdf9;
  --panel-solid: #fffdf9;
  --ink: #15130d;
  --dim: #6d685c;
  --faint: #a8a294;
  --line: #15130d;
  --line-strong: #15130d;
  --acc: #15130d;
  --acc-ink: #fffdf9;
  --glow: transparent;
  --danger: #b3231f;
  --ok: #1e6b40;
  --radius: 2px;
  --shadow: 0 2px 0 rgba(21, 19, 13, .08);
  --mark-bg: #15130d;
  --mark-ink: #fffdf9;
}

html[data-mode="ai"] {
  --bg0: #02141a;
  --bg1: #04222b;
  --panel: rgba(4, 32, 40, .8);
  --panel-solid: #04222b;
  --ink: #d8f7fc;
  --dim: #6fa9b5;
  --faint: #3f6d78;
  --line: rgba(47, 212, 232, .26);
  --line-strong: rgba(47, 212, 232, .6);
  --acc: #2fd4e8;
  --acc-ink: #02141a;
  --glow: rgba(47, 212, 232, .4);
  --danger: #ff7a70;
  --ok: #4be0a0;
  --radius: 12px;
  --shadow: 0 0 34px rgba(47, 212, 232, .12), 0 14px 44px rgba(0, 0, 0, .5);
  --mark-bg: rgba(47, 212, 232, .24);
  --mark-ink: #bff3fb;
}

html, body { height: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg0);
  color: var(--ink);
  overflow-x: hidden;
  transition: background-color .45s ease, color .45s ease;
}
body.in-cascade { pointer-events: none; }

::selection { background: var(--acc); color: var(--acc-ink); }
.mono { font-family: var(--font-mono); }
button { font-family: inherit; color: inherit; background: none; border: none; cursor: pointer; }
a { color: var(--acc); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }

#rain {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}
#vignette {
  position: fixed; inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 38%, transparent 55%, rgba(0, 0, 0, .34) 100%);
  transition: opacity .5s;
}
html[data-mode="strict"] #vignette {
  background: radial-gradient(ellipse at 50% 38%, transparent 60%, rgba(96, 84, 58, .12) 100%);
}

/* ---------------- top bar ---------------- */
#topbar {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 14px 88px;
  pointer-events: none;
}
#topbar > * { pointer-events: auto; }
.wordmark {
  font-family: var(--font-mono);
  font-weight: 700; font-size: 18px; letter-spacing: .14em;
  user-select: none; cursor: default;
  display: flex; align-items: baseline; gap: 6px;
}
.wm-prag { color: var(--ink); }
.wm-trinity {
  color: var(--acc);
  text-shadow: 0 0 14px var(--glow);
}
html[data-mode="strict"] .wm-trinity { text-shadow: none; }
.badge {
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .06em;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--dim);
  background: var(--panel);
  backdrop-filter: blur(6px);
  white-space: nowrap;
}
.top-actions { display: flex; gap: 8px; }

/* ---------------- buttons & chips ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13.5px; font-weight: 500; letter-spacing: .02em;
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: all .18s var(--ease-out);
  user-select: none;
}
.btn .ic { width: 16px; height: 16px; }
.btn-solid { background: var(--acc); color: var(--acc-ink); border-color: var(--acc); }
.btn-solid:hover { filter: brightness(1.1); box-shadow: 0 0 18px var(--glow); }
.btn-line { border-color: var(--line-strong); color: var(--ink); background: transparent; }
.btn-line:hover { border-color: var(--acc); color: var(--acc); box-shadow: 0 0 14px var(--glow); }
html[data-mode="strict"] .btn-line:hover { background: var(--acc); color: var(--acc-ink); box-shadow: none; }
.btn-ghost { color: var(--dim); border-color: transparent; }
.btn-ghost:hover { color: var(--ink); border-color: var(--line); background: var(--panel); }
.btn-icon { padding: 9px; }
.ic { width: 18px; height: 18px; display: block; }
.chip {
  font-size: 12.5px; font-weight: 500;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--dim);
  transition: all .16s var(--ease-out);
}
.chip:hover { color: var(--ink); border-color: var(--line-strong); }
.chip.is-on { background: var(--acc); color: var(--acc-ink); border-color: var(--acc); }
.deeper-tag {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em;
  padding: 2px 7px; border-radius: 999px;
  background: var(--mark-bg); color: var(--mark-ink);
}

/* ---------------- mode zones (edges) ---------------- */
.mode-zone {
  position: fixed; top: 0; bottom: 0;
  width: 76px;
  z-index: 30;
  display: flex; align-items: center; justify-content: center;
  gap: 10px;
  color: var(--faint);
  transition: all .25s var(--ease-out);
  opacity: .85;
}
#zone-left { left: 0; }
#zone-right { right: 0; }
.mode-zone:hover {
  color: var(--ink);
  background: linear-gradient(to right, var(--panel), transparent);
}
#zone-right:hover { background: linear-gradient(to left, var(--panel), transparent); }
.zone-chev { font-size: 22px; line-height: 1; }
.zone-label {
  display: none;
  flex-direction: column; align-items: flex-start; gap: 2px;
  text-align: left;
}
#zone-right .zone-label { align-items: flex-end; text-align: right; }
.zone-label b { font-family: var(--font-mono); font-size: 12px; letter-spacing: .18em; }
.zone-label i { font-style: normal; font-size: 10.5px; color: var(--dim); letter-spacing: .04em; }
.mode-zone:hover .zone-label { display: flex; }
.mode-zone.zone-active { color: var(--acc); }
html[data-mode="strict"] #zone-left, html[data-mode="ai"] #zone-right { opacity: .35; pointer-events: none; }

/* ---------------- stage & hero ---------------- */
#stage { position: relative; z-index: 10; }
#hero {
  min-height: calc(100svh - 250px);
  display: flex; flex-direction: column; align-items: center;
  padding: 96px 96px 0;
}
#mode-head { text-align: center; margin-bottom: 26px; transition: opacity .3s; }
#mode-title {
  font-size: clamp(26px, 4vw, 42px);
  font-weight: 700; letter-spacing: -.01em;
  text-shadow: 0 0 30px var(--glow);
}
html[data-mode="strict"] #mode-title { text-shadow: none; letter-spacing: .02em; }
#mode-sub { margin-top: 10px; color: var(--dim); font-size: 15px; max-width: 560px; }
#mode-sub b { color: var(--ink); }

#searchwrap {
  display: flex; align-items: center; gap: 10px;
  width: min(720px, 100%);
  padding: 8px 10px 8px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 6px);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  transition: border-color .2s, box-shadow .3s;
}
#searchwrap:focus-within { border-color: var(--acc); box-shadow: 0 0 0 1px var(--acc), 0 0 30px var(--glow); }
html[data-mode="strict"] #searchwrap:focus-within { box-shadow: 4px 4px 0 rgba(19,19,17,.9); }
.search-ic { color: var(--dim); flex: none; }
#search {
  flex: 1; min-width: 0;
  background: none; border: none; outline: none;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 16px;
  padding: 10px 0;
}
#search::placeholder { color: var(--faint); }

#ai-toolbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-top: 14px;
}
.lens-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.quota-note { font-size: 11.5px; color: var(--faint); font-family: var(--font-mono); }

/* ---------------- results ---------------- */
#results {
  width: min(860px, 100%);
  flex: 1 1 auto;
  overflow-y: auto;
  margin-top: 22px;
  padding-bottom: 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--faint) transparent;
  -webkit-overflow-scrolling: touch;
}

.neutral-hints {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
  width: min(760px, 100%);
  margin-top: 34px;
}
.hint-card {
  text-align: left;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(8px);
  display: flex; flex-direction: column; gap: 8px;
  transition: all .22s var(--ease-out);
}
.hint-card:hover { transform: translateY(-3px); border-color: var(--line-strong); box-shadow: var(--shadow); }
.hint-left:hover { border-color: #c9c9c2; background: rgba(246,246,242,.95); color: #131311; }
.hint-left:hover .hint-desc, .hint-left:hover .hint-kicker { color: #6b6b63; }
.hint-right:hover { border-color: rgba(47,212,232,.6); box-shadow: 0 0 30px rgba(47,212,232,.18); }
.hint-right:hover .hint-name { color: #2fd4e8; }
.hint-kicker { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .16em; color: var(--faint); text-transform: uppercase; }
.hint-name { font-size: 17px; font-weight: 600; }
.hint-desc { font-size: 13px; line-height: 1.55; color: var(--dim); }

#split-results { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.split-col {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); backdrop-filter: blur(8px);
  padding: 18px;
  display: flex; flex-direction: column; gap: 12px;
}
.split-head { font-family: var(--font-mono); font-size: 12px; letter-spacing: .14em; color: var(--dim); text-transform: uppercase; }
.split-ai-teaser { flex: 1; }
.split-ai-note { font-size: 12.5px; color: var(--dim); margin-top: 8px; }
.commit-btn { align-self: flex-start; }
.mini-hit { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.mini-hit:last-child { border-bottom: none; }
.mini-hit .sec-chip { margin-right: 8px; }
.mini-hit-snip { font-size: 12.5px; color: var(--dim); margin-top: 5px; line-height: 1.5; }

/* strict result cards */
.hit-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-solid);
  padding: 18px 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  animation: rise .35s var(--ease-out) both;
}
html[data-mode="strict"] .hit-card { border-width: 1px; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.hit-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.sec-chip {
  font-family: var(--font-mono); font-weight: 700; font-size: 12px;
  padding: 3px 9px;
  background: var(--acc); color: var(--acc-ink);
  border-radius: 4px;
  letter-spacing: .04em;
  white-space: nowrap;
}
.hit-title { font-size: 14.5px; font-weight: 600; flex: 1; min-width: 160px; }
.hit-path { width: 100%; font-size: 11px; color: var(--faint); font-family: var(--font-mono); letter-spacing: .02em; }
.hit-quote {
  font-family: var(--font-mono);
  font-size: 13.5px; line-height: 1.75;
  color: var(--ink);
  border-left: 2px solid var(--acc);
  padding: 4px 0 4px 16px;
  white-space: pre-wrap;
  word-break: break-word;
}
.hit-quote mark { background: var(--mark-bg); color: var(--mark-ink); padding: 0 3px; border-radius: 2px; }
.hit-actions { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.hit-actions .btn { font-size: 12px; padding: 6px 12px; }
.hit-context { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 12px; }
.hit-context .hit-quote { border-left-color: var(--line); color: var(--dim); }
.results-note { font-size: 12.5px; color: var(--faint); font-family: var(--font-mono); padding: 8px 2px; }

/* ai panel */
.ai-question { font-size: 13px; color: var(--dim); margin-bottom: 14px; }
.ai-question::before { content: '❯ '; color: var(--acc); }
.ai-answer {
  font-size: 15px; line-height: 1.75;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  min-height: 60px;
}
.ai-answer h4 { font-size: 13px; font-family: var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--acc); margin: 18px 0 8px; }
.ai-answer h4:first-child { margin-top: 0; }
.ai-answer p { margin: 0 0 12px; }
.ai-answer p:last-child { margin-bottom: 0; }
.ai-answer ul, .ai-answer ol { margin: 0 0 12px 20px; }
.ai-answer li { margin-bottom: 6px; }
.ai-answer code { font-family: var(--font-mono); font-size: 13px; background: var(--mark-bg); color: var(--mark-ink); padding: 1px 6px; border-radius: 4px; }
.ai-answer strong { color: var(--ink); }
.ai-answer .cite-ref {
  font-family: var(--font-mono); font-size: 12px; font-weight: 700;
  color: var(--acc); cursor: pointer;
  border-bottom: 1px dashed var(--acc);
  white-space: nowrap;
}
.ai-answer.is-thinking { display: flex; align-items: center; gap: 12px; color: var(--dim); font-family: var(--font-mono); font-size: 13px; }
.think-dots { display: inline-flex; gap: 4px; }
.think-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--acc); animation: blink 1.1s infinite; }
.think-dots i:nth-child(2) { animation-delay: .18s; }
.think-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 0%,70%,100% { opacity: .2; } 30% { opacity: 1; } }
.ai-cursor { display: inline-block; width: 8px; height: 16px; background: var(--acc); vertical-align: -2px; animation: blink .8s infinite; }
#ai-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
#ai-citations { margin-top: 18px; }
.cite-head { font-family: var(--font-mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--faint); margin-bottom: 10px; }
.deeper-block { margin-top: 16px; }
.deeper-block .ai-answer { border-color: var(--line-strong); }
.deeper-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: .14em; color: var(--acc); text-transform: uppercase; margin-bottom: 8px; }

/* ---------------- trinity stage ---------------- */
#trinity-stage {
  position: relative;
  height: 250px;
  flex: none;
  width: 100%;
  overflow: visible;
  z-index: 5;
}
#trinity-holder {
  position: absolute;
  bottom: 10px;
  left: 50%;
  width: 150px; height: 240px;
  transform: translateX(-50%);
  transition: filter .5s;
  filter: none;
  will-change: transform;
}
html[data-mode="ai"] #trinity-holder {
  filter: drop-shadow(0 0 12px rgba(47, 212, 232, .65)) drop-shadow(0 0 42px rgba(47, 212, 232, .3));
}
#trinity-holder svg { width: 100%; height: 100%; overflow: visible; }
#floor {
  position: absolute; bottom: 10px; left: 6%; right: 6%;
  height: 1px;
  background: var(--line-strong);
  opacity: .6;
}
#floor::after {
  content: '';
  position: absolute; inset: -1px 0;
  box-shadow: 0 0 18px var(--glow);
}
#critters { position: absolute; inset: 0; pointer-events: none; }
.critter {
  position: absolute; bottom: 11px;
  width: 46px; height: 40px;
  pointer-events: auto; cursor: pointer;
  will-change: transform;
}

/* ---------------- reference ---------------- */
#reference {
  position: relative;
  padding: 70px 96px 60px;
  border-top: 1px solid var(--line);
  background: linear-gradient(to bottom, transparent, var(--bg1) 140px);
}
.ref-head { max-width: 1100px; margin: 0 auto 26px; }
.ref-head h2 { font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
.ref-sub { color: var(--dim); font-size: 14px; margin-top: 6px; }
.ref-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
#ref-search {
  margin-top: 14px;
  width: min(460px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 10px 14px;
  outline: none;
}
#ref-search:focus { border-color: var(--acc); }
.chapter-grid {
  max-width: 1100px; margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}
.chapter-card {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(6px);
  padding: 20px;
  display: flex; flex-direction: column; gap: 8px;
  transition: all .2s var(--ease-out);
  min-height: 130px;
}
.chapter-card:hover {
  transform: translateY(-4px);
  border-color: var(--acc);
  box-shadow: 0 0 26px var(--glow), var(--shadow);
}
html[data-mode="strict"] .chapter-card:hover { box-shadow: 5px 5px 0 rgba(19,19,17,.85); }
.chapter-num {
  font-family: var(--font-mono); font-size: 26px; font-weight: 700;
  color: var(--acc);
}
.chapter-title { font-size: 14px; font-weight: 600; line-height: 1.4; flex: 1; }
.chapter-count { font-family: var(--font-mono); font-size: 11px; color: var(--faint); }

#section-list { max-width: 1100px; margin: 0 auto; }
#section-list-title { font-size: 19px; font-weight: 700; margin: 14px 0 16px; }
.sec-row {
  width: 100%;
  display: flex; align-items: baseline; gap: 14px;
  text-align: left;
  padding: 11px 14px;
  border: 1px solid transparent;
  border-bottom: 1px solid var(--line);
  transition: all .15s;
}
.sec-row:hover { background: var(--panel); border-color: var(--line-strong); border-radius: var(--radius); }
.sec-row-num { font-family: var(--font-mono); font-weight: 700; font-size: 12.5px; color: var(--acc); min-width: 84px; }
.sec-row-title { flex: 1; font-size: 13.5px; }
.sec-row-depth2 { padding-left: 34px; }
.sec-row-depth3 { padding-left: 58px; }
.sec-row-kind { font-family: var(--font-mono); font-size: 10px; color: var(--faint); letter-spacing: .08em; text-transform: uppercase; }

#foot {
  position: relative;
  padding: 26px 96px 34px;
  font-size: 12px; color: var(--faint);
  display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline;
  border-top: 1px solid var(--line);
}
.foot-sep { opacity: .5; }
.foot-dim { opacity: .8; }

/* ---------------- overlays ---------------- */
.overlay {
  position: fixed; inset: 0;
  z-index: 60;
  background: rgba(2, 8, 10, .72);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: fadein .25s ease both;
}
html[data-mode="strict"] .overlay { background: rgba(246, 246, 242, .8); }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.overlay-box {
  position: relative;
  width: min(760px, 100%);
  max-height: min(86vh, 900px);
  overflow-y: auto;
  background: var(--panel-solid);
  border: 1px solid var(--line-strong);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  padding: 34px 38px;
  scrollbar-width: thin;
  animation: pop .3s var(--ease-spring) both;
}
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(12px); } to { opacity: 1; transform: none; } }
.overlay-close {
  position: absolute; top: 14px; right: 16px;
  font-size: 16px; color: var(--dim);
  padding: 8px; line-height: 1;
  border-radius: 50%;
  z-index: 2;
}
.overlay-close:hover { color: var(--ink); background: var(--mark-bg); }

/* section modal */
.section-modal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; padding-right: 30px; }
.section-modal-head h3 { font-size: 18px; }
.section-modal-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.section-modal-actions .btn { font-size: 12px; padding: 6px 12px; border: 1px solid var(--line); }
.section-modal-body {
  font-size: 14px; line-height: 1.8;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}
.section-modal-body p { margin-bottom: 12px; }
.section-modal-body table { border-collapse: collapse; margin: 14px 0; width: 100%; font-size: 12.5px; }
.section-modal-body th, .section-modal-body td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; vertical-align: top; }
.section-modal-body th { background: var(--mark-bg); color: var(--mark-ink); font-weight: 600; }
.section-modal-body ul, .section-modal-body ol { margin: 0 0 12px 22px; }
.section-modal-body li { margin-bottom: 5px; }
.section-modal-body h1, .section-modal-body h2, .section-modal-body h3, .section-modal-body h4 { margin: 18px 0 10px; font-size: 15px; }
.section-modal-body a { word-break: break-all; }
.section-modal-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 22px; border-top: 1px solid var(--line); padding-top: 14px; }

/* ---------------- quiz ---------------- */
.quiz-box { width: min(680px, 100%); }
.quiz-title { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
.quiz-sub { color: var(--dim); font-size: 13.5px; margin: 8px 0 22px; line-height: 1.6; }
#rank-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
  background: var(--panel);
}
.rank-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.rank-name { font-family: var(--font-mono); font-weight: 700; font-size: 15px; color: var(--acc); letter-spacing: .06em; }
.rank-xp { font-family: var(--font-mono); font-size: 12px; color: var(--dim); }
.rank-bar { height: 6px; background: var(--mark-bg); border-radius: 999px; overflow: hidden; }
#rank-fill { height: 100%; width: 0; background: var(--acc); border-radius: 999px; transition: width .8s var(--ease-out); box-shadow: 0 0 12px var(--glow); }
.rank-ladder { display: flex; justify-content: space-between; margin-top: 8px; font-family: var(--font-mono); font-size: 10px; color: var(--faint); letter-spacing: .04em; }
.rank-ladder .rk-done { color: var(--acc); }
.daily-card {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  font-size: 13px;
}
.daily-card .btn { margin-left: auto; font-size: 12px; padding: 6px 12px; }
.daily-done { color: var(--ok); font-family: var(--font-mono); font-size: 12px; }
.quiz-topics { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.quiz-start-row { display: flex; gap: 10px; flex-wrap: wrap; }

.quiz-hud {
  display: flex; justify-content: space-between; align-items: baseline;
  font-family: var(--font-mono); font-size: 12.5px; color: var(--dim);
  margin-bottom: 16px; gap: 10px;
}
#quiz-streak { color: var(--acc); font-weight: 700; }
#quiz-score { font-weight: 700; color: var(--ink); }
.quiz-scenario {
  border-left: 2px solid var(--acc);
  background: var(--panel);
  padding: 14px 16px;
  font-size: 13.5px; line-height: 1.7;
  color: var(--dim);
  margin-bottom: 14px;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.quiz-scenario::before {
  content: 'FIELD SCENARIO';
  display: block;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .18em;
  color: var(--acc); margin-bottom: 6px;
}
.quiz-question { font-size: 16.5px; font-weight: 600; line-height: 1.5; margin-bottom: 16px; }
.quiz-options { display: flex; flex-direction: column; gap: 8px; }
.quiz-opt {
  text-align: left;
  display: flex; gap: 12px; align-items: baseline;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13.5px; line-height: 1.55;
  transition: all .15s;
  background: var(--panel);
}
.quiz-opt:hover:not(:disabled) { border-color: var(--acc); transform: translateX(3px); }
.quiz-opt:disabled { cursor: default; opacity: .55; }
.quiz-opt .opt-key {
  font-family: var(--font-mono); font-weight: 700; font-size: 12px;
  color: var(--acc); flex: none;
}
.quiz-opt.opt-correct { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); opacity: 1; }
.quiz-opt.opt-wrong { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); opacity: 1; }
.quiz-opt.opt-eliminated { opacity: .25; text-decoration: line-through; }
.quiz-lifelines { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.pill-btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .04em;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--dim);
  transition: all .18s;
}
.pill-dot { width: 14px; height: 8px; border-radius: 999px; display: inline-block; }
.pill-red .pill-dot { background: #d8323e; box-shadow: 0 0 8px rgba(216, 50, 62, .7); }
.pill-blue .pill-dot { background: #3f77c9; box-shadow: 0 0 8px rgba(63, 119, 201, .7); }
.pill-btn:hover:not(:disabled) { border-color: var(--line-strong); color: var(--ink); transform: translateY(-1px); }
.pill-btn:disabled { opacity: .3; cursor: default; }
.quiz-reveal {
  margin-top: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.7;
  color: var(--dim);
}
.quiz-reveal .sec-chip { margin-right: 8px; }
.quiz-feedback {
  margin-top: 16px;
  border-radius: var(--radius);
  padding: 16px 18px;
  font-size: 13.5px; line-height: 1.65;
  animation: rise .3s var(--ease-out) both;
}
.quiz-feedback.fb-correct { border: 1px solid var(--ok); background: color-mix(in srgb, var(--ok) 8%, transparent); }
.quiz-feedback.fb-wrong { border: 1px solid var(--danger); background: color-mix(in srgb, var(--danger) 7%, transparent); }
.fb-verdict { font-family: var(--font-mono); font-weight: 700; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 8px; }
.fb-correct .fb-verdict { color: var(--ok); }
.fb-wrong .fb-verdict { color: var(--danger); }
.fb-cite { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.fb-cite .hit-quote { font-size: 12.5px; margin-top: 8px; }
#quiz-next { margin-top: 16px; }
.quiz-end-score {
  text-align: center;
  padding: 20px 0 26px;
}
.quiz-end-score .big {
  font-family: var(--font-mono); font-size: 54px; font-weight: 700;
  color: var(--acc);
  text-shadow: 0 0 30px var(--glow);
}
.quiz-end-score .sub { color: var(--dim); font-size: 13.5px; margin-top: 6px; }
.quiz-end-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  margin-bottom: 20px;
}
.qe-stat { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; text-align: center; }
.qe-stat b { display: block; font-family: var(--font-mono); font-size: 20px; color: var(--ink); }
.qe-stat span { font-size: 11px; color: var(--faint); letter-spacing: .06em; text-transform: uppercase; }
.quiz-end-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* ---------------- tooltip ---------------- */
#tip {
  position: fixed;
  z-index: 90;
  background: var(--panel-solid);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: 12px; line-height: 1.5;
  padding: 8px 12px;
  max-width: 260px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}
#tip.show { opacity: 1; }

/* ---------------- guided tour ---------------- */
#tour-ring {
  position: fixed;
  z-index: 71;
  border: 2px solid var(--acc);
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(2, 8, 10, .62), 0 0 22px var(--glow);
  pointer-events: none;
  transition: all .38s cubic-bezier(.22,.9,.3,1);
}
html[data-mode="strict"] #tour-ring { box-shadow: 0 0 0 9999px rgba(48, 44, 32, .5); }
#tour-box {
  position: fixed;
  z-index: 72;
  width: min(340px, calc(100vw - 32px));
  background: var(--panel-solid);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 18px 20px;
  transition: all .38s cubic-bezier(.22,.9,.3,1);
}
.tour-step-kicker {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .16em;
  color: var(--acc); text-transform: uppercase; margin-bottom: 6px;
}
#tour-box h4 { font-size: 15.5px; font-weight: 600; margin-bottom: 6px; }
#tour-box p { font-size: 13px; line-height: 1.6; color: var(--dim); margin-bottom: 14px; }
.tour-actions { display: flex; gap: 8px; align-items: center; }
.tour-actions .btn { font-size: 12.5px; padding: 7px 14px; }
.tour-skip { margin-left: auto; }

/* ---------------- EU emblem ---------------- */
.eu-badge {
  display: inline-flex; align-items: center;
  cursor: default;
  line-height: 0;
}
.eu-flag {
  width: 28px; height: 19px;
  border-radius: 2.5px;
  box-shadow: 0 0 0 1px var(--line);
  display: block;
}
#foot .eu-flag { width: 24px; height: 16px; }
#foot { align-items: center; }

/* ---------------- toast ---------------- */
#toast {
  position: fixed;
  left: 50%; bottom: 34px;
  transform: translate(-50%, 20px);
  z-index: 80;
  background: var(--panel-solid);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  box-shadow: var(--shadow);
  color: var(--ink);
  font-family: var(--font-mono); font-size: 13px;
  padding: 11px 22px;
  opacity: 0;
  pointer-events: none;
  transition: all .3s var(--ease-out);
  max-width: min(560px, 90vw);
  text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- glitch (deja vu) ---------------- */
@keyframes glitchx {
  0%, 100% { transform: none; filter: none; }
  20% { transform: translateX(-3px); filter: hue-rotate(40deg); }
  40% { transform: translateX(3px) skewX(1deg); }
  60% { transform: translateX(-2px); filter: hue-rotate(-40deg); }
  80% { transform: translateX(1px); }
}
.glitching { animation: glitchx .5s steps(2) 2; }

/* ---------------- responsive ---------------- */
@media (max-width: 900px) {
  #topbar { padding: 12px 16px; }
  #hero { padding: 84px 18px 0; }
  .mode-zone { width: 44px; }
  .mode-zone .zone-label { display: none !important; }
  #reference, #foot { padding-left: 20px; padding-right: 20px; }
  .neutral-hints, #split-results { grid-template-columns: 1fr; }
  #btn-quiz span { display: none; }
  #hero { min-height: calc(100svh - 200px); }
  #trinity-stage { height: 200px; }
  #trinity-holder { width: 120px; height: 195px; }
  .overlay { padding: 10px; align-items: flex-end; }
  .overlay-box { padding: 24px 20px; max-height: 92vh; border-radius: 16px 16px 0 0; }
  .quiz-end-stats { grid-template-columns: 1fr 1fr; }
  #results { margin-top: 16px; }
  #mode-sub { font-size: 13.5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
