/* ============================================================
   BensBenchmark
   ============================================================ */

:root {
  --bg: #ffffff;
  --bg-tint: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f2f2f0;
  --border: #dcdcd8;
  --border-mid: #b8b8b2;
  --ink: #121212;
  --text: #121212;
  --text-2: #5a5a58;
  --muted: #8d8d88;
  --accent: #121212;
  --accent-text: #ffffff;
  --pop: #5a7dd4;

  --green: #6aaa64;
  --yellow: #c9b458;
  --grey: #a8a8a3;
  --key-used: #b4b4ae;
  --key-used-text: #ffffff;

  --good: #3a8a4a;
  --good-soft: #eaf3ea;
  --bad: #c0392b;
  --bad-soft: #fbeceb;
  --warn: #b8860b;
  --warn-soft: #fdf5e3;

  --radius: 6px;
  --radius-lg: 10px;
  --pill: 100px;
  --ease: cubic-bezier(.25, .46, .35, 1);
  --ease-soft: cubic-bezier(.4, 0, .2, 1);
  --ease-in-out: cubic-bezier(.45, .05, .25, 1);
  --maxw: 1080px;

  --font: "Libre Franklin", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-display: "Zilla Slab", Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

:root[data-theme="dark"] {
  --bg: #121212;
  --bg-tint: #191919;
  --surface: #1a1a1a;
  --surface-2: #232323;
  --border: #333330;
  --border-mid: #555550;
  --ink: #f4f4f2;
  --text: #f4f4f2;
  --text-2: #b4b4b0;
  --muted: #8a8a86;
  --accent: #f4f4f2;
  --accent-text: #121212;
  --pop: #8ba6e8;
  --grey: #4a4a46;
  --key-used: #191919;
  --key-used-text: #5e5e5a;
  --good: #6aaa64;
  --good-soft: #1c2a1c;
  --bad: #e06055;
  --bad-soft: #2c1917;
  --warn: #cfa640;
  --warn-soft: #2a2213;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
::selection { background: var(--ink); color: var(--bg); }

h1, h2, h3, h4 { margin: 0; line-height: 1.12; letter-spacing: -.015em; font-weight: 700; }
p { margin: 0; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

.display { font-family: var(--font-display); font-weight: 600; letter-spacing: -.01em; }

/* ---------------- Header ---------------- */
.site-header {
  position: sticky; top: 0; z-index: 200;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease-soft);
}
.site-header.scrolled { border-bottom-color: var(--border); }
.header-inner { height: 58px; display: flex; align-items: center; gap: 6px; }

.brand {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--font-display);
  font-weight: 700; font-size: 1.12rem;
  letter-spacing: -.01em;
  margin-right: auto;
}
.brand-mark {
  width: 26px; height: 26px;
  border-radius: 5px;
  background: var(--ink);
  color: var(--bg);
  display: grid; place-items: center;
  font-family: var(--font);
  font-size: .68rem; font-weight: 800;
  transition: transform .6s var(--ease);
}
.brand:hover .brand-mark { transform: rotate(-10deg) scale(1.1); }

.nav { display: flex; align-items: center; gap: 2px; }
.nav a {
  position: relative;
  padding: 7px 11px;
  font-size: .89rem; font-weight: 500;
  color: var(--text-2);
  transition: color .2s;
}
.nav a::after {
  content: "";
  position: absolute; left: 11px; right: 11px; bottom: 3px;
  height: 1.5px; background: var(--ink);
  transform: scaleX(0); transform-origin: left;
  transition: transform .46s var(--ease);
}
.nav a:hover { color: var(--text); }
.nav a:hover::after { transform: scaleX(1); }
.nav a.active { color: var(--text); font-weight: 600; }
.nav a.active::after { transform: scaleX(1); }

.header-actions { display: flex; align-items: center; gap: 7px; margin-left: 10px; }
.icon-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--pill);
  cursor: pointer;
  transition: border-color .34s var(--ease), transform .34s var(--ease), background .34s var(--ease);
}
.icon-btn:hover { border-color: var(--ink); transform: translateY(-1px); }
.icon-btn:active { transform: scale(.93); }
.icon-btn svg { width: 16px; height: 16px; }
.nav-toggle { display: none; }

