/* ══════════════════════════════════════════════════════════
   JXFRONT — WAR ROOM DESIGN SYSTEM
   Aesthetic: Military Command Center / DEFCON Protocol
   Fonts: Black Ops One · Share Tech Mono · Exo 2
   ══════════════════════════════════════════════════════════ */

:root {
  --bg:        #03060b;
  --bg2:       #070d18;
  --bg3:       #0c1525;
  --amber:     #e8a020;
  --amber-dim: #a06a10;
  --amber-glow:rgba(232,160,32,0.15);
  --blue:      #1a7fff;
  --blue-dim:  #0f4a99;
  --red:       #e03030;
  --green:     #1acc6c;
  --muted:     #4a6080;
  --text:      #c8d8e8;
  --text-dim:  #6a8aaa;
  --border:    rgba(232,160,32,0.2);
  --border-hi: rgba(232,160,32,0.5);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'Exo 2', sans-serif;
  cursor: crosshair;
}

/* ══════════════════════════════════════════════════════════
   SCREENS
   ══════════════════════════════════════════════════════════ */
.screen {
  position: fixed; inset: 0;
  display: none;
}
.screen.active { display: flex; }

/* ══════════════════════════════════════════════════════════
   MENU SCREEN
   ══════════════════════════════════════════════════════════ */
#screen-name {
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

/* Radar background */
.radar-bg {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}

.radar-ring {
  position: absolute;
  width: var(--s); height: var(--s);
  border-radius: 50%;
  border: 1px solid rgba(232,160,32,0.08);
  animation: ring-pulse 4s ease-in-out infinite;
}
.radar-ring:nth-child(2) { animation-delay: .3s; }
.radar-ring:nth-child(3) { animation-delay: .6s; }
.radar-ring:nth-child(4) { animation-delay: .9s; }
.radar-ring:nth-child(5) { animation-delay: 1.2s; }

@keyframes ring-pulse {
  0%,100% { opacity: 0.4; }
  50%      { opacity: 1; border-color: rgba(232,160,32,0.2); }
}

.radar-sweep {
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    transparent 0%,
    transparent 85%,
    rgba(232,160,32,0.06) 92%,
    rgba(232,160,32,0.18) 100%
  );
  animation: sweep 5s linear infinite;
}
@keyframes sweep { to { transform: rotate(360deg); } }

.noise-overlay {
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  background-size: 200px;
  opacity: 0.4;
  pointer-events: none;
}

/* Menu content */
.menu-wrap {
  position: relative; z-index: 2;
  display: flex; flex-direction: column;
  align-items: center; gap: 32px;
  animation: menu-in .6s ease both;
}
@keyframes menu-in {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Logo */
.menu-logo { text-align: center; }
.logo-eyebrow {
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px; letter-spacing: 4px;
  color: var(--amber-dim);
  margin-bottom: 12px;
}
.logo-title {
  font-family: 'Black Ops One', cursive;
  font-size: clamp(56px, 10vw, 96px);
  letter-spacing: 6px;
  line-height: 1;
  color: var(--text);
  text-shadow: 0 0 60px rgba(232,160,32,0.25), 0 0 120px rgba(232,160,32,0.1);
  animation: logo-flicker 8s ease-in-out infinite;
}
.logo-title .amber { color: var(--amber); }
@keyframes logo-flicker {
  0%,96%,100% { opacity: 1; }
  97% { opacity: .88; }
  98% { opacity: 1; }
  99% { opacity: .92; }
}
.logo-sub {
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px; letter-spacing: 5px;
  color: var(--muted); margin-top: 8px;
}

/* Terminal box */
.terminal-box {
  position: relative;
  background: rgba(7,13,24,0.9);
  border: 1px solid var(--border);
  padding: 28px 36px;
  width: min(420px, 90vw);
  backdrop-filter: blur(8px);
}
.corner {
  position: absolute; width: 12px; height: 12px;
  border-color: var(--amber); border-style: solid;
}
.corner.tl { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.corner.tr { top: -1px; right: -1px; border-width: 2px 2px 0 0; }
.corner.bl { bottom: -1px; left: -1px; border-width: 0 0 2px 2px; }
.corner.br { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }

.tb-header {
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px; letter-spacing: 2px;
  color: var(--amber-dim);
  margin-bottom: 20px;
  display: flex; align-items: center; gap: 8px;
}
.status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 6px var(--amber);
  animation: blink 1.4s ease-in-out infinite;
}
@keyframes blink { 50% { opacity: 0.3; } }

.field-wrap { margin-bottom: 20px; }
.field-label {
  display: block;
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px; letter-spacing: 3px;
  color: var(--muted);
  margin-bottom: 8px;
}
.terminal-box input {
  width: 100%;
  background: rgba(232,160,32,0.04);
  border: none; border-bottom: 1px solid var(--border-hi);
  padding: 10px 4px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 18px; letter-spacing: 2px;
  color: var(--text);
  outline: none;
  transition: border-color .2s;
}
.terminal-box input::placeholder { color: var(--muted); }
.terminal-box input:focus { border-bottom-color: var(--amber); }

#playBtn {
  width: 100%; margin-top: 4px;
  background: transparent;
  border: 1px solid var(--amber);
  color: var(--amber);
  font-family: 'Black Ops One', cursive;
  font-size: 16px; letter-spacing: 4px;
  padding: 14px;
  cursor: pointer;
  position: relative; overflow: hidden;
  transition: all .2s;
}
#playBtn::before {
  content: '';
  position: absolute; inset: 0;
  background: var(--amber);
  transform: translateX(-101%);
  transition: transform .25s ease;
  z-index: 0;
}
#playBtn span { position: relative; z-index: 1; }
#playBtn:hover::before { transform: translateX(0); }
#playBtn:hover { color: var(--bg); }

