:root {
  --ink: #0b1220;
  --court-dark: #16213a;
  --court: #1d2c4e;
  --line: rgba(255, 255, 255, 0.22);
  --paper: #f8fafc;
  --outline: #0b1220;
  --player: #38bdf8;
  --player-dark: #0369a1;
  --enemy: #fb7185;
  --enemy-dark: #9f1239;
  --ball: #facc15;
  --ball-dark: #a16207;
  --lime: #a3e635;
  --danger: #f87171;
  --panel: rgba(8, 13, 28, 0.88);
  --display: "Bungee", "Arial Black", sans-serif;
  --body: "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(1200px 800px at 50% -10%, #24365e 0%, var(--ink) 60%) fixed;
  color: var(--paper);
  font-family: var(--body);
  display: flex;
  justify-content: center;
  padding: 18px 12px 28px;
}

.stage { display: flex; flex-direction: column; align-items: center; gap: 10px; }

.frame {
  position: relative;
  width: min(480px, 94vw);
  aspect-ratio: 480 / 720;
  border-radius: 22px;
  overflow: hidden;
  border: 4px solid #020617;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55), 0 0 0 4px rgba(255, 255, 255, 0.06);
  background: var(--court-dark);
}

#game { width: 100%; height: 100%; display: block; touch-action: none; }

.vignette {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 40%, transparent 55%, rgba(0, 0, 0, 0.45) 100%);
}

.topbar {
  position: absolute; top: 10px; left: 10px; right: 10px;
  display: flex; gap: 8px; justify-content: space-between; pointer-events: none;
}

.pill {
  font-family: var(--display);
  font-size: 15px;
  letter-spacing: 0.04em;
  background: rgba(2, 6, 23, 0.72);
  border: 2px solid rgba(255, 255, 255, 0.85);
  color: #fff;
  border-radius: 999px;
  padding: 6px 14px;
  box-shadow: 0 3px 0 var(--outline);
  white-space: nowrap;
}

