:root {
  --bg-dark: #0f172a;
  --panel-bg: rgba(15, 23, 42, 0.9);
  --panel-border: rgba(148, 163, 184, 0.3);
  --accent: #f59e0b;
  --accent-hot: #ef4444;
  --text: #f8fafc;
  --muted: #94a3b8;
  --radius: 14px;
}

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

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background: radial-gradient(circle at top, #1e293b 0%, #090d16 100%);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  touch-action: manipulation;
  overscroll-behavior: none;
}

#app {
  width: 100%;
  height: 100dvh;
  position: relative;
}

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

.hidden {
  display: none !important;
}

/* Loading Screen */
.overlay-screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at top, #1e3a5f 0%, #0b1120 75%);
  z-index: 50;
  overflow-y: auto;
  padding: 20px;
}

.loading-card {
  background: var(--panel-bg);
  border: 2px solid var(--panel-border);
  border-radius: 20px;
  padding: 36px 44px;
  text-align: center;
  width: min(440px, 92vw);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}

.loading-logo {
  font-size: 36px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #fbbf24;
  text-shadow: 0 3px 0 #92400e;
  margin-bottom: 18px;
}

.loading-logo span {
  color: #f87171;
  font-size: 20px;
  vertical-align: middle;
}

.loading-bar-wrap {
  height: 14px;
  background: #1e293b;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid #334155;
}

.loading-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #f59e0b, #ef4444);
  transition: width 0.15s ease;
}

.loading-text {
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
}

/* Main Menu */
.menu-container {
  width: min(1040px, 96vw);
  max-height: 95vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.menu-hero {
  text-align: center;
  position: relative;
}

.menu-banner-img {
  height: 155px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 12px 24px rgba(0,0,0,0.65));
  margin-bottom: -8px;
}

.game-title {
  margin: 0;
  font-size: clamp(34px, 5vw, 52px);
  font-weight: 900;
  letter-spacing: 3px;
  color: #fde047;
  text-shadow: 0 4px 0 #b45309, 0 10px 26px rgba(0,0,0,0.8);
}

.game-title span {
  color: #fb7185;
  font-size: 0.55em;
  vertical-align: middle;
  letter-spacing: 1px;
}

.game-subtitle {
  margin: 4px 0 0;
  color: #cbd5e1;
  font-size: 14px;
}

.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 820px) {
  .menu-grid {
    grid-template-columns: 1fr;
  }
}

.menu-panel {
  background: rgba(15, 23, 42, 0.85);
  border: 2px solid rgba(148, 163, 184, 0.28);
  border-radius: 18px;
  padding: 18px 20px;
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.menu-panel h2 {
  margin: 0 0 14px;
  font-size: 18px;
  color: #fef08a;
}

.panel-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.panel-header-row h2 {
  margin: 0;
}

.setting-row {
  margin-bottom: 13px;
}

.setting-row.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.setting-row label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  margin-bottom: 6px;
}

.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  background: #1e293b;
  color: #cbd5e1;
  border: 1.5px solid #334155;
  border-radius: 10px;
  padding: 7px 11px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
}

.pill:hover {
  border-color: #fbbf24;
  color: #fff;
}

.pill.active {
  background: linear-gradient(180deg, #f59e0b, #d97706);
  color: #111827;
  border-color: #fde68a;
  font-weight: 800;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.4);
}

.teams-setup-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.team-setup-card {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1e293b;
  border: 1.5px solid #334155;
  border-radius: 10px;
  padding: 7px 10px;
}

.team-color-chip {
  width: 14px;
  height: 28px;
  border-radius: 6px;
  flex-shrink: 0;
}

.team-name-input {
  flex: 1;
  min-width: 0;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 7px;
  padding: 6px 9px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.team-type-btn {
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: 1.5px solid #475569;
  background: #0f172a;
  color: #e2e8f0;
  min-width: 86px;
}

.team-type-btn.is-bot {
  background: #312e81;
  border-color: #818cf8;
  color: #e0e7ff;
}

.controls-mini {
  background: rgba(15, 23, 42, 0.7);
  border: 1px dashed #334155;
  border-radius: 10px;
  padding: 9px 11px;
  font-size: 12px;
  color: #cbd5e1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  line-height: 1.5;
}

kbd {
  background: #334155;
  border: 1px solid #475569;
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 11px;
  font-family: monospace;
  color: #fef08a;
}

.menu-actions {
  display: flex;
  justify-content: center;
}

.btn-battle {
  background: linear-gradient(180deg, #ef4444 0%, #b91c1c 100%);
  color: #fff;
  border: 2px solid #fca5a5;
  border-radius: 16px;
  padding: 14px 48px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 1.5px;
  cursor: pointer;
  box-shadow: 0 6px 0 #7f1d1d, 0 14px 30px rgba(239, 68, 68, 0.45);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn-battle:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

.btn-battle:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #7f1d1d;
}

.btn-battle.small {
  padding: 10px 24px;
  font-size: 16px;
}

/* Game Canvas & HUD */
#gameContainer {
  position: relative;
  width: 100%;
  height: 100%;
}

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

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

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

.hud-center {
  pointer-events: none;
  flex: 1;
  justify-content: center;
}

.turn-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.88);
  border: 2px solid rgba(255,255,255,0.22);
  border-radius: 12px;
  padding: 6px 12px;
  font-weight: 800;
  font-size: 14px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.45);
}