/* Features */
.menu-feats {
  display: flex; align-items: center; gap: 16px;
  font-size: 12px; letter-spacing: 1px;
  color: var(--muted);
  font-family: 'Share Tech Mono', monospace;
}
.feat { display: flex; align-items: center; gap: 6px; }
.feat-icon { color: var(--amber); }
.feat-sep { color: var(--border-hi); }

.menu-footer {
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px; letter-spacing: 2px;
  color: var(--muted);
  opacity: 0.6;
}

/* ══════════════════════════════════════════════════════════
   GAME SCREEN
   ══════════════════════════════════════════════════════════ */
#screen-game {
  flex-direction: column;
  background: var(--bg);
}

#gameCanvas, #uiCanvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
#uiCanvas { pointer-events: none; }

/* Scanlines */
.scanlines {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.08) 2px,
    rgba(0,0,0,0.08) 4px
  );
  pointer-events: none; z-index: 50;
}

/* ── TOP HUD ─────────────────────────────────────────── */
#hud-top {
  position: absolute; top: 0; left: 0; right: 0;
  height: 52px;
  display: flex; align-items: center; gap: 0;
  background: linear-gradient(180deg, rgba(3,6,11,0.98) 0%, rgba(3,6,11,0.85) 100%);
  border-bottom: 1px solid var(--border);
  z-index: 40;
  padding: 0 8px;
}

.hud-brand {
  padding: 0 16px;
  border-right: 1px solid var(--border);
  height: 100%; display: flex; flex-direction: column; justify-content: center;
}
.hud-brand-name {
  font-family: 'Black Ops One', cursive;
  font-size: 18px; letter-spacing: 3px;
  color: var(--amber);
  line-height: 1;
}
.hud-brand-sub {
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px; letter-spacing: 3px;
  color: var(--muted);
}

.hud-sep {
  width: 1px; height: 32px;
  background: var(--border); margin: 0 12px;
}

.hud-player-info {
  display: flex; align-items: center; gap: 8px;
  padding: 0 8px;
}
.hud-player-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 8px currentColor;
}
.hud-player-name {
  font-family: 'Share Tech Mono', monospace;
  font-size: 14px; letter-spacing: 2px;
  color: var(--text);
}

.hud-stat-block {
  padding: 0 16px;
  border-left: 1px solid var(--border);
  height: 100%; display: flex; flex-direction: column; justify-content: center;
  gap: 2px;
}
.hsb-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px; letter-spacing: 3px;
  color: var(--muted);
}
.hsb-val {
  font-family: 'Share Tech Mono', monospace;
  font-size: 16px; letter-spacing: 1px;
  color: var(--amber);
  line-height: 1;
}
.hsb-max { color: var(--muted); font-size: 12px; }
.hsb-unit { color: var(--muted); font-size: 11px; }
.hsb-bar {
  width: 80px; height: 2px;
  background: rgba(232,160,32,0.15);
  border-radius: 1px; overflow: hidden;
}
.hsb-fill {
  height: 100%;
  background: var(--amber);
  width: 0%;
  transition: width .4s ease;
  box-shadow: 0 0 4px var(--amber);
}

