/* ==========================================================
   CS KRILLION — visual design
   palette: dusk-on-Dust sand, T orange, CT blue, FACEIT level colours
   ========================================================== */
:root {
  --bg: #07090d;
  --panel: rgba(10, 12, 18, 0.82);
  --ink: #ece5d3;
  --dim: #a39b86;
  --mute: #6f6958;
  --line: rgba(236, 229, 211, 0.14);
  --t: #ff8a1f;          /* terrorist / primary accent */
  --t-glow: rgba(255, 138, 31, 0.45);
  --ct: #6ec6ff;         /* counter-terrorist / secondary accent */
  --red: #ff3b30;
  --green: #3ddc6a;
  --gold: #f2c14e;
  --pix: 'Silkscreen', ui-monospace, monospace;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --lx: 300px;           /* ladder x, set from JS */
  --beep: 1.2s;          /* LED blink period, set from JS */
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%;
  background: var(--bg); color: var(--ink);
  font-family: var(--mono); font-size: 16px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
b { color: #fff; font-weight: 700; }
.red { color: #ff5a47; }

/* ---------------- world ---------------- */
#viewport { position: fixed; inset: 0; overflow: hidden; z-index: 0; }
#world {
  position: absolute; left: 0; right: 0; bottom: 0;
  transition: transform 1.5s cubic-bezier(.22, .8, .25, 1);
  will-change: transform;
}
#world > * { position: absolute; }
.sky {
  left: 0; right: 0;
  background: linear-gradient(to top,
    #f08a45 0%, #c65c3c 1.6%, #7e3a45 4%, #3d2849 7%,
    #1e2038 11%, #121a2e 22%, #0c1222 45%, #090c16 72%,
    #0b0910 88%, #1b0709 100%);
}
.sunglow {
  left: 50%; width: 1600px; height: 900px; transform: translateX(-50%);
  background: radial-gradient(ellipse at 50% 100%, rgba(255,170,90,.38), rgba(255,120,60,.12) 38%, transparent 68%);
  pointer-events: none;
}
.ground { left: 50%; transform: translateX(-50%); image-rendering: pixelated; }
.under { left: 0; right: 0; bottom: 0; background: var(--bg); }

.star { width: 2px; height: 2px; background: #fff; }
.star.big { width: 3px; height: 3px; box-shadow: 0 0 6px rgba(255,255,255,.6); }
.star.tw { animation: twinkle 3s steps(3) infinite; }
@keyframes twinkle { 50% { opacity: .15; } }

.cloud { image-rendering: pixelated; opacity: .75; }

/* ladder — metal, Nuke-style */
.ladder {
  width: 40px; transform: translateX(-50%);
  background:
    linear-gradient(90deg, #262b31 0 2px, #7d8790 2px 4px, #4a5259 4px 8px, transparent 8px calc(100% - 8px), #4a5259 calc(100% - 8px) calc(100% - 4px), #7d8790 calc(100% - 4px) calc(100% - 2px), #262b31 calc(100% - 2px)),
    repeating-linear-gradient(to top, transparent 0 20px, #5c656d 20px 24px, #2b3036 24px 26px, transparent 26px 32px);
  filter: drop-shadow(0 0 1px #000);
}
.ladder::after { /* faint shadow on wall/sky */
  content: ''; position: absolute; inset: 0 -14px 0 auto; width: 10px;
  background: rgba(0,0,0,.18);
}

/* ELO ruler (left) */
.tick { left: 0; height: 1px; width: 14px; background: rgba(236,229,211,.22); }
.tick.major { width: 26px; background: rgba(236,229,211,.45); }
.tick span {
  position: absolute; left: 34px; top: -6px; white-space: nowrap;
  font: 10px var(--pix); letter-spacing: .12em; color: rgba(236,229,211,.5);
}

/* level thresholds (right) */
.lvl-line { left: 0; right: 0; height: 0; border-top: 1px dashed; opacity: .55; pointer-events: none; }
.lvl-line::before {
  content: ''; position: absolute; left: 0; right: 0; top: -1px; height: 26px;
  background: linear-gradient(to top, transparent, currentColor); opacity: .06; transform: translateY(-100%);
}
.lvl-tag {
  right: 84px; display: flex; align-items: center; gap: 10px; transform: translateY(50%);
  font: 11px var(--pix); letter-spacing: .14em; color: var(--dim);
  padding: 4px 10px 4px 4px; background: rgba(7, 9, 13, .7); border: 1px solid var(--line);
}
.lvl-tag b { font-weight: 700; letter-spacing: .18em; }
.lvl-tag small { color: var(--mute); font-size: 10px; }

.joke {
  right: 92px; max-width: 300px; text-align: right;
  font: 11px var(--mono); letter-spacing: .08em; color: rgba(236,229,211,.42);
  white-space: nowrap;
}
.joke.left { right: auto; left: calc(var(--lx) + 46px); text-align: left; }

.lvl10-zone {
  left: 0; right: 0;
  background: linear-gradient(to top, rgba(254,31,0,.20), rgba(254,31,0,.07) 25%, transparent 70%);
}
.lvl10-word {
  left: 50%; transform: translateX(-50%);
  font: 700 clamp(70px, 12vw, 180px)/1 var(--pix); letter-spacing: .06em;
  color: rgba(254, 31, 0, .10); white-space: nowrap; pointer-events: none;
}
.summit { transform: translateX(-50%); image-rendering: pixelated; }
.summit-flag { transform-origin: left center; animation: wave 1.2s steps(4) infinite; }
@keyframes wave { 50% { transform: skewY(-4deg) scaleX(.96); } }

/* crates + bomb */
.crates { image-rendering: pixelated; }
#bomb {
  transform: translateX(-50%);
  transition: left .7s cubic-bezier(.3,.9,.3,1.2), bottom 1.1s cubic-bezier(.25,.9,.3,1.05);
  z-index: 3; filter: drop-shadow(0 2px 0 rgba(0,0,0,.45));
}
#bomb svg { display: block; image-rendering: pixelated; }
#bomb .led { animation: blink var(--beep) steps(1) infinite; }
#bomb .digit { fill: #1f300c; animation: type 4.2s steps(1) infinite both; }
#bomb.climb svg { animation: climb .18s steps(2) 6; }
#bomb.idle svg { animation: bob 2.4s steps(2) infinite; }
@keyframes blink { 0% { fill: #ff3b30; filter: drop-shadow(0 0 2px #ff3b30); } 50% { fill: #4a1410; filter: none; } }
@keyframes type { 0% { opacity: 0; } 4% { opacity: 1; } 78% { opacity: 1; } 79%, 100% { opacity: 0; } }
@keyframes climb { 50% { transform: translate(-3px, -3px) rotate(-3deg); } }
@keyframes bob { 50% { transform: translateY(-2px); } }
.led-glow {
  position: absolute; width: 18px; height: 18px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(255,59,48,.9), transparent 70%);
  animation: glow var(--beep) steps(1) infinite;
}
@keyframes glow { 50% { opacity: 0; } }

.float-elo {
  z-index: 4; transform: translateX(-50%); white-space: nowrap;
  font: 700 18px var(--pix); letter-spacing: .08em; text-shadow: 0 2px 0 #000;
  animation: floatup 1.6s ease-out forwards; pointer-events: none;
}
@keyframes floatup { 0% { opacity: 0; transform: translate(-50%, 8px); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -70px); } }

/* ---------------- overlays / fx ---------------- */
#dust { position: fixed; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
#dust i {
  position: absolute; width: 2px; height: 2px; background: var(--dust-c, rgba(240, 200, 140, .45));
  animation: drift linear infinite;
}
@keyframes drift { from { transform: translate(-40px, 0); } to { transform: translate(calc(100vw + 80px), -60px); } }
body:not([data-screen="landing"]) #dust { opacity: .35; }

.fx-scan {
  position: fixed; inset: 0; pointer-events: none; z-index: 40;
  background: repeating-linear-gradient(to bottom, transparent 0 2px, rgba(0,0,0,.16) 2px 3px);
  mix-blend-mode: multiply;
}
.fx-vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 39;
  background: radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(0,0,0,.55) 100%);
  transition: box-shadow .3s;
}
body.critical .fx-vignette { animation: critical .5s steps(2) infinite; }
@keyframes critical { 50% { box-shadow: inset 0 0 140px rgba(255, 40, 20, .35); } }
#flash { position: fixed; inset: 0; pointer-events: none; z-index: 38; background: #ffd9a0; opacity: 0; }
#flash.boom { animation: boom .9s ease-out; }
@keyframes boom { 0% { opacity: .9; } 20% { opacity: .55; background: #ff7a2a; } 100% { opacity: 0; } }

/* ---------------- corner UI ---------------- */
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center;
  background: rgba(14, 17, 24, .85); border: 1px solid rgba(236,229,211,.22);
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.4);
}
.icon-btn:hover { border-color: var(--t); }
.icon-btn svg { width: 18px; height: 18px; fill: #d7d0bd; }
.icon-btn.tl { position: fixed; top: 14px; left: 14px; z-index: 30; }
.corner-tr { position: fixed; top: 14px; right: 14px; z-index: 30; display: flex; flex-direction: column; gap: 6px; }

/* altimeter */
#alti {
  position: fixed; right: 18px; top: 50%; transform: translateY(-50%); z-index: 20;
  height: min(56vh, 520px); width: 22px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font: 9px var(--pix); letter-spacing: .1em; color: var(--mute);
}
.alti-top { color: #fe1f00; white-space: nowrap; }
.alti-bar { position: relative; flex: 1; width: 6px; background: #151820; outline: 1px solid rgba(236,229,211,.12); }
.alti-seg { position: absolute; left: 0; right: 0; opacity: .3; }
.alti-seg.on { opacity: 1; }
.alti-mark {
  position: absolute; left: 50%; bottom: 0; width: 16px; height: 4px; background: #fff;
  transform: translate(-50%, 50%); transition: bottom 1.1s cubic-bezier(.25,.9,.3,1.05);
  box-shadow: 0 0 8px rgba(255,255,255,.7);
}
.alti-mark span {
  position: absolute; right: 22px; top: 50%; transform: translateY(-50%);
  font: 10px var(--pix); color: #fff; white-space: nowrap; background: rgba(7,9,13,.8); padding: 2px 5px;
}

/* ---------------- screens ---------------- */
.screen { position: fixed; inset: 0; z-index: 10; pointer-events: none; opacity: 0; visibility: hidden; transition: opacity .5s, visibility 0s .5s; }
body[data-screen="landing"] #landing,
body[data-screen="game"] #game,
body[data-screen="results"] #results { opacity: 1; visibility: visible; transition: opacity .5s; }
.screen > * { pointer-events: auto; }

/* ---------------- landing ---------------- */
.hero {
  position: absolute; left: 50%; top: max(7vh, 60px); transform: translateX(-50%);
  width: min(880px, 92vw); text-align: center;
}
.logo {
  margin: 0; font: 700 clamp(30px, 7.4vw, 118px)/1 var(--pix); letter-spacing: .03em;
  white-space: nowrap;
}
.logo-cs { color: var(--t); text-shadow: 0 0 22px var(--t-glow), -3px 0 0 rgba(255, 59, 48, .55), 3px 0 0 rgba(255, 210, 90, .35); }
.logo-k  { color: #f4efe2; text-shadow: 0 0 18px rgba(255,255,255,.22), -3px 0 0 rgba(255, 70, 50, .45), 3px 0 0 rgba(110, 198, 255, .55); }
.tagline {
  margin: 18px 0 0; font: 700 clamp(13px, 1.5vw, 20px) var(--pix); letter-spacing: .52em; color: var(--ct);
  text-shadow: 0 0 12px rgba(110, 198, 255, .45); padding-left: .52em;
}
.lede { margin: 12px 0 0; color: #c8c0ab; font-size: 14px; letter-spacing: .04em; }
.coverage {
  margin: 20px auto 0; width: min(580px, 100%); padding: 12px 18px 11px;
  background: rgba(8, 11, 18, .62); border: 1px solid rgba(110, 198, 255, .35);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.6);
}
.coverage-k { font: 700 11px var(--pix); letter-spacing: .3em; color: var(--ct); }
.coverage-v { margin-top: 6px; font-size: 11px; font-weight: 700; letter-spacing: .1em; line-height: 1.7; }
.coverage-s { margin-top: 3px; font-size: 9.5px; letter-spacing: .12em; color: var(--dim); }

.dock {
  position: absolute; left: 50%; bottom: max(2.6vh, 16px); transform: translateX(-50%);
  width: min(612px, 92vw); display: flex; flex-direction: column; gap: 12px;
}
.btn-main {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 18px;
  height: 68px; width: 100%;
  background: linear-gradient(#1e140b, #120c07);
  border: 3px solid var(--t);
  font: 700 26px var(--pix); letter-spacing: .2em; color: #fff3e2;
  text-shadow: 0 0 12px var(--t-glow);
  box-shadow: 0 0 0 1px #000, 0 0 28px rgba(255, 138, 31, .28), inset 0 0 22px rgba(255, 138, 31, .16);
  transition: background .15s, transform .08s, box-shadow .15s;
}
.btn-main::after { content: ''; position: absolute; left: -3px; right: -3px; bottom: -9px; height: 4px; background: var(--t); opacity: .35; }
.btn-main:hover { background: linear-gradient(#2b1b0c, #1b1009); box-shadow: 0 0 0 1px #000, 0 0 40px rgba(255, 138, 31, .45), inset 0 0 30px rgba(255, 138, 31, .26); }
.btn-main:active { transform: translateY(2px); }
.btn-main .tri { font-size: 20px; animation: nudge 1.4s steps(2) infinite; }
@keyframes nudge { 50% { transform: translateY(-3px); } }

.modes { display: flex; justify-content: center; gap: 8px; margin-top: 6px; }
.mode {
  padding: 7px 12px; font: 10px var(--pix); letter-spacing: .18em; color: var(--dim);
  border: 1px solid var(--line); background: rgba(7,9,13,.6);
}
.mode:hover { color: var(--ink); border-color: rgba(236,229,211,.4); }

.howto summary {
  list-style: none; cursor: pointer; width: max-content;
  font: 10px var(--pix); letter-spacing: .2em; color: var(--dim);
}
.howto summary::before { content: '▶ '; color: var(--t); }
.howto[open] summary::before { content: '▼ '; }
.howto ul {
  margin: 10px 0 0; padding: 14px 18px 14px 34px; background: rgba(8,10,15,.92); border: 1px solid var(--line);
  line-height: 1.85; color: #cfc7b2; font-size: 12.5px;
}
.howto li::marker { color: var(--t); }
.grades { list-style: none; margin-left: -16px; display: flex; flex-wrap: wrap; gap: 6px 12px; font: 10px var(--pix); letter-spacing: .1em; }
.grade-pill { display: inline-flex; gap: 6px; align-items: baseline; }
.grade-pill b { font-weight: 700; }

.meta { display: flex; justify-content: space-between; gap: 12px; font: 10px var(--pix); letter-spacing: .16em; color: var(--mute); }
.links { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.link {
  padding: 6px 12px; font: 10px var(--pix); letter-spacing: .16em; color: var(--ink);
  border: 1px solid rgba(236,229,211,.25); background: rgba(7,9,13,.7);
}
.link.gold { color: var(--gold); border-color: rgba(242,193,78,.4); }
.link.red { color: #ff6a55; border-color: rgba(255,90,70,.4); }
.link:hover { background: rgba(255,255,255,.05); }

@keyframes fadein { from { opacity: 0; } }

/* ---------------- game ---------------- */
.hud {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px; width: min(720px, 92vw);
}
.hud-box {
  height: 62px; display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(4px);
}
.hud-l { border-left: 3px solid var(--ct); }
.hud-r { border-right: 3px solid var(--t); flex-direction: column; align-items: flex-end; justify-content: center; gap: 0; }
.hud-c { flex-direction: column; justify-content: center; gap: 2px; min-width: 190px; background: rgba(18, 10, 10, .88); border-color: rgba(255, 59, 48, .35); }
.hud-k { font: 9px var(--pix); letter-spacing: .24em; color: var(--dim); }
.hud-v { font: 700 24px var(--pix); letter-spacing: .04em; line-height: 1.1; }
.hud-timer { display: flex; align-items: center; gap: 10px; font: 700 28px var(--pix); color: #ff5546; text-shadow: 0 0 12px rgba(255, 59, 48, .6); line-height: 1; }
.c4mini { display: block; line-height: 0; }
.c4mini svg { display: block; image-rendering: pixelated; }
.c4mini .led { animation: blink var(--beep) steps(1) infinite; }
.pips { display: flex; gap: 4px; margin-top: 6px; }
.pips i { width: 14px; height: 14px; border: 1px solid rgba(236,229,211,.25); background: #12151b; }
.pips i.now { border-color: #fff; animation: glow 1s steps(1) infinite; }
.pips i.miss { background: #2b2f36; position: relative; }
.pips i.miss::after { content: ''; position: absolute; inset: 5px; background: #6a6f78; }

.fuse { position: absolute; top: 82px; left: 50%; transform: translateX(-50%); width: min(720px, 92vw); height: 3px; background: rgba(255,255,255,.08); }
.fuse i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #ff3b30, #ff8a1f); transform-origin: left; box-shadow: 0 0 10px rgba(255,80,40,.7); }

.play {
  position: absolute; top: 112px; left: 50%; transform: translateX(-50%);
  width: min(720px, 92vw); display: flex; flex-direction: column; gap: 12px;
}
.prompt {
  padding: 22px 26px 26px; background: var(--panel); border: 1px solid var(--line);
  border-top: 3px solid var(--t); backdrop-filter: blur(4px);
  transition: opacity .3s, transform .3s;
}
.prompt.swap { opacity: 0; transform: translateY(-8px); }
.prompt-meta { display: flex; justify-content: space-between; align-items: center; font: 10px var(--pix); letter-spacing: .2em; color: var(--mute); }
.chip { padding: 4px 8px; background: rgba(255,138,31,.12); border: 1px solid rgba(255,138,31,.45); color: var(--t); }
.prompt h2 { margin: 16px 0 0; font: 700 clamp(20px, 2.4vw, 28px)/1.35 var(--mono); letter-spacing: -.005em; color: #fbf6ea; text-wrap: balance; }

.console { background: rgba(6, 8, 11, .9); border: 1px solid rgba(236,229,211,.2); box-shadow: 0 12px 40px rgba(0,0,0,.45); }
.console-bar {
  display: flex; justify-content: space-between; padding: 6px 10px;
  background: linear-gradient(#262b33, #1b1f26); border-bottom: 1px solid #000;
  font: 9px var(--pix); letter-spacing: .3em; color: #b9b3a2;
}
.console-x { letter-spacing: 0; color: var(--mute); }
.console-log { min-height: 92px; max-height: 140px; overflow: hidden; padding: 10px 14px 4px; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; font-size: 13px; }
.console-log .ln { display: flex; justify-content: space-between; gap: 12px; animation: fadein .2s; }
.console-log .ln.hint { color: var(--mute); }
.console-log .ln.miss { color: #c9675c; }
.console-log .ln.miss .you { text-decoration: line-through; text-decoration-color: rgba(201,103,92,.6); }
.console-log .ln .rs { font: 700 11px var(--pix); letter-spacing: .1em; white-space: nowrap; }
.console-in { display: flex; align-items: center; gap: 10px; padding: 10px 14px 12px; border-top: 1px solid rgba(236,229,211,.08); }
.console-in.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.caret { color: var(--t); font-weight: 700; font-size: 18px; }
#answer {
  flex: 1; min-width: 0; background: transparent; border: 0; outline: none;
  font: 500 18px var(--mono); color: #fff; caret-color: var(--t);
}
#answer::placeholder { color: #4d4a42; }
#answer:disabled { opacity: .4; }
kbd { font: 9px var(--pix); letter-spacing: .15em; color: var(--mute); padding: 4px 6px; border: 1px solid var(--line); }

.toast {
  position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%) scale(.9);
  z-index: 15; padding: 22px 40px 18px; text-align: center; pointer-events: none; opacity: 0;
  background: rgba(7, 9, 13, .92); border: 2px solid currentColor;
  box-shadow: 0 0 60px rgba(0,0,0,.7), 0 0 30px -6px currentColor;
}
.toast.show { animation: toast 1.6s cubic-bezier(.2,1.3,.4,1) forwards; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.8); } 12% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -60%) scale(1); } }
.toast .t-k { font: 10px var(--pix); letter-spacing: .4em; color: var(--dim); }
.toast .t-big { margin-top: 6px; font: 700 40px var(--pix); letter-spacing: .08em; white-space: nowrap; text-shadow: 0 0 20px currentColor; }
.toast .t-sub { margin-top: 6px; font: 700 16px var(--pix); letter-spacing: .14em; color: #fff; }
.toast.lvlup { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.toast.lvlup svg { width: 88px; height: 88px; }

/* ---------------- results ---------------- */
.res {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(760px, 94vw); max-height: 92vh; overflow: auto;
  padding: 24px 26px 20px; background: rgba(9, 11, 16, .9); border: 1px solid rgba(236,229,211,.18);
  border-top: 3px solid var(--t); backdrop-filter: blur(6px);
  box-shadow: 0 30px 90px rgba(0,0,0,.6);
}
.res-head { display: flex; justify-content: space-between; align-items: center; font: 10px var(--pix); letter-spacing: .22em; color: var(--mute); }
.res-tag { color: var(--t); }
.res-hero { display: flex; align-items: center; gap: 22px; margin: 18px 0 20px; }
.res-hero svg { width: 104px; height: 104px; flex: none; filter: drop-shadow(0 0 16px rgba(0,0,0,.6)); }
.res-elo { font: 700 54px/1 var(--pix); letter-spacing: .02em; }
.res-elo small { font-size: 18px; color: var(--dim); letter-spacing: .2em; }
.res-lvl { margin-top: 8px; font: 11px var(--pix); letter-spacing: .2em; color: var(--dim); }
.res-prog { margin-top: 10px; width: min(380px, 50vw); height: 6px; background: #1a1e25; }
.res-prog i { display: block; height: 100%; }

.board { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.board th { text-align: left; padding: 8px 10px; font: 9px var(--pix); letter-spacing: .2em; color: var(--mute); border-bottom: 1px solid var(--line); }
.board td { padding: 9px 10px; border-bottom: 1px solid rgba(236,229,211,.06); vertical-align: top; }
.board tr:nth-child(even) td { background: rgba(255,255,255,.02); }
.board td:first-child { font: 700 11px var(--pix); color: var(--mute); width: 40px; }
.board td.q { color: var(--dim); }
.board td.a { color: #fff; font-weight: 700; white-space: nowrap; }
.board td.g { font: 700 10px var(--pix); letter-spacing: .1em; white-space: nowrap; }
.board .num { text-align: right; }
.board td.num { font: 700 12px var(--pix); white-space: nowrap; }
.board td.none { color: var(--mute); font-weight: 400; }

.share { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-top: 18px; flex-wrap: wrap; }
.share-grid { font-size: 22px; letter-spacing: 3px; }
.share-btns { display: flex; gap: 8px; }
.btn-sm {
  height: 40px; padding: 0 16px; background: rgba(255,255,255,.03); border: 1px solid rgba(236,229,211,.3);
  font: 700 11px var(--pix); letter-spacing: .2em;
}
.btn-sm.primary { border: 2px solid var(--t); color: #fff3e2; background: rgba(255,138,31,.1); box-shadow: 0 0 18px rgba(255,138,31,.2); }
.btn-sm:hover { background: rgba(255,255,255,.08); }
.res-next { margin-top: 16px; text-align: center; font: 10px var(--pix); letter-spacing: .24em; color: var(--mute); }
.res-next b { color: var(--ink); }

/* ---------------- badges ---------------- */
.badge { display: block; }

/* ---------------- responsive ---------------- */
@media (max-width: 1180px) { .joke { display: none; } }
@media (max-width: 860px) {
  .lvl-tag { right: 44px; }
  .lvl-tag span, .lvl-tag small { display: none; }
  .tick span { display: none; }
  #alti { right: 8px; width: 14px; }
  .alti-mark span { display: none; }
  .hud-r .hud-k { display: none; }
  .pips i { width: 10px; height: 10px; }
  .hud-box { padding: 0 10px; }
  .hud-c { min-width: 120px; }
  .board td.q { display: none; }
  .board th:nth-child(2) { display: none; }
}
@media (max-width: 560px) {
  .tagline { letter-spacing: .3em; }
  .coverage { display: none; }
  .meta { flex-direction: column; align-items: center; gap: 4px; }
  .hud-v { font-size: 18px; }
  .hud-timer { font-size: 22px; }
  .res-elo { font-size: 40px; }
  .res-hero svg { width: 76px; height: 76px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; }
}

/* keep the lobby clean: zone jokes + ground level tag appear once you queue */
.joke, .lvl-tag { transition: opacity .6s; }
body[data-screen="landing"] .joke,
body[data-screen="landing"] .lvl-tag { opacity: 0; }

/* small screens in a match: give the HUD the full width */
@media (max-width: 760px) {
  body:not([data-screen="landing"]) .icon-btn.tl,
  body:not([data-screen="landing"]) .corner-tr,
  body:not([data-screen="landing"]) #alti { display: none; }
  .hud, .fuse, .play { width: calc(100vw - 20px); }
  .hud { top: 10px; }
  .hud-box { height: 54px; }
  .fuse { top: 70px; }
  .play { top: 86px; }
  .prompt { padding: 16px 16px 18px; }
  .console-log { min-height: 60px; }
}
@media (max-width: 560px) {
  .logo { font-size: 8.4vw; }
  .hero { top: 72px; }
  #alti { display: none; }
}

/* map-of-the-day chip (lobby only) */
.map-chip {
  position: fixed; left: 14px; bottom: 14px; z-index: 30;
  display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 10px;
  background: rgba(10, 12, 18, .8); border: 1px solid rgba(236,229,211,.2);
  font: 10px var(--pix); letter-spacing: .18em; color: var(--dim);
  transition: opacity .4s, border-color .15s;
}
.map-chip:hover { border-color: var(--t); color: var(--ink); }
.map-chip .dot { width: 6px; height: 6px; background: var(--green); box-shadow: 0 0 6px var(--green); }
.map-chip .k { color: var(--mute); }
.map-chip .reroll { color: var(--t); font-family: var(--mono); font-size: 13px; letter-spacing: 0; }
body:not([data-screen="landing"]) .map-chip { opacity: 0; pointer-events: none; }
@media (max-width: 560px) { .map-chip { bottom: auto; top: 14px; left: 62px; } }

/* Connected game controls; retain the original scene and palette. */
[hidden] { display: none !important; }
button:disabled { cursor: wait; opacity: .6; }
.is-locked { color: #9b9588; }
.lock-mark { display: inline-block; margin-left: 4px; color: var(--gold); font: 11px var(--mono); letter-spacing: .04em; vertical-align: middle; }
.blue-gem-badge { display: block; margin-top: 5px; color: #70d9ff; font: 11px/1.5 var(--pix); letter-spacing: .04em; text-shadow: 0 0 12px #70d9ff55; }
.blue-gem-text { color: #70d9ff; }
.panel-choice.is-locked { background: #10141b; border-style: dashed; }
.panel-choice.is-locked b { color: #b8b1a2; }
button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible { outline: 2px solid var(--ct); outline-offset: 4px; }
.status-line { margin: 0; min-height: 1.4em; text-align: center; color: var(--dim); font-size: 13px; }
.prompt-rule { margin: 12px 0 0; color: var(--gold); font-size: 14px; line-height: 1.6; }
.prompt-scope { margin-top: 12px; color: #b4ae9e; font-size: 13px; line-height: 1.65; }
.prompt-scope summary { cursor: pointer; color: var(--dim); font-size: 12px; }
.prompt-scope p { margin-bottom: 0; }
.submit-answer { background: transparent; color: #b8af98; border: 1px solid var(--line); padding: 6px 8px; font-size: 12px; white-space: nowrap; }
.console-log { overflow-y: auto; font-size: 14px; }
.console-log .ln.fact { color: var(--ct); font-size: 13px; line-height: 1.5; }
.console-log .ln.fact a { text-decoration: underline; text-underline-offset: 3px; }
.console-log .ln .rs { font-size: 11px; }
.round-actions { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 20px; }
.play { max-height: calc(100dvh - 126px); overflow-y: auto; overscroll-behavior: contain; }
.share-btns { flex-wrap: wrap; }
.board td.a { white-space: normal; overflow-wrap: anywhere; }
.icon-btn.muted { opacity: .55; }
.icon-btn.muted::after { content: ''; width: 20px; height: 2px; background: var(--t); position: absolute; transform: rotate(-45deg); }
#panel { width: min(680px, calc(100vw - 28px)); max-height: calc(100dvh - 40px); padding: 26px; color: var(--ink); background: #0c1018; border: 1px solid #534532; border-top: 3px solid var(--t); box-shadow: 0 20px 100px #000; font-size: 16px; line-height: 1.65; }
#panel::backdrop { background: rgba(0, 0, 0, .78); backdrop-filter: blur(5px); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; position: sticky; top: -26px; background: #0c1018; padding: 0 0 18px; z-index: 1; }
.panel-head h2 { font: 18px/1.5 var(--pix); color: var(--t); margin: 0; }
#panel h3 { font-size: 17px; color: #fff; }
#panel h4 { font-size: 15px; margin-bottom: 4px; }
#panel p { color: #bdb6a5; }
#panel a { color: var(--ct); text-decoration: underline; text-underline-offset: 3px; }
.panel-list { display: grid; gap: 10px; }
.panel-choice { text-align: left; display: flex; flex-direction: column; gap: 6px; padding: 16px; background: #151a23; border: 1px solid #363a40; font-size: 14px; line-height: 1.6; }
.panel-choice:hover { border-color: var(--t); background: #1b1f28; }
.panel-choice b { color: var(--gold); font: 14px var(--pix); line-height: 1.6; }
.panel-choice small { color: #a49a84; font-size: 13px; }
.setting { display: flex; align-items: center; justify-content: space-between; padding: 18px 0; border-bottom: 1px solid var(--line); }
.setting input { width: 22px; height: 22px; accent-color: var(--t); }
.empty-state { padding: 20px 0; }
.review-item { padding: 20px 0; border-bottom: 1px solid var(--line); }
.review-item:first-child { padding-top: 0; }
.review-scope { font-size: 14px; }
#shareText { width: 100%; padding: 14px; font: 15px/1.7 var(--mono); background: #05070b; color: #fff; border: 1px solid #555; }
#notice { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 1000; background: #111722; color: #fff; border: 1px solid var(--t); padding: 14px 20px; width: max-content; max-width: calc(100vw - 30px); box-shadow: 0 10px 40px #000; font-size: 14px; line-height: 1.6; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .2s; }
#notice.visible { opacity: 1; visibility: visible; }
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
body.reduce-motion #dust { display: none; }
#landing:has(.howto[open]) { overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: 44px; padding: max(7vh, 60px) 0 24px; }
#landing:has(.howto[open]) .hero, #landing:has(.howto[open]) .dock { position: relative; left: auto; top: auto; bottom: auto; transform: none; flex-shrink: 0; }
#landing:has(.howto[open]) .dock { margin-top: auto; }
@media (max-height: 640px) {
  #landing { overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: 44px; padding: 64px 0 24px; }
  #landing .hero, #landing .dock { position: relative; left: auto; top: auto; bottom: auto; transform: none; flex-shrink: 0; }
}
@media (max-width: 760px) {
  .play { max-height: calc(100dvh - 102px); }
  .prompt h2 { font-size: clamp(18px, 5vw, 24px); }
  .prompt-rule { font-size: 13px; }
  .console-log { min-height: 68px; }
  .round-actions .btn-sm { font-size: 12px; }
  .console-log .ln { flex-wrap: wrap; }
  .console-log .ln .rs { margin-left: auto; }
}
@media (max-width: 420px) {
  .modes { flex-wrap: wrap; }
  .mode { padding: 9px; font-size: 11px; letter-spacing: .05em; }
  .toast { padding: 16px 20px; max-width: calc(100vw - 20px); }
  .toast .t-big { font-size: 25px; }
  #panel { padding: 18px; }
  .panel-head { top: -18px; }
  .board th, .board td { padding: 9px 5px; }
  .board td.g { font-size: 9px; white-space: normal; }
}
