:root {
  --bg: #060913;
  --surface: #0f172a;
  --surface-alt: #16213a;
  --border: #253659;
  --cyan: #00f5ff;
  --magenta: #ff2e97;
  --gold: #ffd600;
  --green: #39ff14;
  --red: #ff3b5c;
  --orange: #ff7a00;
  --text: #f1f5f9;
  --muted: #94a3b8;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html, body, #app {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

.hidden {
  display: none !important;
}

.cyan { color: var(--cyan); }
.magenta { color: var(--magenta); }
.gold { color: var(--gold); }
.red { color: var(--red); }

.overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(4, 8, 18, 0.78);
  backdrop-filter: blur(6px);
  z-index: 20;
  padding: 20px;
}

.overlay.active {
  display: flex;
}

.menu-card, .modal-card {
  width: 100%;
  max-width: 440px;
  background: rgba(15, 23, 42, 0.94);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 28px 26px;
  text-align: center;
  box-shadow: 0 0 40px rgba(0, 245, 255, 0.14);
}

.modal-card.wide {
  max-width: 560px;
  text-align: left;
}

.border-cyan { border-color: var(--cyan); }
.border-magenta { border-color: var(--magenta); }
.border-gold { border-color: var(--gold); }

.title {
  margin: 14px 0 12px;
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 900;
  letter-spacing: 4px;
  color: var(--cyan);
  text-shadow: 0 0 22px rgba(0, 245, 255, 0.45);
}

.pill-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.pill {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.7px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid currentColor;
  white-space: nowrap;
}

.pill-cyan { color: var(--cyan); }
.pill-magenta { color: var(--magenta); }
.pill-gold { color: var(--gold); }
.pill-green { color: var(--green); }

.btn-stack {
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin-top: 14px;
}

.btn {
  height: 50px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 18px rgba(0, 245, 255, 0.25);
}

.btn-primary-cyan {
  background: linear-gradient(90deg, var(--cyan), #00c8d6);
  color: #041016;
  border: 1px solid var(--cyan);
}

.btn-primary-magenta {
  background: linear-gradient(90deg, var(--magenta), #d91c7d);
  color: #fff;
  border: 1px solid var(--magenta);
}

.btn-primary-green {
  background: linear-gradient(90deg, var(--green), #22c55e);
  color: #041016;
  border: 1px solid var(--green);
}

.btn-outline-cyan, .btn-outline-gold, .btn-outline-magenta {
  background: rgba(15, 23, 42, 0.85);
  color: var(--text);
}

.btn-outline-cyan { border: 1.5px solid var(--cyan); }
.btn-outline-gold { border: 1.5px solid var(--gold); }
.btn-outline-magenta { border: 1.5px solid var(--magenta); }

.controls-legend {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
}

/* HUD */
.hud {
  position: fixed;
  top: 10px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
  z-index: 10;
}

.hud-left, .hud-right, .hud-p2 {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 800;
  color: var(--muted);
}

.bar-bg {
  width: 62px;
  height: 7px;
  border-radius: 4px;
  background: rgba(6, 9, 19, 0.85);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.bar-fill {
  height: 100%;
  width: 100%;
  transition: width 0.08s linear;
}

.bar-fill.green { background: var(--green); }
.bar-fill.cyan { background: var(--cyan); }
.bar-fill.magenta { background: var(--magenta); }
.bar-fill.red { background: var(--red); }

.hud-btn {
  background: rgba(15, 23, 42, 0.9);
  color: var(--text);
  border: 1.5px solid var(--cyan);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

/* VEHICLE DOCK */
.vehicle-dock {
  position: fixed;
  bottom: 14px;
  display: flex;
  gap: 6px;
  padding: 6px 8px;
  background: rgba(15, 23, 42, 0.92);
  border-radius: 14px;
  border: 1.5px solid var(--cyan);
  z-index: 12;
}

.dock-p1 { left: 50%; transform: translateX(-50%); }
.dock-p1.split { left: 16px; transform: none; }
.dock-p2 { right: 16px; border-color: var(--magenta); }

.v-btn {
  background: #152038;
  color: var(--text);
  border: 1px solid rgba(0, 245, 255, 0.4);
  border-radius: 9px;
  padding: 7px 11px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.dock-p1 .v-btn.active {
  background: var(--cyan);
  color: #041016;
  border-color: #fff;
}

.dock-p2 .v-btn {
  border-color: rgba(255, 46, 151, 0.45);
}

.dock-p2 .v-btn.active {
  background: var(--magenta);
  color: #fff;
  border-color: #fff;
}

/* MODALS */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 58vh;
  overflow-y: auto;
}

.lb-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
}

.lb-row.me { border-color: var(--cyan); }

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 600;
}

.setting-row.column {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.setting-row input[type="text"] {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
}

.setting-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--cyan);
}

/* TOUCH CONTROLS (Tablet / Mobile) */
.touch-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 11;
}

.joystick {
  position: fixed;
  bottom: 24px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.52);
  border: 2px solid rgba(0, 245, 255, 0.55);
  pointer-events: auto;
  touch-action: none;
}

.joy-p1 { left: 22px; }
.joy-p2 { right: 22px; border-color: rgba(255, 46, 151, 0.6); }

.joy-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  margin-left: -24px;
  margin-top: -24px;
  border-radius: 50%;
  background: rgba(0, 245, 255, 0.82);
  pointer-events: none;
}

.knob-p2 { background: rgba(255, 46, 151, 0.85); }

.action-btns {
  position: fixed;
  bottom: 28px;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  pointer-events: auto;
}

.act-p1 { right: 24px; }
.act-p1.split { right: auto; left: 158px; }
.act-p2 { right: 158px; }

.touch-btn {
  border-radius: 50%;
  font-weight: 900;
  color: #fff;
  cursor: pointer;
  touch-action: none;
}

.touch-btn.fire {
  width: 82px;
  height: 82px;
  font-size: 14px;
  background: rgba(255, 46, 151, 0.34);
  border: 2.5px solid var(--magenta);
}

.touch-btn.fire-p2 {
  width: 76px;
  height: 76px;
  font-size: 13px;
  background: rgba(255, 46, 151, 0.34);
  border: 2.5px solid var(--magenta);
}

.touch-btn.mine {
  width: 56px;
  height: 56px;
  font-size: 11px;
  color: var(--gold);
  background: rgba(255, 122, 0, 0.28);
  border: 2px solid var(--orange);
}
