:root {
  --bg: #0e1320;
  --panel-solid: #1a2436;
  --ink: #e8edf6;
  --muted: #93a0b8;
  --accent: #ff9a2e;
  --accent2: #4fc3f7;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: radial-gradient(1200px 800px at 50% -10%, #1a2740, var(--bg));
  color: var(--ink);
  min-height: 100vh;
}

#app {
  max-width: 1160px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

header h1 {
  font-size: 34px;
  letter-spacing: 1px;
  margin: 8px 0 18px;
  text-align: center;
}
header h1 span { color: var(--accent); }

.panel {
  background: var(--panel-solid);
  border: 1px solid #2a3550;
  border-radius: 12px;
  padding: 20px;
  max-width: 460px;
  margin: 0 auto;
}
.lead { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 0 0 16px; }

label { display: block; color: var(--muted); font-size: 13px; }

input {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #34405e;
  background: #0f1626;
  color: var(--ink);
  font-size: 15px;
}
input:focus { outline: 2px solid var(--accent2); border-color: var(--accent2); }

button {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 11px 16px;
  font-size: 15px;
  font-weight: 700;
  background: var(--accent);
  color: #2a1400;
  white-space: nowrap;
}
button:hover { filter: brightness(1.08); }
#joinBtn { width: 100%; margin-top: 14px; }

.error { color: #ff6b6b; min-height: 18px; font-size: 14px; text-align: center; margin: 10px 0 0; }
.hint { color: var(--muted); font-size: 12px; }
.panel .hint { text-align: center; margin: 12px 0 0; }

/* ---- game ---- */
#hudbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 auto 10px;
  width: 100%;
  max-width: 972px;
}
#hud { display: inline-flex; align-items: center; gap: 1px; flex-wrap: wrap; min-height: 18px; }
#hudbar .hint { margin-left: auto; }
.ic { width: 16px; height: 16px; }

/* canvas + scoreboard side by side; the board wraps below on narrow screens */
#playarea {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: center;
  flex-wrap: wrap;
}

#stage { position: relative; width: 760px; max-width: 100%; }
canvas {
  display: block;
  width: 100%;
  border-radius: 10px;
  border: 1px solid #2a3550;
  background: #0d1426;
}

.scoreboard {
  width: 175px;
  flex: 0 0 auto;
  align-self: stretch;
  background: var(--panel-solid);
  border: 1px solid #2a3550;
  border-radius: 10px;
  padding: 10px 10px;
  font-size: 13px;
}
.sb-head { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; min-height: 13px; }
.sb-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px;
  border-radius: 6px;
}
.sb-row.you { color: var(--accent); font-weight: 700; }
.sb-row.fire { background: linear-gradient(90deg, rgba(255,120,40,0.22), rgba(255,120,40,0)); }
.sb-rank { color: var(--muted); width: 16px; text-align: right; font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.sb-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flame { font-size: 11px; }
.bot { font-size: 9px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); border: 1px solid #3a4666; border-radius: 4px; padding: 0 3px; }
.sb-score { color: var(--accent2); font-weight: 700; font-variant-numeric: tabular-nums; }
.sb-row.you .sb-score { color: var(--accent); }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex: 0 0 auto; }

#status {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: rgba(14, 19, 32, 0.9);
  border: 1px solid var(--accent);
  color: var(--ink);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
}
