/* ─────────────────────────────────────────────────────────────
   wormio — palette pulled from the coin art: void indigo, pearl,
   lilac, a single gold reserved for money. No greys standing in for colour.
   ───────────────────────────────────────────────────────────── */
:root {
  --void: #07051A;
  --nebula: #1A1240;
  --pearl: #F6F1FF;
  --lilac: #B79CFF;
  --lilac-2: #CDBDFF;
  --violet: #7D3DF5;
  --gold: #FFB547;
  --gold-2: #FF9A3C;
  --ok: #5CF2B5;
  --danger: #FF6B7A;

  --text: var(--pearl);
  --muted: #B8ADDB;
  --dim: #8A7FB4;
  --edge: rgba(183, 156, 255, 0.16);
  --edge-2: rgba(183, 156, 255, 0.3);

  --glass: linear-gradient(165deg, rgba(44, 30, 102, 0.62) 0%, rgba(17, 11, 46, 0.74) 55%, rgba(10, 7, 30, 0.82) 100%);
  --glass-hud: linear-gradient(165deg, rgba(36, 24, 88, 0.80), rgba(11, 7, 32, 0.88));

  --r-lg: 22px;
  --r: 16px;
  --r-sm: 12px;
  --pill: 999px;
  --f-ui: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-display: 'Instrument Serif', Georgia, serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--void); color: var(--text); font-family: var(--f-ui); overflow: hidden; -webkit-font-smoothing: antialiased; }
body { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
input, select { user-select: text; -webkit-user-select: text; }
button { font-family: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--lilac); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.gold { color: var(--gold); }
.dim { color: var(--dim); }
.hidden { display: none !important; }
.how-more { margin: 16px 0 0; font-size: 15px; }
.how-more a { color: var(--lilac-2); text-underline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ic { width: 16px; height: 16px; flex: none; }

#game { position: fixed; inset: 0; display: block; }
#vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0) 35vmin, rgba(0, 0, 0, 0.55) 75vmax); }

/* Indigo glass with a lit top-left edge (light comes from the wormhole side). */
.glass, .standings {
  position: relative;
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid var(--edge);
  border-radius: var(--r-lg);
  box-shadow: 0 30px 80px rgba(3, 1, 14, 0.55), inset 0 1px 0 rgba(205, 189, 255, 0.12);
}
.glass::before, .standings::before {
  content: ''; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(140deg, rgba(205, 189, 255, 0.45), rgba(183, 156, 255, 0.05) 35%, rgba(255, 181, 71, 0.18) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}

/* ── Lobby ─────────────────────────────────────────────────── */
#lobby {
  position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden; touch-action: pan-y;
  /* Let the live arena show through; only darken where text sits. */
  background:
    linear-gradient(90deg, rgba(7, 5, 26, 0.72) 0%, rgba(7, 5, 26, 0.35) 38%, rgba(7, 5, 26, 0) 60%, rgba(7, 5, 26, 0.3) 100%),
    linear-gradient(180deg, rgba(7, 5, 26, 0.45), rgba(7, 5, 26, 0) 20%, rgba(7, 5, 26, 0) 75%, rgba(7, 5, 26, 0.7));
}
.topbar { display: flex; align-items: center; gap: 20px; padding: 18px 32px; }
.brand { display: flex; align-items: center; }
.brand img { border-radius: 50%; filter: drop-shadow(0 0 14px rgba(183, 156, 255, 0.55)); }
.live-strip { display: flex; gap: 22px; align-items: center; font-size: 15px; color: var(--muted); flex-wrap: wrap; }
.ls { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.ls b { color: var(--text); font-weight: 700; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.dot.live { background: var(--ok); box-shadow: 0 0 0 0 rgba(92, 242, 181, 0.6); animation: ping 2.4s infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(92, 242, 181, .55); } 80%, 100% { box-shadow: 0 0 0 9px rgba(92, 242, 181, 0); } }
.links { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.text-link { text-decoration: none; font-weight: 600; font-size: 15px; color: var(--muted); transition: color .15s; }
.text-link:hover { color: var(--pearl); }
.icon-link { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--muted); transition: color .15s, background .15s; }
.icon-link:hover { color: var(--pearl); background: rgba(183, 156, 255, 0.12); }
.icon-link svg { width: 17px; height: 17px; }

.lobby-main {
  flex: 1 0 auto; display: grid; grid-template-columns: minmax(380px, 520px) minmax(320px, 380px);
  justify-content: space-between; align-items: end; gap: 40px; padding: 0 40px 28px;
}

/* The wordmark is the hero — the banner's italic serif, large and luminous. */
.mark-xl {
  margin: 0; font-family: var(--f-display); font-style: italic; font-weight: 400;
  font-size: clamp(96px, 12vw, 168px); line-height: 0.85; letter-spacing: -0.035em;
  background: linear-gradient(105deg, #FFFFFF 0%, #EADFFF 30%, var(--lilac) 58%, #FFD9A0 88%, var(--gold) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 30px rgba(183, 156, 255, 0.35));
  padding: 0 0.1em 0.08em 0; /* keep the italic overhang from clipping */
}
.lede { margin: 14px 0 22px; max-width: 30em; color: var(--muted); font-size: 17px; line-height: 1.5; }
.lede b { color: var(--text); font-weight: 700; }
.lede, .live-strip { text-shadow: 0 1px 14px rgba(7, 5, 26, 0.95), 0 0 2px rgba(7, 5, 26, 0.8); }

.worm-card {
  padding: 18px; border-radius: var(--r-lg); position: relative;
  background: linear-gradient(170deg, rgba(36, 24, 86, 0.55), rgba(10, 7, 30, 0.78));
  backdrop-filter: blur(18px) saturate(1.5); -webkit-backdrop-filter: blur(18px) saturate(1.5);
  border: 1px solid var(--edge);
  box-shadow: 0 30px 80px rgba(3, 1, 14, 0.55), inset 0 1px 0 rgba(205, 189, 255, 0.1);
}
.preview-wrap { position: relative; border-radius: var(--r); overflow: hidden; background: radial-gradient(120% 140% at 70% 50%, rgba(125, 61, 245, 0.28), rgba(7, 5, 26, 0) 70%); }
#skinPreview { display: block; width: 100%; height: 120px; }
.skin-name { position: absolute; left: 14px; bottom: 10px; font: italic 400 24px/1 var(--f-display); color: var(--pearl); text-shadow: 0 2px 12px rgba(7, 5, 26, 0.9); }
.skins { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 14px; }
.swatch { position: relative; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 14px; background: rgba(183, 156, 255, 0.06); transition: transform .12s, background .15s; }
.swatch img { width: 44px; height: 44px; display: block; }
.swatch:hover { transform: translateY(-2px); background: rgba(183, 156, 255, 0.14); }
.swatch.sel { background: rgba(183, 156, 255, 0.22); box-shadow: inset 0 0 0 1.5px var(--lilac-2); }
.swatch.locked { opacity: 0.38; }
.swatch.locked::after { content: ''; position: absolute; right: 3px; bottom: 3px; width: 13px; height: 13px; background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23F6F1FF' d='M7 10V7a5 5 0 0 1 10 0v3h1v11H6V10zm2 0h6V7a3 3 0 0 0-6 0z'/></svg>") center/contain no-repeat; }

.field input, #walletInput {
  width: 100%; padding: 14px 16px; border-radius: var(--r-sm); border: 1px solid var(--edge);
  background: rgba(7, 5, 26, 0.55); color: var(--text); font: 600 17px var(--f-ui); outline: none; transition: border-color .15s, background .15s;
}
.field input::placeholder, #walletInput::placeholder { color: var(--dim); font-weight: 500; }
.field input:focus, #walletInput:focus { border-color: var(--lilac); background: rgba(7, 5, 26, 0.75); }
.name-field { display: block; margin-bottom: 14px; }
.wallet-field { margin-bottom: 16px; }
.wf-head { font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 8px; display: flex; gap: 8px; align-items: baseline; }
.f-hint { color: var(--dim); font-weight: 500; }
.wallet-choices { display: flex; flex-direction: column; gap: 8px; }
.wallet-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid var(--edge); background: rgba(7, 5, 26, 0.45); font: 700 15px var(--f-ui); text-align: left; transition: border-color .15s, background .15s; }
.wallet-btn:hover { border-color: var(--lilac); background: rgba(125, 61, 245, 0.16); }
.wallet-btn img { width: 22px; height: 22px; border-radius: 6px; }
.wallet-btn .wb-sub { margin-left: auto; font-weight: 500; font-size: 13px; color: var(--dim); }
.link-btn { background: none; border: 0; color: var(--muted); font: 600 14px var(--f-ui); text-decoration: underline; text-underline-offset: 3px; padding: 4px 0; align-self: flex-start; }
.link-btn:hover { color: var(--pearl); }
.wallet-chip { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid rgba(92, 242, 181, 0.35); background: rgba(92, 242, 181, 0.07); font-weight: 700; }
.wallet-chip .ic { color: var(--ok); }
.wallet-chip.bad { border-color: rgba(255, 107, 122, 0.45); background: rgba(255, 107, 122, 0.08); }
.wallet-chip.bad .ic { color: var(--danger); }
.wc-bal { color: var(--muted); font-weight: 500; font-size: 14px; }
.wallet-chip .link-btn { margin-left: auto; align-self: center; }
.paste-row { margin-top: 8px; }
.mobile-links { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.mobile-links a { font-size: 14px; font-weight: 600; padding: 9px 14px; border-radius: var(--pill); border: 1px solid var(--edge-2); text-decoration: none; }

.actions { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.cta {
  padding: 17px; border: 0; border-radius: var(--r); font: 800 21px var(--f-ui); letter-spacing: 0.01em; color: #1D0F00;
  background: linear-gradient(180deg, #FFD9A0, var(--gold) 50%, var(--gold-2));
  box-shadow: 0 12px 44px rgba(255, 154, 60, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.65);
  transition: transform .1s, filter .15s, box-shadow .15s;
}
.cta:hover { filter: brightness(1.06); box-shadow: 0 16px 56px rgba(255, 154, 60, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.65); }
.cta:active { transform: translateY(1px) scale(0.995); }
.cta:disabled { filter: saturate(0.4) brightness(0.75); cursor: wait; }
.ghost-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 20px; min-height: 48px;
  border-radius: var(--r); border: 1px solid var(--edge-2); background: rgba(7, 5, 26, 0.35); font: 700 16px var(--f-ui); text-decoration: none; transition: border-color .15s, background .15s;
}
.ghost-btn:hover { border-color: var(--lilac-2); background: rgba(125, 61, 245, 0.16); }
.error { color: var(--danger); font-size: 14px; font-weight: 600; line-height: 1.4; margin-top: 10px; }
.error:empty { display: none; }

/* Standings: the pot sits on top of the people who'll split it. */
.standings { padding: 18px; display: flex; flex-direction: column; max-height: min(640px, calc(100vh - 150px)); }
.pot { padding: 4px 6px 16px; border-bottom: 1px solid var(--edge); margin-bottom: 12px; }
.pot-label { font-size: 15px; color: var(--muted); font-weight: 600; }
.pot-row { display: flex; align-items: baseline; gap: 10px; margin-top: 2px; }
.pot-amt { font-size: 52px; font-weight: 900; line-height: 1; color: var(--gold); text-shadow: 0 0 30px rgba(255, 181, 71, 0.4); letter-spacing: -0.02em; }
.pot-sym { font-size: 18px; font-weight: 800; color: var(--pearl); }
.pot-sub { font-size: 14px; color: var(--dim); display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.pot-sub:empty { display: none; }
.tabs { display: flex; gap: 2px; margin-bottom: 8px; }
.tab { border: 0; background: none; padding: 8px 12px; border-radius: var(--pill); font: 700 14px var(--f-ui); color: var(--dim); transition: color .15s, background .15s; }
.tab:hover { color: var(--muted); }
.tab.on { color: var(--pearl); background: rgba(183, 156, 255, 0.14); }
.tab-body { flex: 1; overflow-y: auto; min-height: 0; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(183, 156, 255, .3) transparent; }
.rank-list { list-style: none; margin: 0; padding: 0; }
.rank-list li { display: grid; grid-template-columns: 22px 30px 1fr auto; align-items: center; gap: 10px; padding: 6px 6px; border-radius: 12px; font-size: 15px; }
.rank-list li.paid { background: linear-gradient(90deg, rgba(255, 181, 71, 0.09), rgba(255, 181, 71, 0)); }
.rank-list .rk { color: var(--dim); font-weight: 800; text-align: center; }
.rank-list li.paid .rk { color: var(--gold); }
.rank-list .av { width: 30px; height: 30px; }
.rank-list .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.rank-list .vl { font-weight: 700; text-align: right; }
.rank-list .vl small { display: block; color: var(--gold); font-size: 12px; font-weight: 700; }
#earnersList li, #alltimeList li { grid-template-columns: 22px 1fr auto; }
.paid-line { display: flex !important; align-items: center; gap: 10px; padding: 4px 6px !important; color: var(--gold); font-size: 12px; font-weight: 700; }
.paid-line::before, .paid-line::after { content: ''; flex: 1; border-top: 1px dashed rgba(255, 181, 71, 0.5); }
.board-note { color: var(--dim); font-size: 13px; padding: 10px 6px 0; }
.round-block { padding: 10px 6px; border-bottom: 1px solid var(--edge); }
.round-block:last-child { border-bottom: 0; }
.rb-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 6px; gap: 8px; }
.rb-head b { color: var(--text); }
.rb-row { display: grid; grid-template-columns: 22px 1fr auto auto; gap: 8px; align-items: center; font-size: 14px; padding: 3px 0; }
.rb-row .rk { color: var(--dim); font-weight: 800; }
.rb-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rb-row .am { color: var(--gold); font-weight: 700; }
.rb-row a { color: var(--muted); display: grid; place-items: center; }
.rb-row a svg { width: 14px; height: 14px; }
.earned-total { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 6px 12px; color: var(--muted); font-size: 14px; }
.earned-total b { font-size: 24px; color: var(--gold); font-weight: 900; }
.empty { display: block !important; color: var(--dim); font-size: 14px; padding: 16px 6px; line-height: 1.45; }
.how-btn { margin-top: 12px; border: 0; background: none; padding: 8px; font: 600 14px var(--f-ui); color: var(--muted); text-decoration: underline; text-underline-offset: 3px; align-self: center; }
.how-btn:hover { color: var(--pearl); }

.lobby-foot { display: flex; align-items: center; gap: 14px; padding: 0 40px calc(18px + var(--safe-b)); flex-wrap: wrap; }
.ca, .worm-chip { display: flex; align-items: center; gap: 10px; padding: 7px 8px 7px 14px; border-radius: var(--pill); background: rgba(10, 7, 30, 0.6); border: 1px solid var(--edge); font-size: 14px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.ca-k { font-weight: 800; color: var(--gold); }
.ca code.pending { font: 600 14px var(--f-ui); color: var(--muted); }
.ca code { font: 600 13px ui-monospace, 'SF Mono', Menlo, monospace; color: var(--muted); max-width: 42ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--edge-2); background: rgba(7, 5, 26, 0.45); transition: border-color .15s, background .15s; }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { border-color: var(--lilac-2); background: rgba(125, 61, 245, 0.2); }
.buy { font-weight: 800; font-size: 13px; color: #1D0F00; background: var(--gold); padding: 8px 14px; border-radius: var(--pill); text-decoration: none; }
.worm-chip { padding-right: 16px; color: var(--muted); }
.worm-chip .ic { color: var(--lilac); }
.worm-chip b { color: var(--text); }
.chg.up { color: var(--ok); } .chg.down { color: var(--danger); }
.legal { margin-left: auto; color: var(--dim); font-size: 13px; }

/* ── HUD ───────────────────────────────────────────────────── */
#hud { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
#hud button, #hud .spec-bar, #hud .settings { pointer-events: auto; }
#edgePulse { position: absolute; inset: 0; box-shadow: inset 0 0 140px 30px rgba(255, 107, 122, 0.55); opacity: 0; transition: opacity .3s; }
.round-card, .lb, .hud-bc, .kf, .spec-bar, .hint, #toast {
  /* No backdrop blur in-game: the arena moves every frame, so a live blur re-renders constantly
     and nearly halved the frame rate. A denser tint reads the same. */
  background: var(--glass-hud); border: 1px solid var(--edge);
}
.hud-tl { position: absolute; top: 16px; left: 16px; display: flex; flex-direction: column; gap: 12px; }
.round-card { padding: 10px 16px 12px; border-radius: 16px; min-width: 176px; }
.rc-top { display: flex; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.rc-top b { color: var(--text); }
.rc-clock { font-size: 36px; font-weight: 900; line-height: 1.05; letter-spacing: -0.01em; }
.rc-clock.urgent { color: var(--danger); }
.rc-pot { font-size: 15px; font-weight: 800; color: var(--gold); }
.rc-pot #hPotSym { color: var(--text); }
#killFeed { display: flex; flex-direction: column; gap: 4px; max-width: 300px; }
.kf { font-size: 13px; padding: 6px 11px; border-radius: 10px; color: var(--muted); animation: kfIn .25s ease-out; transition: opacity .5s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kf b { color: var(--text); font-weight: 700; }
.kf.me { background: linear-gradient(90deg, rgba(255, 181, 71, 0.22), rgba(40, 27, 96, 0.6)); color: var(--text); }
.kf.died { background: linear-gradient(90deg, rgba(255, 107, 122, 0.24), rgba(40, 27, 96, 0.6)); }
.kf.bounty { border-color: rgba(255, 181, 71, 0.55); }
.kf.out { opacity: 0; }
@keyframes kfIn { from { transform: translateX(-12px); opacity: 0; } }

.hud-tr { position: absolute; top: 16px; right: 16px; }
.lb { width: 262px; padding: 8px; border-radius: 16px; }
.lb ol { list-style: none; margin: 0; padding: 0; }
.lb li, .lb-me { display: grid; grid-template-columns: 18px 22px 1fr auto; gap: 7px; align-items: center; padding: 3px 6px; border-radius: 10px; font-size: 13px; }
.lb .av { width: 22px; height: 22px; }
.lb li .rk, .lb-me .rk { color: var(--dim); font-weight: 800; text-align: center; }
.lb li .nm, .lb-me .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--muted); }
.lb li .sc, .lb-me .sc { font-weight: 700; text-align: right; }
.lb li .sc small { color: var(--gold); font-weight: 700; margin-left: 6px; }
.lb li.paid .rk { color: var(--gold); }
.lb li.paid .nm { color: var(--text); }
.lb li.me, .lb-me { background: rgba(183, 156, 255, 0.2); }
.lb li.me .nm, .lb-me .nm { color: var(--pearl); }
.lb .paid-line { display: block !important; height: 0; padding: 0 !important; margin: 4px 6px; border-top: 1px dashed rgba(255, 181, 71, 0.55); }
.lb .paid-line::before, .lb .paid-line::after { display: none; }
.lb-me { margin-top: 4px; grid-template-columns: 18px 1fr auto; }

.hud-bl { position: absolute; left: 16px; bottom: calc(16px + var(--safe-b)); }
#minimap { width: 168px; height: 168px; display: block; }
.hud-bc { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(16px + var(--safe-b)); display: flex; gap: 4px; padding: 6px; border-radius: 16px; }
.mb { display: flex; flex-direction: column; align-items: center; padding: 2px 14px; }
.mb span { font-size: 12px; color: var(--dim); font-weight: 600; white-space: nowrap; }
.mb b { font-size: 20px; font-weight: 900; }
.hud-btns { position: absolute; right: 16px; bottom: calc(16px + var(--safe-b)); display: flex; gap: 8px; }
.hud-btns .icon-btn { width: 40px; height: 40px; background: rgba(20, 13, 52, 0.66); }
.event-badge { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); padding: 8px 16px; border-radius: var(--pill); font-weight: 800; font-size: 14px; display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.event-badge.dm { background: rgba(255, 154, 60, 0.2); border: 1px solid rgba(255, 154, 60, 0.6); color: #FFD9A8; }
.event-badge.chaos { background: rgba(125, 61, 245, 0.26); border: 1px solid rgba(183, 156, 255, 0.6); color: var(--lilac-2); }
.event-badge.soon { background: var(--glass-hud); border: 1px solid var(--edge); color: var(--muted); font-weight: 600; }
.event-badge svg { width: 16px; height: 16px; }
.fx-bar { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(86px + var(--safe-b)); display: flex; gap: 6px; }
.fx-chip { font-size: 12px; font-weight: 800; padding: 5px 10px; border-radius: var(--pill); background: rgba(10, 7, 30, 0.75); border: 1px solid var(--c); color: var(--c); }
#boostBtn { display: none; position: absolute; right: 20px; bottom: calc(76px + var(--safe-b)); width: 84px; height: 84px; border-radius: 50%; border: 2px solid rgba(255, 181, 71, 0.55); background: rgba(255, 181, 71, 0.12); color: var(--gold); place-items: center; touch-action: none; }
#boostBtn svg { width: 34px; height: 34px; }
#boostBtn.on { background: rgba(255, 181, 71, 0.38); box-shadow: 0 0 30px rgba(255, 181, 71, 0.5); }
#boostBtn.off { opacity: 0.35; }
.streak { position: absolute; top: 28%; left: 50%; transform: translateX(-50%); font: italic 400 56px var(--f-display); color: var(--gold); text-shadow: 0 0 30px rgba(255, 181, 71, 0.6); animation: pop .5s cubic-bezier(.2, 1.6, .4, 1); white-space: nowrap; }
@keyframes pop { from { transform: translateX(-50%) scale(.5); opacity: 0; } }
.hint { position: absolute; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%); padding: 12px 18px; border-radius: 14px; font-size: 14px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; white-space: nowrap; animation: rise .4s cubic-bezier(.2, .9, .3, 1); transition: opacity .6s; }
.hint-goal { font: italic 400 26px/1.1 var(--f-display); color: var(--pearl); }
.hint-ctl { display: flex; gap: 14px; font-size: 13px; color: var(--muted); flex-wrap: wrap; justify-content: center; }
.hint { align-items: center; text-align: center; }
.hint.out { opacity: 0; }
.spec-bar { position: absolute; bottom: calc(96px + var(--safe-b)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-radius: var(--pill); font-size: 14px; color: var(--muted); white-space: nowrap; }
.spec-bar b { color: var(--text); }
.sb-btn { border: 1px solid var(--edge-2); background: rgba(183, 156, 255, 0.08); border-radius: var(--pill); padding: 6px 12px; font: 800 15px var(--f-ui); min-width: 36px; }
.sb-btn.primary { background: var(--gold); color: #1D0F00; border-color: var(--gold); }
.settings { position: absolute; right: 16px; bottom: calc(68px + var(--safe-b)); width: 240px; padding: 14px; }
.set-title { font-weight: 800; margin-bottom: 8px; }
.set-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; font-size: 14px; color: var(--muted); border-top: 1px solid var(--edge); }
.set-row input { width: 18px; height: 18px; accent-color: var(--lilac); }
.set-row select { background: rgba(7, 5, 26, 0.6); color: var(--text); border: 1px solid var(--edge-2); border-radius: 8px; padding: 4px 8px; font: 600 13px var(--f-ui); }

#toast { position: fixed; z-index: 40; left: 50%; top: 80px; transform: translate(-50%, -10px); padding: 10px 18px; border-radius: var(--pill); font-weight: 600; font-size: 14px; opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none; max-width: calc(100vw - 32px); text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── Overlays ──────────────────────────────────────────────── */
.overlay { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(7, 5, 26, 0.45); padding: 16px; }
.death-card { width: min(420px, 100%); padding: 28px; text-align: center; animation: rise .35s cubic-bezier(.2, .9, .3, 1); }
@keyframes rise { from { transform: translateY(16px) scale(.98); opacity: 0; } }
.d-title { font: italic 400 60px/1 var(--f-display); background: linear-gradient(105deg, #fff, var(--lilac) 70%, #FFD9A0); -webkit-background-clip: text; background-clip: text; color: transparent; padding-right: .1em; }
.d-reason { color: var(--muted); margin: 8px 0 20px; font-size: 15px; }
.d-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.d-stats div { display: flex; flex-direction: column; padding: 10px 4px; border-radius: 12px; background: rgba(7, 5, 26, 0.45); border: 1px solid var(--edge); }
.d-stats b { font-size: 24px; font-weight: 900; }
.d-stats span { font-size: 12px; color: var(--dim); font-weight: 600; }
.d-pb { color: var(--gold); font-weight: 800; margin-bottom: 14px; }
.death-card .cta { width: 100%; }
.d-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.d-row .ghost-btn { padding: 0 6px; min-height: 44px; font-size: 14px; }

.podium { position: fixed; z-index: 25; top: 90px; left: 50%; transform: translateX(-50%); pointer-events: none; width: min(380px, calc(100vw - 32px)); }
.pd-card { padding: 16px 18px; animation: rise .35s cubic-bezier(.2, .9, .3, 1); }
.pd-title { font: italic 400 32px/1.1 var(--f-display); margin-bottom: 10px; }
#pdList { list-style: none; margin: 0; padding: 0; }
#pdList li { display: grid; grid-template-columns: 24px 1fr auto; gap: 10px; padding: 7px 0; border-top: 1px solid var(--edge); font-size: 15px; }
#pdList .rk { color: var(--gold); font-weight: 900; }
#pdList .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#pdList .am { color: var(--gold); font-weight: 800; }
.pd-note { color: var(--dim); font-size: 13px; margin-top: 8px; }

.banner { position: fixed; z-index: 24; top: 30%; left: 50%; transform: translate(-50%, -50%); text-align: center; pointer-events: none; width: calc(100vw - 32px); animation: rise .4s cubic-bezier(.2, .9, .3, 1); }
.bn-title { font: italic 400 84px/1 var(--f-display); text-shadow: 0 0 40px rgba(7, 5, 26, 0.8); }
.bn-title.dm { color: #FFD9A8; text-shadow: 0 0 50px rgba(255, 154, 60, 0.7); }
.bn-title.chaos { color: var(--lilac-2); text-shadow: 0 0 50px rgba(125, 61, 245, 0.8); }
.bn-title.win { color: var(--gold); text-shadow: 0 0 50px rgba(255, 181, 71, 0.7); }
.bn-sub { margin-top: 10px; font-size: 18px; font-weight: 600; color: var(--muted); text-shadow: 0 2px 10px #000; }
.countdown { position: fixed; z-index: 26; inset: 0; display: grid; place-items: center; pointer-events: none; font: italic 400 220px/1 var(--f-display); color: #FFD9A8; text-shadow: 0 0 80px rgba(255, 154, 60, 0.8); }
.countdown span { animation: cd 1s ease-out; }
@keyframes cd { from { transform: scale(1.6); opacity: 0; } 30% { opacity: 1; } to { transform: scale(.9); opacity: .2; } }
.flash { position: fixed; inset: 0; z-index: 23; pointer-events: none; opacity: 0; }
.flash.go { animation: flash .9s ease-out; }
@keyframes flash { from { opacity: .55; } to { opacity: 0; } }

.how-card { position: relative; width: min(640px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 32px; touch-action: pan-y; }
.display { font-family: var(--f-display); font-weight: 400; font-style: italic; margin: 0 0 6px; }
.display.sm { font-size: 44px; line-height: 1; }
.close { position: absolute; top: 16px; right: 16px; font-size: 22px; line-height: 1; }
.steps { list-style: none; padding: 0; margin: 16px 0 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.steps li { display: flex; gap: 12px; padding: 14px; border-radius: 14px; background: rgba(7, 5, 26, 0.4); border: 1px solid var(--edge); }
.st-n { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: rgba(183, 156, 255, 0.16); color: var(--lilac-2); font-weight: 900; }
.steps b { font-size: 16px; }
.steps p { margin: 4px 0 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
.rules { display: flex; flex-direction: column; gap: 8px; font-size: 14px; color: var(--muted); line-height: 1.5; }
.rules b { color: var(--text); margin-right: 6px; }

.rc-box { display: flex; gap: 16px; align-items: center; padding: 20px 24px; max-width: 420px; }
.rc-box p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.spinner { width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--edge-2); border-top-color: var(--lilac); animation: spin 0.9s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.noscript { position: fixed; inset: 0; display: grid; place-items: center; z-index: 99; background: var(--void); }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 980px) {
  .lobby-main { grid-template-columns: minmax(0, 1fr); justify-items: stretch; align-items: start; padding: 0 16px 16px; gap: 20px; }
  .lobby-main > *, .worm-card, .worm-card > * { min-width: 0; }
  .mobile-links a { flex: 1 1 auto; text-align: center; }
  .hero, .standings { width: 100%; max-width: 560px; justify-self: center; }
  .standings { max-height: none; }
  .tab-body { max-height: 420px; }
  .lobby-foot { padding: 0 16px calc(16px + var(--safe-b)); }
  .legal { margin-left: 0; width: 100%; }
  #lobby { background: linear-gradient(180deg, rgba(7, 5, 26, 0.62), rgba(7, 5, 26, 0.5) 30%, rgba(7, 5, 26, 0.7)); }
}
@media (max-width: 640px) {
  .topbar { padding: 12px 16px; gap: 12px; flex-wrap: wrap; }
  .live-strip { order: 3; width: 100%; gap: 14px; font-size: 14px; }
  .links { gap: 10px; }
  .hide-sm { display: none !important; }
  .mark-xl { font-size: clamp(64px, 27vw, 104px); }
  .lede { font-size: 16px; margin: 10px 0 16px; }
  .worm-card { padding: 14px; }
  .swatch, .swatch img { width: 40px; height: 40px; }
  .actions { position: sticky; bottom: 0; z-index: 3; margin: 0 -14px -14px; padding: 14px 14px calc(14px + var(--safe-b)); border-radius: 0 0 var(--r-lg) var(--r-lg); background: linear-gradient(180deg, rgba(14, 9, 38, 0) 0%, rgba(14, 9, 38, 0.985) 14px, rgba(12, 8, 32, 0.99) 100%); }
  .pot-amt { font-size: 44px; }
  .ca { width: 100%; }
  .ca code { flex: 1; min-width: 0; }
  .lb { width: 188px; padding: 6px; }
  .lb li, .lb-me { font-size: 12px; padding: 2px 4px; grid-template-columns: 14px 18px 1fr auto; gap: 5px; }
  .lb .av { width: 18px; height: 18px; }
  .lb li .sc small { display: none; }
  .lb-me { grid-template-columns: 14px 1fr auto; }
  .round-card { min-width: 0; padding: 8px 12px; }
  .rc-clock { font-size: 26px; }
  #killFeed { max-width: 190px; }
  .kf { font-size: 12px; }
  #minimap { width: 112px; height: 112px; }
  .hud-bc { padding: 4px; bottom: calc(22px + var(--safe-b)); }
  .hud-bc .mb { padding: 0 8px; }
  .hud-bc .mb b { font-size: 16px; }
  #mPayWrap, .hud-bc .mb:nth-child(3) { display: none; }
  .event-badge { top: auto; bottom: calc(76px + var(--safe-b)); font-size: 11px; padding: 6px 10px; }
  .eb-detail { display: none; }
  .hud-btns { bottom: calc(176px + var(--safe-b)); right: 16px; flex-direction: column; }
  .hud-btns .icon-btn { width: 36px; height: 36px; }
  .hint { white-space: normal; width: calc(100vw - 32px); bottom: auto; top: 128px; padding: 10px 14px; }
  .hint-goal { font-size: 21px; }
  .hint-ctl { gap: 10px; font-size: 12px; }
  .bn-title { font-size: 54px; }
  .countdown { font-size: 150px; }
  .steps { grid-template-columns: 1fr; }
  .d-title { font-size: 46px; }
  .d-stats b { font-size: 19px; }
  .streak { font-size: 40px; }
}
@media (max-width: 380px) {
  .lobby-main { padding: 0 10px 12px; }
  .topbar { padding: 10px 12px; }
  .worm-card { padding: 12px; }
  .actions { margin: 0 -12px -12px; padding-left: 12px; padding-right: 12px; }
  .swatch, .swatch img { width: 36px; height: 36px; }
  .ghost-btn { padding: 0 14px; }
  .standings { padding: 14px; }
  .pot-amt { font-size: 40px; }
  .ca code { max-width: 100%; }
  .lobby-foot { padding: 0 10px calc(12px + var(--safe-b)); }
  .worm-chip { flex-wrap: wrap; }
}
@media (pointer: coarse) { #boostBtn { display: grid; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
