:root {
  /* ================= ARMAGEDDON هيرمجدون COLOR PALETTE ================= */
  --bg-deep: #070a10;
  --bg-surface: #0c121c;
  --bg-panel: #111a28;
  --bg-panel-elevated: #162438;
  --border-cyan: rgba(0, 229, 255, 0.35);
  --border-cyan-glow: rgba(0, 229, 255, 0.75);
  --border-red: rgba(255, 51, 68, 0.5);
  --border-metal: #22344d;

  /* Neon Glowing Accents */
  --cyber-cyan: #00e5ff;
  --holo-blue: #0099ff;
  --magma-red: #ff3344;
  --fire-orange: #ff7b00;
  --amber-gold: #ffb703;
  --tactical-green: #00e676;

  /* Role Badges from the Poster */
  --role-attacker: #ff3344;
  --role-defender: #0099ff;
  --role-alliance: #00e676;
  --role-scout: #ffb703;

  /* Typography & Layout */
  --text-primary: #f0f6fc;
  --text-muted: #8ba2c0;
  --font-family: 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Consolas', 'Courier New', monospace;

  /* Shadows & Glows */
  --glow-cyan: 0 0 14px rgba(0, 229, 255, 0.35);
  --glow-red: 0 0 14px rgba(255, 51, 68, 0.45);
  --glow-gold: 0 0 12px rgba(255, 183, 3, 0.35);
}

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

body {
  background-color: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-family);
  direction: rtl;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
}

/* ================= TOP TACTICAL HUD (ARMAGEDDON THEMED) ================= */
#hud-top {
  height: 56px;
  background: linear-gradient(180deg, #141f30 0%, #0a1019 100%);
  border-bottom: 2px solid var(--border-cyan);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8), 0 2px 8px rgba(0, 229, 255, 0.15);
}

.hud-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Armageddon Logo Badge */
.badge-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(90deg, rgba(255, 51, 68, 0.25) 0%, rgba(0, 229, 255, 0.15) 100%);
  border: 1px solid var(--magma-red);
  padding: 5px 14px;
  border-radius: 4px;
  font-weight: 900;
  font-size: 16px;
  color: #fff;
  text-shadow: 0 0 10px rgba(255, 51, 68, 0.6);
  box-shadow: var(--glow-red);
  position: relative;
  overflow: hidden;
}

.badge-brand::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  transform: translateX(-100%);
  animation: shine 4s infinite;
}

@keyframes shine {
  100% { transform: translateX(100%); }
}

.badge-online {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 229, 255, 0.12);
  border: 1px solid var(--cyber-cyan);
  color: var(--cyber-cyan);
  padding: 3px 10px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
  box-shadow: var(--glow-cyan);
}

/* Unified High-Tech Icon Command Bar (Bigger icons, No words) */
.hud-icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(17, 24, 39, 0.9) 0%, rgba(30, 41, 59, 0.95) 100%);
  border: 1.5px solid rgba(0, 229, 255, 0.35);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  user-select: none;
}

.hud-icon-btn:hover {
  border-color: var(--amber-gold);
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.4), 0 0 8px rgba(255, 215, 0, 0.2);
  transform: translateY(-2px);
}

.hud-icon-btn:active {
  transform: translateY(0);
}

.hud-icon-btn .btn-icon {
  font-size: 22px;
  line-height: 1;
}

.hud-icon-btn .btn-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--tactical-green);
  color: #000;
  font-size: 10px;
  font-weight: 900;
  border-radius: 10px;
  padding: 1px 5px;
  box-shadow: 0 0 6px rgba(0, 230, 118, 0.7);
}

.hud-icon-btn.brand-btn {
  border-color: var(--magma-red);
  background: radial-gradient(circle, rgba(239, 68, 68, 0.3) 0%, rgba(15, 23, 42, 0.95) 100%);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.35);
}

.hud-icon-btn.brand-btn:hover {
  border-color: #ff8787;
  box-shadow: 0 0 18px rgba(239, 68, 68, 0.6);
}

.hud-icon-btn.nation-icon-btn {
  width: auto;
  padding: 0 6px;
  gap: 6px;
  border-color: var(--amber-gold);
  background: linear-gradient(135deg, rgba(20, 25, 40, 0.95) 0%, rgba(10, 15, 26, 0.95) 100%);
}

.hud-icon-btn.danger-btn:hover {
  border-color: #ef4444;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.5);
}

.hud-icon-btn.admin-btn {
  border-color: #f59e0b;
}

.hud-icon-btn.alert-btn {
  border-color: #ef4444;
  animation: pulse 0.8s infinite;
}

.hud-icon-stat {
  height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.9) 0%, rgba(20, 29, 44, 0.95) 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.hud-icon-stat:hover {
  border-color: var(--amber-gold);
  box-shadow: 0 0 14px rgba(255, 215, 0, 0.3);
  transform: translateY(-2px);
}

.hud-icon-stat .stat-icon {
  font-size: 20px;
  line-height: 1;
}

.hud-icon-stat .stat-val {
  font-size: 15px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #fff;
  letter-spacing: 0.5px;
}

.hud-icon-stat#stat-credits .stat-val {
  color: var(--amber-gold);
}

.hud-icon-stat.stat-danger .stat-val {
  color: #ef4444;
}