.team-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid #fff;
}

.phase-tag {
  background: #334155;
  color: #fde047;
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11px;
  letter-spacing: 0.4px;
}

.timer-box {
  background: #0f172a;
  border: 2px solid #f59e0b;
  color: #fde047;
  font-weight: 900;
  font-size: 22px;
  min-width: 52px;
  text-align: center;
  border-radius: 12px;
  padding: 4px 10px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.5);
  font-variant-numeric: tabular-nums;
}

.timer-box.urgent {
  border-color: #ef4444;
  color: #fca5a5;
  animation: pulseUrgent 0.6s infinite alternate;
}

@keyframes pulseUrgent {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

.announcer-banner {
  background: rgba(15, 23, 42, 0.92);
  border: 2px solid #fbbf24;
  color: #fef08a;
  padding: 7px 18px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.55);
  text-align: center;
}

.wind-widget {
  background: rgba(15, 23, 42, 0.88);
  border: 2px solid rgba(148, 163, 184, 0.35);
  border-radius: 12px;
  padding: 5px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.wind-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.2px;
  color: #94a3b8;
}

.wind-bar {
  width: 116px;
  height: 10px;
  background: #020617;
  border-radius: 999px;
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid #334155;
}

.wind-half {
  width: 50%;
  height: 100%;
  display: flex;
}

.wind-half.left {
  justify-content: flex-end;
}

.wind-half.right {
  justify-content: flex-start;
}

.wind-center-line {
  width: 2px;
  height: 100%;
  background: #f8fafc;
}

.wind-fill {
  height: 100%;
  width: 0%;
  transition: width 0.4s ease;
}

#windLeftFill {
  background: linear-gradient(90deg, #38bdf8, #0284c7);
}

#windRightFill {
  background: linear-gradient(90deg, #0284c7, #38bdf8);
}

.hud-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1.5px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.88);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.12s ease;
}

.hud-icon-btn:hover {
  border-color: #fbbf24;
  transform: translateY(-1px);
}

.hud-icon-btn.muted {
  opacity: 0.5;
}

/* Team Health Bars (Bottom Left) */
.team-bars-hud {
  position: absolute;
  bottom: 12px;
  left: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  z-index: 10;
  pointer-events: none;
}

.team-hp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.82);
  border: 1.5px solid rgba(255,255,255,0.16);
  border-radius: 9px;
  padding: 4px 8px;
  min-width: 195px;
}

.team-hp-row.active-team {
  border-color: #fbbf24;
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.3);
}