/* ---------------- Buttons ---------------- */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 11px 22px;
  border: 1.5px solid var(--ink);
  border-radius: var(--pill);
  background: var(--ink);
  color: var(--bg);
  font-size: .9rem; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  overflow: hidden;
  isolation: isolate;
  transition: transform .34s var(--ease), color .34s var(--ease-soft), background .34s var(--ease-soft), border-color .34s var(--ease), opacity .3s;
}
.btn > * { position: relative; z-index: 1; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }

.btn-ghost { background: transparent; color: var(--ink); border-color: var(--border-mid); }
.btn-ghost::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--ink);
  transform: scaleY(0); transform-origin: bottom;
  transition: transform .34s var(--ease);
}
.btn-ghost:hover { color: var(--bg); border-color: var(--ink); }
.btn-ghost:hover::before { transform: scaleY(1); }

.btn-quiet { background: transparent; color: var(--text-2); border-color: transparent; }
.btn-quiet:hover { background: var(--surface-2); color: var(--text); transform: none; }

.btn-sm { padding: 7px 15px; font-size: .82rem; border-width: 1.2px; }
.btn-lg { padding: 14px 28px; font-size: .98rem; }
.btn-block { width: 100%; }

/* ---------------- Hero ---------------- */
.hero { padding: clamp(46px, 8vw, 84px) 0 clamp(26px, 4vw, 44px); text-align: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: .74rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted);
}
.dot-live {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--good);
  animation: pulse 2.2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 55%, transparent); }
  70% { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.top-stats {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; flex-wrap: wrap;
  font-size: .82rem; color: var(--muted);
  margin-bottom: 18px;
}
.top-stats b { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.top-stats .dot-live { margin-right: 5px; }
.sep-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--border-mid); }

.hero h1 {
  margin: 16px 0 0;
  font-family: var(--font-display);
  font-size: clamp(2.7rem, 8vw, 4.4rem);
  font-weight: 700;
  letter-spacing: -.025em;
  line-height: 1;
}
.hero-sub {
  margin: 16px auto 0;
  max-width: 44ch;
  font-size: clamp(1rem, 2vw, 1.1rem);
  color: var(--text-2);
}
.hero-cta { margin-top: 26px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* scroll cue */
.scroll-cue {
  display: grid; place-items: center; gap: 6px;
  margin: 34px auto 0;
  width: fit-content;
  cursor: pointer;
  color: var(--muted);
  font-size: .72rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  background: none; border: 0;
  transition: color .34s var(--ease);
}
.scroll-cue:hover { color: var(--text); }
.scroll-cue svg { width: 20px; height: 20px; animation: bob 1.9s ease-in-out infinite; }
.scroll-cue:hover svg { animation-duration: .9s; }
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* ---------------- Sections ---------------- */
.section { padding: clamp(40px, 6vw, 70px) 0; }
.section-tint { background: var(--bg-tint); }
.section-head { margin-bottom: 26px; display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; }
.section-head > div { flex: 1 1 300px; }
.kicker {
  font-size: .71rem; font-weight: 800;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 8px;
}
.section-head h2 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.4vw, 2.1rem);
  font-weight: 700;
}
.section-head p { margin-top: 7px; color: var(--text-2); max-width: 48ch; font-size: .94rem; }
.rule { height: 1px; background: var(--border); border: 0; margin: 0; }