.hud-icon-stat.stat-success .stat-val {
  color: #20c997;
}

.hud-icon-stat .power-bar-wrap {
  width: 50px;
  height: 6px;
  background: #06090e;
  border: 1px solid var(--border-metal);
  margin-top: 0;
  border-radius: 2px;
  overflow: hidden;
}

.power-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--tactical-green);
  box-shadow: 0 0 8px var(--tactical-green);
  transition: width 0.3s, background-color 0.3s;
}

.power-bar-fill.low {
  background: var(--magma-red);
  box-shadow: 0 0 8px var(--magma-red);
}

/* Tactical HUD Buttons (Styled like Poster Action Buttons) */
.btn-hud {
  background: linear-gradient(180deg, #1c2b42 0%, #101928 100%);
  border: 1px solid var(--border-cyan);
  color: var(--text-primary);
  padding: 6px 14px;
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.btn-hud:hover {
  background: linear-gradient(180deg, #253956 0%, #172439 100%);
  border-color: var(--cyber-cyan);
  color: #fff;
  box-shadow: var(--glow-cyan);
  transform: translateY(-1px);
}

.btn-hud.danger {
  border-color: var(--magma-red);
  background: linear-gradient(180deg, rgba(255, 51, 68, 0.3) 0%, rgba(200, 20, 40, 0.2) 100%);
  color: #ffa8b0;
}

.btn-hud.danger:hover {
  background: var(--magma-red);
  color: #fff;
  box-shadow: var(--glow-red);
}

/* ================= MAIN ARENA LAYOUT ================= */
#main-stage {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
}

#canvas-wrap {
  flex: 1;
  position: relative;
  background: radial-gradient(ellipse at bottom, #0d1b2a 0%, #050811 50%, #020307 100%);
  cursor: crosshair;
  overflow: hidden;
}

#spaceBgCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 2;
  background: transparent;
}

.world-3d-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
.render-mode-button { position: absolute; left: 14px; top: 14px; z-index: 5; font-size: 11px; border-color: #66ccb9; background: #132b36e8; }
.render-mode-button[aria-pressed="true"] { color: #95f0d5; }

/* Battle Alert Banner */
#battle-alert {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(12, 18, 28, 0.95);
  border: 2px solid var(--magma-red);
  color: #fff;
  padding: 8px 24px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.8), var(--glow-red);
  z-index: 50;
  text-align: center;
}

#battle-alert.active {
  opacity: 1;
}

/* Brush Bar */
#brush-bar {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(14, 22, 34, 0.96);
  border: 1px solid var(--cyber-cyan);
  padding: 8px 20px;
  border-radius: 4px;
  display: flex;
  gap: 16px;
  align-items: center;
  z-index: 50;
  font-size: 13px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8), var(--glow-cyan);
}

#brush-bar[hidden] {
  display: none;
}

/* Tactical Unit Actions Bar (Stargate, Cloaking, Covert Deployment) */
.tactical-actions-bar {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 18, 30, 0.95);
  border: 1px solid var(--cyber-cyan);
  box-shadow: 0 4px 22px rgba(0, 0, 0, 0.85), var(--glow-cyan);
  padding: 8px 18px;
  border-radius: 6px;
  display: flex;
  gap: 12px;
  align-items: center;
  z-index: 45;
}

.tactical-actions-bar[hidden] {
  display: none;
}

.btn-tactical-action {
  background: linear-gradient(180deg, rgba(0, 229, 255, 0.25) 0%, rgba(2, 132, 199, 0.35) 100%);
  border: 1px solid var(--cyber-cyan);
  color: #fff;
  padding: 6px 14px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-tactical-action:hover {
  background: linear-gradient(180deg, rgba(0, 229, 255, 0.45) 0%, rgba(2, 132, 199, 0.6) 100%);
  box-shadow: 0 0 14px rgba(0, 229, 255, 0.6);
  transform: translateY(-1px);
}

.btn-tactical-action.stealth-action {
  border-color: #a855f7;
  background: linear-gradient(180deg, rgba(168, 85, 247, 0.3) 0%, rgba(126, 34, 206, 0.4) 100%);
}

.btn-tactical-action.stealth-action:hover {
  box-shadow: 0 0 14px rgba(168, 85, 247, 0.7);
}

/* ================= RED ALERT ICONIC ARMAGEDDON SIDEBAR ================= */
#sidebar {
  width: 300px;
  background: linear-gradient(180deg, #182435 0%, #0c121d 100%);
  border-right: 3px solid #d4af37;
  display: flex;
  flex-direction: column;
  z-index: 40;
  box-shadow: -4px 0 25px rgba(0, 0, 0, 0.85), inset 2px 0 8px rgba(212, 175, 55, 0.2);
  transition: width 0.25s ease, opacity 0.25s ease;
}

#sidebar.collapsed {
  display: none !important;
}

/* Floating Expand Button docked to the left edge of screen */
.btn-sidebar-floating-expand {
  position: absolute;
  top: 70px;
  left: 14px;
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border: 2px solid #d4af37;
  border-radius: 6px;
  color: #facc15;
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.85), 0 0 12px rgba(212, 175, 55, 0.4);
  transition: all 0.2s ease;
}

