:root {
  --ink: #0b0717;
  --ink2: #150d27;
  --panel: rgba(16, 10, 30, 0.92);
  --brass: #f4c25b;
  --brass-hi: #ffe39a;
  --brass-lo: #9a6a2a;
  --teal: #4fe3cf;
  --rose: #ff6b9a;
  --red: #ff5a5a;      /* fills */
  --red-txt: #ff7878;  /* red text on dark panels */
  --cream: #fff3d6;
  --muted: #c2b8db;    /* secondary text: 8.6:1 on a panel even over a white scene pixel */
  --dim: #a397c2;      /* tertiary text: 4.8:1 or better on every panel tint */
  --px: 3px;
  --display: 'Pixelify Sans', 'Silkscreen', ui-monospace, monospace;
  --caps: 'Silkscreen', 'Pixelify Sans', ui-monospace, monospace;
  /* Silkscreen is drawn on an 8px grid, so it only renders crisp at multiples of 8 */
  --caps-sm: 16px;
  --caps-lg: 24px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--ink); color: var(--cream); overflow: hidden; }
body { font-family: var(--display); touch-action: manipulation; }
button { font-family: inherit; }
.hidden { display: none !important; }

#view { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
#view { image-rendering: pixelated; image-rendering: crisp-edges; touch-action: none; }
/* tower view */
#view.free { cursor: grab; }
#view.free.over { cursor: pointer; }
#view.free.grabbing { cursor: grabbing; }
#crt { position: fixed; inset: 0; pointer-events: none; z-index: 2; opacity: .5;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.28) 0 1px, transparent 1px var(--px)); }
#crt.zap { animation: zap .3s steps(3, end); }
@keyframes zap { 0% { opacity: .9; transform: translateY(0) } 50% { opacity: .3; transform: translateY(2px) } 100% { opacity: .5; transform: none } }
#vignette { position: fixed; inset: 0; pointer-events: none; z-index: 2;
  background: radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(5,2,12,.55) 100%); }
#flash { position: fixed; inset: 0; pointer-events: none; z-index: 3; opacity: 0;
  background: radial-gradient(circle at 50% 35%, rgba(255,246,214,.95), rgba(244,194,91,.45) 45%, rgba(244,194,91,0) 80%); }
#flash.red { background: radial-gradient(circle at 50% 35%, rgba(255,90,90,.7), rgba(255,90,90,0) 70%); }
#flash.go { animation: flash .8s ease-out; }
@keyframes flash { 0% { opacity: .85 } 100% { opacity: 0 } }
#ui { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
#ui > * { pointer-events: auto; }
#labels, #chip { pointer-events: none !important; }

