/* ==========================================================================
   Terraline Vanguard — Modern Bright Strategy / TD (`modern_tactical_bright`)
   Locked Palette: #62D0DC, #B49D5D, #6A645B, #72352E, #AD5C40, #BAD995
   Strict Hygiene: ZERO backdrop-filter: blur(), Exact 9-Slice border-image,
   WCAG AA Contrast (#14121F on btn_primary, #F8FAFC on #1D232B slate).
   ========================================================================== */

:root {
  --bg-slate: #1D232B;
  --bg-slate-elev: #262E38;
  --bg-slate-card: #2F3846;
  --ink-dark: #14121F;
  --text-bright: #F8FAFC;
  --text-muted: #CBD5E1;
  --pal-cyan: #62D0DC;
  --pal-brass: #B49D5D;
  --pal-stone: #6A645B;
  --pal-crimson: #72352E;
  --pal-terracotta: #AD5C40;
  --pal-sage: #BAD995;
  --gold-cta: #FFB703;
  --danger-red: #EF4444;
  --font-display: 'Lilita One', 'Bangers', Impact, sans-serif;
  --font-body: 'Nunito', 'Segoe UI', system-ui, sans-serif;
}

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

html, body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #141A22;
  color: var(--text-bright);
  font-family: var(--font-body);
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

#app-root {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.screen-layer {
  position: absolute;
  inset: 0;
  display: none;
  width: 100%;
  height: 100%;
}

.screen-layer.active {
  display: flex;
}

/* Idle-hidden overlay canvases NEVER steal clicks */
#vfx-3d-canvas,
#cutin-canvas,
#ui-motion-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none !important;
  display: none;
}
#vfx-3d-canvas { z-index: 55; }
#cutin-canvas { z-index: 85; }
#ui-motion-canvas { z-index: 190; }

/* Icons & Typography Helpers */
.icon-xs { width: 18px; height: 18px; object-fit: contain; flex: 0 0 18px; }
.icon-sm { width: 22px; height: 22px; object-fit: contain; flex: 0 0 22px; }
.svg-ic { width: 18px; height: 18px; flex: 0 0 18px; display: block; }
.w-full { width: 100%; }
.mt-12 { margin-top: 12px; }
.mt-auto { margin-top: auto; }
.flex-fill { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }

.hud-num {
  font-family: var(--font-display);
  color: #FFFFFF;
  text-shadow: 0 2px 0 #14121F;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.hud-num.gold { color: var(--gold-cta); }

/* ==========================================================================
   9-SLICE ANTI-DISTORTION CHROME (Exact art_manifest.json slices)
   ========================================================================== */
.btn-primary-9slice {
  box-sizing: border-box;
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 15px 18px 16px 18px;
  border-image: url('../assets/ui/btn_primary.png') 103 83 106 83 fill / 15px 18px 16px 18px / 0 stretch;
  border-radius: 0;
  box-shadow: none;
  color: #14121F;
  font-family: var(--font-display);
  font-size: clamp(14px, 1.15vw, 19px);
  font-weight: 800;
  letter-spacing: 0.03em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 2px 14px;
  filter: drop-shadow(0 4px 0 rgba(10, 12, 18, 0.55));
  transition: transform 0.12s ease, filter 0.12s ease;
}
.btn-primary-9slice:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.05) drop-shadow(0 5px 0 rgba(10, 12, 18, 0.6));
}
.btn-primary-9slice:active:not(:disabled) {
  transform: translateY(2px);
}
.btn-primary-9slice:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}
.btn-primary-9slice .btn-label {
  background-color: #F3AC0F;
  color: #14121F;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1.15;
  text-align: center;
}
.btn-primary-9slice:disabled .btn-label {
  background-color: #2A3342;
  color: #E2E8F0;
}

.panel-9slice {
  box-sizing: border-box;
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 28px 30px 28px 30px;
  border-image: url('../assets/ui/frame_panel.png') 207 221 208 222 fill / 28px 30px 28px 30px / 0 stretch;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.65));
}

