:root {
  --bg: #07081a;
  --panel: rgba(14, 16, 38, 0.92);
  --line: rgba(255, 255, 255, 0.12);
  --ink: #10121f;
  --text: #e6e8f5;
  --muted: #9aa0c3;
  --mint: #2ee6a8;
  --red: #ff4d6d;
  --amber: #ffb020;
  --purple: #b48cff;
  --pink: #ff4dd2;
  --gold: #ffd84a;
  --display: "Bungee", Impact, sans-serif;
  --body: "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: var(--body); }
canvas { position: fixed; inset: 0; display: block; outline: none; }
body[data-state="none"] canvas { cursor: none; }

.screen {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 22px; padding: 24px 16px; overflow-y: auto;
  background: radial-gradient(ellipse at center, rgba(7, 8, 26, 0.55), rgba(7, 8, 26, 0.92));
}
.screen.hidden { display: none; }
#menu {
  background:
    linear-gradient(rgba(7, 8, 26, 0.35), rgba(7, 8, 26, 0.92) 70%),
    var(--keyart, none) center / cover no-repeat, var(--bg);
}
#loading, #mobile { background: var(--bg); }

.logo {
  font-family: var(--display); font-weight: 400; margin: 0; text-align: center; line-height: 0.95;
  font-size: clamp(44px, 7vw, 96px); color: #fff; letter-spacing: 1px;
  -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill;
  text-shadow: 0 6px 0 var(--ink), 0 0 40px rgba(46, 230, 168, 0.55);
}
.logo.small { font-size: clamp(26px, 3.4vw, 42px); }
.tag { margin: 10px 0 0; text-align: center; font-weight: 800; color: var(--mint); letter-spacing: 3px; text-transform: uppercase; font-size: 14px; }

.menu-grid { display: grid; grid-template-columns: minmax(0, 560px) minmax(0, 360px); gap: 18px; width: 100%; max-width: 940px; }
.card {
  background: var(--panel); border: 2px solid var(--line); border-radius: 18px; padding: 22px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45); min-width: 0;
}
.card.center { text-align: center; display: grid; gap: 16px; justify-items: center; max-width: 520px; }
.card h3 { font-family: var(--display); font-weight: 400; font-size: 18px; margin: 0 0 12px; color: #fff; }
label { display: block; font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); margin-bottom: 8px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
input {
  flex: 1 1 220px; min-width: 0; font: 800 18px var(--body); padding: 14px 16px; border-radius: 12px;
  border: 3px solid var(--ink); background: #fff7e3; color: var(--ink); outline: none;
}
input:focus { box-shadow: 0 0 0 3px var(--mint); }
.btn {
  font: 400 18px var(--display); padding: 14px 22px; border-radius: 12px; border: 3px solid var(--ink);
  background: #2a2e57; color: #fff; cursor: pointer; text-decoration: none; display: inline-block;
  box-shadow: 0 5px 0 var(--ink); transition: transform 0.06s, box-shadow 0.06s;
}
.btn.primary { background: var(--mint); color: var(--ink); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.err { min-height: 18px; margin: 8px 0 0; color: var(--red); font-weight: 700; font-size: 14px; }
.how { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 10px; font-size: 15px; line-height: 1.4; color: var(--text); }
.gold { color: var(--gold); }
.mint { color: var(--mint); } .red { color: var(--red); } .purple { color: var(--purple); } .pink { color: var(--pink); }
.arcade-back { position: absolute; top: 16px; left: 16px; color: var(--muted); font-weight: 800; text-decoration: none; font-size: 14px; }
.arcade-back:hover { color: var(--mint); }
.controls { margin: 0; color: var(--muted); font-size: 14px; text-align: center; }
.controls b { color: #fff; }
.link { display: inline-block; margin-top: 12px; color: var(--mint); font-weight: 800; text-decoration: none; }

.board { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.board li { display: grid; grid-template-columns: 28px 1fr auto auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); font-weight: 700; }
.board li.me { background: rgba(46, 230, 168, 0.18); outline: 2px solid var(--mint); }
.board li.empty { display: block; color: var(--muted); font-weight: 600; }
.board .rank { font-family: var(--display); color: var(--gold); }
.board .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .wave { color: var(--muted); font-size: 13px; }
.board .pts { font-family: var(--display); color: #fff; }

.loading { display: grid; gap: 18px; justify-items: center; }
.bar { width: min(420px, 80vw); height: 14px; border-radius: 8px; background: rgba(255, 255, 255, 0.1); border: 2px solid var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--mint); transition: width 0.2s; }
.loading p { color: var(--muted); font-weight: 700; margin: 0; }

.over { display: grid; grid-template-columns: minmax(0, 440px) minmax(0, 520px); gap: 18px; width: 100%; max-width: 980px; }
.figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 18px 0 6px; }
.aim-line { margin: 0 0 4px; color: var(--muted); font-weight: 700; font-size: 13px; }
.figures div { background: rgba(255, 255, 255, 0.05); border-radius: 12px; padding: 12px; text-align: center; }
.figures span { display: block; font-family: var(--display); font-size: 26px; color: #fff; }
.figures small { color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: 1px; font-size: 11px; }
.rank-line { min-height: 22px; font-weight: 800; color: var(--gold); margin: 6px 0 16px; }
.over .row { margin-bottom: 20px; }
.got { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.got li { background: rgba(255, 255, 255, 0.05); border-left: 4px solid var(--red); border-radius: 10px; padding: 12px 14px; }
.got li.clean { border-color: var(--mint); }
.got-head { display: flex; gap: 8px; align-items: baseline; }
.got-label { font-weight: 800; color: #fff; }
.got p { margin: 6px 0 4px; line-height: 1.4; font-size: 14px; }
.got small { color: var(--muted); font-size: 12px; }
.chip { font: 400 11px var(--display); padding: 3px 7px; border-radius: 6px; background: var(--red); color: var(--ink); white-space: nowrap; }
.chip.order { background: var(--purple); } .chip.boss { background: var(--pink); }
.hint { color: var(--muted); font-size: 13px; margin: 12px 0 0; }

@media (max-width: 860px) {
  .menu-grid, .over { grid-template-columns: minmax(0, 1fr); }
  .screen { justify-content: flex-start; }
}