/* ---------------- Game cards ---------------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }

.game-card {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color .45s var(--ease), transform .5s var(--ease), box-shadow .5s var(--ease);
}
.game-card:hover {
  border-color: var(--ink);
  transform: translateY(-4px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .07);
}
.game-card .top { display: block; padding: 20px 20px 16px; }
.game-glyph {
  width: 42px; height: 42px;
  border-radius: 9px;
  display: grid; place-items: center;
  font-size: 1.2rem;
  background: color-mix(in srgb, var(--tile, var(--pop)) 15%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--tile, var(--pop)) 30%, transparent);
  transition: transform .6s var(--ease), background .45s var(--ease);
}
.game-card:hover .game-glyph { transform: translateY(-2px) rotate(-7deg) scale(1.09); }
.game-card h3 { margin-top: 14px; font-size: 1.08rem; font-weight: 700; letter-spacing: -.012em; }
.game-card p { margin-top: 5px; color: var(--text-2); font-size: .88rem; }

.game-foot {
  margin-top: auto;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px 12px 20px;
  border-top: 1px solid var(--border);
  font-size: .82rem;
}
.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: var(--pill);
  font-size: .68rem; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase;
  border: 1px solid color-mix(in srgb, var(--tile, var(--pop)) 34%, transparent);
  color: color-mix(in srgb, var(--tile, var(--pop)) 75%, var(--text));
  background: color-mix(in srgb, var(--tile, var(--pop)) 9%, transparent);
}
.best-chip { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--text); font-size: .8rem; }
.crown { margin-right: 4px; font-size: .92em; line-height: 1; }

.play-link {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 5px;
  font-weight: 700; font-size: .83rem;
}
.play-link svg { width: 13px; height: 13px; transition: transform .45s var(--ease); }
.game-card:hover .play-link svg { transform: translateX(5px); }

/* expander */
.card-expand {
  width: 34px; height: 30px;
  display: grid; place-items: center;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--pill);
  cursor: pointer;
  color: var(--text-2);
  transition: border-color .34s var(--ease), color .34s var(--ease), background .34s var(--ease);
}
.card-expand svg { width: 14px; height: 14px; transition: transform .52s var(--ease); }
.card-expand:hover { border-color: var(--ink); color: var(--text); }
.card-expand[aria-expanded="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.card-expand[aria-expanded="true"] svg { transform: rotate(180deg); }

.modes {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .55s var(--ease-in-out);
  background: var(--bg-tint);
  border-top: 1px solid transparent;
}
.modes.open { grid-template-rows: 1fr; border-top-color: var(--border); }
.modes-inner { overflow: hidden; }
.modes-pad { padding: 15px 18px 17px; }
.modes-label {
  font-size: .68rem; font-weight: 800;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 9px;
}
.modes-label + .modes-label { margin-top: 15px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 13px;
  border: 1px solid var(--border-mid);
  border-radius: var(--pill);
  background: var(--surface);
  font-size: .81rem; font-weight: 600;
  cursor: pointer;
  transition: transform .34s var(--ease), background .34s var(--ease), color .34s var(--ease), border-color .34s var(--ease);
}
.chip:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); transform: translateY(-2px); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip small { opacity: .62; font-weight: 500; }
.chip.done { border-style: dashed; opacity: .68; }

/* ---------------- Stats ---------------- */
.stat-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.stat-cell { padding: 20px 4px; text-align: center; border-right: 1px solid var(--border); }
.stat-cell:last-child { border-right: 0; }
.stat-num {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.3rem);
  font-weight: 700; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; line-height: 1;
}
.stat-label { margin-top: 6px; font-size: .78rem; color: var(--muted); letter-spacing: .01em; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px; margin-bottom: 20px; }
.stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 12px; text-align: center;
  transition: border-color .36s var(--ease);
}
.stat-box:hover { border-color: var(--border-mid); }
.stat-box .v { font-size: 1.28rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat-box .k { font-size: .67rem; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; margin-top: 2px; font-weight: 600; }
.stat-box.hl .v { color: var(--pop); }

/* ---------------- Steps ---------------- */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0; border-top: 1px solid var(--border); }
.step { padding: 24px 20px; border-right: 1px solid var(--border); text-align: center; }
.step:last-child { border-right: 0; }
.step-n {
  font-family: var(--font-display);
  font-size: 1.5rem; font-weight: 700; color: var(--muted);
  transition: color .36s var(--ease);
}
.step:hover .step-n { color: var(--ink); }
.step h3 { justify-content: center; }
.step h3 { margin-top: 6px; font-size: 1rem; }
.step p { margin-top: 5px; color: var(--text-2); font-size: .89rem; }

