:root {
  --cer: #2274A5; --org: #F75C03; --amb: #F1C40F; --ber: #D90368; --emr: #00CC66;
  --bg: #0B0E13; --panel: #131821; --panel-2: #1A202B; --line: rgba(255,255,255,.09);
  --ink: #F3F5F8; --mute: #AAB2BD; --dim: #7D8794;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "Space Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fs-words: clamp(21px, 2.3vw, 30px);
  --radius: 18px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  color: var(--ink); font-family: var(--sans);
  background:
    radial-gradient(1100px 560px at 8% -12%, rgba(34,116,165,.30), transparent 62%),
    radial-gradient(900px 520px at 108% 4%, rgba(217,3,104,.15), transparent 60%),
    radial-gradient(800px 480px at 50% 120%, rgba(0,204,102,.07), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; }
kbd {
  font-family: var(--mono); font-size: .78em; padding: .1em .45em; border-radius: 6px;
  background: var(--panel-2); border: 1px solid var(--line); border-bottom-width: 2px; color: var(--ink);
}
:focus-visible { outline: 3px solid var(--amb); outline-offset: 3px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.palette-strip { display: flex; height: 5px; }
.palette-strip i { flex: 1; }
.palette-strip i:nth-child(1) { background: var(--cer); }
.palette-strip i:nth-child(2) { background: var(--org); }
.palette-strip i:nth-child(3) { background: var(--amb); }
.palette-strip i:nth-child(4) { background: var(--ber); }
.palette-strip i:nth-child(5) { background: var(--emr); }

/* Header */
.top {
  width: min(1080px, 100% - 40px); margin: 22px auto 0;
  display: flex; align-items: center; gap: 18px 24px; flex-wrap: wrap;
}
.logo {
  font-family: var(--sans); font-weight: 700; font-size: 34px; letter-spacing: -.02em;
  color: var(--ink); text-decoration: none; display: inline-flex; align-items: flex-start; padding: 0 4px 14px 0;
  line-height: 1;
}
.logo-fall { display: inline-flex; }
.logo-fall span { display: inline-block; transition: transform .5s cubic-bezier(.3,1.6,.5,1); }
.logo-fall span:nth-child(1) { color: var(--org); transform: rotate(4deg); }
.logo-fall span:nth-child(2) { color: var(--amb); transform: translateY(3px) rotate(-8deg); margin-left: 1px; }
.logo-fall span:nth-child(3) { color: var(--ber); transform: translateY(7px) rotate(12deg); margin-left: 3px; }
.logo-fall span:nth-child(4) { color: var(--emr); transform: translateY(13px) rotate(-24deg); margin-left: 4px; }
.logo:hover .logo-fall span { transform: none; }

.controls { display: flex; gap: 12px; flex-wrap: wrap; margin-left: auto; }
.seg {
  display: inline-flex; align-items: center; gap: 2px; padding: 4px;
  background: rgba(19,24,33,.8); border: 1px solid var(--line); border-radius: 999px;
}
.seg-label { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--dim); padding: 0 8px 0 10px; }
.seg button {
  border: 0; background: transparent; color: var(--mute); cursor: pointer;
  font-size: 14px; font-weight: 500; padding: 8px 13px; border-radius: 999px; min-height: 36px;
  transition: background .2s, color .2s;
}
.seg button:hover { color: var(--ink); background: rgba(255,255,255,.06); }
.seg button[aria-pressed="true"] { background: var(--cer); color: #fff; }
.seg button[data-target][aria-pressed="true"] { background: var(--amb); color: #111; }
.pb {
  margin: 0; font-size: 13px; color: var(--mute); padding: 8px 14px; border-radius: 999px;
  border: 1px dashed rgba(241,196,15,.35); white-space: nowrap;
}
.pb b { color: var(--amb); }
.top-right { display: flex; align-items: center; gap: 10px; }
.lb-open {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer; white-space: nowrap;
  font-weight: 700; font-size: 14px; padding: 7px 14px 7px 10px; border-radius: 999px; min-height: 36px;
  color: #111; background: linear-gradient(135deg, var(--amb), var(--org)); border: 0;
  box-shadow: 0 6px 18px rgba(247,92,3,.28); transition: transform .15s, box-shadow .2s;
}
.lb-open svg { width: 20px; height: 20px; background: #0B0E13; border-radius: 50%; padding: 2px; }
.lb-open:hover { transform: translateY(-1px) rotate(-1.5deg); box-shadow: 0 10px 24px rgba(247,92,3,.38); }

/* Main */
.main { width: min(1080px, 100% - 40px); margin: 0 auto; flex: 1; padding: 28px 0 18px; }

.hud {
  display: grid; grid-template-columns: repeat(4, minmax(70px, auto)) 1fr 1fr; gap: 10px 26px;
  align-items: end; margin-bottom: 22px;
}
.stat { display: flex; flex-direction: column; }
.stat-val { font-family: var(--mono); font-weight: 600; font-size: 34px; line-height: 1.05; font-variant-numeric: tabular-nums; }
.stat:nth-child(1) .stat-val { color: var(--amb); }
.stat-lbl { font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: .12em; margin-top: 4px; }
.meter-head { display: flex; justify-content: space-between; font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--dim); margin-bottom: 8px; }
.meter-head b { font-family: var(--mono); color: var(--ink); letter-spacing: 0; font-size: 14px; }
.combo .meter-head b { color: var(--org); }
.combo.bump .meter-head b { animation: bump .45s cubic-bezier(.3,1.8,.5,1); }
.bar { height: 10px; border-radius: 99px; background: var(--panel-2); overflow: hidden; border: 1px solid var(--line); }
.bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--amb), var(--org)); transition: width .15s ease-out; }
.combo.max .bar i { background: linear-gradient(90deg, var(--org), var(--ber), var(--org)); background-size: 200% 100%; animation: shimmer 1s linear infinite; }
.pips { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; height: 10px; }
.pips i { border-radius: 3px; background: var(--emr); transition: background .25s, transform .25s, opacity .25s; }
.stability.warn .pips i:not(.lost) { background: var(--amb); }
.stability.danger .pips i:not(.lost) { background: var(--ber); }
.pips i.lost { background: var(--panel-2); transform: translateY(4px) rotate(14deg); opacity: .6; }
.pips i.just-lost { animation: pipdrop .4s ease-in; }