/* ---------- shared bits ---------- */
.panel {
  background: var(--panel);
  box-shadow: 0 0 0 3px var(--brass), 0 0 0 6px var(--ink), 0 0 0 7px var(--brass-lo), 0 14px 50px rgba(0,0,0,.6), 0 0 40px rgba(244,194,91,.15);
  border-radius: 2px;
  backdrop-filter: blur(3px);
}
button.big {
  font-family: var(--display); font-weight: 600; font-size: 24px; letter-spacing: .04em;
  color: var(--ink); background: var(--brass); border: 0; padding: 10px 24px 9px; cursor: pointer;
  box-shadow: 0 0 0 3px var(--ink), 0 0 0 5px var(--brass-hi), 0 5px 0 5px var(--brass-lo), 0 0 26px rgba(244,194,91,.45);
  transition: transform .08s, box-shadow .08s; margin-top: 8px;
}
button.big:hover { transform: translateY(-2px); background: var(--brass-hi); }
button.big:active { transform: translateY(3px); box-shadow: 0 0 0 3px var(--ink), 0 0 0 5px var(--brass-hi), 0 1px 0 5px var(--brass-lo); }
button.sec {
  font-family: var(--caps); font-size: var(--caps-sm); color: var(--brass-hi); background: rgba(20,12,36,.92); border: 0;
  padding: 10px 14px 9px; cursor: pointer; box-shadow: 0 0 0 2px var(--brass-lo);
}
button.sec:hover { box-shadow: 0 0 0 2px var(--brass); color: #fff; }
button.sec:disabled { color: var(--dim); box-shadow: 0 0 0 2px #3a3150; cursor: default; }
button.link { background: none; border: 0; color: var(--muted); font-family: var(--caps); font-size: var(--caps-sm); cursor: pointer; margin-top: 16px; text-decoration: underline dotted; text-underline-offset: 5px; }
button.link:hover { color: var(--cream); }
button.icon {
  width: 40px; height: 40px; font-size: 20px; color: var(--brass-hi); background: rgba(16,10,30,.9); border: 0; cursor: pointer;
  box-shadow: 0 0 0 2px var(--brass-lo); font-family: var(--display);
}
button.icon:hover { box-shadow: 0 0 0 2px var(--brass); color: #fff; }
button.icon.off { color: var(--dim); }
.chip { font-family: var(--caps); font-size: var(--caps-sm); padding: 5px 6px 4px; min-width: 84px; text-align: center; display: inline-block; }
.chip.gold { background: var(--brass); color: var(--ink); }
.chip.red { background: var(--red); color: var(--ink); }
.chip.dim { background: #3a3150; color: var(--cream); }
.chip.teal { background: var(--teal); color: var(--ink); }
.fine { color: var(--muted); font-size: 18px; line-height: 1.4; }

/* ---------- title ---------- */
.screen { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; }
#title { align-items: flex-start; padding-top: 9vh; background: linear-gradient(180deg, rgba(8,4,18,.55), transparent 60%); }
.titleBox { text-align: center; max-width: 720px; padding: 22px 40px 26px; background: radial-gradient(ellipse at 50% 50%, rgba(8,4,18,.9) 50%, rgba(8,4,18,.7) 70%, transparent 84%); }
.titleLinks { display: flex; gap: 24px; justify-content: center; flex-wrap: wrap; }
.kicker { font-family: var(--caps); font-size: var(--caps-sm); letter-spacing: 4px; color: var(--teal); text-shadow: 0 0 12px rgba(79,227,207,.6); }
.logo {
  margin: 4px 0 0; font-family: var(--display); font-weight: 700; font-size: clamp(64px, 16vw, 132px); line-height: .9; letter-spacing: .02em;
  color: var(--brass-hi);
  text-shadow: -4px 3px 0 var(--rose), 4px -3px 0 rgba(79,227,207,.85), 0 0 34px rgba(244,194,91,.55), 0 8px 0 rgba(0,0,0,.5);
  animation: flicker 6s step-end infinite;
}
.logo span { color: #fff; margin-left: .18em; }
@keyframes flicker { 0%, 92%, 95%, 100% { opacity: 1 } 93% { opacity: .55 } 94% { opacity: .95 } 94.5% { opacity: .4 } }
.tagline { font-family: var(--caps); font-size: var(--caps-lg); letter-spacing: 9px; color: var(--teal); margin-top: 12px; text-shadow: 0 0 14px rgba(79,227,207,.7); }
.sub { font-size: clamp(19px, 4.8vw, 24px); color: var(--cream); line-height: 1.35; margin: 16px 0 18px; text-shadow: 0 2px 0 rgba(0,0,0,.6); }
.sub b { color: var(--brass-hi); }
.note { margin-top: 16px; color: var(--muted); font-size: 18px; line-height: 1.35; min-height: 1em; text-shadow: 0 2px 0 #000; }
#btnStart { animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-4px); } }

/* ---------- rules ---------- */
#rules { background: rgba(6,3,14,.6); }
.rulesBox { max-width: 620px; padding: 24px 26px 26px; }
.rulesBox h2, .galBox h2 { margin: 0 0 14px; font-size: 30px; color: var(--brass-hi); text-shadow: 2px 2px 0 var(--rose); font-weight: 600; }
.ruleList { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 14px; }
.ruleList li { display: grid; grid-template-columns: 92px 1fr; gap: 14px; align-items: start; font-size: 20px; line-height: 1.35; }
.ruleList b { color: var(--brass-hi); }

/* ---------- HUD ---------- */
#hud { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; align-items: flex-start; justify-content: space-between; pointer-events: none; }
#hud > * { pointer-events: auto; }
#dial {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: rgba(12,7,24,.9);
  box-shadow: 0 0 0 3px var(--brass), 0 0 0 5px var(--ink), 0 0 24px rgba(244,194,91,.25);
}
#dial .num {
  font-family: var(--caps); font-weight: 400; font-size: 40px; line-height: 1; min-width: 2.2ch; text-align: center;
  color: var(--brass-hi); text-shadow: 0 0 14px rgba(255,227,154,.8), 2px 2px 0 #7a3a10; font-variant-numeric: tabular-nums;
}
#dial .num.neg { color: #9fe8ff; text-shadow: 0 0 14px rgba(120,210,255,.8), 2px 2px 0 #1a3a5a; }
#dial .lamp { font-size: 16px; color: #3a2e4a; transition: color .2s, text-shadow .2s; }
#dial .lamp.on.up { color: var(--teal); text-shadow: 0 0 10px var(--teal); }
#dial .lamp.on.down { color: var(--rose); text-shadow: 0 0 10px var(--rose); }
#dial.bump .num { animation: bump .18s; }
@keyframes bump { 50% { transform: scale(1.18); } }
#pips { display: flex; gap: 8px; margin-top: 10px; }
.pip {
  width: 46px; height: 30px; display: flex; align-items: center; justify-content: center; font-family: var(--caps); font-size: var(--caps-sm);
  background: rgba(12,7,24,.92); box-shadow: 0 0 0 2px #4a3e64; color: var(--dim);
}
.pip.cur { box-shadow: 0 0 0 2px var(--brass); color: var(--brass-hi); animation: pulse 1.2s infinite; }
.pip.pos { background: var(--brass); color: var(--ink); box-shadow: 0 0 0 2px var(--brass-hi), 0 0 12px rgba(244,194,91,.6); }
.pip.neg { background: var(--red); color: var(--ink); box-shadow: 0 0 0 2px #ff9a9a; }
.pip.mid { background: #4a3e64; color: var(--cream); box-shadow: 0 0 0 2px #6a5a8a; }
.pip.pop { animation: pipPop .5s cubic-bezier(.2,1.8,.4,1); }
@keyframes pulse { 50% { box-shadow: 0 0 0 2px var(--brass), 0 0 14px rgba(244,194,91,.8); } }
@keyframes pipPop { 0% { transform: scale(1.8); } 100% { transform: none; } }
#hudBtns { display: flex; gap: 10px; }

/* ---------- labels drifting by ---------- */
.flabel {
  position: absolute; font-family: var(--caps); font-size: var(--caps-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--dim); background: rgba(8,4,18,.85); padding: 4px 8px 3px; transform: translateY(-50%); transition: opacity .4s;
}
.flabel b { color: var(--brass); font-weight: 400; margin-right: 8px; }
.flabel.neg b { color: #9fe8ff; }
.flabel.lit { color: var(--cream); }
.flabel.major { color: var(--cream); box-shadow: 0 0 0 2px var(--brass-lo); }
.flabel.major b { color: var(--brass-hi); }

/* ---------- question card ---------- */
#card {
  position: absolute; left: 50%; bottom: 18px; width: min(760px, calc(100vw - 28px)); transform: translateX(-50%);
  padding: 14px 18px 16px; animation: cardIn .45s cubic-bezier(.2,1.4,.4,1) both;
}
#card.out { animation: cardOut .35s ease-in both; }
@keyframes cardIn { from { opacity: 0; transform: translate(-50%, 40px) scale(.94); } }
@keyframes cardOut { to { opacity: 0; transform: translate(-50%, 30px) scale(.96); filter: blur(2px); } }
.cardTop { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.cat { font-family: var(--caps); font-size: var(--caps-sm); letter-spacing: 2px; color: var(--ink); background: var(--teal); padding: 4px 8px 3px; }
.qnum { font-family: var(--caps); font-size: var(--caps-sm); color: var(--muted); }
.cardBody { display: flex; gap: 16px; align-items: center; }
.timer { position: relative; width: 80px; flex: none; }
.timer svg { width: 80px; height: 50px; display: block; overflow: visible; }
/* an old brass floor indicator: bezel, sunburst, ticks, a red zone for the last five seconds, an arrow needle */
.timer .face { fill: #140c22; stroke: var(--brass); stroke-width: 1.6; stroke-linejoin: round; }
.timer #ticks .ray { stroke: rgba(244,194,91,.13); stroke-width: 2.4; }
.timer #ticks .major { stroke: #b89a5a; stroke-width: 1.4; }
.timer #ticks .minor { stroke: #6a5a8a; stroke-width: 1; }
.timer .redzone { fill: none; stroke: var(--red); stroke-width: 1.8; }
.timer .arc { fill: none; stroke: #2a2040; stroke-width: 5; }
.timer .arcFill { fill: none; stroke: var(--brass); stroke-width: 5; stroke-dasharray: 100 100; stroke-dashoffset: 0; filter: drop-shadow(0 0 4px rgba(244,194,91,.8)); }
.timer.hot .arcFill { stroke: var(--red); filter: drop-shadow(0 0 5px var(--red)); }
.timer #needle { fill: var(--rose); transform-origin: 32px 36px; transform: rotate(90deg); filter: drop-shadow(0 0 2px rgba(255,107,154,.7)); }
.timer .hub { fill: var(--brass-hi); stroke: var(--brass-lo); stroke-width: 1; }
.timer .pin { fill: var(--ink); }
.secs { text-align: center; font-family: var(--display); font-weight: 600; font-size: 24px; color: var(--brass-hi); margin-top: 2px; font-variant-numeric: tabular-nums; }
.timer.hot .secs { color: var(--red-txt); text-shadow: 0 0 10px var(--red); }
.qText { flex: 1; min-width: 0; }
.prompt { font-size: clamp(24px, 5vw, 32px); line-height: 1.15; font-weight: 500; color: #fff; text-shadow: 0 2px 0 #000; }
/* which way the list runs is what tells you where #10 sits, so it gets its own lit strip */
.rankline {
  margin-top: 10px; padding: 6px 12px 5px; font-size: 20px; line-height: 1.35; color: var(--cream);
  background: rgba(79,227,207,.1); box-shadow: inset 4px 0 0 var(--teal);
}
.answerRow { display: flex; gap: 10px; margin-top: 14px; }
.inputWrap { position: relative; flex: 1; }
#answer {
  width: 100%; font-family: var(--display); font-size: 26px; color: var(--cream); background: #08050f; border: 0; outline: 0;
  padding: 10px 14px 9px; box-shadow: inset 0 0 0 2px #4a3e64, 0 0 0 0 transparent; caret-color: var(--brass);
}
#answer:focus { box-shadow: inset 0 0 0 2px var(--brass), 0 0 18px rgba(244,194,91,.25); }
#answer::placeholder { color: var(--dim); }
#answer.shake { animation: shake .32s; }
@keyframes shake { 20% { transform: translateX(-6px) } 40% { transform: translateX(5px) } 60% { transform: translateX(-3px) } 80% { transform: translateX(2px) } }
.go { font-family: var(--display); font-weight: 700; font-size: 24px; color: var(--ink); background: var(--brass); border: 0; padding: 0 20px; cursor: pointer; box-shadow: 0 4px 0 var(--brass-lo); }
.go:hover { background: var(--brass-hi); }
.go:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--brass-lo); }
#suggest { list-style: none; margin: 10px 0 0; padding: 2px; display: flex; flex-wrap: wrap; gap: 8px; max-height: 96px; overflow: hidden; }
#suggest li {
  padding: 6px 12px 5px; font-size: 20px; cursor: pointer; color: var(--cream); background: rgba(244,194,91,.1);
  box-shadow: 0 0 0 2px #4a3e64; white-space: nowrap; display: inline-flex; gap: 8px; align-items: baseline;
}
#suggest li small { color: var(--dim); font-size: 16px; }
#suggest li.sel, #suggest li:hover { background: var(--brass); color: var(--ink); box-shadow: 0 0 0 2px var(--brass-hi), 0 0 14px rgba(244,194,91,.5); }
#suggest li.sel small, #suggest li:hover small { color: var(--ink); }
#suggest li mark { background: none; color: var(--brass-hi); text-decoration: underline; text-underline-offset: 3px; }
#suggest li.sel mark, #suggest li:hover mark { color: var(--ink); }
#suggest li.sel::after { content: '↵'; font-size: 16px; opacity: .7; } /* Enter submits the highlighted chip */
.msg { min-height: 26px; margin-top: 8px; font-size: 20px; line-height: 1.35; color: #ffb37a; }
.msg button { font-family: var(--display); font-size: 20px; background: var(--brass); color: var(--ink); border: 0; padding: 2px 10px; margin: 2px 4px; cursor: pointer; }
.msg button.no { background: #3a2e4a; color: var(--cream); }

/* ---------- result chip ---------- */
/* Two acts: while the car rides only the plate shows ("LOCKED IN" + your answer);
   when it lands the score slams in above it. .pts keeps its space throughout so nothing jumps. */
#chip {
  position: absolute; left: 50%; top: 30%; transform: translate(-50%, -50%); text-align: center; z-index: 8;
  width: max-content; max-width: calc(100vw - 32px); pointer-events: none;
}
#chip .pts {
  position: relative; isolation: isolate; visibility: hidden;
  font-family: var(--display); font-weight: 700; font-size: clamp(72px, 15vw, 132px); line-height: .9;
}
#chip .plate {
  display: inline-block; max-width: min(620px, calc(100vw - 32px)); margin-top: 14px; padding: 10px 22px 12px;
  background: rgba(12,7,24,.92); box-shadow: 0 0 0 3px var(--brass-lo), 0 0 0 5px var(--ink), 0 12px 34px rgba(0,0,0,.55);
}
#chip .why { font-family: var(--caps); font-size: var(--caps-lg); line-height: 1.25; color: var(--teal); }
#chip .ans { font-size: 30px; line-height: 1.2; margin-top: 4px; color: var(--cream); }
#chip .dots i { font-style: normal; animation: dot 1.2s infinite; }
#chip .dots i:nth-child(2) { animation-delay: .2s; }
#chip .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes dot { 0%, 20% { opacity: 0; } 30%, 100% { opacity: 1; } }

#chip.lock .plate { animation: lockIn .4s cubic-bezier(.2,1.5,.4,1) both, wait 1.1s ease-in-out .4s infinite; }
@keyframes lockIn { from { opacity: 0; transform: scale(.6); } }
@keyframes wait { 50% { box-shadow: 0 0 0 3px var(--teal), 0 0 0 5px var(--ink), 0 0 30px rgba(79,227,207,.45); } }

#chip.hit .pts { visibility: visible; animation: slam .75s cubic-bezier(.2,1.6,.4,1) both; }
#chip.hit .plate { animation: thump .45s ease-out both; }
#chip.pos .pts { color: var(--brass-hi); text-shadow: -4px 3px 0 var(--rose), 4px -3px 0 rgba(79,227,207,.8), 0 6px 0 #2a1406, 0 0 40px rgba(244,194,91,.9); }
#chip.pos .plate { box-shadow: 0 0 0 3px var(--brass), 0 0 0 5px var(--ink), 0 0 36px rgba(244,194,91,.45); }
#chip.pos .why { color: var(--brass-hi); }
#chip.neg .pts { color: var(--red); text-shadow: 4px 4px 0 #3a0a14, 0 0 40px rgba(255,90,90,.8); }
#chip.neg .plate { box-shadow: 0 0 0 3px var(--red), 0 0 0 5px var(--ink), 0 0 30px rgba(255,90,90,.35); }
#chip.neg .why { color: #ffb0b0; }
/* the #10 jackpot: bigger slam and a ring of light behind the number */
#chip.max .pts { font-size: clamp(88px, 19vw, 168px); animation-name: slamBig; }
#chip.max .pts::before {
  content: ''; position: absolute; left: 50%; top: 50%; z-index: -1; width: 4.2em; height: 4.2em;
  background: repeating-conic-gradient(rgba(255,227,154,.42) 0 7deg, rgba(255,227,154,0) 7deg 18deg);
  -webkit-mask: radial-gradient(circle, #000 18%, transparent 66%); mask: radial-gradient(circle, #000 18%, transparent 66%);
  animation: rays 9s linear infinite, raysIn .7s ease-out both;
}
#chip.leave { animation: chipOut .45s ease-in both; }
@keyframes slam { 0% { opacity: 0; transform: scale(2.6) rotate(-6deg); } 55% { opacity: 1; transform: scale(.94) rotate(1deg); } 100% { transform: none; } }
@keyframes slamBig { 0% { opacity: 0; transform: scale(3.4) rotate(-9deg); } 50% { opacity: 1; transform: scale(.9) rotate(2deg); } 70% { transform: scale(1.06); } 100% { transform: none; } }
@keyframes thump { 0% { transform: scale(1); } 30% { transform: scale(1.07); } 100% { transform: none; } }
@keyframes rays { from { transform: translate(-50%, -50%) rotate(0); } to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes raysIn { from { opacity: 0; } }
@keyframes chipOut { to { opacity: 0; transform: translate(-50%, -110%) scale(.7); } }

/* ---------- answer board ---------- */
#board {
  position: absolute; right: 18px; top: 82px; width: min(390px, 36vw); padding: 12px 14px; max-height: calc(100vh - 106px); overflow: auto;
  animation: boardIn .5s cubic-bezier(.2,1.2,.4,1) both;
}
@keyframes boardIn { from { opacity: 0; transform: translateX(40px); } }
.boardHead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-family: var(--caps); font-size: var(--caps-sm); color: var(--teal); margin-bottom: 8px; }
#boardSub { color: var(--muted); }
#boardList { list-style: none; margin: 0; padding: 0; }
#boardList li {
  display: grid; grid-template-columns: 42px 1fr auto; gap: 8px; align-items: baseline; padding: 4px 6px 3px; font-size: 19px; line-height: 1.2;
  border-bottom: 1px dashed rgba(194,184,219,.18); opacity: 0; animation: rowIn .3s ease-out forwards;
}
#boardList li .rk { font-family: var(--caps); font-size: var(--caps-sm); color: var(--dim); }
#boardList li .nm { color: var(--cream); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#boardList li .nm small { color: var(--dim); font-size: 16px; margin-left: 6px; }
#boardList li .pt { font-family: var(--caps); font-size: var(--caps-sm); color: var(--brass); }
#boardList li.near .pt, #boardList li.near .rk { color: var(--red-txt); }
#boardList li.near { background: rgba(255,90,90,.08); }
#boardList li.sep { display: block; border: 0; font-family: var(--caps); font-size: var(--caps-sm); color: var(--red-txt); padding-top: 8px; }
#boardList li.you { background: var(--brass); }
#boardList li.you .nm, #boardList li.you .rk, #boardList li.you .pt, #boardList li.you .nm small { color: var(--ink); }
#boardList li.you.near { background: var(--red); }
#boardList li.youx { background: #3a2e4a; }
#boardList li.youx .nm { color: #fff; }
#boardList li.youx .nm small { color: var(--muted); }
@keyframes rowIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }

/* ---------- plaque ---------- */
#plaque {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); width: min(620px, calc(100vw - 28px));
  padding: 14px 18px 16px; text-align: center;
  background: linear-gradient(180deg, #3a2a12, #22180c); color: var(--cream);
  box-shadow: 0 0 0 3px var(--brass), 0 0 0 6px #1a1008, 0 0 0 7px var(--brass-lo), 0 14px 40px rgba(0,0,0,.6), 0 0 40px rgba(244,194,91,.2);
  animation: cardIn .45s cubic-bezier(.2,1.3,.4,1) both;
}
.plTop { display: flex; justify-content: center; gap: 12px; align-items: center; font-family: var(--caps); font-size: var(--caps-sm); letter-spacing: 2px; color: var(--brass); }
.new { background: var(--teal); color: var(--ink); padding: 3px 6px 2px; letter-spacing: 0; animation: pulse2 1s infinite; }
@keyframes pulse2 { 50% { box-shadow: 0 0 14px var(--teal); } }
.plName { font-size: clamp(28px, 6.5vw, 38px); font-weight: 600; color: var(--brass-hi); text-shadow: 2px 2px 0 #4a2a08, 0 0 18px rgba(244,194,91,.4); margin: 4px 0 6px; }
.plText { font-size: 20px; line-height: 1.4; color: #efe5cc; }

/* ---------- results ---------- */
#results { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(500px, calc(100vw - 28px)); padding: 18px 20px; animation: resIn .6s cubic-bezier(.2,1.3,.4,1) both; max-height: calc(100vh - 40px); overflow: auto; }
@keyframes resIn { from { opacity: 0; transform: translate(-50%, -44%) scale(.95); } }
.resTop { text-align: center; }
.resKicker { font-family: var(--caps); font-size: var(--caps-sm); letter-spacing: 3px; color: var(--teal); }
.resFloor { font-family: var(--caps); font-size: 80px; line-height: .95; color: var(--brass-hi); text-shadow: -4px 3px 0 var(--rose), 4px -3px 0 rgba(79,227,207,.8), 0 0 40px rgba(244,194,91,.6); }
.resFloor.neg { color: #9fe8ff; }
.resName { font-size: 26px; color: var(--cream); margin-bottom: 12px; }
.resRows { display: grid; gap: 4px; margin: 6px 0 12px; }
.resRow { display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; align-items: baseline; font-size: 19px; padding: 5px 8px 4px; background: rgba(255,255,255,.04); }
.resRow .i { font-family: var(--caps); font-size: var(--caps-sm); color: var(--dim); }
.resRow .a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resRow .a small { color: var(--dim); font-size: 16px; }
.resRow .p { font-family: var(--caps); font-size: var(--caps-sm); }
.resRow .p.pos { color: var(--brass); } .resRow .p.neg { color: var(--red-txt); }
.resStats { text-align: center; color: var(--muted); font-size: 18px; line-height: 1.4; margin-bottom: 10px; }
.resStats b { color: var(--teal); font-weight: 500; }
.resBtns { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: center; }
.resBtns .big { width: 100%; }

/* ---------- explore ---------- */
#exploreBar, #towerBar { position: absolute; left: 12px; right: 12px; bottom: 14px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; pointer-events: none; }
#exploreBar > *, #towerBar > * { pointer-events: auto; }
#btnZoomIn, #btnZoomOut { width: 44px; padding-left: 0; padding-right: 0; }
.exTitle { display: flex; flex-direction: column; padding: 8px 12px; background: rgba(12,7,24,.9); box-shadow: 0 0 0 2px var(--brass-lo); }
.exTitle span:first-child { font-family: var(--caps); font-size: var(--caps-sm); letter-spacing: 2px; color: var(--brass); }
.exTitle span:last-child { font-size: 26px; color: var(--brass-hi); }
.exHint { flex: 1; display: flex; justify-content: center; padding-bottom: 8px; pointer-events: none !important; }
.exHint span { font-family: var(--caps); font-size: var(--caps-sm); color: var(--muted); background: rgba(8,4,18,.85); padding: 6px 10px 5px; }
.exBtns { display: flex; gap: 8px; }
#tip {
  position: absolute; max-width: 320px; padding: 8px 12px 10px; pointer-events: none !important; z-index: 9;
  background: linear-gradient(180deg, #3a2a12, #22180c); box-shadow: 0 0 0 2px var(--brass), 0 0 0 4px #1a1008, 0 10px 30px rgba(0,0,0,.6);
}
.tipTitle { font-size: 20px; color: var(--brass-hi); font-weight: 600; }
.tipText { font-size: 18px; color: #efe5cc; line-height: 1.35; margin-top: 2px; }

/* ---------- gallery ---------- */
#gallery { background: rgba(6,3,14,.6); }
.galBox { width: min(760px, 100%); max-height: calc(100vh - 40px); overflow: auto; padding: 18px 20px; }
.galHead { display: flex; justify-content: space-between; align-items: baseline; }
#galCount { font-family: var(--caps); font-size: var(--caps-sm); color: var(--teal); }
#galGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; margin: 12px 0 14px; padding: 14px; background: linear-gradient(180deg, #2a1c0e, #1a1008); box-shadow: inset 0 0 0 2px var(--brass-lo); }
.gb {
  aspect-ratio: 1; border-radius: 50%; border: 0; font-family: var(--caps); font-size: var(--caps-sm); cursor: default; padding: 0;
  background: radial-gradient(circle at 35% 30%, #332a47, #1e1628); color: var(--muted); box-shadow: 0 0 0 2px #6a4a1a, 0 3px 0 2px #2a1a08;
}
.gb.lit { cursor: pointer; background: radial-gradient(circle at 35% 30%, #fff8d0, var(--brass) 55%, #b07a2a); color: var(--ink); box-shadow: 0 0 0 2px var(--brass-hi), 0 3px 0 2px #6a4a1a, 0 0 16px rgba(244,194,91,.7); }
.gb.lit:hover { transform: translateY(-2px); }
.gb.neg.lit { background: radial-gradient(circle at 35% 30%, #e0faff, #6ad0f0 55%, #3a8cad); }
.gb.sep { grid-column: 1 / -1; aspect-ratio: auto; border-radius: 0; background: none; box-shadow: none; font-family: var(--caps); font-size: var(--caps-sm); color: var(--brass); letter-spacing: 3px; text-align: left; }

/* ---------- the guest ledger ---------- */
#btnLedger svg { width: 18px; height: 18px; fill: currentColor; display: block; margin: auto; }
#stats { background: rgba(6,3,14,.6); }
.statsBox { width: min(860px, 100%); max-height: calc(100vh - 40px); overflow: auto; padding: 18px 20px 20px; overscroll-behavior: contain; }
.stMeta { color: var(--muted); font-size: 18px; line-height: 1.35; margin: -6px 0 12px; display: flex; flex-wrap: wrap; gap: 4px 0; align-items: baseline; }
.stMeta > span { white-space: nowrap; }
.stMeta > span + span:not(.stSample)::before { content: '·'; margin: 0 8px; color: var(--dim); }
.stMeta > .stSample { margin-left: 14px; }
.stSample { color: var(--dim); font-size: 16px; }
.stSample .link { margin: 0 0 0 6px; font-size: var(--caps-sm); }
.stTabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.stTabs button {
  font-family: var(--caps); font-size: var(--caps-sm); padding: 9px 14px 8px; border: 0; cursor: pointer;
  color: var(--brass-hi); background: rgba(20,12,36,.92); box-shadow: 0 0 0 2px var(--brass-lo);
}
.stTabs button:hover { box-shadow: 0 0 0 2px var(--brass); color: #fff; }
.stTabs button.on { background: var(--brass); color: var(--ink); box-shadow: 0 0 0 2px var(--brass-hi); }
.stTabs button:focus-visible, .chipBtn:focus-visible, .stDayNav .sec:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }
.stTabs button:focus:not(:focus-visible) { outline: none; }
#stBody { transition: opacity .15s; min-height: 200px; }
#stBody.busy { opacity: .5; }
.stEmpty { color: var(--muted); font-size: 20px; line-height: 1.4; padding: 18px 4px; }
.stEmpty .link { margin: 0 0 0 6px; }
.stDayNav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.stDayNav > div { text-align: center; display: flex; flex-direction: column; }
.stDayNav b { font-family: var(--caps); font-size: var(--caps-sm); font-weight: 400; letter-spacing: 2px; color: var(--teal); }
.stDayNav small { font-size: 18px; color: var(--cream); margin-top: 2px; }
.stDayNav .sec { font-family: var(--display); font-size: 24px; line-height: 1; padding: 4px 14px 6px; }
.stHero { display: flex; gap: 18px; align-items: center; padding: 12px 16px; margin-bottom: 12px; background: rgba(255,255,255,.04); box-shadow: inset 4px 0 0 var(--brass); }
.stHeroNum { font-family: var(--caps); font-size: 64px; line-height: .95; min-width: 1.6ch; text-align: center; color: var(--brass-hi); text-shadow: -3px 2px 0 var(--rose), 3px -2px 0 rgba(79,227,207,.8); }
.stHeroNum.neg { color: #9fe8ff; }
.stHeroNum.dim { color: var(--dim); text-shadow: none; }
.stHeroText { display: flex; flex-direction: column; gap: 2px; font-size: 18px; line-height: 1.35; color: var(--muted); min-width: 0; }
.stHeroText b { font-size: 24px; font-weight: 600; color: var(--cream); }
.stFilters { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-bottom: 12px; }
.stFilters .grp { display: flex; gap: 6px; flex-wrap: wrap; }
.chipBtn { font-family: var(--display); font-size: 18px; padding: 5px 12px 6px; border: 0; cursor: pointer; color: var(--muted); background: rgba(255,255,255,.04); box-shadow: inset 0 0 0 2px #3a3150; }
.chipBtn:hover { color: var(--cream); box-shadow: inset 0 0 0 2px #6a5a8a; }
.chipBtn.on { color: var(--ink); background: var(--teal); box-shadow: none; }
.stKpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.kpi { padding: 8px 12px 10px; background: rgba(255,255,255,.04); display: flex; flex-direction: column; min-width: 0; }
.kpi .kLabel { font-size: 16px; color: var(--dim); }
.kpi b { font-size: 32px; font-weight: 600; color: var(--brass-hi); line-height: 1.1; }
.kpi small { font-size: 16px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stCard { margin: 0 0 12px; padding: 10px 12px 12px; background: #100a1e; box-shadow: inset 0 0 0 1px #2a2140; }
.stCard figcaption { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin-bottom: 6px; }
.stCardTitle { font-family: var(--caps); font-size: var(--caps-sm); letter-spacing: 1px; color: var(--teal); }
.stLegend { font-size: 16px; color: var(--muted); display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
.stLegend .li { white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; margin-right: 8px; }
.stLegend i, .ctRow i { display: inline-block; width: 10px; height: 10px; flex: none; }
.stLegend i.line, .ctRow i.line { width: 14px; height: 2px; }
.stTbl { margin: 0 0 0 auto !important; font-size: var(--caps-sm); }
.stNote { margin: 8px 0 0; font-size: 18px; color: var(--muted); line-height: 1.35; }
.stSource { font-size: 16px; color: var(--dim); line-height: 1.4; margin: 4px 0 0; }
.badge { font-family: var(--caps); font-size: var(--caps-sm); color: var(--ink); background: var(--muted); padding: 1px 6px 0; margin-right: 6px; letter-spacing: 0; }
svg.viz { display: block; overflow: visible; touch-action: pan-y; }
svg.viz .ax { font-family: var(--display); font-size: 14px; fill: var(--dim); }
svg.viz .cap { font-family: var(--display); font-size: 14px; fill: var(--muted); }
svg.viz .you { font-family: var(--caps); font-size: 16px; fill: var(--cream); }
svg.viz .hit { fill: transparent; cursor: crosshair; }
svg.viz .bar.hov { filter: brightness(1.35); }
.stTable { max-height: 280px; overflow: auto; }
.stTable table { width: 100%; border-collapse: collapse; font-size: 18px; }
.stTable th { font-family: var(--caps); font-size: var(--caps-sm); font-weight: 400; color: var(--dim); text-align: right; padding: 4px 8px; position: sticky; top: 0; background: #100a1e; }
.stTable td { text-align: right; padding: 3px 8px; color: var(--cream); font-variant-numeric: tabular-nums; border-top: 1px solid #2a2140; }
.stTable th:first-child, .stTable td:first-child { text-align: left; }
.stQs { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.stQs li { display: grid; grid-template-columns: 170px 1fr 48px 92px; gap: 10px; align-items: end; padding: 2px 0; }
.stQs .qcat { font-size: 18px; color: var(--cream); padding-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stQs .mini { min-width: 0; }
.stQs .you { font-family: var(--caps); font-size: var(--caps-sm); text-align: right; padding-bottom: 6px; }
.stQs .you.pos { color: var(--brass); } .stQs .you.neg { color: var(--red-txt); } .stQs .you.dim { color: var(--dim); }
.stQs .beat { font-size: 16px; color: var(--muted); padding-bottom: 6px; white-space: nowrap; }
#ctip {
  position: fixed; max-width: 260px; padding: 7px 11px 9px; pointer-events: none !important; z-index: 30;
  background: linear-gradient(180deg, #3a2a12, #22180c); box-shadow: 0 0 0 2px var(--brass), 0 0 0 4px #1a1008, 0 10px 30px rgba(0,0,0,.6);
}
.ctTitle { font-size: 18px; color: var(--brass-hi); font-weight: 600; margin-bottom: 2px; }
.ctRow { display: flex; align-items: center; gap: 6px; font-size: 18px; color: #efe5cc; line-height: 1.3; }
.ctRow b { font-weight: 600; color: #fff; }
.ctRow span { color: #d8c9a6; }
/* the results card's "how you compare" strip */
.resCompare { margin: 0 0 12px; padding: 8px 10px 6px; background: #100a1e; box-shadow: inset 0 0 0 1px #2a2140; }
.rcHead { font-size: 18px; color: var(--muted); margin-bottom: 4px; line-height: 1.3; }
.rcHead b { color: var(--cream); font-weight: 600; }
.rcHead .dim { color: var(--dim); }
.rcHead .badge { margin: 0 0 0 6px; }

#toast { position: absolute; left: 50%; top: 18px; transform: translateX(-50%); padding: 10px 16px 9px; background: var(--brass); color: var(--ink); font-family: var(--caps); font-size: var(--caps-sm); z-index: 20; box-shadow: 0 0 0 3px var(--ink); }

/* ---------- responsive ---------- */
@media (min-width: 761px) {
  /* keep the plaque clear of the answer board: centred when there's room, otherwise in the space to its left */
  #board:not(.hidden) ~ #plaque {
    --bw: min(390px, 36vw);
    width: min(620px, calc(100vw - var(--bw) - 62px));
    left: min(50%, calc(100% - var(--bw) - 30px - min(310px, (100vw - var(--bw) - 62px) / 2)));
  }
}
@media (max-width: 760px) {
  #board { left: 12px; right: 12px; width: auto; top: 112px; max-height: 38vh; padding: 8px 10px; }
  #boardList li { font-size: 18px; padding: 3px 4px 2px; grid-template-columns: 38px 1fr auto; }
  #pips { position: absolute; top: 62px; left: 0; margin: 0; gap: 6px; }
  #hud { top: 10px; left: 10px; right: 10px; }
  #chip { top: 26%; }
  #chip .why { font-size: var(--caps-sm); }
  #chip .ans { font-size: 24px; }
  #chip .plate { padding: 8px 16px 10px; }
  #dial .num { font-size: 32px; }
  .pip { width: 42px; height: 28px; }
  #card { bottom: 10px; padding: 12px 14px 14px; }
  .cardBody { gap: 12px; }
  .timer, .timer svg { width: 62px; }
  .timer svg { height: 40px; }
  .secs { font-size: 20px; }
  .rankline { font-size: 18px; padding: 5px 10px 4px; }
  #answer { font-size: 22px; }
  .go { font-size: 22px; padding: 0 16px; }
  #suggest li { font-size: 18px; }
  .ruleList li { font-size: 18px; grid-template-columns: 84px 1fr; gap: 12px; }
  .tagline { font-size: var(--caps-sm); letter-spacing: 6px; }
  .plText { font-size: 18px; }
  #plaque { bottom: 10px; }
  .exHint { display: none; }
  .exBtns { flex-wrap: wrap; justify-content: flex-end; }
  .exTitle span:last-child { font-size: 22px; }
  #title { padding-top: 6vh; }
  .statsBox { padding: 14px 14px 16px; max-height: calc(100vh - 24px); }
  .stKpis { grid-template-columns: repeat(2, 1fr); }
  .kpi b { font-size: 28px; }
  .stHero { gap: 12px; padding: 10px 12px; }
  .stHeroNum { font-size: 48px; }
  .stHeroText b { font-size: 21px; }
  .stQs li { grid-template-columns: 1fr 44px 82px; grid-template-areas: 'cat you beat' 'mini mini mini'; gap: 2px 8px; }
  .stQs .qcat { grid-area: cat; } .stQs .mini { grid-area: mini; } .stQs .you { grid-area: you; } .stQs .beat { grid-area: beat; }
  .stQs .qcat, .stQs .you, .stQs .beat { padding-bottom: 0; }
}
@media (max-height: 640px) and (min-width: 761px) {
  #title { padding-top: 3vh; }
  .logo { font-size: 84px; }
}