.panel-inner-slate {
  background: var(--bg-slate);
  color: var(--text-bright);
  border-radius: 10px;
  border: 1px solid rgba(98, 208, 220, 0.28);
  padding: 16px 18px;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Red-Dot Notification Badge Rule: NEVER clip badges! */
.has-badge,
[data-notify-bucket] {
  overflow: visible !important;
  position: relative !important;
}

.notify-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  z-index: 35;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: #EF4444;
  color: #FFFFFF;
  border: 2px solid #14121F;
  font-family: var(--font-display);
  font-size: 11px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* Standard Sculpted Buttons */
.btn-tactical-cyan {
  background: linear-gradient(180deg, #38BDF8 0%, #0284C7 100%);
  color: #0F172A;
  border: 2px solid #14121F;
  border-radius: 12px;
  box-shadow: 0 4px 0 #0C4A6E;
  font-family: var(--font-display);
  font-size: clamp(13px, 1.05vw, 17px);
  font-weight: 800;
  min-height: 50px;
  padding: 6px 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-tactical-cyan:hover:not(:disabled) { filter: brightness(1.07); transform: translateY(-1px); }
.btn-tactical-cyan:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 #0C4A6E; }

.btn-slate-pill {
  background: #283240;
  color: #F8FAFC;
  border: 2px solid #475569;
  border-radius: 10px;
  min-height: 42px;
  padding: 6px 12px;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: clamp(12px, 0.9vw, 14px);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.12s ease, transform 0.12s ease, border-color 0.12s ease;
}
.btn-slate-pill:hover { background: #334155; border-color: var(--pal-cyan); transform: translateY(-1px); }
.btn-slate-pill.btn-gold-accent { border-color: var(--gold-cta); background: #332B1E; color: #FEF3C7; }
.btn-slate-pill.btn-danger-outline { border-color: #DC2626; color: #FCA5A5; }

/* ==========================================================================
   1. TITLE SCREEN
   ========================================================================== */
#title-screen {
  align-items: center;
  justify-content: center;
}

.title-bg-wrap {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.title-bg-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.title-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(95deg, rgba(16, 21, 30, 0.88) 0%, rgba(16, 21, 30, 0.62) 55%, rgba(16, 21, 30, 0.35) 100%);
}

.title-content {
  position: relative;
  z-index: 2;
  width: min(1440px, 92vw);
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.85fr);
  align-items: center;
  gap: 32px;
}
.title-content > * { min-width: 0; }

.title-kicker-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(29, 35, 43, 0.92);
  border: 2px solid var(--pal-cyan);
  border-radius: 999px;
  padding: 6px 14px;
  color: #E0F2FE;
  font-weight: 800;
  font-size: 13px;
  margin-bottom: 12px;
}

.game-logo-title {
  margin: 0 0 20px 0;
  font-family: var(--font-display);
  font-size: clamp(38px, 4.4vw, 68px);
  line-height: 1.02;
  letter-spacing: 0.03em;
  color: #FFF9E6;
  -webkit-text-stroke: 2.2px #14121F;
  text-shadow: 0 5px 0 #14121F;
}

.title-loading-box {
  max-width: 480px;
  background: rgba(29, 35, 43, 0.92);
  border: 2px solid #475569;
  border-radius: 12px;
  padding: 12px 16px;
}
.loading-bar-track {
  width: 100%;
  height: 14px;
  background: #0F172A;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid #334155;
}
.loading-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--pal-cyan), var(--gold-cta));
  transition: width 0.14s ease-out;
}
.loading-bar-label {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 800;
  color: #E2E8F0;
}

.title-cta-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.title-primary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

.title-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.title-right-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.title-hero-showcase {
  position: relative;
  width: min(400px, 32vw);
  height: min(420px, 52vh);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.title-hero-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 12px 22px rgba(0, 0, 0, 0.65));
}

.title-cores-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(29, 35, 43, 0.94);
  border: 2px solid var(--gold-cta);
  border-radius: 999px;
  padding: 6px 16px;
  font-weight: 800;
  color: #FEF3C7;
}

/* ==========================================================================
   2. EXPEDITION COMMAND SETUP SCREEN
   ========================================================================== */
#setup-screen {
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 30%, #263241 0%, #121720 100%);
  padding: 18px;
}

.setup-shell {
  width: min(1520px, 96vw);
  height: min(920px, 94vh);
}

.setup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  margin-bottom: 12px;
}

.section-display-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(20px, 2vw, 30px);
  color: #FFF9E6;
  letter-spacing: 0.03em;
  text-shadow: 0 3px 0 #14121F;
}

.setup-header-cores {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #283240;
  border: 1px solid var(--gold-cta);
  border-radius: 999px;
  padding: 5px 12px;
}

.setup-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr) minmax(0, 0.95fr);
  gap: 16px;
}
.setup-grid > * { min-width: 0; min-height: 0; }

.setup-col {
  background: #242C37;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sub-heading {
  margin: 0 0 8px 0;
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--pal-cyan);
  letter-spacing: 0.03em;
}