.btn-sidebar-floating-expand:hover {
  background: #334155;
  color: #fff;
  border-color: #fde047;
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.95), 0 0 16px rgba(250, 204, 21, 0.6);
}

/* Radar Display: Full High-Tech Rectangular Command Monitor */
.radar-box {
  padding: 8px 10px;
  border-bottom: 2px solid #3b4c68;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #131c2a 0%, #0a0f18 100%);
}

.radar-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 800;
  color: #d4af37;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.radar-header-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.radar-status-badge {
  color: var(--radar-green);
  font-size: 10px;
}

.btn-collapse-sidebar {
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid #d4af37;
  color: #f8fafc;
  font-family: var(--font-family);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.btn-collapse-sidebar:hover {
  background: #334155;
  border-color: #facc15;
  color: #facc15;
  box-shadow: 0 0 8px rgba(250, 204, 21, 0.4);
}

.radar-screen {
  width: 100%;
  height: 190px;
  border-radius: 6px;
  border: 2px solid #d4af37;
  background: radial-gradient(ellipse at center, #062b1e 0%, #03140e 70%, #010806 100%);
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 20px rgba(0, 230, 118, 0.25), 0 0 12px rgba(0, 0, 0, 0.85);
  cursor: crosshair;
}

#radarCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 4px;
}

.radar-grid-overlay {
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(to right, rgba(0, 230, 118, 0.12) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 230, 118, 0.12) 1px, transparent 1px);
  background-size: 28px 19px;
  pointer-events: none;
}

.radar-sweep {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(0, 230, 118, 0.2) 50%, rgba(0, 230, 118, 0.55) 95%, transparent 100%);
  width: 25%;
  animation: radarScanline 3.2s linear infinite;
  pointer-events: none;
}

@keyframes radarScanline {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}

/* Red Alert Classic Action Toolbar (Repair 🔧 & Sell 💲) */
.ra-action-toolbar {
  display: flex;
  gap: 8px;
  padding: 6px 10px;
  background: #0f1622;
  border-bottom: 2px solid #2a3a50;
  justify-content: center;
}

.btn-ra-tool {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 8px;
  background: linear-gradient(180deg, #23344a 0%, #15202e 100%);
  border: 1px solid #d4af37;
  border-radius: 4px;
  color: #fff;
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 2px 4px rgba(0, 0, 0, 0.5);
  transition: all 0.15s ease;
}

.btn-ra-tool:hover {
  background: linear-gradient(180deg, #334b6b 0%, #1f2f45 100%);
  border-color: #ffd700;
  color: #ffd700;
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.5);
}

.btn-ra-tool.active {
  background: linear-gradient(180deg, #b8860b 0%, #8c6507 100%);
  border-color: #fff;
  color: #fff;
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.75);
  transform: translateY(1px);
}

.btn-ra-tool .tool-icon {
  font-size: 14px;
}

/* Sidebar Build Tabs */
.sidebar-tabs {
  display: flex;
  border-bottom: 2px solid #2a3a50;
  background: #0d1420;
}

.tab-btn {
  flex: 1;
  padding: 8px 3px;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.18s;
  text-align: center;
}

.tab-btn:hover {
  color: #fff;
  background: rgba(212, 175, 55, 0.08);
}

.tab-btn.active {
  color: #ffd700;
  border-bottom-color: #ffd700;
  background: rgba(212, 175, 55, 0.15);
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
}

/* Sidebar Build Area & Vertical Power Strip Layout */
.sidebar-build-wrapper {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* Red Alert 2 Iconic Vertical Power Meter Strip */
#ra-power-strip {
  width: 26px;
  background: #090e16;
  border-left: 2px solid #202e42;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 2px;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.8);
}

.power-meter-label {
  font-size: 9px;
  font-weight: 900;
  font-family: var(--font-mono);
  color: #d4af37;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.power-meter-track {
  flex: 1;
  width: 12px;
  background: #141d29;
  border: 1px solid #33445c;
  border-radius: 2px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

#ra-power-fill {
  width: 100%;
  height: 75%;
  background: linear-gradient(to top, #00e676, #69db7c);
  box-shadow: 0 0 8px rgba(0, 230, 118, 0.6);
  transition: height 0.3s ease, background 0.3s;
}

#ra-power-fill.low {
  background: linear-gradient(to top, #ff3344, #ff8787);
  box-shadow: 0 0 10px rgba(255, 51, 68, 0.8);
  animation: powerBlink 0.6s infinite alternate;
}

@keyframes powerBlink {
  from { opacity: 0.5; }
  to { opacity: 1; }
}

#ra-power-bolt {
  font-size: 13px;
  margin-top: 4px;
  color: #ffd700;
  filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.7));
}

/* Items List - Compact Icon Grid Layout */
.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  align-content: start;
}

.build-card.compact-icon-card {
  position: relative;
  background: linear-gradient(180deg, #131d2c 0%, #0c121c 100%);
  border: 1px solid var(--border-metal);
  border-radius: 4px;
  padding: 6px 4px;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.18s;
  min-height: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.build-card.compact-icon-card:hover:not(:disabled) {
  border-color: var(--cyber-cyan);
  background: #19273c;
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.4);
  transform: translateY(-2px);
}

.build-card.compact-icon-card:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.8);
}