.team-hp-name {
  font-size: 12px;
  font-weight: 800;
  width: 82px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-hp-track {
  flex: 1;
  height: 11px;
  background: #020617;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #334155;
}

.team-hp-fill {
  height: 100%;
  transition: width 0.35s ease;
}

.team-hp-num {
  font-size: 11px;
  font-weight: 800;
  min-width: 28px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Bottom Center Touch / Mouse Controls */
.hud-bottom-center {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 10;
}

.action-key {
  background: rgba(15, 23, 42, 0.86);
  color: #e2e8f0;
  border: 1.5px solid rgba(148, 163, 184, 0.35);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.action-key:active {
  background: #334155;
  transform: scale(0.96);
}

.action-key.fire-key {
  background: linear-gradient(180deg, #ef4444, #b91c1c);
  border-color: #fca5a5;
  color: #fff;
}

/* Mobile Virtual Analog Joystick & Right Thumb Action Cluster (hidden on desktop) */
.touch-joystick,
.mobile-right-actions {
  display: none;
}

@media (max-width: 900px), (hover: none) and (pointer: coarse) {
  .hud-bottom-center {
    display: none;
  }
  .touch-joystick {
    display: block;
    position: absolute;
    bottom: calc(14px + env(safe-area-inset-bottom));
    left: calc(14px + env(safe-area-inset-left));
    width: 122px;
    height: 122px;
    z-index: 15;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
  }
  .joystick-ring {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(15, 23, 42, 0.45) 0%, rgba(15, 23, 42, 0.82) 100%);
    border: 2px solid rgba(148, 163, 184, 0.45);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), inset 0 0 18px rgba(56, 189, 248, 0.14);
    backdrop-filter: blur(6px);
  }
  .joy-dir {
    position: absolute;
    font-size: 10px;
    color: rgba(203, 213, 225, 0.48);
    pointer-events: none;
    font-weight: 800;
  }
  .joy-dir.n { top: 6px; left: 50%; transform: translateX(-50%); }
  .joy-dir.s { bottom: 6px; left: 50%; transform: translateX(-50%); }
  .joy-dir.w { left: 8px; top: 50%; transform: translateY(-50%); }
  .joy-dir.e { right: 8px; top: 50%; transform: translateY(-50%); }

  .joystick-knob {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 50px;
    height: 50px;
    margin-left: -25px;
    margin-top: -25px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #fde047 0%, #f59e0b 55%, #b45309 100%);
    border: 2px solid #fef9c3;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
    pointer-events: none;
    transition: transform 0.04s linear;
  }
  .touch-joystick.active .joystick-ring {
    border-color: #fbbf24;
  }

  .mobile-right-actions {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    touch-action: none;
  }
  .mob-round-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.88);
    border: 2px solid rgba(148, 163, 184, 0.45);
    color: #f8fafc;
    font-size: 16px;
    font-weight: 800;
    line-height: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    padding: 0;
    cursor: pointer;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
  }
  .mob-round-btn span {
    font-size: 8px;
    font-weight: 700;
    color: #cbd5e1;
    text-transform: uppercase;
  }
  .mob-round-btn:active {
    transform: scale(0.92);
    border-color: #38bdf8;
    background: #1e293b;
  }

  .mob-fire-btn {
    width: 66px;
    height: 66px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #fb7185 0%, #ef4444 50%, #991b1b 100%);
    border: 2.5px solid #fecaca;
    color: #fff;
    font-size: 20px;
    font-weight: 900;
    line-height: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 0;
    cursor: pointer;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.55);
  }
  .mob-fire-btn span {
    font-size: 9px;
    letter-spacing: 0.4px;
  }
  .mob-fire-btn:active,
  .mob-fire-btn.charging {
    transform: scale(0.93);
    box-shadow: 0 0 24px rgba(251, 191, 36, 0.9);
    border-color: #fde047;
  }
}