/* ---------------- Forms ---------------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .8rem; font-weight: 700; margin-bottom: 6px; }
.input, textarea.input, select.input {
  width: 100%;
  padding: 11px 13px;
  font: inherit; font-size: .94rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 11%, transparent); }
.input::placeholder { color: var(--muted); }
textarea.input { resize: vertical; min-height: 104px; }
.hint { font-size: .79rem; color: var(--muted); margin-top: 6px; }

.notice {
  padding: 10px 13px; border-radius: var(--radius);
  font-size: .86rem; font-weight: 600; margin-bottom: 13px;
  border: 1px solid transparent;
  animation: slideDown .3s var(--ease);
}
.notice-bad { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 26%, transparent); }
.notice-good { background: var(--good-soft); color: var(--good); border-color: color-mix(in srgb, var(--good) 26%, transparent); }
@keyframes slideDown { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(20px, 3.5vw, 30px);
}

/* ---------------- Tabs ---------------- */
.tabs { display: inline-flex; gap: 4px; padding: 3px; background: var(--surface-2); border-radius: var(--pill); }
.tabs button {
  padding: 7px 15px; border: 0; background: transparent;
  border-radius: var(--pill);
  font-size: .84rem; font-weight: 600; color: var(--text-2);
  cursor: pointer;
  transition: background .38s var(--ease), color .3s var(--ease);
}
.tabs button:hover { color: var(--text); }
.tabs button.on { background: var(--ink); color: var(--bg); }

/* ---------------- Footer ---------------- */
.site-footer { border-top: 1px solid var(--border); padding: 40px 0 28px; margin-top: 30px; }
.footer-top { display: flex; gap: 36px; flex-wrap: wrap; justify-content: space-between; }
.footer-brand { max-width: 240px; }
.footer-brand p { margin-top: 10px; color: var(--muted); font-size: .86rem; }
.footer-cols { display: flex; gap: 46px; flex-wrap: wrap; }
.footer-col h4 { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: 10px; font-weight: 800; }
.footer-col a {
  display: block; padding: 3px 0;
  font-size: .87rem; color: var(--text-2);
  transition: color .3s var(--ease), transform .36s var(--ease);
}
.footer-col a:hover { color: var(--text); transform: translateX(4px); }
.footer-bottom {
  margin-top: 32px; padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex; gap: 14px; justify-content: space-between; align-items: center; flex-wrap: wrap;
  font-size: .82rem; color: var(--muted);
}
.player-count {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .85rem; color: var(--text-2);
}
.player-count b { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 700; }

/* ---------------- Reveal ---------------- */
.reveal {
  opacity: 0; transform: translateY(16px);
  transition: opacity .8s var(--ease), transform .8s var(--ease);
  transition-delay: var(--d, 0ms);
}
.reveal.in { opacity: 1; transform: none; }
.reveal-scale { transform: translateY(12px) scale(.985); }

.progress-bar {
  position: fixed; top: 0; left: 0; height: 2px;
  background: var(--ink); z-index: 300; width: 0;
  transition: width .1s linear; pointer-events: none;
}

/* ---------------- Game shell ---------------- */
.game-shell { padding: 26px 0 54px; }
.game-head { display: flex; align-items: flex-start; gap: 15px; flex-wrap: wrap; margin-bottom: 18px; }
.game-head .glyph {
  width: 40px; height: 40px; border-radius: 9px;
  display: grid; place-items: center; font-size: 1.15rem;
  background: color-mix(in srgb, var(--tile, var(--pop)) 15%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--tile, var(--pop)) 30%, transparent);
}
.game-head h1 { font-family: var(--font-display); font-size: clamp(1.5rem, 3.6vw, 1.95rem); font-weight: 700; }
.game-head p { color: var(--text-2); font-size: .9rem; margin-top: 3px; }
.game-head-main { flex: 1 1 260px; }
.game-head-actions { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }

.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .84rem; color: var(--muted); font-weight: 600;
  margin-bottom: 14px; white-space: nowrap;
  transition: color .3s var(--ease), transform .36s var(--ease);
}
.back-link:hover { color: var(--text); transform: translateX(-3px); }
.back-link svg { width: 14px; height: 14px; flex: 0 0 auto; }

.mode-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 11px 14px; margin-bottom: 18px;
  background: var(--bg-tint);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.mode-bar .lbl { font-size: .7rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.mode-bar .sep { width: 1px; height: 18px; background: var(--border); }

.board-area {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(16px, 3vw, 26px);
}
.msg-line { min-height: 24px; text-align: center; font-size: .89rem; font-weight: 600; color: var(--text-2); margin-top: 11px; }

.daily-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 16px; margin-bottom: 16px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--tile, var(--pop));
  border-radius: var(--radius);
  background: var(--surface);
  font-size: .88rem;
}
.daily-banner b { font-weight: 700; }
.countdown-num { font-variant-numeric: tabular-nums; font-weight: 700; }

/* ---------------- Toast / modal ---------------- */
.toast-wrap {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 400; display: flex; flex-direction: column; gap: 7px; align-items: center; pointer-events: none;
}
.toast {
  padding: 10px 18px; background: var(--ink); color: var(--bg);
  border-radius: var(--pill); font-size: .86rem; font-weight: 600;
  animation: toastIn .36s var(--ease);
}
.toast.out { animation: toastOut .28s var(--ease-soft) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.95); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-6px); } }

.modal-back {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(18, 18, 18, .46);
  display: grid; place-items: center; padding: 18px;
  animation: fadeIn .22s var(--ease-soft);
}
.modal-back.closing { animation: fadeOut .18s var(--ease-soft) forwards; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; } }
.modal {
  width: 100%; max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
  animation: modalIn .34s var(--ease);
}
.modal-wide { max-width: 520px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }
.modal h2 { font-family: var(--font-display); font-size: 1.28rem; font-weight: 700; }
.modal p.sub { color: var(--text-2); font-size: .9rem; margin-top: 6px; }
.modal-close {
  float: right; width: 28px; height: 28px;
  border: 0; background: var(--surface-2); border-radius: 50%;
  cursor: pointer; display: grid; place-items: center; color: var(--muted);
  transition: background .34s var(--ease), color .34s var(--ease), transform .4s var(--ease);
}
.modal-close:hover { background: var(--ink); color: var(--bg); transform: rotate(90deg); }