.compact-icon-card .icon-badge {
  font-size: 20px;
  margin-bottom: 2px;
  z-index: 2;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.8));
}

.compact-icon-card .card-title-mini {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  z-index: 2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.compact-icon-card .price-mini {
  font-family: var(--font-mono);
  color: var(--amber-gold);
  font-size: 11px;
  font-weight: 800;
  z-index: 2;
  margin-top: 2px;
}

.compact-icon-card .card-status {
  font-size: 9px;
  color: var(--text-muted);
  z-index: 2;
  margin-top: 1px;
}

.build-card .card-row {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
  z-index: 2;
}

.build-card .price {
  font-family: var(--font-mono);
  color: var(--amber-gold);
  font-size: 13px;
  font-weight: 800;
}

.build-card .card-status {
  position: relative;
  font-size: 11px;
  color: var(--text-muted);
  z-index: 2;
  margin-top: 4px;
}

.build-card .card-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: rgba(0, 229, 255, 0.3);
  pointer-events: none;
  transition: width 0.1s linear;
}

.build-card.ready {
  border-color: var(--tactical-green);
  box-shadow: 0 0 12px rgba(0, 230, 118, 0.4);
}

.build-card.ready .card-status {
  color: var(--tactical-green);
  font-weight: 800;
  animation: pulse 1s infinite alternate;
}

@keyframes pulse {
  from { opacity: 0.7; }
  to { opacity: 1; }
}

/* ================= FULL-WIDTH BOTTOM TACTICAL CHAT & COMMS BAR ================= */
#chat-bar-full {
  width: 100vw;
  background: linear-gradient(180deg, rgba(14, 22, 34, 0.98) 0%, rgba(7, 10, 16, 0.99) 100%);
  border-top: 2px solid var(--border-cyan);
  box-shadow: 0 -4px 25px rgba(0, 0, 0, 0.8), 0 -1px 8px rgba(0, 229, 255, 0.2);
  z-index: 90;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(10px);
  transition: max-height 0.25s ease-in-out;
}

.chat-bar-header {
  height: 32px;
  background: linear-gradient(90deg, #162438 0%, #0c121c 100%);
  border-bottom: 1px solid var(--border-metal);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
}

.chat-bar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}

.chat-status-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyber-cyan);
  box-shadow: 0 0 8px var(--cyber-cyan);
  animation: pulse 2s infinite;
}

.chat-bar-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-channel-badge {
  font-size: 11px;
  background: rgba(0, 229, 255, 0.12);
  border: 1px solid var(--border-cyan);
  color: var(--cyber-cyan);
  padding: 2px 8px;
  border-radius: 3px;
  font-weight: 600;
}

.btn-hud.mini {
  padding: 2px 8px;
  font-size: 10px;
  min-height: 20px;
}

.chat-bar-body {
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
}

.chat-bar-body.collapsed {
  display: none;
}

.chat-messages {
  height: 110px;
  overflow-y: auto;
  padding: 8px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  background: rgba(4, 7, 12, 0.6);
  scrollbar-width: thin;
  scrollbar-color: var(--border-cyan) #090e17;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: var(--border-cyan);
  border-radius: 3px;
}

.msg-line {
  line-height: 1.45;
  word-break: break-word;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.msg-line .sender {
  font-weight: 800;
  color: var(--cyber-cyan);
  background: rgba(0, 229, 255, 0.08);
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid rgba(0, 229, 255, 0.25);
  white-space: nowrap;
}

.msg-line .text {
  color: var(--text-primary);
}

.msg-line.system {
  color: var(--amber-gold);
  background: rgba(255, 183, 3, 0.07);
  padding: 3px 8px;
  border-radius: 4px;
  border-right: 3px solid var(--amber-gold);
  font-weight: 500;
}

.chat-input-bar {
  padding: 8px 16px;
  border-top: 1px solid var(--border-metal);
  display: flex;
  align-items: center;
  gap: 10px;
  background: #090e17;
}

.chat-input-bar .input-icon {
  font-size: 16px;
  color: var(--cyber-cyan);
}

.chat-input-bar input {
  flex: 1;
  background: #05080e;
  border: 1px solid var(--border-cyan);
  color: #fff;
  font-family: var(--font-family);
  font-size: 14px;
  padding: 7px 14px;
  border-radius: 4px;
  outline: none;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.6);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-input-bar input:focus {
  border-color: var(--cyber-cyan);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.35);
}

.chat-input-bar button {
  background: linear-gradient(180deg, var(--cyber-cyan) 0%, #0099ff 100%);
  color: #070a10;
  border: none;
  padding: 7px 22px;
  font-size: 13px;
  font-weight: 800;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.4);
  transition: transform 0.15s, box-shadow 0.15s;
}

.chat-input-bar button:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 18px rgba(0, 229, 255, 0.7);
}

.chat-input-bar button:active {
  transform: translateY(1px);
}

/* ================= MODALS & POSTER HERO SCREEN ================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 12, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(8px);
}

.modal-overlay[hidden] {
  display: none;
}

.modal-card {
  background: linear-gradient(180deg, #131c2a 0%, #0a1019 100%);
  border: 2px solid var(--border-cyan);
  border-radius: 8px;
  padding: 24px;
  width: min(580px, 94vw);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.9), var(--glow-cyan);
  position: relative;
}

.modal-card.wide {
  width: min(940px, 96vw);
}

/* ================= COMMANDERS DOSSIER & WAR ACADEMY ================= */
#commanders-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  max-height: 55vh;
  overflow-y: auto;
  padding: 4px;
}