.pill.you { color: #bae6fd; }
.pill.cpu { color: #fecdd3; }
.pill.mid { color: var(--lime); }

.fxrow {
  position: absolute; left: 10px; bottom: 10px;
  display: flex; gap: 6px; flex-wrap: wrap;
  max-width: 70%; pointer-events: none;
}
.fx {
  font-family: var(--display);
  font-size: 11px; letter-spacing: 0.05em;
  background: rgba(2, 6, 23, 0.8);
  border: 2px solid var(--lime); color: var(--lime);
  border-radius: 999px; padding: 3px 10px;
}

.headline.small { font-size: 28px; }

.card-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px; margin: 0 0 12px;
  max-height: 300px; overflow-y: auto;
}
.card {
  position: relative; text-align: left;
  background: #141f38; color: #e2e8f0;
  border: 3px solid #2b3857;
  border-radius: 14px;
  padding: 9px 10px;
  cursor: pointer;
  font-family: var(--body);
  box-shadow: 0 3px 0 var(--outline);
  transition: transform 0.08s ease, border-color 0.12s ease;
}
.card:hover { transform: translateY(-2px); }
.card .nm {
  font-family: var(--display); font-size: 12.5px; color: var(--c);
  display: flex; align-items: center; gap: 7px;
}
.card .nm .dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--c); border: 2px solid #fff; flex: none;
}
.card .ds { display: block; font-size: 11px; color: #9fb0c9; line-height: 1.35; margin-top: 3px; }
.card .uses { display: block; font-size: 10.5px; font-weight: 800; color: #fff; margin-top: 4px; letter-spacing: 0.05em; }
.card.sel { border-color: var(--lime); }
.card .slot {
  position: absolute; top: -11px; right: -7px;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--lime); color: #0b1220;
  font-family: var(--display); font-size: 13px; line-height: 24px; text-align: center;
  border: 2px solid var(--outline);
}
.btnrow { display: flex; gap: 8px; }
.btn.half { width: 50%; font-size: 14px; padding: 10px 8px; }
.btn.disabled { opacity: 0.45; }
.btn .keycap { margin-right: 6px; }

.exe { color: var(--lime); font-size: 0.55em; }

.gauge {
  position: absolute; right: 8px; top: 64px; bottom: 14px;
  width: 30px;
  background: rgba(2, 6, 23, 0.8);
  border: 2px solid #fff; border-radius: 10px;
  overflow: hidden; cursor: pointer;
  box-shadow: 0 3px 0 var(--outline);
}
.gauge .gfill {
  position: absolute; left: 0; right: 0; bottom: 0; height: 0%;
  background: linear-gradient(180deg, #fde047, #f59e0b);
}
.gauge span {
  position: absolute; inset: 0;
  writing-mode: vertical-rl;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-size: 10px; letter-spacing: 0.2em;
  color: #fff; text-shadow: 1px 1px 0 var(--outline);
}
.gauge.full { border-color: var(--lime); animation: gpulse 0.7s infinite alternate; }
.gauge.full span { color: var(--lime); }
@keyframes gpulse { from { box-shadow: 0 3px 0 var(--outline); } to { box-shadow: 0 3px 0 var(--outline), 0 0 14px var(--lime); } }

.card.off { opacity: 0.38; cursor: default; }
.card.off:hover { transform: none; }

@media (prefers-reduced-motion: reduce) {
  .gauge.full { animation: none; }
  .card:hover { transform: none; }
  .btn:hover { transform: none; }
  .panel { transition: none; }
}

.panel {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%) scale(1);
  width: min(86%, 360px);
  background: var(--panel);
  border: 3px solid #fff;
  border-radius: 20px;
  box-shadow: 0 6px 0 var(--outline), 0 24px 60px rgba(0, 0, 0, 0.5);
  padding: 24px 22px 20px;
  text-align: center;
  backdrop-filter: blur(4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.panel.hidden { opacity: 0; pointer-events: none; transform: translate(-50%, -48%) scale(0.96); }
.panel.show { opacity: 1; pointer-events: auto; }

.title {
  font-family: var(--display);
  font-size: 52px; line-height: 0.95; margin: 0;
  color: var(--ball);
  text-shadow: 3px 3px 0 var(--enemy-dark), 6px 6px 0 var(--outline);
}
.title span { color: var(--player); }

.subtitle {
  font-family: var(--display); margin: 6px 0 10px;
  letter-spacing: 0.42em; font-size: 15px; color: var(--lime);
}

.headline {
  font-family: var(--display); font-size: 38px; margin: 0 0 6px;
  color: #fff; text-shadow: 3px 3px 0 var(--outline);
}

.blurb { font-size: 14px; line-height: 1.5; color: #cbd5e1; margin: 0 0 16px; }

.btn {
  font-family: var(--display);
  font-size: 18px;
  border: 3px solid var(--outline);
  border-radius: 14px;
  padding: 12px 18px;
  cursor: pointer;
  width: 100%;
  margin-top: 8px;
  box-shadow: 0 4px 0 var(--outline);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.12s;
}

.btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--outline); }
.btn:focus-visible { outline: 3px solid var(--lime); outline-offset: 2px; }
.btn.primary { background: linear-gradient(180deg, var(--lime), #65a30d); color: #0b1220; }
.btn.ghost { background: #1e293b; color: #e2e8f0; border-color: #e2e8f0; }

.keys {
  display: flex; flex-direction: column; gap: 6px;
  margin: 14px 0 4px; font-size: 12px; color: #94a3b8;
}
.keys div { display: flex; align-items: center; justify-content: center; gap: 5px; flex-wrap: wrap; }
.keys em { font-style: normal; margin-left: 4px; }

.keycap {
  display: inline-block;
  font-family: var(--body); font-weight: 800; font-size: 11px;
  background: #e2e8f0; color: #0f172a;
  border: 1px solid #94a3b8; border-bottom-width: 3px; border-radius: 6px;
  padding: 3px 8px;
}

.best { margin: 12px 0 0; font-size: 13px; letter-spacing: 0.12em; color: #94a3b8; }
.best b { color: var(--ball); font-size: 16px; }

.stats { width: 100%; border-collapse: collapse; margin: 6px 0 10px; font-size: 14px; }
.stats td { padding: 7px 4px; border-bottom: 1px dashed rgba(255, 255, 255, 0.2); color: #cbd5e1; text-align: left; }
.stats td:last-child { text-align: right; color: #fff; }

.toast {
  position: absolute; left: 50%; top: 64px;
  transform: translateX(-50%);
  font-family: var(--display); font-size: 20px;
  background: rgba(2, 6, 23, 0.85);
  border: 2px solid var(--lime); color: var(--lime);
  padding: 8px 18px; border-radius: 999px; white-space: nowrap;
  transition: opacity 0.25s ease;
}
.toast.hidden { opacity: 0; }

.foot { font-size: 12px; color: #94a3b8; margin: 0; text-align: center; }
.foot b { color: #e2e8f0; }

@media (max-width: 520px) {
  .title { font-size: 44px; }
  .pill { font-size: 13px; padding: 5px 11px; }
}
