:root {
  --bg: #241e33; --panel: rgba(30, 25, 45, 0.84); --line: rgba(220, 200, 255, 0.16);
  --text: #f5f0f7; --muted: #b8aec4; --accent: #e8825a; --accent2: #8cc8d8;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: Inter, system-ui, sans-serif; }
canvas#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(20, 12, 30, 0.45) 100%); }
.hidden { display: none !important; }
button { font: inherit; font-weight: 700; color: var(--text); background: rgba(255,255,255,0.07); border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; cursor: pointer; transition: transform .08s, background .15s; }
button:hover { background: rgba(255,255,255,0.14); }
button:active { transform: scale(0.97); }
button.primary { background: linear-gradient(135deg, #e8825a, #c4607a); border: none; box-shadow: 0 4px 14px rgba(0,0,0,0.25); }
button.primary:disabled { opacity: 0.4; cursor: default; }
button.small { padding: 5px 10px; font-size: 13px; }
input { width: 100%; font: inherit; color: var(--text); background: rgba(0,0,0,0.3); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 6px 0 6px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; backdrop-filter: blur(10px); }
.panel h3 { margin: 0 0 10px; font-family: Bungee, sans-serif; font-weight: 400; letter-spacing: 1px; color: var(--accent2); }
.muted { color: var(--muted); font-size: 13px; line-height: 1.45; }
.error { color: #ff7a8a; font-size: 13px; min-height: 1em; margin-top: 8px; }
.row { display: flex; gap: 8px; }

/* menu */
#menu { position: fixed; inset: 0; overflow-y: auto; padding: 5vh 16px 32px; display: flex; flex-direction: column; align-items: center;
  background: linear-gradient(180deg, rgba(36,30,51,0.35), rgba(36,30,51,0.88)); }
#menu h1 { font-family: Bungee, sans-serif; font-weight: 400; font-size: clamp(42px, 8vw, 92px); line-height: 0.9; margin: 0; text-align: center;
  text-shadow: 4px 4px 0 #3b2f52; }
#menu h1 span { color: var(--accent); text-shadow: 4px 4px 0 #3b2f52; }
.tag-line { color: var(--muted); margin: 14px 0 28px; text-align: center; }
.menu-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; width: min(1240px, 100%); }
.fighter-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fighter-head h3 { margin: 0; }
.seg.tabs button { padding: 4px 12px; font-size: 13px; }
#preview { display: block; width: 100%; height: 170px; margin: 10px 0 4px; border-radius: 12px;
  background: radial-gradient(ellipse at 50% 85%, rgba(240,178,133,0.35), transparent 70%), linear-gradient(180deg, rgba(47,74,122,0.5), rgba(154,122,160,0.35)); }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatches .sw { width: 26px; height: 26px; padding: 0; border-radius: 50%; background: var(--c); border: 2px solid rgba(0,0,0,0.35); }
.swatches .sw.on { outline: 3px solid #fff; outline-offset: 1px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chips button { padding: 5px 9px; font-size: 12px; font-weight: 600; border-radius: 8px; }
.chips button.on { background: var(--accent2); color: #1d1828; border-color: transparent; }
.menu-grid .primary { width: 100%; margin-top: 14px; padding: 13px; font-size: 17px; }
.seg { display: flex; gap: 6px; }
.seg button { flex: 1; padding: 8px 0; }
.seg button.on { background: var(--accent2); color: #1d1828; border-color: transparent; }
.controls table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 10px; }
.controls th { color: var(--muted); font-weight: 600; text-align: left; padding: 3px 4px; }
.controls td { padding: 4px; border-top: 1px solid var(--line); }
.controls td:first-child { color: var(--muted); }
#loading { position: fixed; bottom: 16px; right: 16px; color: var(--muted); font-size: 13px; }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; }
#cards { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.card { width: 190px; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: 12px; padding: 8px 10px; }
.card .nm { display: flex; justify-content: space-between; font-weight: 800; font-size: 14px; }
.card .nm .you { color: var(--c); font-size: 11px; }
.card .bar { height: 9px; border-radius: 6px; background: rgba(255,255,255,0.1); margin-top: 6px; overflow: hidden; }
.card .bar i { display: block; height: 100%; background: var(--c); transition: width .15s; }
.card .wp { font-size: 12px; font-weight: 600; color: var(--muted); margin-top: 4px; min-height: 15px; }
.card .pips { display: flex; gap: 4px; margin-top: 6px; }
.card .pips b { width: 10px; height: 10px; border-radius: 50%; border: 1px solid var(--c); }
.card .pips b.on { background: var(--c); }
.card.out { opacity: 0.45; }
#timer { position: absolute; top: 96px; left: 50%; transform: translateX(-50%); font-family: Bungee, sans-serif; font-size: 28px; text-shadow: 2px 2px 0 rgba(30,22,45,0.7); }
#banner { position: absolute; top: 38%; left: 0; right: 0; text-align: center; font-family: Bungee, sans-serif; font-size: clamp(36px, 7vw, 84px); opacity: 0;
  color: #fff5e8; text-shadow: 4px 4px 0 rgba(40,28,60,0.75); }
#banner.show { animation: pop 1.3s ease-out forwards; }
#banner.hold { animation: popHold 0.4s ease-out forwards; }
@keyframes pop { 0% { opacity: 0; transform: scale(2.2); } 12% { opacity: 1; transform: scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: scale(0.95); } }
@keyframes popHold { 0% { opacity: 0; transform: scale(2); } 100% { opacity: 1; transform: scale(1); } }
#focushint { position: absolute; bottom: 48px; left: 50%; transform: translateX(-50%); background: rgba(30, 25, 45, 0.92); border: 1px solid var(--accent); color: #fff; font-weight: 700; padding: 10px 18px; border-radius: 10px; pointer-events: auto; cursor: pointer; white-space: nowrap; }
#errbox { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); max-width: min(720px, 92vw); background: #7a2330; color: #fff; padding: 10px 14px; border-radius: 10px; font-size: 13px; z-index: 50; }
#debug { position: fixed; left: 12px; top: 90px; margin: 0; background: rgba(0,0,0,0.7); color: #d8ffd8; font: 12px/1.45 Consolas, monospace; padding: 8px 10px; border-radius: 8px; z-index: 50; pointer-events: none; white-space: pre; }
#netstatus { position: absolute; top: 140px; left: 50%; transform: translateX(-50%); background: rgba(150, 50, 50, 0.85); color: #fff; font-weight: 700; padding: 8px 16px; border-radius: 10px; }
#hint { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); color: var(--muted); font-size: 12px; background: rgba(0,0,0,0.35); padding: 6px 12px; border-radius: 8px; white-space: nowrap; }

#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.tag { position: absolute; left: 0; top: 0; font-size: 12px; font-weight: 800; color: var(--c); text-shadow: 0 1px 3px #000; white-space: nowrap; }
.tag.dead { opacity: 0.4; text-decoration: line-through; }
.tag.me { color: #fff; background: var(--c); padding: 2px 9px; border-radius: 999px; font-size: 13px; text-shadow: none; box-shadow: 0 2px 6px rgba(0,0,0,0.35); }
.tag.me::after { content: ''; position: absolute; left: 50%; bottom: -5px; transform: translateX(-50%); border: 5px solid transparent; border-top-color: var(--c); border-bottom: 0; }
.card.me { background: rgba(60, 50, 80, 0.92); box-shadow: 0 0 0 2px var(--c); }
.tag.stun::after { content: ' ✦'; color: #ffe066; }

/* lobby */
#lobby { position: fixed; left: 12px; bottom: 12px; width: 280px; }
.lobby-head { font-family: Bungee, sans-serif; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.lobby-head #room-code { color: var(--accent2); letter-spacing: 2px; }
.lobby-head button { margin-left: auto; }
#lobby .share { margin-top: 6px; font-size: 12px; word-break: break-all; user-select: all; }
#lobby-list { list-style: none; padding: 0; margin: 10px 0; }
#lobby-list li { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-weight: 600; }
#lobby-list li i { width: 12px; height: 12px; border-radius: 50%; background: var(--c); }
#lobby-list li small { color: var(--muted); font-weight: 400; }
#host-controls .primary { width: 100%; margin-top: 8px; }
#lobby-map-row { margin-bottom: 8px; }
#lobby-map-row label { margin-top: 0; }
#over { position: fixed; top: 58%; left: 50%; transform: translateX(-50%); text-align: center; min-width: 300px; }
#over h2 { font-family: Bungee, sans-serif; font-weight: 400; margin: 0 0 14px; }
#over .row { justify-content: center; margin-bottom: 10px; }

@media (max-width: 640px) {
  .card { width: calc(50% - 6px); }
  #timer { top: auto; bottom: 40px; }
  #lobby { width: auto; right: 12px; }
}