.commander-card-item {
  background: linear-gradient(180deg, #121c2c 0%, #0a111a 100%);
  border: 1px solid var(--border-metal);
  border-right: 4px solid var(--border-cyan);
  border-radius: 6px;
  padding: 12px;
  display: flex;
  gap: 12px;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s;
}

.commander-card-item:hover {
  border-color: var(--cyber-cyan);
  background: #172437;
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 229, 255, 0.25);
}

.commander-avatar-box {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid var(--cyber-cyan);
  background: #080d14;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
  position: relative;
  flex-shrink: 0;
}

.commander-avatar-box .status-dot {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--tactical-green);
  border: 2px solid #080d14;
}

.commander-info-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.commander-name-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.commander-name-row b {
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.commander-power-rating {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  color: var(--amber-gold);
}

.commander-stars {
  color: #ffb703;
  font-size: 13px;
  letter-spacing: 2px;
}

.commander-badges-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  margin-top: 2px;
}

.badge-tag {
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
}

.badge-tag.veteran {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
  border: 1px solid #c084fc;
}

.badge-tag.recruit {
  background: rgba(0, 229, 255, 0.15);
  color: var(--cyber-cyan);
  border: 1px solid var(--cyber-cyan);
}

.badge-tag.medals {
  background: rgba(255, 183, 3, 0.15);
  color: #ffd166;
  border: 1px solid #ffd166;
}

/* Poster Header Banner */
.poster-hero {
  position: relative;
  width: 100%;
  height: 200px;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 18px;
  border: 1px solid var(--border-cyan);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
}

.poster-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.poster-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(10, 16, 25, 0.95) 0%, rgba(10, 16, 25, 0.4) 60%, transparent 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 14px;
}

.poster-hero-overlay h2 {
  font-size: 24px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 15px rgba(255, 51, 68, 0.8);
  margin-bottom: 2px;
}

.poster-hero-overlay p {
  font-size: 13px;
  color: var(--cyber-cyan);
  font-weight: 600;
}

/* Pillars Grid (The 5 items from the poster) */
.poster-pillars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.pillar-item {
  background: rgba(22, 36, 56, 0.6);
  border: 1px solid var(--border-metal);
  padding: 8px;
  border-radius: 4px;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
}

.pillar-item .icon {
  font-size: 18px;
  color: var(--cyber-cyan);
  margin-bottom: 3px;
}

.pillar-item b {
  display: block;
  color: #fff;
  font-size: 12px;
  margin-bottom: 2px;
}

/* Form Styles */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-group label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
  background: #090e16;
  border: 1px solid var(--border-metal);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 4px;
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--cyber-cyan);
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.3);
}

/* Poster Call to Action Button */
.btn-primary {
  background: linear-gradient(90deg, #e52b38 0%, #ff5500 100%);
  color: #fff;
  border: 1px solid #ff7b00;
  padding: 10px 24px;
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: 800;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--glow-red);
}

.btn-primary:hover {
  background: linear-gradient(90deg, #ff3344 0%, #ff6a00 100%);
  box-shadow: 0 0 20px rgba(255, 51, 68, 0.8);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #1c2638;
  color: var(--text-primary);
  border: 1px solid var(--border-metal);
  padding: 8px 18px;
  font-family: var(--font-family);
  font-size: 14px;
  border-radius: 4px;
  cursor: pointer;
}

.btn-secondary:hover {
  background: #25334a;
  border-color: var(--text-muted);
}

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  justify-content: flex-end;
}

/* ================= 3D ADMIN STUDIO ================= */
#admin-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 10, 16, 0.96);
  z-index: 300;
  display: flex;
  flex-direction: column;
  overflow: auto;
}

#admin-overlay[hidden] {
  display: none;
}

#admin-overlay.min {
  inset: auto 0 0 0;
  height: auto;
  background: transparent;
  pointer-events: none;
}

#admin-overlay.min .admin-body {
  display: none;
}

#admin-overlay.min .admin-header {
  pointer-events: auto;
}