#leaveBtn {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid rgba(224,48,48,0.3);
  color: rgba(224,48,48,0.6);
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px; letter-spacing: 2px;
  cursor: pointer;
  transition: all .2s;
  margin-left: 8px;
}
#leaveBtn:hover {
  background: rgba(224,48,48,0.15);
  border-color: var(--red);
  color: var(--red);
}

/* ── SPAWN PROMPT ────────────────────────────────────── */
#spawn-prompt {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 30; pointer-events: none;
}
#spawn-prompt.hidden { display: none; }

.sp-box {
  position: relative;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.sp-rings {
  position: absolute; inset: -60px;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.sp-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(232,160,32,0.3);
}
.sp-ring:nth-child(1) { width: 120px; height: 120px; animation: sp-expand 2s ease-out infinite; }
.sp-ring:nth-child(2) { width: 120px; height: 120px; animation: sp-expand 2s ease-out infinite .7s; }
@keyframes sp-expand {
  0%   { width: 60px; height: 60px; opacity: .8; }
  100% { width: 220px; height: 220px; opacity: 0; }
}
.sp-icon {
  font-size: 48px; color: var(--amber);
  animation: sp-pulse 1.5s ease-in-out infinite;
  line-height: 1;
}
@keyframes sp-pulse { 50% { opacity: .4; transform: scale(1.1); } }
.sp-title {
  font-family: 'Black Ops One', cursive;
  font-size: 22px; letter-spacing: 4px;
  color: var(--amber);
  text-shadow: 0 0 20px rgba(232,160,32,0.5);
}
.sp-hint {
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px; letter-spacing: 1px;
  color: var(--muted);
}

/* ── LEADERBOARD ─────────────────────────────────────── */
#leaderboard {
  position: absolute;
  top: 60px; right: 12px;
  width: 210px;
  background: rgba(3,6,11,0.9);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
  z-index: 35;
}
.lb-head {
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px; letter-spacing: 3px;
  color: var(--amber-dim);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 6px;
}
.lb-icon { color: var(--amber); }
#lb-list { padding: 4px 0; }

.lb-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  color: var(--text-dim);
  transition: background .15s;
}
.lb-row:hover { background: rgba(232,160,32,0.04); }
.lb-row.lb-me {
  color: var(--amber);
  background: rgba(232,160,32,0.06);
}
.lb-dot {
  width: 6px; height: 6px; border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 4px currentColor;
}
.lb-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-count { color: var(--amber-dim); font-size: 10px; }
.lb-me .lb-count { color: var(--amber); }

/* ── BOTTOM CONTROLS ─────────────────────────────────── */
#bottom-controls {
  position: absolute;
  bottom: 12px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 0;
  background: rgba(3,6,11,0.92);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  z-index: 35;
}

.bc-group {
  padding: 10px 16px;
  display: flex; flex-direction: column; gap: 6px;
}
.bc-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px; letter-spacing: 3px;
  color: var(--muted);
}
.bc-row { display: flex; gap: 4px; }
.bc-vsep {
  width: 1px; align-self: stretch;
  background: var(--border); margin: 8px 0;
}

/* Ratio buttons */
.ratio-btn {
  background: transparent;
  border: 1px solid rgba(232,160,32,0.2);
  color: var(--muted);
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px; letter-spacing: 1px;
  padding: 6px 10px;
  cursor: pointer;
  transition: all .15s;
}
.ratio-btn:hover {
  border-color: rgba(232,160,32,0.5);
  color: var(--text);
  background: rgba(232,160,32,0.05);
}
.ratio-btn.active {
  background: rgba(232,160,32,0.12);
  border-color: var(--amber);
  color: var(--amber);
  box-shadow: 0 0 8px rgba(232,160,32,0.2) inset;
}

