:root {
  --bg: #0a0c0b;
  --ink: #e6e9e1;
  --dim: #8c958a;
  --faint: #59625a;
  --panel: #121714;
  --panel-2: #19201c;
  --line: #29332e;
  --tile: #e4e7df;
  --tile-ink: #262b27;
  --amber: #ffb347;
  --amber-soft: rgba(255, 179, 71, 0.14);
  --teal: #5fd3a6;
  --teal-soft: rgba(95, 211, 166, 0.16);
  --danger: #e8604a;
  --fluo: #d9f0cf;
  --font-type: "Special Elite", "Courier New", monospace;
  --font-ui: "IBM Plex Mono", ui-monospace, "Cascadia Mono", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font-ui); }
body { overflow-x: hidden; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; }
kbd {
  display: inline-block; min-width: 1.6em; padding: 1px 5px; margin: 0 1px;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px;
  background: var(--panel-2); font: 600 0.8em var(--font-ui); text-align: center; color: var(--ink);
}

/* ---------- screens ---------- */
.screen { display: none; min-height: 100vh; min-height: 100dvh; }
.screen.active { display: flex; }

#screen-intro, #screen-end {
  align-items: center; justify-content: center; padding: 32px 16px;
  background:
    radial-gradient(ellipse at 50% 35%, rgba(217, 240, 207, 0.07), transparent 60%),
    var(--bg);
}
.intro, .end { width: min(640px, 100%); text-align: center; }

.title {
  font-family: var(--font-type); font-weight: 400; letter-spacing: 0.12em;
  font-size: clamp(34px, 8vw, 64px); margin: 18px 0 22px; color: var(--fluo);
  text-shadow: 0 0 18px rgba(217, 240, 207, 0.35);
}
.flicker { animation: flicker 6s infinite; }
@keyframes flicker {
  0%, 18%, 22%, 25%, 53%, 57%, 100% { opacity: 1; }
  20%, 24%, 55% { opacity: 0.25; }
}

