/* ON THE DOT — styles */
:root {
  --bg: #07070c;
  --bg2: #0e0e18;
  --panel: rgba(18, 18, 30, 0.72);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text: #f2f2f7;
  --muted: #8b8ba3;
  --dot: #ffd166;
  --dot-glow: rgba(255, 209, 102, 0.55);
  --cyan: #4de1ff;
  --green: #7bed9f;
  --red: #ff4d6d;
  --violet: #9b7bff;
  --grade-dead: #ffd166;
  --grade-hair: #7bed9f;
  --grade-close: #4de1ff;
  --grade-miss: #ff4d6d;
  --font-ui: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --ring: min(72vw, 46vh, 440px);
  --ease: cubic-bezier(.2,.8,.2,1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.14) transparent; }
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 3px; }
*::-webkit-scrollbar-track { background: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  overflow: hidden;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
body.shake { animation: shake .32s var(--ease); }
@keyframes shake {
  0% { transform: translate(0,0); }
  20% { transform: translate(-8px, 4px); }
  40% { transform: translate(7px, -3px); }
  60% { transform: translate(-5px, 2px); }
  80% { transform: translate(3px, -1px); }
  100% { transform: translate(0,0); }
}
body.zoom #ring-wrap { animation: zoomPop .55s var(--ease); }
@keyframes zoomPop {
  0% { transform: scale(1); }
  30% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

#bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }
#flash { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 50; transition: opacity .5s ease-out; }
#flash.on { opacity: .55; transition: none; }
#wash { position: fixed; inset: 0; background: radial-gradient(ellipse at center, transparent 30%, rgba(255,77,109,.45)); opacity: 0; pointer-events: none; z-index: 49; transition: opacity .6s ease-out; }
#wash.on { opacity: 1; transition: none; }

/* ===== Screens ===== */
.screen {
  position: fixed; inset: 0; z-index: 1;
  display: none; flex-direction: column;
  opacity: 0; transform: translateY(14px) scale(.985);
  transition: opacity .35s var(--ease), transform .35s var(--ease);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.screen.active { display: flex; }
.screen.shown { opacity: 1; transform: none; }

.bar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 14px 18px; gap: 12px;
}
.bar h2 { margin: 0; font-size: 18px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.bar-stat { text-align: right; font-family: var(--font-mono); color: var(--dot); font-size: 14px; }
.bar .back { justify-self: start; }

/* ===== Buttons ===== */
.btn {
  appearance: none; border: 1px solid var(--panel-border); background: rgba(255,255,255,.04);
  color: var(--text); font: 500 15px var(--font-ui); letter-spacing: .04em;
  padding: 12px 22px; border-radius: 999px; cursor: pointer;
  transition: transform .15s var(--ease), background .2s, border-color .2s, box-shadow .2s;
  backdrop-filter: blur(6px);
}
.btn:hover { background: rgba(255,255,255,.09); border-color: rgba(255,255,255,.18); transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn.primary { background: var(--dot); color: #1a1200; border-color: transparent; font-weight: 700; box-shadow: 0 0 0 0 var(--dot-glow); }
.btn.primary:hover { background: #ffdb7d; box-shadow: 0 0 28px var(--dot-glow); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: rgba(255,255,255,.06); }
.btn.small { padding: 7px 14px; font-size: 13px; }
.btn.danger { border-color: rgba(255,77,109,.4); color: var(--red); }
.btn[disabled] { opacity: .45; cursor: default; transform: none; }

/* ===== Title ===== */
#screen-title { align-items: center; justify-content: center; text-align: center; }
.title-wrap { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.logo { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.logo h1 {
  margin: 0; font-family: var(--font-mono); font-weight: 800; font-size: clamp(44px, 9vw, 92px);
  line-height: .92; letter-spacing: -.02em;
  background: linear-gradient(180deg, #fff 0%, #cfcfe6 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.logo-ring {
  position: relative; width: 120px; height: 120px; border-radius: 50%;
  border: 6px solid rgba(255,255,255,.12);
  box-shadow: inset 0 0 40px rgba(77,225,255,.08);
}
.logo-dot {
  position: absolute; width: 22px; height: 22px; border-radius: 50%; background: var(--dot);
  left: 50%; top: -14px; transform: translateX(-50%);
  box-shadow: 0 0 18px var(--dot-glow), 0 0 44px var(--dot-glow);
  animation: dotPulse 2s ease-in-out infinite;
}
@keyframes dotPulse { 0%,100% { box-shadow: 0 0 14px var(--dot-glow), 0 0 30px var(--dot-glow); } 50% { box-shadow: 0 0 26px var(--dot-glow), 0 0 70px var(--dot-glow); } }
.logo-sweep {
  position: absolute; inset: -6px; border-radius: 50%;
  border: 6px solid transparent; border-top-color: var(--cyan);
  animation: sweep 2s linear infinite; filter: drop-shadow(0 0 8px var(--cyan));
}
@keyframes sweep { to { transform: rotate(360deg); } }
.tagline { margin: 0; color: var(--muted); font-size: 17px; letter-spacing: .02em; }
.menu { display: flex; flex-direction: column; gap: 10px; width: min(300px, 80vw); margin-top: 6px; }
.menu .btn { width: 100%; padding: 14px; font-size: 16px; }
.hint-line { color: var(--muted); font-size: 13px; opacity: .7; margin: 6px 0 0; letter-spacing: .06em; }

/* ===== Mode grid ===== */
.mode-grid, .options-body, .ladder, .ach-grid, .settings, .lobby, .hotseat, .mp-choice {
  overflow-y: auto; padding: 8px 18px 40px; margin: 0 auto; width: 100%;
  flex: 1; min-height: 0; align-content: start; grid-auto-rows: max-content;
}
.mode-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; max-width: 1100px; }
.mode-card {
  appearance: none; text-align: left; cursor: pointer;
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: 18px;
  padding: 18px 18px 16px; color: var(--text); font-family: var(--font-ui);
  display: flex; flex-direction: column; gap: 8px; position: relative; overflow: hidden;
  transition: transform .2s var(--ease), border-color .2s, box-shadow .2s;
  backdrop-filter: blur(10px);
}
.mode-card::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 100% 0%, var(--accent, var(--cyan)) 0%, transparent 45%); opacity: .12; transition: opacity .3s; }
.mode-card:hover { transform: translateY(-3px); border-color: rgba(255,255,255,.2); box-shadow: 0 16px 40px rgba(0,0,0,.4); }
.mode-card:hover::before { opacity: .28; }
.mode-card strong { font-size: 19px; font-weight: 700; letter-spacing: .01em; }
.mode-card span { color: var(--muted); font-size: 14px; line-height: 1.4; }
.mode-card .pb { margin-top: 6px; font-family: var(--font-mono); font-size: 12px; color: var(--accent, var(--cyan)); letter-spacing: .04em; }
.mode-card .badge { position: absolute; top: 14px; right: 14px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent, var(--cyan)); border: 1px solid currentColor; padding: 3px 8px; border-radius: 999px; opacity: .8; }
.mode-card.locked { opacity: .5; }
.mode-card.big { padding: 26px; gap: 10px; }
.mp-choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; max-width: 760px; }

/* ===== Options ===== */
.options-body { max-width: 560px; display: flex; flex-direction: column; gap: 22px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field > label { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.field small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.seg { display: inline-flex; align-self: flex-start; background: rgba(255,255,255,.05); border: 1px solid var(--panel-border); border-radius: 12px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.seg-btn { appearance: none; border: 0; background: transparent; color: var(--muted); font: 500 14px var(--font-ui); padding: 8px 16px; border-radius: 9px; cursor: pointer; transition: background .2s, color .2s; }
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: rgba(255,255,255,.12); color: var(--text); }
input[type=text] { appearance: none; background: rgba(255,255,255,.05); border: 1px solid var(--panel-border); color: var(--text); font: 500 15px var(--font-ui); padding: 11px 14px; border-radius: 12px; outline: none; }
input[type=text]:focus { border-color: var(--cyan); }
input[type=range] { accent-color: var(--dot); width: 180px; }
input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--dot); }

/* ===== Ladder ===== */
.ladder { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; max-width: 900px; }
.rung { background: var(--panel); border: 1px solid var(--panel-border); border-radius: 14px; padding: 12px 14px; cursor: pointer; display: flex; flex-direction: column; gap: 5px; position: relative; transition: transform .2s var(--ease), border-color .2s; }
.rung:hover { transform: translateY(-2px); border-color: rgba(255,255,255,.2); }
.rung.locked { opacity: .38; cursor: default; }
.rung.locked:hover { transform: none; }
.rung .n { font-family: var(--font-mono); font-size: 11px; color: var(--muted); letter-spacing: .1em; }
.rung .t { font-weight: 700; font-size: 15px; }
.rung .d { font-size: 12px; color: var(--muted); }
.rung .stars { font-size: 14px; letter-spacing: 2px; color: var(--dot); }
.rung .stars .off { color: rgba(255,255,255,.15); }

/* ===== Play ===== */
#screen-play { justify-content: flex-start; }
.play-bar { grid-template-columns: auto 1fr; }
.hud { display: flex; justify-content: flex-end; gap: 22px; flex-wrap: wrap; }
.hud-item { display: flex; flex-direction: column; align-items: flex-end; min-width: 52px; }
.hud-label { font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.hud-value { font-family: var(--font-mono); font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hud-value.bump { animation: bump .3s var(--ease); }
@keyframes bump { 30% { transform: scale(1.25); color: var(--dot); } }

.stage { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 14px; cursor: pointer; padding-top: 5vh; }
.ring-wrap { position: relative; width: var(--ring); height: var(--ring); display: grid; place-items: center; }
#ring { position: absolute; inset: 0; width: 100%; height: 100%; }
.readout-wrap { position: relative; z-index: 2; text-align: center; display: flex; flex-direction: column; gap: 4px; }
.readout {
  font-family: var(--font-mono); font-weight: 800; font-variant-numeric: tabular-nums;
  font-size: calc(var(--ring) * .22); line-height: 1; letter-spacing: -.02em;
  text-shadow: 0 0 30px rgba(255,255,255,.15);
  transition: color .2s;
}
.readout.hidden-time { color: transparent; text-shadow: none; }
.readout.hidden-time::after { content: "· · ·"; color: var(--muted); position: absolute; left: 0; right: 0; text-shadow: none; animation: blink 1.1s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .25; } }
.readout-sub { font-size: 13px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.play-hint { color: var(--muted); font-size: 13px; letter-spacing: .12em; text-transform: uppercase; opacity: .7; transition: opacity .3s; min-height: 18px; }
.play-hint.off { display: none; }

.target-announce { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; z-index: 5; background: radial-gradient(circle, rgba(7,7,12,.85) 30%, rgba(7,7,12,.4)); }
.target-announce span { letter-spacing: .3em; color: var(--muted); font-size: 14px; }
.target-announce strong { font-family: var(--font-mono); font-size: clamp(64px, 14vw, 140px); font-weight: 800; color: var(--dot); text-shadow: 0 0 40px var(--dot-glow); animation: pop .5s var(--ease); }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.countdown { position: absolute; inset: 0; display: grid; place-items: center; z-index: 6; font-family: var(--font-mono); font-size: clamp(90px, 22vw, 220px); font-weight: 800; color: var(--cyan); text-shadow: 0 0 40px rgba(77,225,255,.5); pointer-events: none; }
.countdown.tick { animation: cdTick .9s var(--ease); }
@keyframes cdTick { 0% { transform: scale(1.5); opacity: 0; } 20% { transform: scale(1); opacity: 1; } 100% { transform: scale(.85); opacity: 0; } }
.turn-banner { position: absolute; top: 4px; left: 50%; transform: translateX(-50%); z-index: 4; padding: 8px 18px; border-radius: 999px; background: var(--panel); border: 1px solid var(--panel-border); font-weight: 700; letter-spacing: .06em; white-space: nowrap; }

.score-pop { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); font-family: var(--font-mono); font-weight: 800; font-size: calc(var(--ring) * .09); pointer-events: none; z-index: 3; animation: scorePop 1.25s var(--ease) forwards; text-shadow: 0 0 20px currentColor; }
@keyframes scorePop { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.6); } 15% { opacity: 1; transform: translate(-50%, 0) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -70px) scale(1); } }
.mode-card .icon { position: absolute; top: 12px; right: 14px; font-size: 22px; opacity: .8; filter: drop-shadow(0 0 10px var(--accent, var(--cyan))); }

.readout.miss { animation: readoutMiss .4s var(--ease); }
@keyframes readoutMiss { 20% { transform: translateX(-10px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
.readout-sub .live { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--red); margin-left: 6px; vertical-align: middle; animation: livePulse 1s ease-in-out infinite; box-shadow: 0 0 8px var(--red); }
@keyframes livePulse { 50% { opacity: .25; transform: scale(.7); } }
.result.dead { border-color: rgba(255,209,102,.45); box-shadow: 0 20px 60px rgba(0,0,0,.5), 0 0 40px rgba(255,209,102,.15); }
.result.hair { border-color: rgba(123,237,159,.35); }
.result.miss { border-color: rgba(255,77,109,.35); }

/* ===== Result ===== */
.result {
  position: relative;
  width: min(460px, 94vw); background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 20px; padding: 16px 18px 12px; text-align: center; z-index: 7;
  backdrop-filter: blur(14px); box-shadow: 0 20px 60px rgba(0,0,0,.5);
  animation: resultIn .35s var(--ease);
  display: flex; flex-direction: column; gap: 6px;
}
@keyframes resultIn { 0% { transform: translateY(24px); opacity: 0; } 100% { transform: translateY(0); opacity: 1; } }
.grade { font-family: var(--font-mono); font-weight: 800; font-size: 34px; letter-spacing: .06em; animation: gradePop .4s var(--ease); }
@keyframes gradePop { 0% { transform: scale(.5); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
.grade.dead { color: var(--grade-dead); text-shadow: 0 0 30px var(--dot-glow); }
.grade.hair { color: var(--grade-hair); text-shadow: 0 0 22px rgba(123,237,159,.5); }
.grade.close { color: var(--grade-close); }
.grade.miss { color: var(--grade-miss); }
.result-reading { font-family: var(--font-mono); font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.result-target { color: var(--muted); font-size: 16px; margin-left: 8px; font-weight: 400; }
.deviation { font-family: var(--font-mono); font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ruler { margin: 4px 6px 0; }
.ruler-track { position: relative; height: 10px; border-radius: 6px; background: rgba(255,255,255,.07); overflow: visible; }
.ruler-zone { position: absolute; top: 0; bottom: 0; border-radius: 6px; left: 50%; transform: translateX(-50%); }
.ruler-zone.close { background: rgba(77,225,255,.14); }
.ruler-zone.hair { background: rgba(123,237,159,.28); }
.ruler-zone.dead { background: rgba(255,209,102,.55); }
.ruler-center { position: absolute; left: 50%; top: -4px; bottom: -4px; width: 2px; background: var(--dot); transform: translateX(-50%); box-shadow: 0 0 8px var(--dot-glow); }
.ruler-marker { position: absolute; top: -6px; width: 6px; height: 22px; border-radius: 3px; background: #fff; left: 50%; transform: translateX(-50%); box-shadow: 0 0 10px rgba(255,255,255,.6); transition: left .6s var(--ease); }
.ruler-labels { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 10px; color: var(--muted); margin-top: 8px; }
.ruler-labels span:nth-child(2) { display: none; }
.result-meta { font-size: 13px; color: var(--muted); min-height: 16px; }
.result-meta b { color: var(--dot); font-weight: 600; }
.result-hint { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); opacity: .7; margin-top: 2px; }

/* ===== Leaderboard overlay ===== */
.leaderboard {
  position: absolute; inset: 0; z-index: 9; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: rgba(7,7,12,.82); backdrop-filter: blur(10px); padding: 20px;
}
.leaderboard h3 { margin: 0; font-size: 14px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.leaderboard ol { list-style: none; margin: 0; padding: 0; width: min(440px, 92vw); display: flex; flex-direction: column; gap: 6px; }
.leaderboard li { display: grid; grid-template-columns: 28px 12px 1fr auto auto; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--panel-border); border-radius: 12px; padding: 10px 14px; font-size: 15px; animation: resultIn .4s var(--ease) both; animation-delay: calc(var(--i) * 60ms); }
.leaderboard li .rank { font-family: var(--font-mono); color: var(--muted); }
.leaderboard li .sw { width: 12px; height: 12px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }
.leaderboard li .dev { font-family: var(--font-mono); font-size: 13px; color: var(--muted); }
.leaderboard li .pts { font-family: var(--font-mono); font-weight: 700; min-width: 56px; text-align: right; }
.leaderboard li.me { border-color: rgba(255,209,102,.5); }
.leaderboard li .g { font-size: 11px; letter-spacing: .1em; }
.lb-actions { display: flex; gap: 10px; margin-top: 8px; }
.lb-note { color: var(--muted); font-size: 13px; }

/* ===== Summary ===== */
#screen-summary { align-items: center; justify-content: center; }
.summary-card { width: min(520px, 94vw); background: var(--panel); border: 1px solid var(--panel-border); border-radius: 24px; padding: 28px 24px; text-align: center; display: flex; flex-direction: column; gap: 12px; backdrop-filter: blur(14px); box-shadow: 0 30px 80px rgba(0,0,0,.5); max-height: 92vh; overflow-y: auto; }
.summary-card h2 { margin: 0; font-size: 14px; letter-spacing: .24em; text-transform: uppercase; color: var(--muted); }
.summary-big { font-family: var(--font-mono); font-size: 64px; font-weight: 800; color: var(--dot); text-shadow: 0 0 40px var(--dot-glow); line-height: 1; }
.summary-sub { color: var(--muted); font-size: 14px; }
.summary-rows { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.summary-rows div { display: flex; justify-content: space-between; padding: 8px 12px; background: rgba(255,255,255,.04); border-radius: 10px; font-size: 14px; }
.summary-rows b { font-family: var(--font-mono); font-weight: 600; }
.summary-rows .strip { display: flex; gap: 6px; justify-content: center; background: transparent; padding: 4px 0 8px; flex-wrap: wrap; }
.summary-rows .strip i { width: 14px; height: 14px; border-radius: 50%; background: rgba(255,255,255,.12); animation: stripIn .4s var(--ease) both; animation-delay: calc(var(--i) * 40ms); }
.summary-rows .strip i.dead { background: var(--grade-dead); box-shadow: 0 0 10px var(--dot-glow); }
.summary-rows .strip i.hair { background: var(--grade-hair); }
.summary-rows .strip i.close { background: var(--grade-close); }
.summary-rows .strip i.miss { background: var(--grade-miss); opacity: .7; }
@keyframes stripIn { from { transform: scale(0); } }
.target-announce strong.land { animation: land .5s var(--ease); }
@keyframes land { 0% { transform: scale(1.25); filter: brightness(2); } 100% { transform: scale(1); } }
.summary-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 10px; height: 170px; margin: 8px 0; }
.podium .col { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 96px; }
.podium .col .name { font-weight: 700; font-size: 14px; max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium .col .pts { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.podium .col .block { width: 100%; border-radius: 10px 10px 4px 4px; background: linear-gradient(180deg, var(--c), rgba(255,255,255,.05)); display: grid; place-items: center; font-family: var(--font-mono); font-weight: 800; font-size: 22px; color: #0a0a10; animation: rise .8s var(--ease) both; transform-origin: bottom; }
@keyframes rise { from { transform: scaleY(0); } }

/* ===== Achievements ===== */
.stats-strip { display: flex; gap: 10px; flex-wrap: wrap; padding: 4px 18px 10px; max-width: 1100px; margin: 0 auto; width: 100%; }
.stat { background: var(--panel); border: 1px solid var(--panel-border); border-radius: 12px; padding: 10px 14px; display: flex; flex-direction: column; min-width: 120px; }
.stat b { font-family: var(--font-mono); font-size: 18px; font-weight: 700; }
.stat span { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; max-width: 1100px; }
.ach { background: var(--panel); border: 1px solid var(--panel-border); border-radius: 14px; padding: 14px; display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: center; }
.ach .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; background: rgba(255,209,102,.12); }
.ach.locked .ico { background: rgba(255,255,255,.04); filter: grayscale(1); opacity: .4; }
.ach.locked { opacity: .55; }
.ach strong { display: block; font-size: 14px; }
.ach span { font-size: 12px; color: var(--muted); }
.ach.secret strong::after { content: " · secret"; color: var(--violet); font-weight: 400; font-size: 11px; }
.center-row { display: flex; justify-content: center; padding: 10px 0 30px; }

/* ===== Settings ===== */
.settings { max-width: 520px; display: flex; flex-direction: column; gap: 8px; }
.settings .row { display: flex; align-items: center; justify-content: space-between; gap: 16px; background: var(--panel); border: 1px solid var(--panel-border); border-radius: 14px; padding: 14px 16px; cursor: pointer; }
.settings .row > span { display: flex; flex-direction: column; gap: 2px; font-weight: 500; }
.settings .row small { color: var(--muted); font-weight: 400; font-size: 12px; }

/* ===== Lobby ===== */
.lobby, .hotseat { max-width: 560px; display: flex; flex-direction: column; gap: 18px; }
.lobby-join { display: flex; flex-direction: column; gap: 18px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; background: var(--c); transition: transform .15s; }
.swatch:hover { transform: scale(1.12); }
.swatch.active { border-color: #fff; box-shadow: 0 0 12px var(--c); }
.lobby-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.join-row { display: flex; gap: 8px; }
.join-row input { width: 120px; font-family: var(--font-mono); font-weight: 700; letter-spacing: .3em; text-transform: uppercase; text-align: center; }
.lobby-status { color: var(--muted); font-size: 13px; min-height: 18px; }
.lobby-status.err { color: var(--red); }
.room-code { display: flex; align-items: center; gap: 12px; }
.room-code span { font-size: 12px; letter-spacing: .2em; color: var(--muted); }
.room-code strong { font-family: var(--font-mono); font-size: 36px; letter-spacing: .28em; color: var(--dot); text-shadow: 0 0 20px var(--dot-glow); }
.players { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.players li { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--panel-border); border-radius: 12px; padding: 10px 14px; }
.players li .sw { width: 12px; height: 12px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }
.players li .tag { margin-left: auto; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.host-controls { display: flex; flex-direction: column; gap: 14px; }
.guest-wait { color: var(--muted); font-size: 14px; animation: blink 1.6s ease-in-out infinite; }
.hs-players { display: flex; flex-direction: column; gap: 8px; }
.hs-row { display: flex; gap: 8px; align-items: center; }
.hs-row input { flex: 1; }
.hs-row .sw { width: 22px; height: 22px; border-radius: 50%; background: var(--c); flex: none; }

/* ===== Toasts ===== */
#toasts { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; pointer-events: none; width: min(380px, 92vw); }
.toast { background: rgba(18,18,30,.92); border: 1px solid rgba(255,209,102,.4); border-radius: 14px; padding: 12px 14px; display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: center; box-shadow: 0 10px 40px rgba(0,0,0,.5), 0 0 30px rgba(255,209,102,.12); animation: toastIn .4s var(--ease); }
.toast.out { animation: toastOut .4s var(--ease) forwards; }
.toast .ico { font-size: 24px; text-align: center; }
.toast strong { display: block; font-size: 13px; color: var(--dot); letter-spacing: .06em; }
.toast span { font-size: 13px; color: var(--text); }
.toast.plain { border-color: var(--panel-border); grid-template-columns: 1fr; }
@keyframes toastIn { from { transform: translateY(-20px); opacity: 0; } }
@keyframes toastOut { to { transform: translateY(-20px); opacity: 0; } }

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .bar { padding: 10px 12px; }
  .bar h2 { font-size: 14px; }
  .hud { gap: 10px; flex-wrap: nowrap; }
  .hud-item { min-width: 0; }
  .hud-value { font-size: 15px; }
  .hud-label { font-size: 9px; max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .play-bar .back { padding: 8px 10px; }
  .grade { font-size: 26px; }
  .result { padding: 12px 14px 10px; bottom: 6px; }
  .result-reading { font-size: 22px; }
  :root { --ring: min(78vw, 36vh); }
  .stage { gap: 10px; padding-top: 1vh; }
  .menu { width: min(300px, 84vw); }
  input[type=range] { width: 120px; }
}
@media (max-height: 700px) and (min-width: 641px) {
  :root { --ring: min(60vw, 52vh, 420px); }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
