/* TUMBLER — styles.css
 * Neon-vault / dark-heist system. One bold thing (the dial); everything else
 * is brushed steel, kept quiet. Two accents: safe-green = a pin set,
 * brass = loose pins + loot. Alarm-red only ever means danger.
 */

:root {
  --vault-black: #0B0E11;
  --steel-900: #14181D;
  --steel-800: #1C2127;
  --steel-700: #232b33;
  --steel-600: #2f3942;
  --line: #2A323B;
  --line-soft: #20262d;

  --hit: #34E0A1;     /* pin set (correct) + success */
  --hit-deep: #176b50;
  --brass: #E8B24C;   /* loose pin (misplaced) + loot */
  --brass-deep: #6e5320;
  --alarm: #FF4D4D;   /* danger only */
  --blue: #5AA9FF;
  --violet: #C46BFF;

  --bone: #ECECE6;
  --muted: #8a96a2;
  --dim: #5d6873;

  --display: "Oswald", "Arial Narrow", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Courier New", monospace;
  --body: "Space Grotesk", system-ui, sans-serif;

  --r: 10px;
  --maxw: 1120px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(1100px 680px at 50% -8%, #161b22 0%, rgba(11,14,17,0) 60%),
    radial-gradient(900px 600px at 110% 110%, #12171d 0%, rgba(11,14,17,0) 55%),
    var(--vault-black);
  color: var(--bone);
  font-family: var(--body);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* faint brushed texture, behind everything, very subtle */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: repeating-linear-gradient(90deg, rgba(255,255,255,0.012) 0 1px, transparent 1px 3px);
  opacity: 0.6;
}

.display { font-family: var(--display); letter-spacing: 0.01em; line-height: 1.02; margin: 0; text-transform: uppercase; }
.accent { color: var(--hit); }
.muted { color: var(--muted); }
code { font-family: var(--mono); color: var(--brass); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px clamp(16px, 4vw, 40px);
  background: linear-gradient(180deg, rgba(11,14,17,0.92), rgba(11,14,17,0.7));
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  background: none; border: 0; cursor: pointer; color: var(--bone);
  font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: 0.22em;
  text-transform: uppercase; padding: 0;
}
.brand-mark { width: 26px; height: 26px; color: var(--hit); display: inline-flex; }
.brand-mark svg { width: 100%; height: 100%; }
.brand:hover .brand-mark { color: var(--brass); }
.brand-word { text-transform: none; letter-spacing: 0.005em; }
.topbar-actions { display: flex; gap: 8px; }
.tbtn {
  font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: 0.14em;
  color: var(--muted); background: var(--steel-800); border: 1px solid var(--line);
  padding: 9px 12px; border-radius: 8px; cursor: pointer; text-transform: uppercase;
  white-space: nowrap; transition: color .15s, border-color .15s, background .15s;
}
.brand { flex: 0 0 auto; }
.topbar { gap: 12px; }
.topbar-actions { flex-wrap: wrap; justify-content: flex-end; }
.tbtn:hover { color: var(--bone); border-color: var(--steel-600); }
.tbtn.on { color: var(--hit); border-color: var(--hit-deep); }

/* ---------- generic screen / layout ---------- */
.screen { position: relative; z-index: 1; max-width: var(--maxw); margin: 0 auto; padding: clamp(20px, 4vw, 48px); }

/* ---------- HOME ---------- */
.home-inner {
  display: grid; grid-template-columns: minmax(240px, 0.85fr) 1.15fr;
  gap: clamp(24px, 5vw, 64px); align-items: center;
  padding: clamp(12px, 3vw, 32px) 0;
}
.home-title { font-size: clamp(38px, 6.4vw, 76px); font-weight: 700; }
.lede { color: var(--muted); font-size: clamp(15px, 1.6vw, 18px); line-height: 1.55; max-width: 46ch; margin: 18px 0 26px; }

.home-config { display: flex; flex-direction: column; gap: 16px; }
.cfg-row { display: flex; align-items: center; gap: 16px; }
.cfg-label { font-family: var(--mono); font-size: 12px; letter-spacing: 0.2em; color: var(--dim); width: 52px; }

.seg { display: inline-flex; background: var(--steel-900); border: 1px solid var(--line); border-radius: 10px; padding: 4px; gap: 4px; }
.seg-opt {
  font-family: var(--mono); font-weight: 700; font-size: 13px; letter-spacing: 0.08em;
  color: var(--muted); background: none; border: 0; cursor: pointer;
  padding: 9px 16px; border-radius: 7px; text-transform: uppercase; transition: all .15s;
}
.seg-opt:hover { color: var(--bone); }
.seg-opt.active { color: var(--vault-black); background: var(--hit); box-shadow: 0 0 18px rgba(52,224,161,0.35); }
.mode-desc { font-size: 13px; line-height: 1.5; color: var(--muted); max-width: 52ch; margin: -4px 0 2px; }
.mode-desc b { color: var(--bone); }
.readrules-opt { display: inline-flex; align-items: center; gap: 9px; margin-top: 12px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.03em; color: var(--muted); cursor: pointer; }
.readrules-opt input { width: 16px; height: 16px; accent-color: var(--hit); cursor: pointer; flex: 0 0 auto; }
.readrules-opt:hover { color: var(--bone); }

.crew-names { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 2px; }
.crew-input {
  font-family: var(--mono); font-size: 16px; color: var(--bone);
  background: var(--steel-900); border: 1px solid var(--line);
  border-left: 3px solid var(--pc, var(--hit)); border-radius: 8px;
  padding: 11px 12px; width: 150px; max-width: 46vw;
}
.crew-input:focus { outline: none; border-color: var(--pc, var(--hit)); box-shadow: 0 0 0 3px rgba(255,255,255,0.04); }
.crew-input::placeholder { color: var(--dim); }

.btn {
  font-family: var(--display); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  border-radius: 10px; padding: 14px 22px; cursor: pointer; border: 1px solid transparent;
  font-size: 15px; transition: transform .08s, box-shadow .15s, background .15s, color .15s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--hit); color: #06150f; box-shadow: 0 6px 26px rgba(52,224,161,0.28); }
.btn--primary:hover { box-shadow: 0 8px 34px rgba(52,224,161,0.42); }
.btn--ghost { background: var(--steel-800); color: var(--bone); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--steel-600); }
.btn--danger { background: var(--alarm); color: #2a0707; }
.cta { margin-top: 8px; align-self: flex-start; }

.best-strip {
  display: flex; flex-wrap: wrap; gap: 28px; margin-top: 34px; padding-top: 20px;
  border-top: 1px solid var(--line-soft);
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em; color: var(--dim); text-transform: uppercase;
}
.best-strip b { color: var(--brass); font-weight: 800; }

/* ---------- DIAL (signature) ---------- */
.dial { width: clamp(200px, 34vw, 320px); aspect-ratio: 1; margin: 0 auto; filter: drop-shadow(0 18px 40px rgba(0,0,0,0.5)); }
.dial--big { width: clamp(220px, 30vw, 360px); }
.dial svg { width: 100%; height: 100%; overflow: visible; }
.dial-rim { fill: none; stroke: #1b2128; stroke-width: 14; }
.dial-face { fill: #0e1318; stroke: var(--line); stroke-width: 1.5; }
.dt { stroke: #38424d; stroke-width: 2; stroke-linecap: round; }
.dt.hot { stroke: var(--hit); filter: drop-shadow(0 0 4px rgba(52,224,161,0.7)); }
.dial-knob circle { fill: #161c22; stroke: #313b45; stroke-width: 1.5; }
.dial-knob { transform-origin: 100px 100px; transition: transform .6s cubic-bezier(.2,.8,.2,1); }
.dial-grip { stroke: var(--brass); stroke-width: 3.4; stroke-linecap: round; }
.dial-hub { fill: var(--brass) !important; stroke: none !important; }
.dial-num { fill: var(--brass); font-family: var(--mono); font-weight: 800; font-size: 26px; letter-spacing: 0.06em; }
.dial--big .dial-knob { animation: dial-idle 14s linear infinite; }
.dial--open .dial-knob { animation: dial-pop 1s ease-out; }
@keyframes dial-idle { to { transform: rotate(360deg); } }
@keyframes dial-pop { 0% { transform: rotate(0); } 70% { transform: rotate(420deg); } 100% { transform: rotate(396deg); } }

/* ---------- PLAY ---------- */
.play { display: grid; grid-template-columns: 1fr 300px; gap: clamp(16px, 2.5vw, 30px); align-items: start; }
.play-main { min-width: 0; }

.vault-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.vhl { margin-right: auto; }
.vault-label { font-family: var(--display); font-weight: 700; font-size: clamp(20px, 3vw, 28px); letter-spacing: 0.06em; }
.vault-sub { font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; color: var(--dim); margin-top: 2px; text-transform: uppercase; }
.turn-chip {
  font-family: var(--mono); font-weight: 700; font-size: 11px; letter-spacing: 0.12em;
  color: var(--pc, var(--hit)); border: 1px solid color-mix(in srgb, var(--pc, var(--hit)) 40%, var(--line));
  background: color-mix(in srgb, var(--pc, var(--hit)) 12%, transparent);
  padding: 7px 11px; border-radius: 999px; text-transform: uppercase;
}
.gear-btn {
  font-family: var(--mono); font-weight: 700; font-size: 12px; letter-spacing: 0.1em;
  color: var(--bone); background: var(--steel-800); border: 1px solid var(--line);
  padding: 10px 14px; border-radius: 9px; cursor: pointer; text-transform: uppercase;
  transition: border-color .15s, background .15s;
}
.gear-btn:hover { border-color: var(--brass); }
.gear-btn b { color: var(--brass); margin-left: 6px; }

.probe-hint {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; color: var(--muted);
  display: flex; align-items: center; gap: 8px; margin-bottom: 14px; min-height: 22px; text-transform: uppercase;
}
.probe-hint.empty { color: var(--dim); }
.probe-slot {
  display: inline-grid; place-items: center; width: 22px; height: 26px; border-radius: 4px;
  border: 1px solid var(--line); color: var(--dim); background: var(--steel-900); font-weight: 700;
}
.probe-slot.on { color: #06150f; background: var(--hit); border-color: var(--hit); }

.grid { display: grid; gap: 8px; justify-content: center; margin-bottom: 14px; }
.grid-row { display: grid; grid-auto-flow: column; gap: 8px; justify-content: center; }
.tile {
  width: clamp(44px, 9.4vw, 62px); aspect-ratio: 1; display: grid; place-items: center;
  font-family: var(--mono); font-weight: 800; font-size: clamp(20px, 4.4vw, 30px);
  color: var(--bone); background: #11161b;
  border: 1.5px solid var(--line); border-radius: 8px; text-transform: uppercase;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}
.tile.active { border-color: var(--steel-600); transform: scale(1.02); transition: transform .06s; }
.tile.filled { border-color: transparent; }
.tile.hit { background: var(--hit); color: #06150f; box-shadow: 0 0 16px rgba(52,224,161,0.32); }
.tile.near { background: var(--brass); color: #1f1503; box-shadow: 0 0 14px rgba(232,178,76,0.26); }
.tile.miss { background: #1a1f25; color: var(--dim); }
.tile.fog {
  background: repeating-linear-gradient(45deg, #1a2026 0 7px, #161b21 7px 14px);
  color: rgba(236,236,230,0.35);
}

.effbar { min-height: 26px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }
.eff { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; padding: 5px 10px; border-radius: 999px; border: 1px solid; text-transform: uppercase; }
.eff.frost { color: var(--blue); border-color: color-mix(in srgb, var(--blue) 45%, transparent); background: rgba(90,169,255,0.08); }
.eff.fogc { color: var(--muted); border-color: var(--line); background: rgba(255,255,255,0.03); }
.eff.dec { color: var(--hit); border-color: var(--hit-deep); background: rgba(52,224,161,0.08); }

/* keyboard */
.kb { display: flex; flex-direction: column; gap: 8px; max-width: 540px; margin: 4px auto 0; }
.kb-row { display: flex; gap: 6px; justify-content: center; }
.key {
  flex: 1 1 0; min-width: 0; height: 52px; border-radius: 7px; cursor: pointer;
  font-family: var(--mono); font-weight: 700; font-size: 15px; text-transform: uppercase;
  color: var(--bone); background: var(--steel-700); border: 1px solid var(--line);
  box-shadow: 0 2px 0 #0c1014; transition: transform .05s, background .15s, color .15s;
}
.key:hover { background: var(--steel-600); }
.key:active { transform: translateY(2px); box-shadow: 0 0 0 #0c1014; }
.key.wide { flex: 1.4 1 0; font-size: 18px; line-height: 1; display: flex; align-items: center; justify-content: center; padding: 0; }
.key.enter-key { color: var(--hit); font-weight: 800; }
.key.hit { background: var(--hit); color: #06150f; border-color: var(--hit); }
.key.near { background: var(--brass); color: #1f1503; border-color: var(--brass); }
.key.miss { background: #11151a; color: var(--dim); box-shadow: none; }
.key.frozen { background: #0d1b2b; color: var(--blue); border-color: var(--blue); cursor: not-allowed; }

/* crew rail */
.crew { background: linear-gradient(180deg, var(--steel-900), #10141a); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; align-self: stretch; }
.crew h3 { font-family: var(--mono); font-size: 12px; letter-spacing: 0.2em; color: var(--dim); margin: 0 0 12px; display: flex; justify-content: space-between; align-items: baseline; text-transform: uppercase; }
.crew h3 .timer { color: var(--brass); font-weight: 700; letter-spacing: 0.08em; }
.crew-cards { display: flex; flex-direction: column; gap: 10px; }
.crew-card {
  border: 1px solid var(--line); border-left: 3px solid var(--pc); border-radius: 9px;
  padding: 11px 12px; background: var(--steel-800); transition: box-shadow .2s, transform .2s; position: relative;
}
.crew-card.active { box-shadow: 0 0 0 1px var(--pc), 0 0 22px color-mix(in srgb, var(--pc) 28%, transparent); }
.crew-card.solved { opacity: 0.92; }
.crew-card.busted { opacity: 0.6; }
.cc-top { display: flex; justify-content: space-between; align-items: center; }
.crew-name { font-family: var(--display); font-weight: 600; letter-spacing: 0.04em; font-size: 16px; text-transform: uppercase; }
.combo { font-family: var(--mono); font-size: 11px; font-weight: 800; color: var(--hit); }
.crew-loot { font-family: var(--mono); font-weight: 800; font-size: 19px; color: var(--brass); margin: 2px 0 8px; }
.alarm { display: flex; gap: 3px; }
.pip { flex: 1 1 0; height: 6px; border-radius: 3px; background: #283038; }
.pip.on { background: var(--alarm); box-shadow: 0 0 7px rgba(255,77,77,0.55); }
.crew-card.active .pip.on:last-child { animation: pip-pulse 1s ease-in-out infinite; }
@keyframes pip-pulse { 50% { opacity: 0.4; } }
.crew-status { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; color: var(--dim); margin-top: 8px; text-transform: uppercase; }
.crew-card.solved .crew-status { color: var(--hit); }
.crew-card.busted .crew-status { color: var(--alarm); }

.feed-wrap { margin-top: 14px; border-top: 1px solid var(--line-soft); padding-top: 12px; }
.feed-title { font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em; color: var(--dim); margin-bottom: 8px; }
.feed { display: flex; flex-direction: column; gap: 7px; max-height: 168px; overflow: auto; }
.feed-item { font-size: 12.5px; color: var(--muted); line-height: 1.35; animation: feed-in .25s ease; }
@keyframes feed-in { from { opacity: 0; transform: translateX(-6px); } }

/* ---------- OVERLAY + PANELS ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center; padding: 20px; }
.overlay.show { display: flex; background: rgba(7,9,11,0.78); backdrop-filter: blur(6px); animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.panel {
  width: min(520px, 96vw); max-height: 92vh; overflow: auto;
  background: linear-gradient(180deg, var(--steel-900), #0f1318);
  border: 1px solid var(--line); border-radius: 16px; padding: clamp(22px, 4vw, 36px);
  box-shadow: 0 30px 80px rgba(0,0,0,0.6); text-align: center; animation: rise .26s cubic-bezier(.2,.8,.2,1);
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.panel h2 { font-size: clamp(26px, 4.4vw, 38px); }

.pass-panel .dial { width: 150px; }
.pass-vault { font-family: var(--mono); font-size: 12px; letter-spacing: 0.2em; color: var(--dim); margin: 6px 0; }
.pass-panel h2 { margin: 6px 0 4px; font-size: clamp(26px, 5vw, 40px); }
.pass-panel .btn { margin-top: 18px; }

/* shop */
.shop-panel { width: min(560px, 96vw); text-align: left; }
.shop-head { display: flex; justify-content: space-between; align-items: baseline; }
.shop-bank { font-family: var(--mono); font-weight: 800; color: var(--brass); }
.target-select { margin: 14px 0; }
.target-select > span { font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; color: var(--dim); display: block; margin-bottom: 8px; }
.target-opts { display: flex; gap: 8px; flex-wrap: wrap; }
.target-opt {
  font-family: var(--mono); font-size: 12px; font-weight: 700; cursor: pointer;
  color: var(--muted); background: var(--steel-800); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 14px; text-transform: uppercase;
}
.target-opt.active { color: var(--pc); border-color: var(--pc); box-shadow: 0 0 0 1px var(--pc); }
.shop-grid { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.shop-item {
  display: flex; align-items: center; gap: 14px; text-align: left; cursor: pointer;
  background: var(--steel-800); border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px;
  color: var(--bone); transition: border-color .15s, background .15s;
}
.shop-item:hover { border-color: var(--steel-600); background: var(--steel-700); }
.shop-item.disabled { opacity: 0.42; cursor: not-allowed; }
.si-icon { font-size: 22px; width: 30px; text-align: center; }
.si-body { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.si-name { font-family: var(--display); font-weight: 600; letter-spacing: 0.05em; font-size: 16px; }
.sab-tag { font-family: var(--mono); font-size: 9px; font-style: normal; color: var(--alarm); letter-spacing: 0.14em; margin-left: 6px; vertical-align: middle; }
.si-desc { font-size: 12.5px; color: var(--muted); }
.si-why { font-style: normal; color: var(--dim); }
.shop-cost { font-family: var(--mono); font-weight: 800; color: var(--brass); white-space: nowrap; }
.shop-panel .btn { width: 100%; }

/* summary + game over */
.standings { display: flex; flex-direction: column; gap: 8px; margin: 18px 0; }
.standing-row {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 10px; background: var(--steel-800);
  border: 1px solid var(--line); border-left: 3px solid var(--pc); text-align: left;
}
.standing-row.big { grid-template-columns: auto auto 1fr auto; }
.sr-rank { font-family: var(--mono); font-weight: 800; color: var(--dim); font-size: 14px; }
.sr-name { font-family: var(--display); font-weight: 600; letter-spacing: 0.04em; font-size: 17px; text-transform: uppercase; }
.sr-res { font-family: var(--mono); font-size: 12px; }
.sr-meta { font-family: var(--mono); font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.r-good { color: var(--hit); } .r-bad { color: var(--alarm); }
.sr-loot { font-family: var(--mono); font-weight: 800; color: var(--brass); font-size: 16px; }
.badge { font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; padding: 3px 7px; border-radius: 6px; background: rgba(232,178,76,0.12); color: var(--brass); border: 1px solid var(--brass-deep); }

.gameover-panel .dial { width: 130px; }
.go-kicker { font-family: var(--mono); font-size: 11px; letter-spacing: 0.28em; color: var(--dim); margin-top: 4px; }
.go-title { font-size: clamp(28px, 5vw, 44px); margin: 4px 0 6px; color: var(--brass); }
.go-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.go-actions .btn { flex: 1 1 auto; }

/* how to play */
.how-panel { text-align: left; width: min(560px, 96vw); }
.how-list { padding-left: 20px; margin: 16px 0 22px; }
.how-list li { margin-bottom: 12px; line-height: 1.5; color: var(--muted); }
.how-list b { color: var(--bone); }
.how-panel .btn { width: 100%; }
.chip { font-family: var(--mono); font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 4px; }
.chip.hit { background: var(--hit); color: #06150f; }
.chip.near { background: var(--brass); color: #1f1503; }
.chip.miss { background: #1a1f25; color: var(--dim); }

/* how-to: legend + cards */
.how-intro { color: var(--muted); margin: 4px 0 14px; line-height: 1.5; }
.legend { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.legend-item { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--muted); }
.legend-item .chip { width: 28px; height: 28px; display: inline-grid; place-items: center; border-radius: 6px; font-size: 14px; flex: 0 0 auto; }
.how-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.how-card { background: var(--steel-800); border: 1px solid var(--line); border-radius: 10px; padding: 12px 13px; }
.how-card h4 { margin: 0 0 5px; font-family: var(--display); font-weight: 600; letter-spacing: 0.03em; font-size: 14px; text-transform: uppercase; color: var(--bone); }
.how-card p { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.how-modes { border-top: 1px solid var(--line-soft); padding-top: 12px; margin-bottom: 18px; }
.how-modes p { margin: 0 0 8px; font-size: 13px; color: var(--muted); line-height: 1.5; }
.how-modes b { color: var(--hit); }
.how-h { font-family: var(--display); font-weight: 700; font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); margin: 6px 0 10px; }
.flow { list-style: none; counter-reset: step; padding: 0; margin: 0 0 18px; }
.flow li { counter-increment: step; position: relative; padding-left: 40px; margin-bottom: 11px; line-height: 1.5; color: var(--muted); font-size: 13.5px; }
.flow li::before { content: counter(step); position: absolute; left: 0; top: -1px; width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; background: var(--steel-800); border: 1px solid var(--brass-deep); color: var(--brass); font-family: var(--mono); font-weight: 800; font-size: 12px; }
.flow b { color: var(--bone); }
.how-foot { display: flex; gap: 8px; margin-top: 4px; }
.how-foot .btn { flex: 1; width: auto; }
@media (max-width: 520px) { .how-grid { grid-template-columns: 1fr; } }
@media (max-width: 440px) { .how-foot { flex-direction: column; } }

/* ---------- ONLINE: home CTA, menu, lobby ---------- */
.online-cta { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line); display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.online-cta-label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; color: var(--dim); text-transform: uppercase; }
.online-cta .btn { border-color: var(--brass-deep); color: var(--brass); }
.online-cta .btn:hover { border-color: var(--brass); }

.online-menu, .lobby { display: grid; place-items: center; min-height: 64vh; }
.online-panel, .lobby-panel { text-align: center; }
.block { width: 100%; margin-top: 10px; }
.back { margin-top: 16px; color: var(--muted); }
.fld { display: block; text-align: left; margin: 18px 0 6px; }
.fld span { font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; color: var(--dim); display: block; margin-bottom: 6px; }
.fld .crew-input { width: 100%; }
.or-line { display: flex; align-items: center; gap: 12px; margin: 18px 0 12px; color: var(--dim); font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; }
.or-line::before, .or-line::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.join-row { display: flex; gap: 8px; }
.join-row .code-input { flex: 1; text-align: center; font-size: 22px; font-weight: 800; letter-spacing: 0.3em; text-transform: uppercase; }
.join-row .btn { flex: 0 0 auto; }

.demo-banner { font-family: var(--mono); font-size: 11px; line-height: 1.5; color: var(--brass); background: rgba(232,178,76,0.08); border: 1px solid var(--brass-deep); border-radius: 9px; padding: 10px 12px; margin: 14px 0; text-align: left; }
.demo-banner code { font-size: 11px; }

.room-code { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.rc-label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.22em; color: var(--dim); }
.rc-code { font-family: var(--mono); font-weight: 800; font-size: clamp(40px, 9vw, 64px); letter-spacing: 0.2em; color: var(--hit); text-shadow: 0 0 30px rgba(52,224,161,0.35); }

.lobby-seats { display: grid; gap: 8px; margin: 16px 0; }
.lobby-seat { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--steel-800); text-align: left; }
.lobby-seat.empty { opacity: 0.5; border-style: dashed; }
.ls-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--pc, var(--dim)); box-shadow: 0 0 10px var(--pc, transparent); flex: 0 0 auto; }
.lobby-seat.empty .ls-dot { background: var(--dim); box-shadow: none; }
.ls-name { font-family: var(--display); font-weight: 600; letter-spacing: 0.03em; font-size: 16px; text-transform: uppercase; }
.lobby-wait { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 12px; letter-spacing: 0.06em; }

.solved-chip { color: var(--hit) !important; border-color: var(--hit-deep) !important; background: rgba(52,224,161,0.1) !important; }
.busted-chip { color: var(--alarm) !important; border-color: #6b2020 !important; background: rgba(255,77,77,0.1) !important; }

/* ---------- leaderboard ---------- */
.board { display: grid; place-items: center; min-height: 64vh; }
.board-panel { width: min(540px, 96vw); text-align: center; }
.board-tabs { display: inline-flex; gap: 4px; background: var(--steel-900); border: 1px solid var(--line); border-radius: 10px; padding: 4px; margin: 14px 0 4px; }
.board-tab { font-family: var(--mono); font-weight: 700; font-size: 12px; letter-spacing: 0.08em; color: var(--muted); background: none; border: 0; cursor: pointer; padding: 9px 16px; border-radius: 7px; text-transform: uppercase; transition: all .15s; }
.board-tab:hover { color: var(--bone); }
.board-tab.active { color: var(--vault-black); background: var(--brass); }
.board-list { display: flex; flex-direction: column; gap: 6px; margin: 16px 0; max-height: 52vh; overflow: auto; text-align: left; }
.board-row { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 9px; background: var(--steel-800); border: 1px solid var(--line); }
.board-row.top { border-color: var(--brass-deep); }
.br-rank { font-family: var(--mono); font-weight: 800; color: var(--dim); text-align: center; }
.board-row.top .br-rank { font-size: 18px; }
.br-name { font-family: var(--display); font-weight: 600; letter-spacing: 0.03em; font-size: 16px; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.br-mode { font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; color: var(--dim); text-transform: uppercase; }
.br-loot { font-family: var(--mono); font-weight: 800; color: var(--brass); }
.board-empty { color: var(--muted); font-size: 14px; line-height: 1.5; padding: 24px 8px; text-align: center; }
.go-post { margin-top: 6px; }
.go-posted { font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em; color: var(--hit); margin: 4px 0 12px; }
.group-board { margin: 14px 0; text-align: left; }
.group-title { font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em; color: var(--dim); margin-bottom: 8px; text-transform: uppercase; }
.group-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 8px; background: var(--steel-800); border: 1px solid var(--line); border-left: 3px solid var(--pc); margin-bottom: 6px; }
.group-row .gr-wins { font-family: var(--mono); font-size: 11px; color: var(--hit); letter-spacing: 0.06em; }
.group-row .gr-loot { font-family: var(--mono); font-weight: 800; color: var(--brass); }
.group-row .gr-name { font-family: var(--display); font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; }

/* ---------- first-time gear hint ---------- */
.gear-hint {
  position: fixed; z-index: 45; max-width: 280px;
  background: var(--steel-700); border: 1px solid var(--brass-deep); border-radius: 11px;
  padding: 13px 15px; font-size: 13px; line-height: 1.45; color: var(--bone);
  box-shadow: 0 14px 44px rgba(0,0,0,0.55); animation: rise .26s ease;
}
.gear-hint b { color: var(--brass); }
.gear-hint-arrow { position: absolute; top: -7px; right: 26px; width: 12px; height: 12px; background: var(--steel-700); border-left: 1px solid var(--brass-deep); border-top: 1px solid var(--brass-deep); transform: rotate(45deg); }
.gear-hint-x { display: inline-block; margin-top: 10px; font-family: var(--mono); font-weight: 700; font-size: 11px; letter-spacing: 0.08em; color: #1f1503; background: var(--brass); border: 0; border-radius: 6px; padding: 7px 14px; cursor: pointer; text-transform: uppercase; }
.gear-btn.hint-pulse { animation: gear-pulse 1.3s ease-in-out infinite; border-color: var(--brass); }
@keyframes gear-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232,178,76,0.45); }
  50% { box-shadow: 0 0 0 7px rgba(232,178,76,0); }
}
@media (prefers-reduced-motion: reduce) { .gear-btn.hint-pulse { animation: none; } }

/* ---------- TOAST ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 24px);
  z-index: 60; padding: 12px 18px; border-radius: 10px; pointer-events: none;
  font-family: var(--mono); font-size: 13px; font-weight: 700; letter-spacing: 0.02em;
  background: var(--steel-700); color: var(--bone); border: 1px solid var(--line);
  opacity: 0; transition: opacity .2s, transform .2s; box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.good { border-color: var(--hit-deep); color: var(--hit); }
.toast.warn { border-color: var(--brass-deep); color: var(--brass); }
.toast.bad { border-color: #6b2020; color: var(--alarm); }

/* ---------- animations: flip / crack / bust / shake ---------- */
.grid-row.flip .tile.filled { animation: flip .5s ease both; animation-delay: calc(var(--d) * 0.09s); }
@keyframes flip { 0% { transform: rotateX(0); } 45% { transform: rotateX(-90deg); } 100% { transform: rotateX(0); } }
.grid.cracked { animation: crack-glow .9s ease; }
@keyframes crack-glow { 0% { filter: brightness(1); } 25% { filter: brightness(1.5) drop-shadow(0 0 24px rgba(52,224,161,0.6)); } 100% { filter: brightness(1); } }
.play.bust { animation: bust-shake .5s ease; }
@keyframes bust-shake { 10%,90% { transform: translateX(-3px); } 30%,70% { transform: translateX(5px); } 50% { transform: translateX(-6px); } }
.shake { animation: shake .4s ease; }
@keyframes shake { 10%,90% { transform: translateX(-2px); } 30%,70% { transform: translateX(4px); } 50% { transform: translateX(-5px); } }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .home-inner { grid-template-columns: 1fr; text-align: center; }
  .home-inner .dial { order: -1; }
  .lede { margin-left: auto; margin-right: auto; }
  .cfg-row { justify-content: center; }
  .crew-names { justify-content: center; }
  .cta { align-self: center; }
  .play { grid-template-columns: 1fr; }
  /* board + keyboard first so the keyboard is reachable without scrolling;
     the crew/status panel sits just below for a quick glance. */
  .crew { order: 2; margin-top: 16px; padding: 12px; }
  .crew h3 { margin-bottom: 8px; }
  .crew-cards { flex-direction: row; flex-wrap: wrap; }
  .crew-card { flex: 1 1 130px; padding: 9px 11px; }
  .crew-loot { font-size: 16px; margin: 2px 0 6px; }
  .feed-wrap { display: none; }
}
@media (max-width: 430px) {
  .key { height: 46px; font-size: 13px; }
  .topbar { gap: 8px; padding-left: 10px; padding-right: 10px; }
  .topbar-actions { gap: 5px; }
  .topbar-actions .tbtn { padding: 7px 8px; font-size: 9.5px; letter-spacing: 0.02em; }
  .brand { font-size: 17px; letter-spacing: 0.06em; }
  .brand-mark { width: 20px; height: 20px; }
}

/* ---------- touch + mobile polish ---------- */
html, body { overflow-x: hidden; }
button, .key, .seg-opt, .tile, .shop-item, .target-opt, .lobby-seat { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.key, .tile, .seg-opt, .btn, .brand, .tbtn, .crew-card, .vault-label, .rc-code { -webkit-user-select: none; user-select: none; }
.topbar { padding-top: max(14px, env(safe-area-inset-top)); }
.kb { padding-bottom: env(safe-area-inset-bottom); }
.toast { bottom: calc(26px + env(safe-area-inset-bottom)); }
@media (max-width: 600px) {
  .key { height: 48px; }
  .tile { width: clamp(40px, 12.5vw, 52px); }
  .grid { gap: 6px; margin-bottom: 10px; }
  .grid-row { gap: 6px; }
  .vault-head { gap: 10px; margin-bottom: 10px; }
  .vault-label { font-size: 22px; }
  .probe-hint { font-size: 11px; margin-bottom: 8px; min-height: 18px; }
  .turn-chip { order: 3; }
  .screen.play { padding-top: 14px; }
  /* keep the three top-bar buttons fitting once the trophy reads "LEADERBOARD" */
  .topbar { padding-left: 12px; padding-right: 12px; }
  .topbar-actions { gap: 6px; }
  .topbar-actions .tbtn { padding: 8px 8px; font-size: 10px; letter-spacing: 0.06em; }
  .brand { font-size: 18px; letter-spacing: 0.12em; }
  .brand-mark { width: 22px; height: 22px; }
}

/* ---------- a11y: focus + reduced motion ---------- */
:focus-visible { outline: 2px solid var(--hit); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .dial--big .dial-knob { animation: none; }
}