.admin-header {
  background: #101826;
  border-bottom: 2px solid var(--border-cyan);
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.admin-header h3 {
  font-size: 16px;
  color: var(--amber-gold);
}

.admin-body {
  display: grid;
  grid-template-columns: 240px minmax(320px, 400px) minmax(0, 1fr);
  gap: 12px;
  padding: 16px;
  flex: 1;
  align-items: start;
}

@media (max-width: 1024px) {
  .admin-body {
    grid-template-columns: 1fr;
  }
}

.admin-box {
  background: #0e1624;
  border: 1px solid var(--border-metal);
  border-radius: 4px;
  padding: 12px;
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.admin-tabs button {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 3px;
  border: 1px solid var(--border-metal);
  background: #152032;
  color: var(--text-primary);
  cursor: pointer;
}

.admin-tabs button.active {
  background: var(--holo-blue);
  color: #fff;
  border-color: var(--cyber-cyan);
  box-shadow: var(--glow-cyan);
}

.admin-items-list {
  display: grid;
  gap: 5px;
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 10px;
}

.admin-items-list button {
  text-align: right;
  padding: 7px 12px;
  font-size: 13px;
  background: #121c2c;
  border: 1px solid var(--border-metal);
  color: var(--text-primary);
  border-radius: 3px;
  cursor: pointer;
}

.admin-items-list button.active {
  border-color: var(--amber-gold);
  background: #1c2b42;
  box-shadow: var(--glow-gold);
}

.pv-wrap canvas {
  background: #080d14;
  border: 1px solid var(--border-cyan);
  width: 100%;
  height: auto;
  border-radius: 4px;
}

.views-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 10px;
}

.views-grid canvas {
  background: #080d14;
  border: 1px solid var(--border-metal);
  width: 100%;
  height: auto;
  border-radius: 3px;
}

.views-grid div {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

/* Parts Table */
.parts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 10px;
}

.parts-table th, .parts-table td {
  padding: 5px 6px;
  border: 1px solid var(--border-metal);
  text-align: center;
}

.parts-table input, .parts-table select {
  width: 52px;
  background: #080d14;
  border: 1px solid var(--border-metal);
  color: var(--text-primary);
  font-size: 12px;
  padding: 3px;
}

.parts-table select {
  width: auto;
}

.parts-table tr.selected {
  background: rgba(0, 229, 255, 0.18);
}

/* ================= ZOOM CONTROLS TOOLBAR ================= */
.tactical-zoom-bar {
  position: absolute;
  bottom: 24px;
  right: 24px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(10, 16, 26, 0.88);
  border: 1px solid var(--border-metal);
  backdrop-filter: blur(8px);
  padding: 5px 8px;
  border-radius: 6px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.6);
  user-select: none;
}

.btn-zoom {
  background: #142033;
  color: var(--text-primary);
  border: 1px solid var(--border-metal);
  border-radius: 4px;
  padding: 5px 10px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-zoom:hover {
  background: #1e3352;
  border-color: var(--cyber-cyan);
  color: #fff;
  transform: translateY(-1px);
}

.btn-zoom-fit {
  font-size: 12px;
  font-weight: 600;
  color: var(--gold-energy);
  border-color: rgba(255, 183, 3, 0.4);
}

.btn-zoom-fit:hover {
  border-color: var(--gold-energy);
  background: rgba(255, 183, 3, 0.15);
}

.zoom-display {
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  color: var(--cyber-cyan);
  min-width: 52px;
  text-align: center;
  user-select: none;
}

.zoom-slider-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 140px;
  margin: 0 4px;
}

.zoom-slider-wrap input[type="range"] {
  width: 100%;
  height: 6px;
  background: #0f172a;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  border: 1px solid var(--border-metal);
}

.zoom-slider-wrap input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--cyber-cyan);
  border: 2px solid #fff;
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.85);
  cursor: pointer;
  transition: transform 0.1s;
}

.zoom-slider-wrap input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.25);
}

.zoom-slider-center-tick {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 12px;
  background: rgba(255, 255, 255, 0.45);
  pointer-events: none;
}

/* ================= OCCUPATION STATUS BANNER ================= */
.occupation-banner {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  background: linear-gradient(90deg, rgba(224, 49, 49, 0.95), rgba(160, 20, 20, 0.95));
  border: 1px solid #ff8787;
  color: #fff;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 20px rgba(224, 49, 49, 0.5);
  animation: pulse 2s infinite ease-in-out;
}

.occupation-banner .occ-icon {
  font-size: 18px;
}

/* ================= REBUILDING & PEACE SHIELD ADVISOR PANEL ================= */
.advisor-panel {
  position: absolute;
  top: 18px;
  left: 20px;
  z-index: 45;
  width: 380px;
  background: rgba(8, 14, 24, 0.94);
  border: 1px solid var(--gold-energy);
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7), 0 0 15px rgba(255, 183, 3, 0.25);
  backdrop-filter: blur(10px);
  overflow: hidden;
  animation: fadeIn 0.3s ease;
}

.advisor-header {
  background: linear-gradient(90deg, #1f1b0a 0%, #121008 100%);
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 183, 3, 0.3);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.advisor-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--gold-energy);
  display: flex;
  align-items: center;
  gap: 6px;
}

.advisor-timer {
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  color: #ffe066;
  background: rgba(255, 183, 3, 0.15);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(255, 183, 3, 0.4);
}

.advisor-body {
  padding: 12px 14px;
}

.advisor-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 12px;
}

.advisor-checklist {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.advisor-check-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0f1826;
  border: 1px solid #1a293d;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 12px;
}

.advisor-check-item.done {
  border-color: rgba(32, 201, 151, 0.5);
  background: rgba(32, 201, 151, 0.08);
}

.advisor-check-item .item-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #fff;
}

.advisor-check-item .item-status {
  font-weight: 700;
  font-size: 11px;
}

.advisor-check-item.done .item-status {
  color: var(--tactical-green);
}

.advisor-check-item:not(.done) .item-status {
  color: #ff922b;
}

.advisor-progress-wrap {
  margin-top: 8px;
}

.advisor-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #fff;
  margin-bottom: 4px;
  font-weight: 600;
}