/* ---------------- Keyboard ---------------- */
.keyboard { display: grid; gap: 5px; margin-top: 16px; user-select: none; }
.krow { display: flex; gap: 4px; justify-content: center; }
.key {
  flex: 1 1 auto; min-width: 0; max-width: 42px; height: 50px;
  border: 0; border-radius: 4px;
  background: var(--surface-2);
  font-size: .84rem; font-weight: 700; text-transform: uppercase;
  cursor: pointer; display: grid; place-items: center;
  transition: transform .16s var(--ease), background .4s var(--ease), color .4s var(--ease), opacity .4s var(--ease);
}
.key:hover { background: var(--border); }
.key:active { transform: scale(.9); }
.key.wide { max-width: 68px; flex: 1.5 1 auto; font-size: .68rem; }
.key.correct { background: var(--green); color: #fff; }
.key.present { background: var(--yellow); color: #fff; }
.key.absent { background: var(--key-used); color: var(--key-used-text); }

/* ---------------- Leaderboard ---------------- */
.lb-table { width: 100%; border-collapse: collapse; font-size: .89rem; }
.lb-table th {
  text-align: left; font-size: .67rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); font-weight: 800; padding: 0 8px 8px; border-bottom: 1px solid var(--border);
}
.lb-table td { padding: 10px 8px; border-bottom: 1px solid var(--border); transition: background .32s var(--ease); }
.lb-table tr:last-child td { border-bottom: 0; }
.lb-table tbody tr:hover td { background: var(--surface-2); }
.lb-table td.rank { width: 34px; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 700; }
.lb-table td.score { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.lb-table tr.me td { background: var(--surface-2); font-weight: 700; }

.empty { text-align: center; padding: 30px 18px; color: var(--muted); font-size: .89rem; }

/* ---------------- Party / versus ---------------- */
.code-display {
  font-family: var(--font-mono);
  font-size: clamp(2.2rem, 9vw, 3.4rem);
  font-weight: 700; letter-spacing: .24em;
  text-align: center; padding: 6px 0 0 .24em;
}
.code-input {
  font-family: var(--font-mono);
  font-size: 1.6rem; font-weight: 700;
  letter-spacing: .34em; text-align: center;
  text-transform: uppercase;
  padding: 14px 10px 14px calc(10px + .34em);
}
.player-list { display: grid; gap: 7px; }
.player-row {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  animation: slideIn .34s var(--ease);
  transition: border-color .36s var(--ease), transform .36s var(--ease);
}
.player-row:hover { border-color: var(--border-mid); }
@keyframes slideIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
.player-row.you { border-color: var(--ink); }
.avatar-sm {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ink); color: var(--bg);
  font-size: .72rem; font-weight: 800; flex: 0 0 auto;
}
.player-row .nm { font-weight: 600; font-size: .92rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge {
  font-size: .64rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  padding: 3px 8px; border-radius: var(--pill);
  border: 1px solid var(--border-mid); color: var(--muted);
}
.badge.host { border-color: var(--ink); color: var(--ink); }
.badge.done { border-color: var(--good); color: var(--good); }

.race-bar { height: 6px; background: var(--surface-2); border-radius: var(--pill); overflow: hidden; flex: 1; min-width: 60px; }
.race-bar i { display: block; height: 100%; background: var(--ink); border-radius: var(--pill); width: 0; transition: width .6s var(--ease); }
.race-bar.me i { background: var(--pop); }

.podium { display: grid; gap: 8px; }
.podium-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px;
  border: 1px solid var(--border); border-radius: var(--radius);
  animation: popRow .4s var(--ease) both;
}
@keyframes popRow { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: none; } }
.podium-row.first { border-color: var(--ink); border-width: 2px; }
.podium-pos { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; width: 28px; }

/* ---------------- Utilities ---------------- */
.mono { font-family: var(--font-mono); }
.center { text-align: center; }
.muted { color: var(--muted); }
.row { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 11px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 32px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

/* ---------------- Responsive ---------------- */
@media (max-width: 800px) {
  .nav {
    position: fixed; inset: 58px 0 auto;
    flex-direction: column; align-items: stretch; gap: 0;
    padding: 10px 18px 16px;
    background: var(--bg); border-bottom: 1px solid var(--border);
    transform: translateY(-10px); opacity: 0; pointer-events: none;
    transition: opacity .26s var(--ease-soft), transform .3s var(--ease);
  }
  .nav.open { opacity: 1; transform: none; pointer-events: auto; }
  .nav a { padding: 12px 4px; font-size: 1rem; border-bottom: 1px solid var(--border); }
  .nav a::after { display: none; }
  .nav-toggle { display: grid; }
  .wrap { padding: 0 16px; }
  .header-inner { gap: 5px; }
  .brand { min-width: 0; font-size: 1rem; }
  .brand > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .header-actions { gap: 5px; margin-left: 4px; }
  #bb-account .btn { max-width: 90px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .step { border-right: 0; border-bottom: 1px solid var(--border); }
  .step:last-child { border-bottom: 0; }
  .footer-cols { gap: 30px; }
}
@media (max-width: 400px) {
  .brand > span:last-child { max-width: 104px; }
  #bb-account .btn { max-width: 74px; padding-left: 11px; padding-right: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}