.factions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.faction-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 11px;
  border-radius: 9px;
  background: #1D232B;
  border: 2px solid #3E4C5E;
  color: var(--text-bright);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.faction-card.active {
  border-color: var(--gold-cta);
  background: #2D3542;
}
.faction-card strong { font-size: 14px; color: #FFF9E6; }
.faction-card span { font-size: 12px; color: var(--text-muted); line-height: 1.3; }

.diff-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.diff-grid > * { min-width: 0; }

.diff-btn {
  padding: 8px;
  border-radius: 8px;
  background: #1D232B;
  border: 2px solid #3E4C5E;
  color: var(--text-bright);
  text-align: left;
  cursor: pointer;
}
.diff-btn.active {
  border-color: var(--pal-cyan);
  background: #1E3240;
}
.diff-btn strong { display: block; font-size: 13px; color: #FFF9E6; }
.diff-btn span { display: block; font-size: 11px; color: var(--text-muted); }

.endless-toggle-row {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  background: #1D232B;
  border: 1px solid rgba(255, 183, 3, 0.4);
  cursor: pointer;
}
.endless-toggle-row input { width: 18px; height: 18px; accent-color: var(--gold-cta); }
.endless-copy strong { display: block; font-size: 13px; color: var(--gold-cta); }
.endless-copy span { display: block; font-size: 11px; color: var(--text-muted); }

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

.btn-mini-link {
  background: #1D232B;
  color: #FEF3C7;
  border: 1px solid var(--gold-cta);
  border-radius: 7px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.cmd-roster-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding-right: 4px;
}
.cmd-roster-grid > * { min-width: 0; }

.cmd-roster-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 8px;
  background: #1D232B;
  border: 2px solid #384454;
  color: var(--text-bright);
  text-align: left;
  cursor: pointer;
}
.cmd-roster-card.active { border-color: var(--gold-cta); background: #2F3847; }
.cmd-roster-card.locked { opacity: 0.68; border-style: dashed; }
.cmd-roster-thumb { width: 38px; height: 38px; border-radius: 6px; object-fit: cover; flex: 0 0 38px; background: #141920; }
.cmd-roster-info { min-width: 0; flex: 1; }
.cmd-roster-info strong { display: block; font-size: 12px; color: #FFF9E6; line-height: 1.2; }
.cmd-roster-info > span { display: block; font-size: 11px; color: var(--text-muted); line-height: 1.2; }
.cmd-roster-info .rec-pill-tag { display: inline-block; width: auto; }

.setup-dossier {
  align-items: center;
  text-align: center;
}
.dossier-portrait-wrap {
  width: 146px;
  height: 146px;
  border-radius: 14px;
  background: radial-gradient(circle, #334155 0%, #141A22 100%);
  border: 2px solid var(--gold-cta);
  overflow: hidden;
  margin-bottom: 8px;
}
.dossier-portrait {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  image-rendering: auto;
  transform: translateZ(0);
}
.dossier-name { font-family: var(--font-display); font-size: 19px; color: #FFF9E6; }
.dossier-role { font-size: 12px; font-weight: 800; color: var(--pal-cyan); margin-bottom: 8px; }
.dossier-box, .dossier-ult-box {
  width: 100%;
  background: #1D232B;
  border: 1px solid #3E4C5E;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.35;
  color: #E2E8F0;
  text-align: left;
  margin-bottom: 8px;
}
.dossier-ult-box { border-color: rgba(255, 183, 3, 0.5); }
.dossier-unlock-note {
  width: 100%;
  padding: 7px 10px;
  border-radius: 8px;
  background: #3B1F24;
  border: 1px solid #F87171;
  color: #FECACA;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}

/* ==========================================================================
   3. 16:9 TACTICAL BATTLEFIELD HUD
   ========================================================================== */
#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
}

.top-hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  min-height: 52px;
  z-index: 25;
  background: rgba(23, 29, 38, 0.94);
  border-bottom: 2px solid #384454;
  padding: 5px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hud-cluster {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.hud-stat-pill {
  background: #252E3B;
  border: 1px solid #475569;
  border-radius: 8px;
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 36px;
}
.hud-stat-pill.cores-pill { cursor: pointer; border-color: var(--gold-cta); }
.pill-label { font-weight: 800; font-size: 12px; color: #FFF9E6; white-space: nowrap; }
.hud-income { font-size: 11px; font-weight: 800; color: var(--pal-sage); white-space: nowrap; }
.hud-income.cyan { color: var(--pal-cyan); }

.hq-bar-shell {
  position: relative;
  width: clamp(135px, 13vw, 210px);
  height: 28px;
  background: #0F172A;
  border: 2px solid #475569;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hq-bar-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, #22C55E, #84CC16);
  transition: width 0.18s ease-out;
}
.hq-shield-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 6px;
  background: #38BDF8;
  transition: width 0.18s ease-out;
}
.hq-bar-text {
  position: relative;
  z-index: 2;
  font-size: 12px;
}

.wave-hex-badge {
  background: #252E3B;
  border: 2px solid var(--gold-cta);
  border-radius: 8px;
  padding: 3px 9px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
}
.wave-num-text { font-family: var(--font-display); font-size: 13px; color: #FFF9E6; white-space: nowrap; }
.phase-chip {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--pal-cyan);
  color: #0F172A;
  white-space: nowrap;
}

.speed-btn-group {
  display: inline-flex;
  background: #141922;
  border: 1px solid #475569;
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}
.btn-speed {
  background: transparent;
  color: #CBD5E1;
  border: none;
  border-radius: 6px;
  padding: 5px 7px;
  font-family: var(--font-display);
  font-size: 12px;
  cursor: pointer;
}
.btn-speed.active { background: var(--gold-cta); color: #14121F; }

.btn-hud-icon {
  background: #283240;
  color: #F8FAFC;
  border: 1px solid #475569;
  border-radius: 8px;
  min-height: 36px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.btn-hud-icon.btn-gold-accent { border-color: var(--gold-cta); background: #332B1E; color: #FEF3C7; }

.btn-hud-sq {
  width: 36px;
  height: 36px;
  background: #283240;
  color: #F8FAFC;
  border: 1px solid #475569;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-hud-sq.btn-danger-outline { border-color: #DC2626; color: #FCA5A5; }

/* Side Panels */
.side-hud-panel {
  position: absolute;
  top: 60px;
  bottom: 92px;
  z-index: 20;
  background: rgba(26, 32, 42, 0.93);
  border: 2px solid #3B4758;
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}
.left-panel { left: 10px; width: clamp(216px, 16.5vw, 256px); }
.right-panel { right: 10px; width: clamp(224px, 17.5vw, 268px); }

.cmd-card-compact {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #252E3B;
  border: 1px solid #475569;
  border-radius: 9px;
  padding: 6px 8px;
}
.hud-cmd-avatar { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; border: 2px solid var(--gold-cta); flex: 0 0 42px; }
.hud-cmd-meta { min-width: 0; flex: 1; }
.hud-cmd-name { font-family: var(--font-display); font-size: 13px; color: #FFF9E6; line-height: 1.15; }
.hud-cmd-passive { font-size: 11px; color: var(--text-muted); line-height: 1.2; }

.btn-ult-gauge {
  position: relative;
  width: 100%;
  min-height: 44px;
  background-color: #1B2330;
  border: 2px solid #475569;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  padding: 6px 10px;
  color: #F8FAFC;
}
.btn-ult-gauge.ready {
  background-color: #F59E0B;
  border-color: var(--gold-cta);
  color: #14121F;
}
.ult-gauge-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, #D97706, #FBBF24);
  opacity: 0.42;
  transition: width 0.15s ease-out;
}
.btn-ult-gauge.ready .ult-gauge-fill { opacity: 0.95; }
.ult-btn-content {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 13px;
}
.ult-label-text {
  background-color: rgba(20, 26, 35, 0.88);
  color: #F8FAFC;
  padding: 2px 7px;
  border-radius: 5px;
}
.btn-ult-gauge.ready .ult-label-text {
  background-color: #FBBF24;
  color: #14121F;
}

.hotkey-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 5px;
  background: #14121F;
  color: #FFF9E6;
  font-family: var(--font-display);
  font-size: 11px;
  border: 1px solid #64748B;
}
.hotkey-chip.dark { background: #14121F; color: #FFB703; border-color: #14121F; }

.panel-section {
  background: #222B37;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 8px;
  padding: 7px 8px;
}
.panel-sec-title {
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--pal-cyan);
  letter-spacing: 0.04em;
  margin-bottom: 5px;
}

.threat-tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.threat-pill {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 6px;
  background: #313D4F;
  color: #F8FAFC;
  border: 1px solid #64748B;
}
.threat-pill.boss { background: #4C1D24; border-color: #F87171; color: #FECACA; }

.doctrines-mini-list,
.dps-telemetry-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 150px;
  overflow-y: auto;
  font-size: 11px;
}
.doc-mini-row, .dps-mini-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 3px 6px;
  background: #1A212B;
  border-radius: 5px;
  color: #E2E8F0;
}

/* Right Contextual Drawer */
.drawer-mode {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.drawer-title {
  font-family: var(--font-display);
  font-size: 15px;
  color: #FFF9E6;
}
.drawer-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-muted);
}
.zone-rule-note {
  background: rgba(98, 208, 220, 0.12);
  border: 1px solid rgba(98, 208, 220, 0.45);
  border-radius: 7px;
  padding: 5px 8px;
  font-size: 11px;
  line-height: 1.32;
  color: #BAE6FD;
  font-weight: 700;
}

.btn-mini-action {
  background: #2B3646;
  color: #F8FAFC;
  border: 1px solid var(--pal-cyan);
  border-radius: 7px;
  padding: 4px 8px;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-mini-close {
  background: #334155;
  color: #F8FAFC;
  border: 1px solid #64748B;
  border-radius: 7px;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  font-weight: 800;
  cursor: pointer;
}

.zone-hover-telemetry {
  background: #182936;
  border: 1px solid var(--pal-cyan);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 800;
  color: #E0F2FE;
}

.zone-candidates-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.zone-card {
  background: #242E3C;
  border: 2px solid #475569;
  border-radius: 9px;
  padding: 8px 10px;
  color: #F8FAFC;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.zone-card.active {
  border-color: var(--pal-cyan);
  background: #1E3242;
}
.zone-card.nest {
  border-color: #F87171;
  background: #3A1F26;
}
.zone-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-weight: 800;
  font-size: 13px;
}
.zone-card-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.btn-tactical-reroll {
  background: #283445;
  color: #E0F2FE;
  border: 2px solid var(--pal-cyan);
  border-radius: 9px;
  min-height: 40px;
  padding: 6px 10px;
  font-family: var(--font-display);
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-tactical-reroll:disabled { opacity: 0.45; cursor: not-allowed; }

/* Tower Inspector */
.insp-elev-badge {
  background: #1E3240;
  border: 1px solid var(--pal-cyan);
  border-radius: 7px;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 800;
  color: #BAE6FD;
}
.insp-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.insp-stat {
  background: #232C38;
  border-radius: 6px;
  padding: 5px 8px;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}
.insp-stat strong { color: #FFF9E6; font-family: var(--font-display); font-size: 13px; }

.mini-label { font-size: 11px; font-weight: 800; color: var(--text-muted); margin-bottom: 4px; }
.prio-btn-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
}
.btn-prio {
  background: #232C38;
  color: #CBD5E1;
  border: 1px solid #475569;
  border-radius: 6px;
  padding: 5px 2px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}
.btn-prio.active { background: var(--pal-cyan); color: #0F172A; border-color: #FFF; }

.insp-tracks-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.track-box {
  background: #232C38;
  border: 2px solid #475569;
  border-radius: 9px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.track-box.active-track { border-color: var(--gold-cta); }
.track-box.locked-track { opacity: 0.52; }
.track-head { display: flex; justify-content: space-between; font-weight: 800; font-size: 12px; color: #FFF9E6; }
.track-desc { font-size: 11px; color: var(--text-muted); line-height: 1.3; }
.track-pips { display: flex; gap: 4px; }
.track-pip { width: 18px; height: 6px; border-radius: 3px; background: #0F172A; border: 1px solid #64748B; }
.track-pip.filled { background: var(--gold-cta); border-color: #FEF08A; }

.btn-track-upg {
  background: linear-gradient(180deg, #FBBF24 0%, #D97706 100%);
  color: #14121F;
  border: 1px solid #14121F;
  border-radius: 7px;
  min-height: 34px;
  padding: 4px 8px;
  font-family: var(--font-display);
  font-size: 12px;
  cursor: pointer;
}
.btn-track-upg:disabled { background: #334155; color: #94A3B8; cursor: not-allowed; }

.btn-sell-tower {
  background: #3B1F24;
  color: #FECACA;
  border: 1px solid #EF4444;
  border-radius: 8px;
  min-height: 34px;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
}

.starter-crate-card {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #2E2718;
  border: 2px solid var(--gold-cta);
  border-radius: 10px;
  padding: 8px;
}
.crate-icon { width: 38px; height: 38px; object-fit: contain; }
.crate-copy { flex: 1; min-width: 0; font-size: 11px; }
.crate-copy strong { display: block; color: #FEF3C7; font-size: 12px; }
.crate-copy span { color: #E2E8F0; }

.btn-mini-gold {
  background: var(--gold-cta);
  color: #14121F;
  border: 1px solid #14121F;
  border-radius: 7px;
  min-height: 34px;
  padding: 5px 10px;
  font-family: var(--font-display);
  font-size: 12px;
  cursor: pointer;
}

/* Bottom Blueprint Dock */
.bottom-build-dock {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 8px;
  min-height: 76px;
  z-index: 25;
  background: rgba(23, 29, 38, 0.95);
  border: 2px solid #3B4758;
  border-radius: 14px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.blueprint-deck {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 6px;
}
.blueprint-deck > * { min-width: 0; }

.bp-card {
  position: relative;
  background: #252E3B;
  border: 2px solid #475569;
  border-radius: 10px;
  padding: 4px 4px 3px;
  color: #F8FAFC;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
  min-height: 70px;
  text-align: center;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.bp-card:hover:not(.depleted) { transform: translateY(-2px); border-color: var(--pal-cyan); }
.bp-card.selected { border-color: var(--gold-cta); background: #313B4B; box-shadow: 0 0 0 2px rgba(255, 183, 3, 0.35); }
.bp-card.depleted { opacity: 0.48; }
.blueprint-deck.phase-expand-locked .bp-card {
  opacity: 0.72;
  border-style: dashed;
}
.dock-phase-hint {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 12px;
  background: rgba(15, 23, 42, 0.94);
  border: 1.5px solid var(--pal-cyan);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 800;
  color: #E0F2FE;
  pointer-events: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  max-width: calc(100% - 24px);
}
.bp-top-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding-left: 12px;
}
.bp-thumb { width: 30px; height: 30px; object-fit: contain; flex: 0 0 30px; }
.bp-meta { min-width: 0; flex: 1; }
.bp-name {
  width: 100%;
  font-weight: 800;
  font-size: 9.5px;
  color: #FFF9E6;
  line-height: 1.08;
  min-height: 21px;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.bp-cost-row { display: flex; flex-direction: column; align-items: flex-start; gap: 0; font-size: 10.5px; line-height: 1.15; }
.bp-cost { color: var(--gold-cta); font-family: var(--font-display); }
.bp-stock { color: var(--pal-cyan); font-weight: 800; }
.bp-key {
  position: absolute;
  top: 3px;
  left: 4px;
  font-family: var(--font-display);
  font-size: 9.5px;
  background: #14121F;
  color: #CBD5E1;
  padding: 1px 4px;
  border-radius: 4px;
}

.dock-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-send-wave {
  min-width: 170px;
  min-height: 58px;
}

/* FTUE Non-Blocking Banner */
.ftue-banner {
  position: absolute;
  top: 62px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  width: min(620px, 56vw);
  background: #1D232B;
  border: 2px solid var(--gold-cta);
  border-radius: 12px;
  padding: 9px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.6);
}
body.tb-modal-active .ftue-banner {
  display: none !important;
}
.ftue-step-badge {
  background: var(--gold-cta);
  color: #14121F;
  font-family: var(--font-display);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
}
.ftue-copy { flex: 1; min-width: 0; font-size: 12px; }
.ftue-copy strong { display: block; color: #FFF9E6; font-size: 13px; }
.ftue-copy span { color: #CBD5E1; }

/* ==========================================================================
   4. MODALS (Codex, Operations, Armory Shop, Settings, Reinforcement, Result)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(12, 16, 24, 0.80);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-shell {
  width: min(780px, 94vw);
  max-height: calc(100vh - 24px);
  display: flex;
  flex-direction: column;
}
.modal-shell > .panel-inner-slate {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}
.modal-shell.modal-wide {
  width: min(1180px, 95vw);
}

.modal-top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  margin-bottom: 12px;
}
.modal-display-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(20px, 1.9vw, 28px);
  color: #FFF9E6;
  text-shadow: 0 2px 0 #14121F;
}
.modal-sub {
  margin: 3px 0 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.modal-scroll-body {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 66vh;
  overflow-y: auto;
  padding-right: 4px;
}

.tab-pill-bar {
  display: inline-flex;
  gap: 6px;
  background: #141A22;
  padding: 4px;
  border-radius: 9px;
}
.tab-pill {
  background: transparent;
  color: #CBD5E1;
  border: none;
  border-radius: 7px;
  padding: 6px 12px;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
}
.tab-pill.active {
  background: var(--pal-cyan);
  color: #0F172A;
}

/* Reinforcement 3-Card Draft */
.reinforcement-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.reinforcement-grid > * { min-width: 0; }

.reinf-card {
  background: #26303E;
  border: 2px solid #475569;
  border-radius: 12px;
  padding: 16px;
  color: #F8FAFC;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  transition: transform 0.14s ease, border-color 0.14s ease;
}
.reinf-card:hover { transform: translateY(-4px); border-color: var(--gold-cta); }
.reinf-type-chip {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  background: #141A22;
  color: var(--pal-cyan);
}
.reinf-title { font-family: var(--font-display); font-size: 18px; color: #FFF9E6; }
.reinf-desc { font-size: 13px; line-height: 1.4; color: #E2E8F0; flex: 1; }

/* Codex Grid */
.codex-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.codex-grid > * { min-width: 0; }

.codex-card {
  background: #252E3B;
  border: 1px solid #475569;
  border-radius: 10px;
  padding: 12px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.codex-thumb { width: 54px; height: 54px; object-fit: contain; flex: 0 0 54px; background: #18202A; border-radius: 8px; padding: 4px; }
.codex-copy { min-width: 0; flex: 1; }
.codex-copy strong { display: block; font-family: var(--font-display); font-size: 15px; color: #FFF9E6; margin-bottom: 3px; }
.codex-copy p { margin: 0 0 5px 0; font-size: 12px; color: var(--text-muted); line-height: 1.35; }
.codex-meta-tag { display: inline-block; font-size: 11px; font-weight: 800; color: var(--pal-cyan); }

/* Operations & Medals */
.ops-list-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.ops-list-grid > * { min-width: 0; }

.op-card, .ach-card {
  background: #252E3B;
  border: 1px solid #475569;
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.op-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.op-head strong { font-family: var(--font-display); font-size: 16px; color: #FFF9E6; }
.ms-row {
  background: #1B222C;
  border-radius: 8px;
  padding: 7px 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}

.ops-footer-bar {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.25);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.giftcode-inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.giftcode-status {
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  min-height: 16px;
}
.giftcode-status.ok { color: #34D399; }
.giftcode-status.err { color: #FCA5A5; }
.inp-tactical {
  background: #141A22;
  color: #F8FAFC;
  border: 1px solid #475569;
  border-radius: 7px;
  padding: 6px 10px;
  font-size: 13px;
  width: 155px;
}

/* Command Armory Shop (8 SKUs) */
.shop-balance-row { display: flex; align-items: center; gap: 8px; }
.shop-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.shop-grid > * { min-width: 0; }

.shop-card {
  position: relative;
  background: #252E3B;
  border: 2px solid #475569;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
}
.shop-card.featured { border-color: var(--gold-cta); background: #2D2A1F; }
.shop-badge {
  align-self: center;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--gold-cta);
  color: #14121F;
}
.shop-art { width: 84px; height: 84px; object-fit: contain; }
.shop-title { font-family: var(--font-display); font-size: 15px; color: #FFF9E6; line-height: 1.2; }
.shop-desc { font-size: 11px; color: var(--text-muted); line-height: 1.3; flex: 1; }
.btn-shop-buy {
  width: 100%;
  min-height: 38px;
  border-radius: 8px;
  background: linear-gradient(180deg, #FBBF24 0%, #D97706 100%);
  color: #14121F;
  border: 1px solid #14121F;
  font-family: var(--font-display);
  font-size: 14px;
  cursor: pointer;
}
.btn-shop-buy.owned { background: #334155; color: #CBD5E1; cursor: default; }

/* Settings Modal */
.settings-body { display: flex; flex-direction: column; gap: 12px; }
.settings-group {
  background: #252E3B;
  border: 1px solid #3F4D60;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.settings-sec-label { font-family: var(--font-display); font-size: 13px; color: var(--pal-cyan); }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.setting-lbl { font-size: 13px; font-weight: 700; color: #F8FAFC; }
.setting-ctrl { display: flex; align-items: center; gap: 8px; }
.btn-toggle-pill {
  min-width: 58px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid #64748B;
  background: #141A22;
  color: #CBD5E1;
  font-family: var(--font-display);
  font-size: 12px;
  cursor: pointer;
}
.btn-toggle-pill.active { background: #22C55E; color: #052E16; border-color: #86EFAC; }
.tactical-slider { width: 120px; accent-color: var(--pal-cyan); }

.lang-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.lang-grid > * { min-width: 0; }
.btn-lang {
  background: #1B222C;
  color: #E2E8F0;
  border: 1px solid #475569;
  border-radius: 7px;
  min-height: 34px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.btn-lang.active { background: var(--pal-cyan); color: #0F172A; border-color: #FFF; }

.slot-switcher-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.slot-btn {
  background: #1B222C;
  color: #E2E8F0;
  border: 1px solid #475569;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.slot-btn.active { border-color: var(--gold-cta); background: #2E291C; color: #FEF3C7; }
.settings-note { font-size: 11px; color: var(--text-muted); }
.settings-footer-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

/* Result & Chest Reveal */
.result-inner, .chest-reveal-inner { align-items: center; text-align: center; gap: 12px; }
.result-stats-row {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.res-stat-card {
  background: #252E3B;
  border: 1px solid #475569;
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
}
.res-stat-card strong { font-size: 20px; }
.result-actions-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; width: 100%; }

.chest-visual-stage { padding: 12px; }
.chest-big-img { width: 112px; height: 112px; object-fit: contain; }
.chest-rewards-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }
.chest-reward-pill {
  background: #252E3B;
  border: 2px solid var(--gold-cta);
  border-radius: 10px;
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  color: #FEF3C7;
}

/* Build Version Tag, Setup First-Launch Guidance & Pre-Wave Warning Modal */
.build-ver-tag {
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(98, 208, 220, 0.16);
  border: 1px solid rgba(98, 208, 220, 0.45);
  color: #BAE6FD;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.setup-guide-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  margin-bottom: 10px;
  border-radius: 10px;
  background: rgba(34, 49, 68, 0.92);
  border: 1.5px solid rgba(98, 208, 220, 0.55);
  flex: 0 0 auto;
}
.setup-guide-copy {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  flex: 1;
  font-size: 12.5px;
  color: #E2E8F0;
}
.setup-rec-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--gold-cta);
  color: #14121F;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.03em;
  flex: 0 0 auto;
}
.setup-guide-text strong { color: #FFF9E6; }
.rec-pill-tag {
  display: inline-block;
  margin-left: 5px;
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(255, 183, 3, 0.22);
  border: 1px solid rgba(255, 183, 3, 0.65);
  color: #FDE047;
  font-size: 9.5px;
  font-weight: 800;
  vertical-align: middle;
}

.setup-advanced-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 9px;
  background: rgba(20, 27, 38, 0.9);
  border: 1.5px solid #475569;
  color: #CBD5E1;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.setup-advanced-toggle:hover {
  border-color: var(--pal-cyan);
  color: #FFF9E6;
}
.setup-advanced-group.collapsed {
  display: none;
}

.wave-confirm-shell {
  width: min(520px, 92vw);
}
.wave-confirm-inner {
  align-items: center;
  text-align: center;
  gap: 14px;
  padding: 20px;
}
.wave-confirm-body {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: #E2E8F0;
}
.wave-confirm-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: 100%;
}

/* Toast Stack (strictly cleared above STEP 1 tutorial bar & bottom dock — 0px overlap!) */
.toast-stack {
  position: fixed;
  bottom: 146px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  max-width: min(560px, 56vw);
  pointer-events: none;
}
.toast-msg {
  background: rgba(20, 25, 34, 0.95);
  color: #FFF9E6;
  border: 2px solid var(--pal-cyan);
  border-radius: 999px;
  padding: 7px 16px;
  font-weight: 800;
  font-size: 13px;
}
.toast-msg.toast-warn {
  background: rgba(34, 16, 22, 0.96);
  color: #FEE2E2;
  border-color: #F87171;
  box-shadow: 0 4px 18px rgba(239, 68, 68, 0.35);
}

.btn-title-command-cta {
  flex-direction: column;
  gap: 1px;
  line-height: 1.05;
}
.btn-sub-label {
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  opacity: 0.86;
}

.ops-guide-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 9px 12px;
  margin-bottom: 12px;
  border-radius: 10px;
  background: rgba(30, 44, 62, 0.92);
  border: 1.5px solid rgba(98, 208, 220, 0.5);
}
.ops-guide-copy {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
  min-width: 240px;
  font-size: 12.5px;
  color: #E2E8F0;
}
.ops-guide-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ms-row.ms-locked {
  opacity: 0.82;
}
.btn-mini-gold.is-locked {
  background: #334155;
  color: #CBD5E1;
  border-color: #475569;
}

.shop-art-frame {
  width: 88px;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: radial-gradient(circle at 50% 45%, rgba(98, 208, 220, 0.16), rgba(15, 23, 42, 0.45));
  margin: 4px 0;
  flex: 0 0 auto;
}
.shop-art-frame .shop-art {
  display: block;
  width: 82px;
  height: 82px;
  object-fit: contain;
}

/* Responsive <= 1480px (1280x720 clean fit across all 9 languages including DE/RU) */
@media (max-width: 1480px) {
  .top-hud { padding: 4px 8px; gap: 4px; }
  .hud-cluster { gap: 4px; }
  .hud-stat-pill { padding: 3px 6px; gap: 4px; min-height: 32px; }
  .pill-label { font-size: 11px; }
  .hud-income { display: none; }
  .hq-bar-shell { width: 120px; height: 26px; }
  .hq-bar-text { font-size: 11px; }
  .wave-hex-badge { padding: 2px 6px; gap: 4px; min-height: 32px; }
  .wave-num-text { font-size: 11px; }
  .phase-chip { font-size: 9px; padding: 2px 4px; }
  .btn-speed { padding: 4px 5px; font-size: 11px; }
  .btn-hud-icon { padding: 3px 6px; font-size: 11px; min-height: 32px; gap: 4px; }
  .btn-hud-icon .icon-sm { width: 16px; height: 16px; flex: 0 0 16px; }
  .btn-hud-sq { width: 32px; height: 32px; flex: 0 0 32px; }
  .left-panel { width: 206px; padding: 8px; }
  .right-panel { width: 218px; padding: 8px; }
  .bp-thumb { width: 32px; height: 32px; flex: 0 0 32px; }
  .bp-name { font-size: 11px; }
  .btn-send-wave { min-width: 146px; min-height: 54px; font-size: 13px; }
  .shop-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .codex-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 960px) {
  .title-content { grid-template-columns: 1fr; }
  .setup-grid { grid-template-columns: 1fr; }
  .blueprint-deck { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .shop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Locked 60 FPS GPU-Composited Modal & Slot-Border Tuning */
[data-tb-archetype="modern_tactical_bright"] {
  --tb-open-ms: 190ms;
  --tb-close-ms: 150ms;
  --tb-stagger-ms: 12ms;
}
.modal-shell {
  transform: translateZ(0);
  backface-visibility: hidden;
}
.tb-stagger-in {
  animation-duration: 180ms;
}
body.tb-modal-active .tb-cta-pulse,
body.tb-modal-active .tb-cta-pulse::after,
.tb-cta-pulse:disabled,
.tb-cta-pulse:disabled::after {
  animation-play-state: paused !important;
}
.shop-card.tb-slot-border-chaser,
.reinf-card.tb-slot-border-chaser,
.btn-ult-gauge.tb-slot-border-lightning {
  animation: none !important;
  border-color: #FBBF24 !important;
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.45), inset 0 0 6px rgba(251, 191, 36, 0.22);
}

/* ==========================================================================
   5. SEASON 2-4 (v2.1 -> v5.0) EXTENDED UI COMPONENTS
   ========================================================================== */
.title-currency-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.title-cores-badge.shard-badge {
  border-color: #A78BFA;
  cursor: pointer;
}
.setup-header-currencies {
  display: flex;
  align-items: center;
  gap: 8px;
}
.setup-header-cores {
  cursor: pointer;
}
.mini-curr-tag {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 800;
}

.compact-chip-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.compact-chip-grid > * { min-width: 0; }

.season-chip-btn {
  background: #1D232B;
  border: 2px solid #3E4C5E;
  border-radius: 8px;
  padding: 6px 8px;
  color: var(--text-bright);
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-family: var(--font-body);
}
.season-chip-btn strong {
  font-size: 12px;
  color: #FFF9E6;
  line-height: 1.2;
}
.season-chip-btn span {
  font-size: 10.5px;
  color: var(--text-muted);
  line-height: 1.2;
}
.season-chip-btn.active {
  border-color: var(--pal-cyan);
  background: #1E3240;
}
.season-chip-btn.mutator-active {
  border-color: #F97316;
  background: #36221C;
}

.puzzle-picker-box {
  margin-top: 10px;
  padding: 8px;
  background: #19222D;
  border: 1px solid var(--pal-cyan);
  border-radius: 8px;
}

.ascension-stepper-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: #1D232B;
  border: 1px solid #A78BFA;
  border-radius: 8px;
}
.asc-copy strong { display: block; font-size: 12.5px; color: #E9D5FF; }
.asc-copy span { display: block; font-size: 11px; color: var(--text-muted); }
.asc-controls { display: inline-flex; align-items: center; gap: 6px; }

.dossier-season-box {
  border-color: var(--pal-cyan);
  background: #182531;
}

.btn-hud-sq.active-toggle {
  background: var(--pal-cyan);
  color: #0F172A;
  border-color: #FFF9E6;
  font-family: var(--font-display);
  font-size: 12px;
}
.btn-hud-sq {
  font-family: var(--font-display);
  font-size: 12px;
}

.path-calc-bar {
  background: #192836;
  border: 1px solid rgba(98, 208, 220, 0.5);
  border-radius: 7px;
  padding: 5px 8px;
  font-size: 11.5px;
  font-weight: 800;
  color: #BAE6FD;
}

/* Tier-4 Apex Inspector Box */
.insp-apex-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.apex-box {
  background: linear-gradient(180deg, #2B2418 0%, #1E1B18 100%);
  border: 2px solid #FBBF24;
  border-radius: 9px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.apex-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-display);
  font-size: 12px;
  color: #FDE047;
}
.apex-branch-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.btn-apex-spec {
  background: #332917;
  border: 1px solid #FBBF24;
  border-radius: 7px;
  padding: 6px;
  color: #FEF9C3;
  cursor: pointer;
  text-align: left;
  font-size: 11px;
}
.btn-apex-spec strong { display: block; color: #FDE047; font-size: 11.5px; }
.btn-apex-spec:disabled { opacity: 0.48; cursor: not-allowed; }

/* Radial Hotkey Build Wheel Grid */
.build-wheel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.wheel-card {
  background: #252E3B;
  border: 2px solid #475569;
  border-radius: 10px;
  padding: 9px 11px;
  color: #F8FAFC;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}
.wheel-card:hover:not(:disabled) { border-color: var(--gold-cta); background: #2F3B4C; }
.wheel-card:disabled { opacity: 0.45; cursor: not-allowed; }

/* Global Defense Order Progress Bar */
.gdo-banner-box {
  background: #1D2735;
  border: 2px solid var(--pal-cyan);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
}
.gdo-bar-track {
  width: 100%;
  height: 18px;
  background: #0F172A;
  border: 1px solid #475569;
  border-radius: 999px;
  overflow: hidden;
  margin: 8px 0;
}
.gdo-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #38BDF8, #34D399, #FBBF24);
}

.tab-pill-bar {
  flex-wrap: wrap;
}