.advisor-progress-bar {
  height: 8px;
  background: #142033;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #1e3352;
}

#advisor-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff922b, var(--gold-energy), var(--tactical-green));
  transition: width 0.3s ease;
}

/* ================= CASUALTIES & WAR LOSSES REGISTRY ================= */
@media (max-width: 720px) {
  #casualties-columns-wrap {
    grid-template-columns: 1fr !important;
  }
}

/* ================= ICONIC HUD STATS & DATA BADGES ================= */
.hud-stat.hud-stat-icon {
  flex-direction: row;
  align-items: center;
  gap: 7px;
  min-width: unset;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  border-radius: 4px;
}

.hud-stat.hud-stat-icon:hover {
  background: rgba(0, 229, 255, 0.12);
  border-color: var(--cyber-cyan);
  transform: translateY(-1px);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
}

.hud-stat.hud-stat-icon .stat-icon {
  font-size: 16px;
  line-height: 1;
  filter: drop-shadow(0 0 4px rgba(0, 229, 255, 0.4));
}

.hud-stat.hud-stat-icon .value {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

/* ================= BUILD CARDS WITH THUMBNAIL & QUEUES ================= */
.build-card.compact-icon-card {
  position: relative;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  overflow: hidden;
  border-radius: 6px;
  background: #090e18;
  border: 1px solid var(--border-metal);
  transition: all 0.18s ease;
  cursor: pointer;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.7);
}

.build-card.compact-icon-card:hover {
  border-color: var(--cyber-cyan);
  box-shadow: 0 0 14px rgba(0, 229, 255, 0.45), inset 0 0 8px rgba(0, 229, 255, 0.15);
  transform: translateY(-2px);
}

.card-preview-thumb {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, rgba(0, 229, 255, 0.08) 0%, rgba(10, 16, 26, 0.6) 100%);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.card-preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.9));
  transition: transform 0.2s ease;
}

.build-card.compact-icon-card:hover .card-preview-thumb img {
  transform: scale(1.08);
}

.queue-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #0b0f19;
  font-size: 13px;
  font-weight: 900;
  min-width: 22px;
  height: 22px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border-radius: 11px;
  border: 1.5px solid #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.85);
  z-index: 10;
  line-height: 1;
}

/* Unaffordable / Insufficient Funds Deactivated State */
.build-card.disabled-unaffordable {
  opacity: 0.48;
  filter: grayscale(0.65);
  cursor: not-allowed !important;
}

.build-card.disabled-unaffordable .price-mini {
  color: #ef4444 !important;
  font-weight: 800;
}

.build-card.disabled-unaffordable:hover {
  border-color: rgba(239, 68, 68, 0.6);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
  transform: none;
}

/* ================= FLOATING TACTICAL ITEM TOOLTIP ================= */
.tactical-item-tooltip {
  position: fixed;
  z-index: 9999;
  background: rgba(10, 15, 25, 0.96);
  border: 1px solid var(--border-cyan);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.85), 0 0 15px rgba(0, 229, 255, 0.25);
  backdrop-filter: blur(8px);
  border-radius: 8px;
  padding: 12px 14px;
  width: 275px;
  pointer-events: none;
  direction: rtl;
  color: #fff;
  font-family: var(--font-family);
  animation: fadeInTooltip 0.15s ease-out;
}