/* Arena */
.arena {
  position: relative; padding: 30px 32px; border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(26,32,43,.75), rgba(19,24,33,.75));
  border: 1px solid var(--line); box-shadow: 0 20px 60px rgba(0,0,0,.35);
  cursor: text;
}
.arena.unstable .words-wrap { animation: wobble 1.4s ease-in-out infinite; }
.arena.collapsed .words-wrap { visibility: hidden; }
.words-wrap { height: calc(var(--fs-words) * 1.65 * 3); overflow: hidden; }
.words {
  position: relative; display: flex; flex-wrap: wrap; column-gap: .62em;
  font-family: var(--mono); font-size: var(--fs-words); color: var(--dim);
  transition: transform .22s ease; user-select: none;
}
.word { display: flex; height: 1.65em; align-items: center; border-radius: 4px; }
.word.wrong { box-shadow: inset 0 -2px 0 rgba(217,3,104,.8); }
.ch { display: inline-block; white-space: pre; }
.ch.ok { color: var(--emr); animation: pop .2s ease-out; }
.ch.bad { color: #FF5FA2; background: rgba(217,3,104,.22); border-radius: 3px; animation: shake .3s ease-in-out; text-decoration: underline 2px var(--ber); text-underline-offset: 4px; }
.ch.extra { color: #FF5FA2; opacity: .8; text-decoration: line-through 2px var(--ber); animation: shake .3s ease-in-out; }
.ch.miss { text-decoration: underline wavy rgba(217,3,104,.7); text-underline-offset: 5px; }
.caret {
  position: absolute; left: 0; top: 0; width: 3px; height: 1.15em; border-radius: 2px;
  background: var(--amb); box-shadow: 0 0 12px rgba(241,196,15,.7);
  transition: left .09s ease-out, top .14s ease-out; pointer-events: none; z-index: 2;
}
.arena:not(.running) .caret { animation: blink 1s steps(1) infinite; }
.hidden-input {
  position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0;
  font-size: 16px; border: 0; padding: 0; caret-color: transparent; pointer-events: none;
}
.focus-hint {
  position: absolute; inset: 0; display: grid; place-items: center; border-radius: var(--radius);
  background: rgba(11,14,19,.62); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.focus-hint span { background: var(--panel-2); border: 1px solid var(--line); padding: 10px 18px; border-radius: 999px; color: var(--ink); }
.arena.blurred .focus-hint { opacity: 1; pointer-events: auto; }
.hint-start { margin: 18px 0 0; font-size: 14px; color: var(--mute); transition: opacity .3s; }
.arena.running .hint-start { opacity: 0; }

.combo-pop {
  position: absolute; z-index: 3; pointer-events: none; font-family: var(--sans); font-weight: 700; font-size: 18px;
  color: var(--org); text-shadow: 0 2px 10px rgba(247,92,3,.5); animation: floatup .9s ease-out forwards; white-space: nowrap;
}

.rules { color: var(--mute); font-size: 15px; margin: 16px 2px 0; }
.rules b { color: var(--ink); font-weight: 600; }

/* Results */
.results {
  position: relative; z-index: 26; max-width: 760px; margin: 0 auto; padding: 30px 32px 26px;
  border-radius: 22px; background: rgba(19,24,33,.94); border: 1px solid var(--line);
  box-shadow: 0 30px 80px rgba(0,0,0,.5); overflow: hidden;
  animation: rise .5s cubic-bezier(.2,1.2,.4,1);
}
.results::before { content: ""; position: absolute; inset: 0 0 auto; height: 5px; background: linear-gradient(90deg, var(--cer), var(--org), var(--amb), var(--ber), var(--emr)); }
.r-kicker { margin: 0; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.results h2 { margin: 6px 0 4px; font-size: clamp(34px, 5vw, 48px); line-height: 1; letter-spacing: -.02em; outline: none; }
.results.pass h2 { color: var(--emr); }
.results.fail h2 { color: #FF4F9A; }
.r-reason { margin: 6px 0 0; color: var(--mute); font-size: 16px; }
.badge-pb { display: inline-block; margin-top: 12px; padding: 6px 12px; border-radius: 999px; background: var(--amb); color: #111; font-weight: 700; font-size: 13px; animation: bump .6s cubic-bezier(.3,1.8,.5,1); }
.r-grid { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; margin-top: 22px; }
.r-big { font-family: var(--mono); font-weight: 600; font-size: 76px; line-height: .9; color: var(--amb); display: flex; flex-direction: column; }
.r-big small { font-size: 14px; color: var(--dim); letter-spacing: .14em; text-transform: uppercase; margin-top: 6px; font-family: var(--sans); }
.r-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 18px; margin: 0; }
.r-stats dt { font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: .12em; }
.r-stats dd { margin: 4px 0 0; font-family: var(--mono); font-size: 20px; font-weight: 600; }
.spark { margin: 22px 0 0; padding: 14px 16px 10px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); }
.spark figcaption { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: .12em; margin-bottom: 8px; }
.legend { display: inline-flex; gap: 6px; align-items: center; text-transform: none; letter-spacing: 0; }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-left: 6px; }
.lg-line { background: linear-gradient(90deg, var(--cer), var(--emr)); }
.lg-target { background: repeating-linear-gradient(90deg, var(--amb) 0 4px, transparent 4px 7px); }
.lg-err { width: 7px !important; height: 7px !important; border-radius: 50% !important; background: var(--ber); }
.spark svg { display: block; width: 100%; height: 90px; overflow: visible; }
.r-actions { display: flex; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.btn {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); cursor: pointer;
  font-weight: 600; font-size: 15px; padding: 12px 20px; border-radius: 12px; min-height: 46px;
  display: inline-flex; align-items: center; gap: 10px; transition: transform .15s, background .2s;
}
.btn:hover { transform: translateY(-1px); background: #222a37; }
.btn.primary { background: var(--org); border-color: var(--org); color: #111; }
.btn.primary:hover { background: #ff6d1a; }
.btn.primary kbd { background: rgba(0,0,0,.18); border-color: rgba(0,0,0,.2); color: #111; }
.poke-hint { margin: 14px 0 0; font-size: 13px; color: var(--dim); }
.btn.no-kbd kbd { display: none; }
.lb-btn { border-color: rgba(241,196,15,.35); }
.lb-btn:hover { border-color: var(--amb); }

/* Claim your spot */
.claim {
  position: relative; margin: 22px 0 0; padding: 18px 18px 14px; border-radius: 16px;
  background:
    linear-gradient(var(--panel-2), var(--panel-2)) padding-box,
    linear-gradient(120deg, var(--cer), var(--emr), var(--amb), var(--org), var(--ber)) border-box;
  border: 2px solid transparent; animation: rise .45s cubic-bezier(.2,1.2,.4,1);
}
.claim-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.claim-title { margin: 0; font-size: 24px; letter-spacing: -.01em; }
.claim-title span:nth-child(1) { color: var(--amb); }
.claim-title span:nth-child(2) { color: var(--org); }
.claim-title span:nth-child(3) { color: var(--ber); }
.claim-sub { margin: 0; color: var(--ink); font-weight: 600; }
.claim.gold .claim-sub { color: var(--amb); }
.claim-row { display: flex; gap: 10px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.claim-label { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--mute); width: 100%; }
#nick {
  flex: 1 1 180px; min-width: 0; min-height: 46px; padding: 10px 14px; border-radius: 12px;
  font: 600 18px var(--mono); color: var(--ink); background: var(--bg); border: 2px solid rgba(255,255,255,.14);
  transition: border-color .2s, box-shadow .2s;
}
#nick::placeholder { color: var(--dim); font-weight: 400; }
#nick:focus { outline: none; border-color: var(--amb); box-shadow: 0 0 0 4px rgba(241,196,15,.22); }
.claim-btn { background: var(--emr); border-color: var(--emr); color: #06210f; }
.claim-btn:hover { background: #12dd78; }
.claim-btn:disabled { opacity: .6; cursor: progress; transform: none; }
.claim-help { margin: 8px 0 0; font-size: 12.5px; color: var(--dim); }
.claim-msg { margin: 6px 0 0; font-size: 14px; min-height: 1.2em; color: var(--mute); }
.claim-msg.err { color: #FF6BA8; font-weight: 600; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.lb-note { margin: 18px 0 0; padding: 10px 14px; border-radius: 12px; font-size: 14.5px; font-weight: 600; background: var(--bg); border: 1px dashed var(--line); color: var(--mute); }
.lb-note.win { color: var(--emr); border-color: rgba(0,204,102,.45); }
.lb-note.miss { color: var(--amb); border-color: rgba(241,196,15,.35); }
.lb-note.off { color: var(--dim); }

/* Leaderboard dialog */
.lb {
  width: min(560px, calc(100% - 24px)); max-height: min(840px, calc(100dvh - 24px)); padding: 0; border: 0; border-radius: 22px;
  color: var(--ink); background: var(--panel); box-shadow: 0 40px 120px rgba(0,0,0,.6); overflow: hidden;
}
.lb[open] { animation: rise .4s cubic-bezier(.2,1.2,.4,1); }
.lb::backdrop { background: rgba(5,7,10,.72); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); }
.lb-inner { position: relative; padding: 24px 22px 18px; max-height: inherit; overflow: auto; }
.lb-inner::before { content: ""; position: absolute; inset: 0 0 auto; height: 6px; background: linear-gradient(90deg, var(--cer), var(--org), var(--amb), var(--ber), var(--emr)); }
.lb-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lb-title { margin: 4px 0 0; font-size: 38px; line-height: 1; letter-spacing: -.02em; }
.lb-ten { display: inline-flex; }
.lb-ten span { display: inline-block; }
.lb-ten span:nth-child(1) { color: var(--org); transform: rotate(-6deg); }
.lb-ten span:nth-child(2) { color: var(--ber); transform: translateY(5px) rotate(14deg); }
.lb-close {
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel-2);
  font-size: 26px; line-height: 1; cursor: pointer; color: var(--mute);
}
.lb-close:hover { color: var(--ink); background: #222a37; }
.lb-tabs { display: flex; gap: 4px; margin: 16px 0 12px; padding: 4px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); }
.lb-tabs button {
  flex: 1; border: 0; background: transparent; color: var(--mute); cursor: pointer; font-size: 14px; font-weight: 600;
  padding: 8px 6px; border-radius: 999px; min-height: 38px; transition: background .2s, color .2s;
}
.lb-tabs button:hover { color: var(--ink); }
.lb-tabs button[aria-selected="true"] { background: var(--cer); color: #fff; }
.lb-panel { border-radius: 14px; }
.lb-cols, .lb-row { display: grid; grid-template-columns: 44px 1fr 86px 58px; align-items: center; gap: 10px; }
.lb-cols { padding: 0 12px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--dim); }
.lb-cols span:nth-child(n+3), .lb-wpm, .lb-acc { text-align: right; }
.lb-panel:has(.lb-list:empty) .lb-cols { display: none; }
.lb-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.lb-row {
  position: relative; padding: 9px 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line);
  border-left: 4px solid var(--accent, var(--cer));
}
.lb-rank {
  width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%;
  font: 700 15px var(--mono); color: var(--ink); background: rgba(255,255,255,.06);
}
.lb-name { font: 600 17px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-wpm { font: 700 20px var(--mono); color: var(--ink); }
.lb-wpm small { font: 500 11px var(--sans); color: var(--dim); text-transform: uppercase; letter-spacing: .08em; }
.lb-acc { font: 500 14px var(--mono); color: var(--mute); }
/* podium */
.lb-row.r1, .lb-row.r2, .lb-row.r3 { padding-top: 12px; padding-bottom: 12px; }
.lb-row.r1 { --accent: var(--amb); background: linear-gradient(90deg, rgba(241,196,15,.22), rgba(241,196,15,.04) 70%), var(--panel-2); border-color: rgba(241,196,15,.45); }
.lb-row.r2 { --accent: var(--ber); background: linear-gradient(90deg, rgba(217,3,104,.22), rgba(217,3,104,.04) 70%), var(--panel-2); border-color: rgba(217,3,104,.45); }
.lb-row.r3 { --accent: var(--org); background: linear-gradient(90deg, rgba(247,92,3,.22), rgba(247,92,3,.04) 70%), var(--panel-2); border-color: rgba(247,92,3,.45); }
.lb-row.r1 .lb-rank { background: var(--amb); color: #111; width: 38px; height: 38px; font-size: 18px; box-shadow: 0 0 18px rgba(241,196,15,.55); }
.lb-row.r2 .lb-rank { background: var(--ber); color: #fff; width: 35px; height: 35px; }
.lb-row.r3 .lb-rank { background: var(--org); color: #111; width: 35px; height: 35px; }
.lb-row.r1 .lb-wpm { color: var(--amb); }
.lb-row.r1 .lb-name { font-size: 19px; }
/* fresh entry */
.lb-row.fresh { border-color: var(--emr); box-shadow: 0 0 0 2px rgba(0,204,102,.55), 0 10px 30px rgba(0,204,102,.25); }
.lb-you {
  position: absolute; top: -9px; right: 10px; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .12em; background: var(--emr); color: #06210f;
}
.lb-row.in { animation: lbIn .45s cubic-bezier(.2,1.3,.4,1) both; animation-delay: calc(var(--i) * 45ms); }
.lb-row.drop { animation: lbDrop .9s cubic-bezier(.3,1.5,.5,1) both; z-index: 2; }
.lb-ch { display: inline-block; white-space: pre; animation: chDrop .7s cubic-bezier(.3,1.6,.5,1) both; animation-delay: calc(400ms + var(--k) * 70ms); }
.lb-status { display: grid; gap: 6px; justify-items: center; text-align: center; padding: 26px 12px; color: var(--mute); }
.lb-status:empty { display: none; }
.lb-status strong { font-size: 20px; color: var(--ink); }
.lb-status.off strong { color: var(--ber); }
.lb-status.empty strong { color: var(--emr); }
.lb-status .btn { margin-top: 8px; }
.lb-foot { margin: 14px 2px 0; font-size: 12px; color: var(--dim); }
@keyframes lbIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes lbDrop {
  0% { opacity: 0; transform: translateY(-260px) rotate(-7deg); }
  55% { opacity: 1; transform: translateY(8px) rotate(2deg); }
  75% { transform: translateY(-4px) rotate(-1deg); }
  100% { transform: none; }
}
@keyframes chDrop { 0% { opacity: 0; transform: translateY(-40px) rotate(var(--r)); } 60% { opacity: 1; transform: translateY(3px) rotate(calc(var(--r) / -4)); } 100% { opacity: 1; transform: none; } }

.foot { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 16px 20px 26px; color: var(--dim); font-size: 13px; position: relative; z-index: 1; }
.foot-keys { display: flex; gap: 22px; justify-content: center; flex-wrap: wrap; }
.built-by {
  display: inline-flex; align-items: center; gap: 10px; text-decoration: none;
  color: var(--dim); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .25em;
  opacity: .72; transition: opacity .2s, color .2s;
}
.built-by:hover, .built-by:focus-visible { opacity: 1; color: var(--mute); }
.built-by img { height: 30px; width: auto; display: block; }

/* Falling letters */
.fall-layer { position: fixed; inset: 0; pointer-events: none; z-index: 25; overflow: hidden; font-family: var(--mono); }
.fallen {
  position: absolute; left: 0; top: 0; display: flex; align-items: center; justify-content: center;
  will-change: transform; white-space: pre; color: var(--dim); line-height: 1;
  transition: opacity .3s;
}
.fallen.is-ok { color: var(--emr); }
.fallen.is-bad { color: #FF4F9A; }
.fallen.gone { opacity: 0; }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 30; }
body.has-pile .main { padding-bottom: 170px; }
@media (max-width: 560px) { body.has-pile .main { padding-bottom: 230px; } }
body.has-pile .foot { opacity: 0; }
.foot { transition: opacity .3s; }
body.quake .main { animation: quake .45s ease-out; }

@keyframes pop { 0% { transform: translateY(-3px) scale(1.28); text-shadow: 0 0 14px rgba(0,204,102,.9); } 100% { transform: none; text-shadow: none; } }
@keyframes shake { 0%,100% { transform: none; } 20% { transform: translateX(-4px) rotate(-4deg); } 40% { transform: translateX(4px) rotate(3deg); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes pipdrop { 0% { transform: none; opacity: 1; } 60% { transform: translateY(8px) rotate(20deg); } 100% { transform: translateY(4px) rotate(14deg); opacity: .6; } }
@keyframes wobble { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-.35deg) translateY(1px); } 75% { transform: rotate(.35deg) translateY(-1px); } }
@keyframes floatup { 0% { opacity: 0; transform: translate(-50%, 0) scale(.7); } 20% { opacity: 1; transform: translate(-50%, -10px) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -46px) scale(1); } }
@keyframes rise { from { opacity: 0; transform: translateY(24px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes quake { 0%,100% { transform: none; } 15% { transform: translate(-6px, 3px); } 30% { transform: translate(5px, -3px); } 45% { transform: translate(-4px, 2px); } 60% { transform: translate(3px, -1px); } 80% { transform: translate(-1px, 1px); } }

@media (max-width: 860px) {
  .hud { grid-template-columns: repeat(4, 1fr); }
  .hud .meter { grid-column: span 2; }
  .controls { margin-left: 0; width: 100%; }
}
@media (max-width: 560px) {
  .top { width: calc(100% - 28px); margin-top: 16px; gap: 12px; }
  .logo { font-size: 28px; }
  .top-right { margin-left: auto; order: 1; gap: 8px; }
  .pb { font-size: 12px; padding: 6px 10px; }
  .lb-open { font-size: 13px; padding: 6px 11px 6px 8px; }
  .claim { padding: 16px 14px 12px; }
  .claim-title { font-size: 21px; }
  .claim-btn { flex: 1 1 100%; justify-content: center; }
  .lb-inner { padding: 22px 14px 14px; }
  .lb-title { font-size: 32px; }
  .lb-cols, .lb-row { grid-template-columns: 36px 1fr 70px 48px; gap: 8px; }
  .lb-row { padding: 8px 10px; }
  .lb-name { font-size: 15px; }
  .lb-row.r1 .lb-name { font-size: 16px; }
  .lb-wpm { font-size: 17px; }
  .lb-acc { font-size: 12.5px; }
  .lb-tabs button { font-size: 13px; }
  .controls { order: 2; }
  .controls { gap: 8px; }
  .seg { width: 100%; justify-content: space-between; }
  .seg button { padding: 8px 10px; flex: 1; font-size: 13px; }
  .seg-label { padding: 0 4px 0 8px; font-size: 11px; }
  .main { width: calc(100% - 28px); padding-top: 18px; }
  .hud { gap: 12px 10px; margin-bottom: 16px; }
  .stat-val { font-size: 26px; }
  .stat-lbl { font-size: 10px; letter-spacing: .08em; }
  .arena { padding: 20px 18px; }
  .rules { font-size: 14px; }
  .results { padding: 24px 20px 20px; }
  .r-grid { grid-template-columns: 1fr; gap: 16px; }
  .r-big { flex-direction: row; align-items: baseline; gap: 10px; font-size: 60px; }
  .r-stats { grid-template-columns: repeat(2, 1fr); }
  .foot-keys { gap: 12px; font-size: 12px; }
  .foot-keys span:last-child { display: none; }
}
@media (hover: none) { .foot-keys { display: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .arena:not(.running) .caret { animation: none; }
  .words { transition: none; }
  .fallen { transition: transform .7s cubic-bezier(.55,0,.8,.3), opacity .3s !important; }
}
