:root {
  --bg: #0e1220;
  --bg-soft: #161b2e;
  --panel: #1b2036;
  --line: #2a3150;
  --text: #e8ecff;
  --muted: #8b93b8;
  --accent: #ffe66d;
  --good: #2ecc71;
  --bad: #ff6b6b;
  --warn: #ffb545;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: radial-gradient(1200px 600px at 50% -10%, #1d2440 0%, var(--bg) 60%);
  color: var(--text);
  font: 14px/1.45 "Segoe UI", Roboto, Arial, sans-serif;
}

body { display: flex; flex-direction: column; min-height: 100%; }

.hidden { display: none !important; }

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 20px;
  background: rgba(14, 18, 32, 0.85);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(6px);
}

.logo {
  font-weight: 800;
  letter-spacing: 3px;
  font-size: 20px;
  color: var(--accent);
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.logo span {
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--muted);
  font-weight: 400;
  text-transform: uppercase;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  font-size: 12px;
  color: var(--muted);
}

.status i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  display: inline-block;
}

.status.online i { background: var(--good); box-shadow: 0 0 8px var(--good); }
.status.online { color: var(--text); }
.status.connecting i { background: var(--warn); }
.status.offline i { background: var(--bad); }

.score { margin-left: auto; font-size: 15px; color: var(--muted); }
.score strong { color: var(--accent); font-size: 20px; }

main {
  flex: 1;
  display: flex;
  gap: 18px;
  padding: 18px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.stage { position: relative; }

canvas {
  display: block;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #12162a;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  max-width: 100%;
}

.legend {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.legend span { color: var(--text); }

.panel {
  width: 290px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}

.panel h2 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--muted);
  margin: 18px 0 8px;
  display: flex;
  justify-content: space-between;
}

.panel h2:first-child { margin-top: 0; }

.panel h2 small { color: var(--accent); letter-spacing: 0; }

.board { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }

.board li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--bg-soft);
  font-size: 13px;
}

.board li.me { outline: 1px solid var(--accent); }
.board li.off { opacity: 0.45; }
.board .dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.board .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .pts { color: var(--accent); font-weight: 700; }

.beacon-info { font-size: 13px; color: var(--muted); }
.beacon-info b { color: var(--text); }

.stats { margin: 0; font-size: 13px; }
.stats div { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px dashed rgba(255, 255, 255, 0.06); }
.stats dt { color: var(--muted); }
.stats dd { margin: 0; }

.rules { margin: 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.rules strong { color: var(--accent); }

button {
  cursor: pointer;
  font: inherit;
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 10px 14px;
}

button.primary { background: var(--accent); color: #1b1b1b; border-color: transparent; font-weight: 700; width: 100%; }
button.ghost { background: transparent; color: var(--muted); width: 100%; margin-top: 18px; }
button.ghost:hover { color: var(--text); border-color: var(--accent); }

.toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 30;
  max-width: 320px;
}

.toast {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  animation: slide 0.2s ease-out;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
}

.toast.conflict { border-left-color: var(--bad); }
.toast.info { border-left-color: #4ecdc4; }
.toast.fade { opacity: 0; transition: opacity 0.3s; }

@keyframes slide { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

.offline-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  background: linear-gradient(90deg, #7a2b2b, #a8433a);
  padding: 8px 20px;
  text-align: center;
  font-size: 13px;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 9, 18, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}

.card {
  width: 380px;
  max-width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 26px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}

.card h1 { margin: 0 0 8px; font-size: 22px; }
.card p { margin: 0 0 18px; color: var(--muted); font-size: 13px; }
.card label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }

.card input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  margin-bottom: 16px;
}

.card input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