@keyframes fadeInTooltip {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.tactical-item-tooltip .tt-header {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(0, 229, 255, 0.25);
  padding-bottom: 8px;
  margin-bottom: 8px;
}

.tactical-item-tooltip .tt-thumb {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background: #060a12;
  border: 1px solid rgba(0, 229, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.tactical-item-tooltip .tt-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.tactical-item-tooltip .tt-title {
  font-weight: 800;
  font-size: 13px;
  color: #fff;
  line-height: 1.3;
}

.tactical-item-tooltip .tt-cat {
  font-size: 10px;
  color: var(--cyber-cyan);
}

.tactical-item-tooltip .tt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 10px;
  font-size: 11px;
  margin-bottom: 8px;
}

.tactical-item-tooltip .tt-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tactical-item-tooltip .tt-stat-label {
  color: var(--text-muted);
}

.tactical-item-tooltip .tt-stat-val {
  font-weight: 700;
  color: #fff;
}

.tactical-item-tooltip .tt-req {
  font-size: 10px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #f59e0b;
  padding: 4px 8px;
  border-radius: 4px;
  margin-top: 6px;
}

/* Assembled Atlas Uploader & Slicer */
.checkerboard-bg {
  background-color: #0c1017;
  background-image:
    linear-gradient(45deg, #161b24 25%, transparent 25%),
    linear-gradient(-45deg, #161b24 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #161b24 75%),
    linear-gradient(-45deg, transparent 75%, #161b24 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
}

.atlas-drop-zone {
  border: 2px dashed rgba(0, 229, 255, 0.45);
  border-radius: 8px;
  padding: 16px;
  background: rgba(0, 229, 255, 0.04);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.atlas-drop-zone:hover, .atlas-drop-zone.dragover {
  border-color: var(--amber-gold);
  background: rgba(255, 215, 0, 0.08);
  box-shadow: 0 0 15px rgba(0, 229, 255, 0.2);
}

.facet-slice-card {
  background: #0f141f;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: border-color 0.2s;
}

.facet-slice-card:hover {
  border-color: var(--cyber-cyan);
}

/* ================= NATION FLAG & COMMANDER AVATAR ================= */
.hud-stat-nation {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.85) 0%, rgba(30, 41, 59, 0.9) 100%);
  border: 1px solid rgba(0, 229, 255, 0.35);
  border-radius: 8px;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.hud-stat-nation:hover {
  border-color: var(--amber-gold);
  box-shadow: 0 0 14px rgba(255, 215, 0, 0.25);
  transform: translateY(-1px);
}

.hud-avatar-thumb {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--amber-gold);
  overflow: hidden;
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0b101b;
  flex-shrink: 0;
}

.hud-avatar-thumb img, .hud-avatar-thumb svg, .hud-avatar-thumb canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hud-flag-thumb {
  width: 28px;
  height: 18px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  overflow: hidden;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: #111;
}

.hud-flag-thumb img, .hud-flag-thumb canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hud-nation-details {
  display: flex;
  flex-direction: column;
  text-align: right;
  line-height: 1.15;
}

.hud-country-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--amber-gold);
  white-space: nowrap;
}

.hud-commander-title {
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
}

.flag-preview-box {
  width: 76px;
  height: 50px;
  border-radius: 4px;
  border: 1.5px solid var(--border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  background: #090d16;
  flex-shrink: 0;
}

.flag-preview-box.large {
  width: 110px;
  height: 70px;
  border-color: var(--amber-gold);
  box-shadow: 0 0 16px rgba(255, 215, 0, 0.2);
}

.flag-preview-box canvas, .flag-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-preview-box {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 2px solid var(--cyber-cyan);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.3);
  background: #090d16;
  flex-shrink: 0;
}

.avatar-preview-box.large {
  width: 82px;
  height: 82px;
  border-color: var(--amber-gold);
  box-shadow: 0 0 18px rgba(255, 215, 0, 0.35);
}

.avatar-preview-box canvas, .avatar-preview-box img, .avatar-preview-box svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ================= GOOGLE AUTH & SOCIAL SIGN-IN ================= */
.btn-google-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 10px 16px;
  background: #ffffff;
  color: #1f2937;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  margin-bottom: 12px;
}

.btn-google-auth:hover {
  background: #f3f4f6;
  box-shadow: 0 6px 20px rgba(66, 133, 244, 0.4);
  transform: translateY(-1px);
}

.btn-google-auth:active {
  transform: translateY(0);
}

.btn-google-auth .google-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.google-auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 12px 0 16px;
  color: var(--text-muted);
  font-size: 11px;
}

.google-auth-divider::before,
.google-auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.google-auth-divider span {
  padding: 0 12px;
}

/* ================= USER SETTINGS MODAL & TABS ================= */
.hud-icon-btn.settings-btn {
  border-color: rgba(0, 229, 255, 0.5);
}

.hud-icon-btn.settings-btn:hover {
  border-color: var(--cyber-cyan);
  box-shadow: 0 0 14px rgba(0, 229, 255, 0.6);
  transform: scale(1.1);
}

.settings-nav-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  overflow-x: auto;
}

.settings-tab-btn {
  padding: 8px 14px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.settings-tab-btn:hover {
  background: rgba(0, 229, 255, 0.1);
  color: #fff;
  border-color: var(--cyber-cyan);
}

.settings-tab-btn.active {
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.25) 0%, rgba(2, 132, 199, 0.2) 100%);
  color: #fff;
  border-color: var(--cyber-cyan);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
}

.settings-tab-pane {
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: fadeIn 0.2s ease-in-out;
}

.settings-tab-pane[hidden] {
  display: none !important;
}


.negotiation-button{position:absolute;z-index:8;top:52px;left:12px;background:#bd4738;padding:10px 24px}
.recovery-status{position:absolute;z-index:8;top:52px;left:12px;background:#123d4ee8;color:#b9f5df;padding:10px;border:1px solid #61cbb5;border-radius:6px}
.economy-dialog{max-width:500px;background:#132334;color:#e3eff5;padding:25px;border:1px solid #578d9c;border-radius:12px;line-height:1.8}
.economy-dialog::backdrop{background:#0009}.economy-dialog button{padding:8px 16px;cursor:pointer}.economy-dialog a{color:#85d8db}

.wood-button{position:absolute;z-index:7;top:90px;left:12px}.wood-balance{position:absolute;z-index:7;top:130px;left:12px;color:#d4e9bc;background:#1f3327cc;padding:4px 8px}
#btnMilitaryAid{position:absolute;z-index:8;top:168px;left:12px;cursor:pointer;background:#183a4ded;border-color:#70c5d4}
#aidBadge:not(:empty){display:inline-block;min-width:18px;border-radius:12px;background:#d84c3e;color:#fff;padding:0 5px}
#militaryAidDialog select{width:100%;padding:8px;background:#1d3448;color:#e3eff5;border:1px solid #578d9c;border-radius:6px}
#btnSendAid:disabled{opacity:.55;cursor:not-allowed}

.ledger-table{width:100%;border-collapse:collapse;font-size:12px}.ledger-table td{padding:7px 4px;border-bottom:1px solid #416072}.economy-dialog{max-height:80vh;overflow:auto}