/* Order buttons */
.order-btn {
  display: flex; align-items: center; gap: 6px;
  background: transparent;
  border: 1px solid rgba(232,160,32,0.2);
  color: var(--muted);
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px; letter-spacing: 2px;
  padding: 6px 14px;
  cursor: pointer;
  transition: all .15s;
}
.order-btn:hover {
  border-color: rgba(232,160,32,0.5);
  color: var(--text);
  background: rgba(232,160,32,0.05);
}
.order-btn.active {
  background: rgba(26,127,255,0.12);
  border-color: var(--blue);
  color: var(--blue);
}
.order-btn.recall:hover {
  border-color: rgba(26,204,108,0.5);
  color: var(--green);
  background: rgba(26,204,108,0.05);
}

/* ── ZOOM CONTROLS ───────────────────────────────────── */
#zoom-controls {
  position: absolute;
  bottom: 72px; right: 12px;
  display: flex; flex-direction: column; gap: 4px;
  z-index: 35;
}
.zoom-btn {
  width: 36px; height: 36px;
  background: rgba(3,6,11,0.9);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 18px; font-family: 'Share Tech Mono', monospace;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
  backdrop-filter: blur(8px);
}
.zoom-btn:hover {
  border-color: var(--amber);
  color: var(--amber);
  background: rgba(232,160,32,0.08);
}

/* ── TOOLTIP ─────────────────────────────────────────── */
#tooltip {
  position: fixed;
  display: none;
  background: rgba(3,6,11,0.95);
  border: 1px solid var(--border-hi);
  color: var(--text);
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px; letter-spacing: 1px;
  padding: 6px 10px;
  pointer-events: none;
  z-index: 100;
  white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════
   SOLDIER GROUP CANVAS LABELS — done in game.js
   (these CSS vars are referenced by canvas rendering)
   ══════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════════════
   ATTACKS PANEL
   ══════════════════════════════════════════════════════════ */
#attacks-panel {
  position: absolute;
  bottom: 12px; right: 12px;
  width: 230px;
  background: rgba(3,6,11,0.92);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  z-index: 35;
  max-height: 260px;
  display: flex; flex-direction: column;
}
.ap-head {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px; letter-spacing: 3px;
  color: var(--amber-dim);
  flex-shrink: 0;
}
.ap-icon { color: var(--amber); }
#ap-list {
  overflow-y: auto; overflow-x: hidden;
  flex: 1;
}
#ap-list::-webkit-scrollbar { width: 3px; }
#ap-list::-webkit-scrollbar-track { background: transparent; }
#ap-list::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 2px; }

.ap-empty {
  padding: 12px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px; letter-spacing: 1px;
  color: var(--muted);
  text-align: center;
}

.ap-row {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(232,160,32,0.06);
  display: flex; flex-direction: column; gap: 5px;
  transition: background .1s;
}
.ap-row:last-child { border-bottom: none; }
.ap-row:hover { background: rgba(232,160,32,0.03); }

.ap-row-top {
  display: flex; align-items: center; gap: 6px;
}
.ap-badge {
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px; letter-spacing: 2px;
  color: var(--amber);
  background: rgba(232,160,32,0.1);
  border: 1px solid rgba(232,160,32,0.2);
  padding: 1px 5px;
  flex-shrink: 0;
}
.ap-troops {
  flex: 1;
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  color: var(--text);
}
.ap-troops span { color: var(--amber); font-size: 15px; font-weight: bold; }
.ap-of { color: var(--muted); font-size: 10px; }
.ap-cancel {
  width: 20px; height: 20px;
  background: transparent;
  border: 1px solid rgba(224,48,48,0.3);
  color: rgba(224,48,48,0.5);
  font-size: 11px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all .15s; flex-shrink: 0;
}
.ap-cancel:hover {
  background: rgba(224,48,48,0.15);
  border-color: var(--red); color: var(--red);
}
.ap-bar-wrap {
  height: 2px;
  background: rgba(232,160,32,0.1);
  border-radius: 1px; overflow: hidden;
}
.ap-bar-fill {
  height: 100%;
  background: var(--amber);
  box-shadow: 0 0 4px var(--amber);
  transition: width .3s ease;
}
.ap-stats {
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px; letter-spacing: 1px;
  color: var(--muted);
  display: flex; justify-content: space-between;
}
.ap-stats .green { color: var(--green); }
.ap-stats .red   { color: #e05050; }