@media (max-width: 820px) {
  .overlay-screen {
    align-items: flex-start;
    padding: 10px 8px 24px;
  }
  .menu-container {
    width: 100%;
    max-height: none;
    overflow-y: visible;
    gap: 10px;
  }
  .menu-banner-img {
    height: 82px;
    margin-bottom: -4px;
  }
  .game-subtitle {
    font-size: 12px;
  }
  .menu-panel {
    padding: 12px 12px;
    border-radius: 14px;
  }
  .setting-row.split {
    grid-template-columns: 1fr;
  }
  .llm-inputs {
    grid-template-columns: 1fr;
  }
  .wifi-qr-wrap {
    flex-direction: column;
    align-items: stretch;
  }
  .wifi-qr-box {
    align-self: center;
  }
  .hud-top {
    padding: 6px 8px;
    gap: 6px;
  }
  .turn-badge {
    padding: 4px 8px;
    font-size: 11px;
    gap: 5px;
  }
  .phase-tag {
    font-size: 9px;
    padding: 1px 5px;
  }
  .timer-box {
    font-size: 15px;
    padding: 3px 8px;
    min-width: 34px;
  }
  .hud-icon-btn {
    width: 32px;
    height: 32px;
    font-size: 14px;
    border-radius: 8px;
  }
  .hud-bottom-right {
    bottom: calc(10px + env(safe-area-inset-bottom));
    right: calc(10px + env(safe-area-inset-right));
    gap: 7px;
  }
  .weapon-dock-btn {
    padding: 5px 10px 5px 7px;
    gap: 6px;
    border-radius: 12px;
  }
  .weapon-dock-btn img {
    width: 30px;
    height: 30px;
  }
  .weapon-dock-name {
    font-size: 12px;
    max-width: 112px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .weapon-dock-ammo {
    font-size: 10px;
  }
  .fuse-selector {
    padding: 3px 5px;
    gap: 3px;
    font-size: 10px;
  }
  .fuse-selector span {
    display: none;
  }
  .fuse-btn {
    padding: 4px 7px;
    font-size: 11px;
  }
  .arsenal-drawer {
    left: 8px;
    right: 8px;
    width: auto;
    bottom: calc(146px + env(safe-area-inset-bottom));
    max-height: 52dvh;
    padding: 10px;
  }
  .arsenal-grid {
    grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
    gap: 6px;
  }
  .arsenal-slot {
    height: 52px;
    padding: 5px;
  }
  .team-bars-hud {
    bottom: auto;
    top: 46px;
    left: 8px;
    gap: 3px;
    pointer-events: none;
  }
  .team-hp-row {
    min-width: 118px;
    padding: 2px 6px;
    font-size: 10px;
    gap: 5px;
  }
  .team-hp-name {
    width: 52px;
  }
  .hud-right {
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 4px;
  }
  .wind-widget {
    display: none;
  }
  .announcer-banner {
    font-size: 12px;
    padding: 4px 10px;
    max-width: 88vw;
    white-space: normal;
    text-align: center;
  }
}

@media (max-height: 500px) and (pointer: coarse) {
  .touch-joystick {
    width: 104px;
    height: 104px;
    bottom: calc(8px + env(safe-area-inset-bottom));
  }
  .joystick-knob {
    width: 42px;
    height: 42px;
    margin-left: -21px;
    margin-top: -21px;
  }
  .mob-fire-btn {
    width: 58px;
    height: 58px;
    font-size: 18px;
  }
  .mob-round-btn {
    width: 44px;
    height: 44px;
  }
  .arsenal-drawer {
    bottom: calc(122px + env(safe-area-inset-bottom));
    max-height: 60dvh;
  }
}

/* Wi-Fi Multiplayer & QR Invite Card */
.wifi-invite-card {
  background: rgba(14, 116, 144, 0.16);
  border: 1.5px solid rgba(56, 189, 248, 0.42);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.wifi-invite-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.wifi-title {
  font-size: 13px;
  font-weight: 800;
  color: #7dd3fc;
}

.wifi-status {
  font-size: 12px;
  color: #cbd5e1;
  margin-top: 2px;
}

.wifi-status.connected {
  color: #86efac;
  font-weight: 700;
}

.wifi-qr-toggle {
  background: #0f172a;
  color: #7dd3fc;
  border: 1px solid #38bdf8;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.wifi-qr-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(56, 189, 248, 0.3);
}

.wifi-qr-box {
  background: #fff;
  padding: 6px;
  border-radius: 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.wifi-qr-box svg {
  display: block;
  width: 136px;
  height: 136px;
}

.wifi-link-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wifi-hint {
  font-size: 11px;
  color: #cbd5e1;
  line-height: 1.35;
}

.wifi-url-row {
  display: flex;
  gap: 6px;
}

.wifi-url-input {
  flex: 1;
  min-width: 0;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 7px;
  padding: 6px 8px;
  color: #fde047;
  font-size: 11px;
  font-family: monospace;
  user-select: all;
  -webkit-user-select: all;
}

.wifi-copy-btn {
  background: #0284c7;
  border: 1px solid #38bdf8;
  color: #fff;
  border-radius: 7px;
  padding: 0 10px;
  font-size: 13px;
  cursor: pointer;
}

.wifi-room-code {
  font-size: 12px;
  color: #94a3b8;
}

.wifi-room-code b {
  color: #fde047;
  letter-spacing: 1px;
}

.wifi-join-by-code {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(56, 189, 248, 0.3);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wifi-join-label {
  font-size: 11px;
  font-weight: 700;
  color: #93c5fd;
}

.wifi-join-inputs {
  display: flex;
  gap: 6px;
}

.wifi-code-input {
  flex: 1;
  min-width: 0;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 7px;
  padding: 7px 10px;
  color: #fde047;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-family: monospace;
}

.wifi-code-input:focus {
  outline: none;
  border-color: #38bdf8;
}

.wifi-join-btn {
  background: #0ea5e9;
  border: 1px solid #38bdf8;
  color: #fff;
  border-radius: 7px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.wifi-join-btn:hover {
  background: #0284c7;
}

.wifi-join-error {
  font-size: 11px;
  color: #fca5a5;
  font-weight: 600;
}

.team-type-btn.is-wifi {
  background: #0c4a6e;
  border-color: #38bdf8;
  color: #bae6fd;
}

.guest-lobby-card {
  width: min(420px, 94vw);
}

.guest-conn-badge {
  display: inline-block;
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(52, 211, 153, 0.5);
  color: #6ee7b7;
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 700;
}

.guest-conn-badge.error {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(248, 113, 113, 0.5);
  color: #fca5a5;
}

.guest-team-info {
  margin-top: 12px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  color: #fde047;
  font-weight: 700;
}

.guest-tips {
  margin-top: 12px;
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.4;
}

/* Bottom Right Weapon Dock */
.hud-bottom-right {
  position: absolute;
  bottom: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
  z-index: 10;
}

.fuse-selector {
  background: rgba(15, 23, 42, 0.9);
  border: 1.5px solid rgba(148, 163, 184, 0.35);
  border-radius: 10px;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #cbd5e1;
}

.fuse-btn {
  background: #1e293b;
  border: 1px solid #475569;
  color: #e2e8f0;
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.fuse-btn.active {
  background: #f59e0b;
  color: #111827;
  border-color: #fde68a;
}

.weapon-dock-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(15, 23, 42, 0.92);
  border: 2px solid #f59e0b;
  border-radius: 14px;
  padding: 7px 14px 7px 10px;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
  transition: transform 0.12s ease;
}

.weapon-dock-btn:hover {
  transform: translateY(-2px);
}

.weapon-dock-btn img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.weapon-dock-info {
  text-align: left;
}

.weapon-dock-name {
  font-size: 14px;
  font-weight: 800;
  color: #fef08a;
}

.weapon-dock-ammo {
  font-size: 11px;
  color: #cbd5e1;
}

/* Arsenal Drawer */
.arsenal-drawer {
  position: absolute;
  right: 14px;
  bottom: 84px;
  width: min(468px, 94vw);
  max-height: calc(100vh - 104px);
  overflow-y: auto;
  background: rgba(15, 23, 42, 0.96);
  border: 2px solid #f59e0b;
  border-radius: 16px;
  padding: 12px;
  z-index: 25;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
}

.arsenal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
  font-size: 13px;
  color: #fde047;
  margin-bottom: 10px;
}

.arsenal-close {
  background: #334155;
  border: none;
  color: #fff;
  border-radius: 6px;
  width: 24px;
  height: 24px;
  cursor: pointer;
}

.arsenal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 7px;
}

.arsenal-slot {
  position: relative;
  background: #1e293b;
  border: 1.5px solid #334155;
  border-radius: 10px;
  width: 100%;
  height: 58px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, transform 0.12s ease;
}

.arsenal-slot:hover:not(.empty) {
  border-color: #fbbf24;
  background: #283548;
  transform: scale(1.04);
}

.arsenal-slot.selected {
  border-color: #fde047;
  background: rgba(245, 158, 11, 0.22);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.45);
}

.arsenal-slot.empty {
  opacity: 0.3;
  cursor: not-allowed;
}

.arsenal-slot img {
  width: 46px;
  height: 46px;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.slot-ammo {
  position: absolute;
  bottom: 2px;
  right: 4px;
  background: rgba(2, 6, 23, 0.85);
  color: #fde047;
  font-size: 10px;
  font-weight: 800;
  padding: 0 4px;
  border-radius: 4px;
}

.arsenal-desc {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #334155;
  font-size: 12px;
  color: #cbd5e1;
  min-height: 32px;
}

.llm-inputs {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 8px;
}

.llm-inputs input {
  background: #0f172a;
  border: 1.5px solid #334155;
  border-radius: 8px;
  padding: 6px 9px;
  color: #e2e8f0;
  font-size: 12px;
  min-width: 0;
}

/* Modals */
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
  padding: 16px;
}

.modal-box {
  background: #0f172a;
  border: 2px solid #475569;
  border-radius: 18px;
  padding: 22px 26px;
  width: min(540px, 95vw);
  box-shadow: 0 24px 60px rgba(0,0,0,0.75);
}

.modal-box.small {
  width: min(340px, 92vw);
  text-align: center;
}

.modal-box h3, .modal-box h2 {
  margin: 0 0 14px;
  color: #fde047;
}

.help-list {
  margin: 0 0 18px;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.65;
  color: #e2e8f0;
}

.modal-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-btns {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
}

.btn-primary, .btn-secondary, .btn-danger {
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: 1.5px solid transparent;
}

.btn-primary {
  background: #f59e0b;
  color: #111827;
  border-color: #fde68a;
}

.btn-secondary {
  background: #1e293b;
  color: #e2e8f0;
  border-color: #475569;
}

.btn-danger {
  background: #7f1d1d;
  color: #fecaca;
  border-color: #ef4444;
}

.victory-box {
  text-align: center;
  border-color: #fbbf24;
}

.victory-trophy {
  font-size: 56px;
  margin-bottom: 6px;
}

.victory-sub {
  color: #cbd5e1;
  margin: 0 0 14px;
}

.victory-stats {
  background: #1e293b;
  border-radius: 12px;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 13px;
  text-align: left;
}