.tape { display: inline-flex; align-items: center; gap: 14px; padding: 10px 18px; border-radius: 8px;
  background: #1b1d1c; border: 1px solid #2f3431; box-shadow: inset 0 0 0 4px #141615; }
.reel { width: 26px; height: 26px; border-radius: 50%; border: 3px solid #555c57;
  background: repeating-conic-gradient(#2a2e2c 0 30deg, #3c423e 30deg 60deg); animation: spin 2.4s linear infinite; }
.tape-label { font: 12px var(--font-type); letter-spacing: 0.2em; color: #c8c2ad; background: #e8e1c8; color: #3a3426; padding: 3px 8px; border-radius: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

.tape-lines { font-family: var(--font-type); font-size: clamp(15px, 2.4vw, 18px); line-height: 1.6; color: #c9cfc5; margin-bottom: 28px; }
.tape-lines p { margin: 0 0 6px; opacity: 0; animation: lineIn 0.6s ease forwards; animation-delay: var(--d); }
.tape-lines b { color: var(--amber); font-weight: 400; }
@keyframes lineIn { from { opacity: 0; transform: translateY(4px); filter: blur(3px); } to { opacity: 1; transform: none; filter: none; } }

.controls { color: var(--dim); font-size: 12.5px; line-height: 2; margin-top: 26px; }
.best { color: var(--teal); font-size: 13px; min-height: 1em; }

/* ---------- buttons ---------- */
.btn {
  border: 1px solid var(--line); background: var(--panel-2); border-radius: 6px;
  padding: 9px 16px; cursor: pointer; font-weight: 600; letter-spacing: 0.02em;
  transition: background 0.15s, border-color 0.15s, transform 0.08s;
}
.btn:hover { border-color: var(--amber); background: #222a25; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.btn-big {
  font-family: var(--font-type); font-weight: 400; font-size: 20px; letter-spacing: 0.14em;
  padding: 14px 40px; background: var(--fluo); color: #141814; border-color: var(--fluo);
  box-shadow: 0 0 30px rgba(217, 240, 207, 0.25);
}
.btn-big:hover { background: #fff; border-color: #fff; }
.btn-ghost { background: transparent; }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; font-size: 17px; }
.icon-btn.muted { color: var(--faint); text-decoration: line-through; }

/* ---------- room ---------- */
#screen-room { flex-direction: column; align-items: center; padding: 10px 16px 14px; gap: 10px; }
.hud { width: min(100%, 1100px, calc((100dvh - 130px) * 1.5)); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.hud-block { display: flex; align-items: baseline; gap: 10px; }
.hud-center { flex-direction: column; align-items: center; gap: 4px; }
.hud-right { justify-content: flex-end; }
.hud-label { font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--dim); }
.hud-timer, .panel-timer { font: 700 28px var(--font-ui); font-variant-numeric: tabular-nums; color: var(--fluo); transition: color 0.2s; }
.hud-timer.critical, .panel-timer.critical { color: var(--danger); animation: pulse 1s infinite; }
.hud-timer.hit, .panel-timer.hit { color: var(--danger); transform: scale(1.08); }
@keyframes pulse { 50% { opacity: 0.55; } }
.pips-wrap { display: flex; align-items: center; gap: 10px; }
.pips { display: flex; gap: 6px; }
.pip { width: 18px; height: 18px; border-radius: 4px; border: 1px solid #3a4540; background: #141a17; transition: all 0.3s; }
.pip.on { background: var(--teal); border-color: var(--teal); box-shadow: 0 0 10px rgba(95, 211, 166, 0.6); }
.hud-small { font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; }

.stage { width: min(100%, 1100px, calc((100dvh - 130px) * 1.5)); aspect-ratio: 3 / 2; position: relative;
  border-radius: 6px; overflow: hidden; box-shadow: 0 0 0 1px #1d2420, 0 20px 60px rgba(0, 0, 0, 0.7); background: #000; }
#room { width: 100%; height: 100%; display: block; touch-action: none; cursor: pointer; }
.hint { margin: 0; font-size: 12.5px; color: var(--dim); text-align: center; }

/* ---------- overlay / panel ---------- */
.overlay { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(2, 4, 3, 0.72); backdrop-filter: blur(3px); }
.overlay.hidden { display: none; }
.panel { position: relative; width: min(980px, 100%); max-height: calc(100dvh - 32px); overflow: auto;
  background: linear-gradient(180deg, #151a17, #0e1210); border: 1px solid #2b3530; border-radius: 10px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  animation: panelIn 0.25s ease; }
@keyframes panelIn { from { opacity: 0; transform: scale(0.97); } }
.panel-head { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-bottom: 1px solid #242e29;
  position: sticky; top: 0; background: #131815; z-index: 3; }
.g-icon { width: 40px; height: 40px; flex: none; }
.g-headtext { flex: 1; min-width: 0; }
.g-headtext h2 { margin: 0; font: 400 21px var(--font-type); letter-spacing: 0.08em; color: var(--amber); }
.g-headtext p { margin: 2px 0 0; font-size: 12.5px; color: var(--dim); }
.panel-timer { font-size: 20px; }
.game-root { padding: 20px; }

.stamp { position: absolute; left: 50%; top: 50%; z-index: 5; pointer-events: none;
  font: 400 clamp(40px, 9vw, 84px) var(--font-type); letter-spacing: 0.15em; color: var(--teal);
  border: 6px solid var(--teal); border-radius: 10px; padding: 6px 26px; background: rgba(10, 20, 16, 0.85);
  opacity: 0; transform: translate(-50%, -50%) rotate(-10deg) scale(1.8); }
.stamp.show { animation: stamp 0.45s cubic-bezier(.2, 1.6, .4, 1) forwards; }
@keyframes stamp { to { opacity: 1; transform: translate(-50%, -50%) rotate(-10deg) scale(1); } }

/* ---------- toasts ---------- */
.toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 40;
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; width: calc(100% - 32px); }
.toast { background: rgba(18, 23, 20, 0.95); border: 1px solid #34413a; border-left: 3px solid var(--amber);
  padding: 9px 16px; border-radius: 6px; font-size: 13.5px; max-width: 520px; text-align: center;
  animation: toastIn 0.25s ease, toastOut 0.4s ease 2.8s forwards; }
.toast.bad { border-left-color: var(--danger); }
.toast.good { border-left-color: var(--teal); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-6px); } }

/* ---------- end ---------- */
.end-kicker { font-size: 12px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--dim); }
.end-text { font-family: var(--font-type); font-size: 18px; line-height: 1.6; color: #c9cfc5; margin-bottom: 30px; }
.end-text b { color: var(--amber); font-weight: 400; }
#screen-end.win .title { color: var(--teal); text-shadow: 0 0 22px rgba(95, 211, 166, 0.45); }
#screen-end.lose .title { color: var(--danger); text-shadow: 0 0 22px rgba(232, 96, 74, 0.35); }

/* ---------- shared game bits ---------- */
.g-status { font-size: 14px; color: var(--dim); min-height: 1.4em; text-align: center; margin: 12px 0 0; }
.g-status b { color: var(--ink); }
.shake { animation: shake 0.35s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* ---------- word search ---------- */
.ws { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 22px; align-items: start; }
.ws-grid { display: grid; grid-template-columns: repeat(var(--n), 1fr); width: min(100%, 580px); aspect-ratio: 1; margin: 0 auto;
  padding: 8px; border-radius: 6px; touch-action: none; user-select: none; -webkit-user-select: none;
  background:
    linear-gradient(rgba(120, 128, 116, 0.35) 1px, transparent 1px) 0 0 / calc(100% / var(--n) * 2) calc(100% / var(--n) * 2),
    linear-gradient(90deg, rgba(120, 128, 116, 0.35) 1px, transparent 1px) 0 0 / calc(100% / var(--n) * 2) calc(100% / var(--n) * 2),
    var(--tile);
  background-origin: content-box;
  box-shadow: inset 0 0 40px rgba(90, 80, 50, 0.25), 0 0 0 1px #3a443e; }
.ws-cell { display: flex; align-items: center; justify-content: center; margin: 1px; border-radius: 999px; cursor: pointer;
  font: 700 clamp(13px, 2.5vw, 21px)/1 var(--font-ui); color: var(--tile-ink); transition: background 0.1s; }
.ws-cell.sel { background: var(--amber); color: #1b1207; }
.ws-cell.anchor { box-shadow: 0 0 0 2px var(--amber) inset; }
.ws-cell.f0 { background: #9fdcc4; } .ws-cell.f1 { background: #f5c98a; } .ws-cell.f2 { background: #b8c9f2; }
.ws-cell.f3 { background: #f2b0b0; } .ws-cell.f4 { background: #d6c3f0; } .ws-cell.f5 { background: #c9e59a; }
.ws-cell.sel.f0, .ws-cell.sel.f1, .ws-cell.sel.f2, .ws-cell.sel.f3, .ws-cell.sel.f4, .ws-cell.sel.f5 { background: var(--amber); }
.ws-theme { font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--dim); }
.ws-theme b { display: block; font: 400 26px var(--font-type); letter-spacing: 0.04em; text-transform: none; color: var(--amber); margin: 4px 0 14px; }
.ws-words { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.ws-words li { font: 600 15px var(--font-ui); letter-spacing: 0.12em; padding: 6px 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel-2); transition: all 0.2s; }
.ws-words li.done { color: var(--faint); text-decoration: line-through; border-color: transparent; background: transparent; }
.ws-tip { font-size: 12px; color: var(--dim); line-height: 1.5; margin-top: 14px; }

/* ---------- code lock ---------- */
.cl { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 26px; align-items: start; }
.cl-history { display: grid; gap: 7px; min-height: 120px; }
.cl-row { display: flex; gap: 7px; align-items: center; }
.cl-row .n { width: 22px; font-size: 12px; color: var(--faint); }
.cl-d { width: 44px; height: 48px; display: grid; place-items: center; border-radius: 6px; font: 700 22px var(--font-ui);
  border: 1px solid var(--line); background: var(--panel-2); }
.cl-d.hit { background: var(--teal); border-color: var(--teal); color: #08140f; }
.cl-d.near { background: var(--amber); border-color: var(--amber); color: #1b1207; }
.cl-d.miss { background: #252c28; color: #6f786f; }
.cl-d.empty { border-style: dashed; color: transparent; }
.cl-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--dim); margin-top: 16px; }
.cl-legend span::before { content: ""; display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; background: var(--c); }
.cl-pad { background: linear-gradient(180deg, #2b312d, #1d221f); border: 1px solid #39433d; border-radius: 12px; padding: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 10px 30px rgba(0, 0, 0, 0.4); }
.cl-display { display: flex; justify-content: center; gap: 8px; padding: 12px; border-radius: 6px; background: #0b100d; border: 1px solid #000; margin-bottom: 14px; }
.cl-display span { width: 40px; height: 46px; display: grid; place-items: center; font: 700 26px var(--font-ui); color: #9ff0c4;
  text-shadow: 0 0 10px rgba(110, 240, 170, 0.6); border-bottom: 2px solid #284a37; }
.cl-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cl-keys button { height: 50px; border-radius: 8px; border: 1px solid #4a554e; cursor: pointer; font: 700 19px var(--font-ui);
  background: linear-gradient(180deg, #454d48, #353c38); box-shadow: 0 3px 0 #1b201d; }
.cl-keys button:active { transform: translateY(2px); box-shadow: 0 1px 0 #1b201d; }
.cl-keys .enter { background: linear-gradient(180deg, #3f7a5e, #2f5f48); }
.cl-tries { margin-top: 12px; text-align: center; font-size: 12.5px; color: var(--dim); }
.cl-tries b { color: var(--amber); }

/* ---------- sequence ---------- */
.sq { display: flex; flex-direction: column; align-items: center; }
.sq-round { font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--dim); margin-bottom: 14px; }
.sq-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; width: min(100%, 360px); }
.sq-lamp { aspect-ratio: 1; border-radius: 14px; border: 1px solid #333d37; cursor: pointer;
  background: radial-gradient(circle at 50% 40%, #2a322d, #161b18); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.35); transition: background 0.08s, box-shadow 0.08s; }
.sq-lamp.on { background: radial-gradient(circle at 50% 45%, #ffffff, var(--fluo) 40%, #8fbf85); box-shadow: 0 0 34px rgba(217, 240, 207, 0.7), inset 0 0 12px #fff; }
.sq-lamp.wrong { background: radial-gradient(circle, #ff8b75, #7a2a1f); }
.sq.locked .sq-lamp { cursor: default; }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .ws, .cl { grid-template-columns: 1fr; }
  .ws-words { grid-template-columns: repeat(2, 1fr); }
  .cl-pad { order: -1; max-width: 320px; margin: 0 auto; width: 100%; }
  .game-root { padding: 14px; }
  .panel-head { flex-wrap: wrap; gap: 10px; }
  .g-headtext p { display: none; }
  .hud-timer { font-size: 22px; }
  .pip { width: 14px; height: 14px; }
}

/* ---------- streak pips (shared) ---------- */
.mt-streak, .fe-streak, .hl-streak { display: flex; justify-content: center; gap: 6px; margin: 4px 0 16px; }
.mt-streak span, .fe-streak span, .hl-streak span { width: 16px; height: 16px; border-radius: 4px; border: 1px solid #3a4540; background: #141a17; transition: all 0.2s; }
.mt-streak span.on, .fe-streak span.on, .hl-streak span.on { background: var(--teal); border-color: var(--teal); box-shadow: 0 0 8px rgba(95, 211, 166, 0.5); }
.hl-streak { margin: 18px 0 0; }

/* ---------- wordle ---------- */
.wd { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.wd-board { display: grid; gap: 6px; }
.wd-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.wd-t { width: clamp(44px, 11vw, 56px); aspect-ratio: 1; display: grid; place-items: center; border: 2px solid #2c3530; border-radius: 4px;
  font: 700 clamp(20px, 5vw, 28px) var(--font-ui); background: #101512; }
.wd-t.filled { border-color: #66726a; }
.wd-t.hit { background: var(--teal); border-color: var(--teal); color: #08140f; }
.wd-t.near { background: var(--amber); border-color: var(--amber); color: #1b1207; }
.wd-t.miss { background: #2a312d; border-color: #2a312d; color: #7d867e; }
.wd-kb { display: grid; gap: 6px; width: min(100%, 520px); }
.wd-kr { display: flex; justify-content: center; gap: 5px; }
.wd-kb button { flex: 1; max-width: 44px; height: 50px; border: 0; border-radius: 5px; background: #3b443f; cursor: pointer; font: 700 15px var(--font-ui); padding: 0; }
.wd-kb button.wide { max-width: 66px; flex: 1.5; font-size: 18px; }
.wd-kb button.hit { background: var(--teal); color: #08140f; }
.wd-kb button.near { background: var(--amber); color: #1b1207; }
.wd-kb button.miss { background: #1c221f; color: #5d665f; }

/* ---------- math ---------- */
.mt { display: flex; flex-direction: column; align-items: center; }
.mt-q { font: 700 clamp(44px, 10vw, 72px) var(--font-ui); letter-spacing: 0.04em; color: var(--fluo); margin: 6px 0 14px; transition: color 0.15s; }
.mt-q.good { color: var(--teal); }
.mt-q.bad { color: var(--danger); }
.mt-bar { width: min(100%, 420px); height: 8px; border-radius: 99px; background: #1b221e; overflow: hidden; margin-bottom: 18px; }
.mt-bar i { display: block; height: 100%; width: 100%; background: var(--teal); border-radius: inherit; }
.mt-bar i.low { background: var(--danger); }
.mt-in { width: 180px; text-align: center; padding: 12px; border-radius: 8px; border: 1px solid var(--line); background: #0b0f0d; color: var(--ink);
  font: 700 30px var(--font-ui); }
.mt-in:focus { outline: none; border-color: var(--amber); }

/* ---------- odd one out ---------- */
.fe { display: flex; flex-direction: column; align-items: center; }
.fe-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; width: min(100%, 640px); }
.fe-card { padding: 0; border: 3px solid #2b3530; border-radius: 8px; overflow: hidden; cursor: pointer; background: #000; line-height: 0; transition: border-color 0.15s; }
.fe-card:hover { border-color: var(--amber); }
.fe-card svg { width: 100%; height: auto; display: block; }
.fe-card.good { border-color: var(--teal); box-shadow: 0 0 18px rgba(95, 211, 166, 0.5); }
.fe-card.bad { border-color: var(--danger); }

/* ---------- higher / lower ---------- */
.hl { display: flex; flex-direction: column; align-items: center; }
.hl-cat { font: 400 24px var(--font-type); color: var(--amber); margin-bottom: 14px; letter-spacing: 0.04em; }
.hl-pair { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: stretch; width: min(100%, 700px); }
.hl-vs { align-self: center; font: 400 20px var(--font-type); color: var(--faint); }
.hl-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  padding: 22px 14px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); min-height: 190px; transition: border-color 0.2s, background 0.2s; }
.hl-card .n { font: 700 19px var(--font-ui); line-height: 1.25; }
.hl-card .q { font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--dim); }
.hl-card .v { font: 700 24px var(--font-ui); color: var(--fluo); font-variant-numeric: tabular-nums; }
.hl-card.good { border-color: var(--teal); background: var(--teal-soft); }
.hl-card.bad { border-color: var(--danger); background: rgba(232, 96, 74, 0.12); }
.hl-btns { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; justify-content: center; }

/* ---------- quiz show ---------- */
.tv { display: grid; grid-template-columns: minmax(0, 1fr) 130px; gap: 22px; align-items: start; }
.tv-q { padding: 20px 28px; text-align: center; font: 600 clamp(16px, 2.6vw, 20px)/1.4 var(--font-ui);
  background: linear-gradient(180deg, #1d2a4a, #121a33); border: 2px solid #8fa6d8; border-radius: 40px; margin-bottom: 16px; min-height: 76px;
  display: flex; align-items: center; justify-content: center; }
.tv-answers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tv-a { text-align: left; padding: 13px 18px; border-radius: 30px; border: 2px solid #8fa6d8; cursor: pointer; font: 500 15px var(--font-ui);
  background: linear-gradient(180deg, #1a2440, #10172b); transition: background 0.15s; }
.tv-a b { color: var(--amber); margin-right: 6px; }
.tv-a:hover:not(:disabled) { background: #26355e; }
.tv-a.lock { background: #c98a1e; border-color: #ffd27a; color: #1b1207; }
.tv-a.lock b { color: #1b1207; }
.tv-a.good { background: #2f9e6e; border-color: #8ff0c4; color: #fff; }
.tv-a.good b { color: #fff; }
.tv-a.bad { background: #a8392b; border-color: #ff9c8a; color: #fff; }
.tv-a.gone { opacity: 0.15; cursor: default; }
.tv-tools { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.tv-tools .g-status { margin: 0; text-align: left; }
.tv-joker:disabled { opacity: 0.35; cursor: default; text-decoration: line-through; }
.tv-ladder { list-style: none; margin: 0; padding: 10px; border-radius: 10px; background: #10172b; border: 1px solid #2c3a63; display: grid; gap: 4px; }
.tv-ladder li { padding: 6px 10px; border-radius: 6px; font: 700 15px var(--font-ui); color: #8fa6d8; text-align: right; }
.tv-ladder li.done { color: var(--teal); }
.tv-ladder li.cur { background: var(--amber); color: #1b1207; }

/* ---------- type racer ---------- */
.tr { display: flex; flex-direction: column; align-items: center; }
.tr-text { width: min(100%, 720px); padding: 20px 22px; border-radius: 8px; background: var(--tile); color: #7f877c; margin-bottom: 16px;
  font: 600 clamp(17px, 2.6vw, 22px)/1.7 var(--font-ui); user-select: none; -webkit-user-select: none; }
.tr-text span.ok { color: #1e6b4a; }
.tr-text span.err { color: #fff; background: var(--danger); border-radius: 2px; }
.tr-text span.cur { color: var(--tile-ink); box-shadow: inset 0 -3px 0 var(--amber); }
.tr-bar { width: min(100%, 720px); }
.tr-in { width: min(100%, 720px); padding: 12px 14px; border-radius: 8px; border: 1px solid var(--line); background: #0b0f0d; color: var(--ink); font: 600 17px var(--font-ui); }
.tr-in:focus { outline: none; border-color: var(--amber); }
.tr-in.err { border-color: var(--danger); }

/* ---------- pokemon ---------- */
.pk { display: flex; flex-direction: column; align-items: center; }
.pk-q { font: 400 clamp(18px, 3vw, 24px) var(--font-type); color: var(--amber); text-align: center; margin-bottom: 16px; min-height: 1.3em; }
.pk-pair { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: center; width: min(100%, 640px); }
.pk-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px; border-radius: 12px; cursor: pointer;
  background: radial-gradient(circle at 50% 35%, #26302b, #141a17); border: 2px solid var(--line); transition: border-color 0.15s, opacity 0.2s; }
.pk-card:hover { border-color: var(--amber); }
.pk-card img { width: 100%; max-width: 200px; aspect-ratio: 1; object-fit: contain; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5)); }
.pk-card.loading { opacity: 0.35; }
.pk-name { font: 700 17px var(--font-ui); text-align: center; }
.pk-val { font: 700 18px var(--font-ui); color: var(--fluo); min-height: 1.3em; }
.pk-card.good { border-color: var(--teal); background: radial-gradient(circle at 50% 35%, #1f4a3a, #12201a); }
.pk-card.bad { border-color: var(--danger); }

@media (max-width: 760px) {
  .tv { grid-template-columns: 1fr; }
  .tv-ladder { grid-auto-flow: column; order: -1; }
  .tv-ladder li { text-align: center; padding: 4px; font-size: 12px; }
  .tv-answers { grid-template-columns: 1fr; }
  .hl-pair, .pk-pair { grid-template-columns: 1fr; }
  .hl-vs { justify-self: center; }
  .hl-card { min-height: 0; }
  .pk-card img { max-width: 120px; }
}

/* ---------- maze ---------- */
#screen-maze { flex-direction: column; align-items: center; padding: 10px 16px 14px; gap: 10px; background: #050605; }
#screen-maze .hud, .maze-stage { width: min(100%, 1100px, calc((100dvh - 130px) * 1.47)); }
.maze-stage { aspect-ratio: 750 / 510; box-shadow: 0 0 0 1px #2a1414, 0 20px 60px rgba(0, 0, 0, 0.8); }
#maze { width: 100%; height: 100%; display: block; touch-action: none; }
#mz-killer { color: #e8604a; letter-spacing: 0.14em; }
.mz-skill { position: relative; width: 220px; height: 18px; border-radius: 99px; background: #1b1414; border: 1px solid #3a2222; overflow: hidden; }
.mz-skill i { position: absolute; inset: 0 auto 0 0; width: 0; background: #7a2a1f; transition: width 0.2s linear; }
.mz-skill i.active { background: #e8604a; animation: pulse 0.5s infinite; }
.mz-skill span { position: relative; display: block; text-align: center; font-size: 11px; line-height: 16px; color: #f0d9d4; }

.mz-msg { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); padding: 7px 14px; border-radius: 6px; pointer-events: none;
  background: rgba(10, 8, 8, 0.85); border: 1px solid #4a2a26; font: 400 15px var(--font-type); color: #f2d6cf; opacity: 0; transition: opacity 0.3s; white-space: nowrap; }
.mz-msg.show { opacity: 1; }
.mz-flash { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; opacity: 0; background: rgba(110, 0, 0, 0.75); }
.mz-flash span { font: 400 clamp(40px, 10vw, 90px) var(--font-type); letter-spacing: 0.2em; color: #fff; }
.mz-flash.show { animation: caught 1.4s ease forwards; }
@keyframes caught { 0% { opacity: 0; } 10% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; } }

.mz-card { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 12px; overflow: auto;
  background: radial-gradient(ellipse at 50% 40%, rgba(40, 6, 6, 0.85), rgba(0, 0, 0, 0.94)); }
.mz-card.hidden { display: none; }
.mz-card-inner { text-align: center; max-width: 520px; }
.mz-kicker { font: 400 15px var(--font-type); color: #c9cfc5; margin: 0 0 6px; }
.mz-portrait { width: 110px; height: 110px; }
.mz-hunted { margin: 0; font-size: 11px; letter-spacing: 0.25em; text-transform: uppercase; color: var(--dim); }
.mz-card h2 { margin: 4px 0 2px; font: 400 clamp(24px, 4vw, 34px) var(--font-type); letter-spacing: 0.08em; color: #e8604a; text-shadow: 0 0 18px rgba(232, 96, 74, 0.4); }
.mz-from { margin: 0 0 10px; font-size: 12px; color: var(--dim); }
.mz-skilltxt { margin: 0 0 12px; font-size: 14px; line-height: 1.5; }
.mz-skilltxt b { color: var(--amber); }
.mz-legend { list-style: none; padding: 0; margin: 0 auto 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; text-align: left; font-size: 12px; color: #c4cbc1; max-width: 460px; }
.mz-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 7px; vertical-align: -1px; }
.lg-btn { background: var(--amber); box-shadow: 0 0 6px var(--amber); }
.lg-trap { border: 2px solid #9aa29a; }
.lg-slime { background: rgba(140, 190, 70, 0.8); }
.lg-exit { background: #8cffbe; box-shadow: 0 0 8px #8cffbe; }
.mz-card .btn-big { padding: 11px 44px; }

/* ---------- freedom (win) ---------- */
.freedom { display: none; width: 100%; aspect-ratio: 16 / 9; border-radius: 10px; margin-bottom: 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); }
#screen-end.win .end { width: min(900px, 100%); }
#screen-end.win .freedom { display: block; }
#screen-end.win .end-kicker, #screen-end.win .title, #screen-end.win .end-text, #screen-end.win .seed-end, #screen-end.win .end-actions { opacity: 0; animation: lineIn 0.8s ease forwards; }
#screen-end.win .end-kicker { animation-delay: 3.6s; }
#screen-end.win .title { animation-delay: 4.2s; margin-top: 0; }
#screen-end.win .end-text { animation-delay: 4.8s; }
#screen-end.win .seed-end { animation-delay: 5.2s; }
#screen-end.win .end-actions { animation-delay: 5.6s; }

@media (max-width: 760px) {
  .mz-skill { width: 150px; }
  .mz-card { position: fixed; z-index: 30; }
  .mz-legend { grid-template-columns: 1fr; }
  .mz-portrait { width: 70px; height: 70px; }
  .mz-msg { font-size: 12px; white-space: normal; width: 90%; text-align: center; }
}

/* ---------- seeds ---------- */
.seed-box { width: min(360px, 100%); margin: 0 auto 22px; text-align: left; }
.seed-box label { display: block; font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--dim); margin-bottom: 6px; }
.seed-row { display: flex; gap: 8px; }
.seed-row input { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 6px; border: 1px solid var(--line); background: #0b0f0d; color: var(--fluo);
  font: 700 18px var(--font-ui); letter-spacing: 0.12em; text-transform: uppercase; }
.seed-row input:focus { outline: none; border-color: var(--amber); }
.seed-row .icon-btn { width: 44px; height: 44px; font-size: 19px; border-radius: 6px; }
.seed-hint { margin: 6px 0 0; font-size: 11.5px; color: var(--dim); line-height: 1.5; }
.hud-seed { font-size: 11px; color: var(--dim); letter-spacing: 0.08em; margin-right: 10px; align-self: center; }
.hud-seed b { color: var(--ink); font-weight: 600; }
.seed-end { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; margin: -10px 0 22px; }
.seed-end code { font: 700 20px var(--font-ui); letter-spacing: 0.12em; color: var(--amber); padding: 6px 12px; border: 1px dashed #4a5148; border-radius: 6px; }
.end-actions { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; align-items: center; }
@media (max-width: 760px) { .hud-seed { display: none; } }

/* ---------- mini sudoku ---------- */
.sd { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.sd-grid { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(4, minmax(0, 1fr));
  width: min(84vw, 320px); aspect-ratio: 1; border: 3px solid #5d675f; border-radius: 6px; overflow: hidden; background: var(--tile); }
/* thick 2x2 box dividers drawn on top, so every cell keeps the same size */
.sd-grid::before, .sd-grid::after { content: ""; position: absolute; background: #5d675f; pointer-events: none; }
.sd-grid::before { left: calc(50% - 1.5px); top: 0; bottom: 0; width: 3px; }
.sd-grid::after { top: calc(50% - 1.5px); left: 0; right: 0; height: 3px; }
.sd-cell { border: 1px solid #a9b0a6; min-width: 0; min-height: 0; background: transparent; cursor: pointer; font: 700 clamp(24px, 7vw, 34px) var(--font-ui); color: #1f6fb8; padding: 0; }
.sd-cell.given { color: var(--tile-ink); cursor: default; }
.sd-cell.sel { background: rgba(255, 179, 71, 0.4); }
.sd-cell.bad { color: var(--danger); background: rgba(232, 96, 74, 0.15); }
.sd.done .sd-cell { color: #1e6b4a; }
.sd-pad { display: flex; gap: 8px; }
.sd-pad .btn { width: 52px; height: 48px; font-size: 20px; padding: 0; }

/* ---------- slide puzzle ---------- */
.sl { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.sl-wrap { display: flex; gap: 18px; align-items: flex-start; }
.sl-board { position: relative; width: min(80vw, 360px); aspect-ratio: 1; background: #0b0d0c; border: 3px solid #3a443e; border-radius: 6px; overflow: hidden; }
.sl-tile { position: absolute; left: 0; top: 0; width: 33.333%; height: 33.333%; border: 1px solid rgba(0, 0, 0, 0.6); padding: 0; cursor: pointer;
  background-size: 300% 300%; transition: transform 0.15s ease; }
.sl-tile span { position: absolute; left: 5px; top: 3px; font: 700 13px var(--font-ui); color: #fff; text-shadow: 0 0 3px #000, 0 0 3px #000; display: none; }
.sl.nums .sl-tile span { display: block; }
.sl-tile.gap { visibility: hidden; }
.sl.done .sl-tile.gap { visibility: visible; animation: lineIn 0.5s ease; }
.sl.done .sl-tile { border-color: transparent; }
.sl-ref { width: 120px; border-radius: 4px; border: 2px solid #3a443e; opacity: 0.9; }
.sl-bar { display: flex; gap: 18px; align-items: center; font-size: 13px; color: var(--dim); }
.sl-bar label { cursor: pointer; display: flex; gap: 6px; align-items: center; }

/* ---------- laser ---------- */
.lz { display: flex; flex-direction: column; align-items: center; }
.lz-svg { width: min(86vw, 440px); height: auto; display: block; }
.lz-floor { fill: #0f1311; }
.lz-cell { fill: none; stroke: #222a26; stroke-width: 1; }
.lz-beam { fill: none; stroke: #ff3b30; stroke-width: 3; stroke-linejoin: round; }
.lz-beam-glow { fill: none; stroke: rgba(255, 59, 48, 0.35); stroke-width: 10; stroke-linejoin: round; filter: blur(2px); }
.lz-m { cursor: pointer; }
.lz-m:hover .lz-mback { stroke: #6b7770; }
.lz-mback { stroke: #3d4741; stroke-width: 9; stroke-linecap: round; }
.lz-mglass { stroke: #cfe3ea; stroke-width: 4; stroke-linecap: round; }
.lz-emit { fill: #2e3531; stroke: #59645d; }
.lz-recv { fill: #1b211e; stroke: #59645d; stroke-width: 3; }
.lz-core { fill: #4a2a26; transition: fill 0.2s; }
.lz-target.on .lz-core { fill: var(--teal); filter: drop-shadow(0 0 8px var(--teal)); }
.lz-target.on .lz-recv { stroke: var(--teal); }

/* ---------- memory ---------- */
.mm { display: flex; flex-direction: column; align-items: center; }
.mm-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; width: min(88vw, 420px); }
.mm-card { position: relative; aspect-ratio: 1; border: 0; padding: 0; background: none; cursor: pointer; perspective: 600px; }
.mm-card span { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 10px; backface-visibility: hidden; transition: transform 0.35s ease; }
.mm-back { background: repeating-linear-gradient(45deg, #2a322d 0 8px, #222924 8px 16px); border: 2px solid #3d4741; }
.mm-face { background: var(--tile); font-size: clamp(28px, 8vw, 42px); transform: rotateY(180deg); border: 2px solid #b7bdb3; }
.mm-card.up .mm-back, .mm-card.found .mm-back { transform: rotateY(180deg); }
.mm-card.up .mm-face, .mm-card.found .mm-face { transform: rotateY(360deg); }
.mm-card.found .mm-face { border-color: var(--teal); box-shadow: 0 0 12px rgba(95, 211, 166, 0.5); }

/* ---------- kim ---------- */
.km { display: flex; flex-direction: column; align-items: center; }
.km-round { font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--dim); margin-bottom: 10px; }
.km-bar { width: min(100%, 460px); height: 6px; border-radius: 99px; background: #1b221e; overflow: hidden; margin-bottom: 14px; }
.km-bar i { display: block; height: 100%; width: 100%; background: var(--amber); }
.km-tray { display: flex; flex-wrap: wrap; justify-content: center; align-content: center; gap: 14px; width: min(100%, 520px); min-height: 190px; padding: 22px;
  border-radius: 50% / 30%; background: radial-gradient(ellipse at 50% 40%, #6d5a43, #3e3226); border: 4px solid #2a2219; box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.5); }
.km-item { font-size: clamp(30px, 7vw, 44px); filter: drop-shadow(0 4px 3px rgba(0, 0, 0, 0.5)); animation: lineIn 0.3s ease; }
.km-q { font: 400 18px var(--font-type); color: var(--amber); margin: 16px 0 10px; min-height: 1.3em; text-align: center; }
.km-opts { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.km-opt { width: 74px; height: 74px; font-size: 36px; border-radius: 12px; border: 2px solid var(--line); background: var(--panel-2); cursor: pointer; }
.km-opt:hover { border-color: var(--amber); }
.km-opt.good { border-color: var(--teal); background: var(--teal-soft); }
.km-opt.bad { border-color: var(--danger); background: rgba(232, 96, 74, 0.15); }

/* ---------- flags ---------- */
.fl { display: flex; flex-direction: column; align-items: center; }
.fl-flag { width: min(80vw, 330px); margin: 4px 0 18px; }
.fl-svg { width: 100%; height: auto; display: block; border-radius: 4px; box-shadow: 0 0 0 1px #3a443e, 0 10px 30px rgba(0, 0, 0, 0.5); }
.fl-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: min(100%, 560px); }
.fl-a { text-align: center; }

@media (max-width: 760px) {
  .sl-wrap { flex-direction: column; align-items: center; }
  .sl-ref { width: 90px; }
  .fl-opts { grid-template-columns: 1fr; }
}
