/* ===== War Room Theme for Map Room ===== */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700&family=EB+Garamond:ital,wght@0,400;0,500;0,600;1,400&family=IBM+Plex+Mono:wght@400;500&family=Special+Elite&display=swap');

:root {
  /* === Base Palette === */
  --bg-primary:       #2b2b22;
  --bg-secondary:     #33332a;
  --bg-tertiary:      #252520;
  --bg-overlay:       rgba(15, 15, 10, 0.85);
  --bg-modal:         #2e2e24;
  --bg-darkest:       #0a0a08;

  /* === Surface Colors === */
  --surface-panel:    #38362e;
  --surface-card:     #3d3a30;
  --surface-input:    #2a2a22;
  --surface-hover:    #45423a;
  --surface-disabled: #2a2a22;
  --surface-disabled-mid: #3a3a3a;

  /* === Border Colors === */
  --border-primary:   #5a5540;
  --border-secondary: #4a4535;
  --border-accent:    #8b7d4a;
  --border-modal:     #6b6040;

  /* === Text Colors === */
  --text-primary:     #d4c8a0;
  --text-secondary:   #a09878;
  --text-muted:       #8a7d60;
  --text-heading:     #c4a44a;
  --text-accent:      #d4a038;

  /* === Accent Colors === */
  --accent-gold:      #c4a44a;
  --accent-gold-bright: #dbb84a;
  --accent-brass:     #b89a3a;
  --accent-red:       #a04040;
  --accent-red-bright: #c05050;
  --accent-blue:      #5a7a9a;
  --accent-green:     #5a8a4a;
  --color-on-gold:    #1a1a10;  /* dark text for use on gold/accent backgrounds */

  /* === Alliance Colors === */
  --alliance-axis:    #a04040;
  --alliance-allies:  #5a8a4a;

  /* === Phase Colors === */
  --phase-active:     #c4a44a;
  --phase-inactive:   #4a4535;
  --phase-complete:   #5a8a4a;

  /* === Shadows === */
  --shadow-sm:        0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:        0 2px 8px rgba(0,0,0,0.5);
  --shadow-lg:        0 4px 16px rgba(0,0,0,0.6);
  --shadow-inset:     inset 0 1px 3px rgba(0,0,0,0.5);
  --shadow-bevel-up:  inset 0 1px 0 rgba(255,255,255,0.08), inset 0 -1px 0 rgba(0,0,0,0.3);
  --shadow-bevel-down: inset 0 1px 3px rgba(0,0,0,0.4), inset 0 -1px 0 rgba(255,255,255,0.05);

  /* === Typography === */
  --font-heading:     'Cinzel', 'Georgia', 'Times New Roman', serif;
  --font-body:        'EB Garamond', 'Georgia', 'Times New Roman', serif;
  --font-mono:        'IBM Plex Mono', 'Courier New', Courier, monospace;
  --font-diary:       'Special Elite', 'Courier New', monospace;

  /* === Fluid Text Scale (Utopia-style clamp tokens) === */
  --text-xs:   clamp(0.5625rem, 0.52rem + 0.13vw, 0.6875rem);  /* ~9–11px  */
  --text-sm:   clamp(0.6875rem, 0.63rem + 0.18vw, 0.8125rem);  /* ~11–13px */
  --text-base: clamp(0.8125rem, 0.71rem + 0.32vw, 1.0625rem);  /* ~13–17px */
  --text-lg:   clamp(1rem,      0.87rem + 0.41vw, 1.3125rem);   /* ~16–21px */
  --text-xl:   clamp(1.1875rem, 1.04rem + 0.47vw, 1.625rem);   /* ~19–26px */
  --text-2xl:  clamp(1.5rem,    1.3rem  + 0.63vw, 2.125rem);   /* ~24–34px */

  /* === Fluid Spacing === */
  --space-xs:  clamp(0.25rem,  0.21rem + 0.13vw, 0.375rem);
  --space-sm:  clamp(0.5rem,   0.43rem + 0.22vw, 0.6875rem);
  --space-md:  clamp(0.75rem,  0.65rem + 0.32vw, 1.0625rem);
  --space-lg:  clamp(1rem,     0.87rem + 0.41vw, 1.3125rem);
  --space-xl:  clamp(1.5rem,   1.3rem  + 0.63vw, 2rem);

  /* === Transitions === */
  --transition-fast:   150ms ease;
  --transition-normal: 200ms ease;

  /* === Border Radius === */
  --radius-xs:        3px;
  --radius-sm:        4px;
  --radius-md:        6px;
  --radius-lg:        10px;

  /* === Button Presets === */
  --btn-bg:           #4a4535;
  --btn-bg-hover:     #5a5540;
  --btn-bg-primary:      #6b5a2a;
  --btn-bg-primary-dark: #5a4a20; /* darkest shade; used as gradient endpoint */
  --btn-bg-danger:    #6b2a2a;
  --btn-bg-success:   #2a5a3a;
  --btn-text:         #d4c8a0;

  /* === Status/Semantic Colors === */
  --color-success:    #4caf50;
  --color-warning:    #ff8c00;
  --color-hit:        #e05050;
  --color-miss:       #666666;
  --color-info-text:  #c0b890;
  --color-danger:     #ff4444;
  --color-danger-soft: #ff6b6b;
  --color-danger-text: var(--color-danger); /* alias for color-danger — use on text */
  --color-danger-text-soft: #ff8888; /* softer danger text (lighter than color-danger-soft) */
  --color-info:       #5090d0;
  --color-casualty:   #c06050;
  --color-parchment:  #c0b890;
  --color-valid:      #40a060;
  --color-success-bright: #44cc88;
  --color-white:      #ffffff;
  --color-black:      #000000;

  /* === Extended Accent Colors === */
  --accent-blue-light: #7ab0d0;
  --bg-elevated:      #444;

  /* === Combat/Overlay Colors === */
  --color-amphibious:  #5090c0;
  --color-draw:        #c0a040;
  --color-hover-active: #4080d0;
  --color-sbr-aa:      #d09050;
  --color-sbr-bombing: #d0c060;
  --color-attacker:    #e06040;  /* attacker-side accent (orange-red) */
  --color-defender:    #5090d0;  /* defender-side accent (blue) */

  /* === Battle Board Gradient Stops === */
  --gradient-battle-header-top: #3a2a18;  /* warm amber — top of battle board headers */
  --gradient-battle-header-bot: #2a1c10;  /* warm amber — bottom of battle board headers */
  --gradient-battle-column-bot: #1a1610;  /* very dark — bottom of attacker/defender columns */
  --gradient-staging-top:       #1a2a18;  /* dark green — top of staging panel */
  --gradient-staging-bot:       #142010;  /* dark green — bottom of staging panel */

  /* === Map Feature Indicators === */
  --color-blockade:    #88ddff;
  --color-convoy:      #66ccee;
  --color-installations: #88aacc;

  /* === Log/Diary Entry Type Colors === */
  --color-log-dice:    #8898a8;
  --color-log-purchase: #80a870;
  --color-log-placement: #7898b0;
  --color-log-income:  #c8b040;

  /* === Note Type Colors === */
  --color-note-move:   #5080e0;
  --color-note-strategy: #a070d0;

  /* === Lobby Colors === */
  --color-lobby-title: #f0e0a0;
  --color-lobby-subtitle: #a09070;
  --lobby-input-bg:             rgba(26, 26, 20, 0.9);
  --lobby-input-border:         rgba(90, 85, 64, 0.6);
  --lobby-muted-bg:             rgba(51, 51, 42, 0.8);
  --lobby-axis-selected-bg:     rgba(139, 0, 0, 0.8);
  --lobby-allies-selected-bg:   rgba(0, 51, 102, 0.8);
  --lobby-axis-mine-bg:         rgba(139, 0, 0, 0.3);
  --lobby-allies-mine-bg:       rgba(0, 51, 102, 0.3);
  --gradient-lobby-resume:      linear-gradient(180deg, #3a6b3a 0%, #2a5a2a 50%, #204a20 100%);
  --gradient-lobby-confirm:     linear-gradient(180deg, #8b7a3a 0%, #6b5a2a 50%, #5a4a20 100%);
  --gradient-options-resume:    linear-gradient(180deg, #2a6a2a 0%, #1a5a1a 50%, #124012 100%);
  --lobby-cell-bg:              rgba(26, 26, 20, 0.5);
  --lobby-gold-border:          rgba(196, 165, 74, 0.1);
  --lobby-gold-border-md:       rgba(196, 165, 74, 0.25);
  --lobby-gold-border-lg:       rgba(196, 165, 74, 0.45);
  --lobby-gold-border-header:   rgba(196, 165, 74, 0.3);
  --lobby-segment-active-bg:    rgba(196, 165, 74, 0.12);
  --lobby-segment-active-border: rgba(196, 165, 74, 0.45);
  --lobby-segment-inactive-bg:  rgba(42, 42, 34, 0.6);
  --lobby-card-bg:              rgba(10, 10, 8, 0.85);
  --lobby-expanded-card-bg:     rgba(12, 10, 7, 0.95);
  --lobby-expanded-header-bg:   linear-gradient(90deg, rgba(196,165,74,0.18), rgba(196,165,74,0.06));
  --lobby-tagline-color:        rgba(144, 128, 96, 0.6);

  /* === Toggle === */
  --toggle-knob:      #888;
  --toggle-knob-on:   #80c080;
  --toggle-off:       var(--toggle-knob);    /* alias for toggle-knob */
  --toggle-on:        var(--toggle-knob-on); /* alias for toggle-knob-on */

  /* === Tooltip / Popover === */
  --surface-tooltip:  rgba(25, 24, 18, 0.93);
  --tooltip-border:   #444;
  --tooltip-text:     #ddd;
  --tooltip-divider:  #333;

  /* === Map === */
  --map-bg:           #1a2028;
  --map-ocean:        #4a6070;
  --map-water-stroke: #4a6a7a;
  --map-selected:     #c4a44a;
  --map-battle:       #c05050;
  --map-valid-dest:   #6a9a5a;
  --map-move-dest:    #c4a44a;
  --map-hover:        #b8a060;

  /* === Arrow Glow === */
  --arrow-color:      #d4a038;

  /* === Z-Index Scale === */
  --z-search:         20;
  --z-toast:          900;
  --z-battle:         1000;
  --z-overlay:        1100;
  --z-sidebar-backdrop: 4000;
  --z-sidebar:        4001;
  --z-menu-backdrop:  5000;
  --z-menu:           5001;
  --z-debug:          5002;
  --z-settings:       6000;
  --z-dialog:         6001;
  --z-dialog-confirm: 6002;
  --z-modal:          7000;
  --z-cover:          8000;

  /* === Overlay Tints (semi-transparent color tokens) === */
  --overlay-dark-20:       rgba(0,0,0,0.2);
  --overlay-dark-30:       rgba(0,0,0,0.3);
  --overlay-dark-40:       rgba(0,0,0,0.4);
  --overlay-dark-50:       rgba(0,0,0,0.5);
  --overlay-dark-60:       rgba(0,0,0,0.6);
  --overlay-dark-70:       rgba(0,0,0,0.7);
  --overlay-light-08:      rgba(255,255,255,0.08);
  --overlay-light-20:      rgba(255,255,255,0.2);
  --overlay-gold-04:       rgba(196,164,74,0.04);
  --overlay-gold-08:       rgba(196,164,74,0.08);
  --overlay-gold-12:       rgba(196,164,74,0.12);
  --overlay-gold-15:       rgba(196,164,74,0.15);
  --overlay-gold-25:       rgba(196,164,74,0.25);
  --overlay-gold-40:       rgba(196,164,74,0.4);
  --overlay-blue-08:       rgba(90,122,154,0.08);   /* accent-blue at 8% */
  --overlay-blue-12:       rgba(77,171,247,0.12);
  --overlay-blue-20:       rgba(77,171,247,0.2);
  --overlay-navy-15:       rgba(80,130,196,0.15);
  --overlay-navy-20:       rgba(76,100,180,0.2);
  --overlay-success-08:    rgba(76,175,80,0.08);    /* color-success at 8% */
  --overlay-success-15:    rgba(76,175,80,0.15);    /* color-success at 15% */
  --overlay-green-15:      rgba(90,138,74,0.15);    /* accent-green at 15% */
  --overlay-danger-10:     rgba(255,68,68,0.1);
  --overlay-danger-15:     rgba(180,60,60,0.15);
  --overlay-danger-40:     rgba(120,30,30,0.4);
  --overlay-danger-50:     rgba(180,60,60,0.5);
  --overlay-panel-brown:   rgba(40,35,30,0.7);
  --gradient-bar-top:      rgba(40,35,30,0.96);     /* stage/preview bar gradient top */
  --gradient-bar-bot:      rgba(30,26,22,0.98);     /* stage/preview bar gradient bottom */
  --gradient-chart-top:    rgba(30,40,55,0.62);     /* chart/purchase section gradient top */
  --gradient-chart-bot:    rgba(25,35,50,0.66);     /* chart/purchase section gradient bottom */

  /* === Die Colors === */
  --color-die-dimmed-bg:   #1a1a1a;
  --color-die-damage-bg:   #5a4a1a;
  --color-die-hit-bg:      #c03030;
  --color-die-miss-bg:     #2a2a2a;
  --glow-hit:              rgba(224,80,80,0.4);

  /* === Extended Status Colors === */
  --color-warning-soft:    #ff9966;   /* pulsing timer warning color */
  --color-warning-muted:   #ffaa44;   /* air unit remaining movement */
  --color-warning-error:   #ffaa88;   /* air landing error text */
  --color-stat-hp:         #a050d0;   /* unit stat card HP color */

  /* === Extended Dark Overlays === */
  --overlay-dark-75:       rgba(0,0,0,0.75);
  --overlay-dark-80:       rgba(0,0,0,0.8);
  --overlay-dark-82:       rgba(0,0,0,0.82);
  --overlay-dark-90:       rgba(0,0,0,0.9);

  /* === Extended Light Overlays === */
  --overlay-light-02:      rgba(255,255,255,0.02);
  --overlay-light-03:      rgba(255,255,255,0.03);
  --overlay-light-04:      rgba(255,255,255,0.04);
  --overlay-light-10:      rgba(255,255,255,0.1);

  /* === Extended Gold Overlays (accent-gold = rgb(196,164,74)) === */
  --overlay-gold-07:       rgba(196,164,74,0.07);
  --overlay-gold-10:       rgba(196,164,74,0.1);
  --overlay-gold-20:       rgba(196,164,74,0.2);
  --overlay-gold-30:       rgba(196,164,74,0.3);
  --overlay-gold-accent-10: rgba(212,160,32,0.1);  /* text-accent at 10% */
  --overlay-gold-accent-20: rgba(212,160,32,0.2);  /* text-accent at 20% */

  /* === Hit/Danger Overlays === */
  --overlay-hit-18:        rgba(224,80,80,0.18);
  --overlay-danger-18:     rgba(180,40,40,0.18);
  --overlay-danger-35:     rgba(200,60,60,0.35);
  --overlay-danger-dark-30: rgba(80,30,30,0.3);    /* dark danger background */
  --overlay-border-30:     rgba(90,85,64,0.3);     /* border-primary at 30% */
  --overlay-casualty-20:   rgba(160,64,64,0.2);    /* casualty selection highlight */
  --overlay-danger-ruby-25: rgba(233,69,96,0.25);  /* ruby danger accent */

  /* === Ocean/Amphibious Overlays === */
  --overlay-ocean-10:      rgba(80,144,192,0.1);
  --overlay-ocean-20:      rgba(80,144,192,0.2);
  --overlay-ocean-30:      rgba(80,144,192,0.3);
  --overlay-ocean-dark-30: rgba(20,30,40,0.3);
  --overlay-ocean-dark-50: rgba(20,30,40,0.5);
  --overlay-ocean-dark-60: rgba(20,30,40,0.6);

  /* === SBR / Battle Result Overlays === */
  --overlay-sbr-dark:      rgba(10,8,5,0.93);
  --overlay-battle-screen: rgba(10,8,5,0.92);  /* full-screen battle/combat backdrop */
  --overlay-army-dark-90:  rgba(20,32,16,0.9); /* dark army-green scroll fade */
  --overlay-win-green:     rgba(20,60,20,0.5);
  --overlay-loss-red:      rgba(60,20,20,0.5);
  --overlay-battle-draw-1: rgba(80,80,60,0.3);
  --overlay-battle-draw-2: rgba(40,40,30,0.3);

  /* === Misc Overlays === */
  --overlay-info-30:       rgba(77,120,160,0.3);
  --overlay-parchment-05:  rgba(200,184,120,0.05);
  --overlay-search-bg:     rgba(30,28,20,0.95);
  --overlay-minimap-bg:    rgba(10,16,40,0.9);
  --overlay-map-dark:      rgba(30,28,22,0.85);

  /* === Map Drawing Constants === */
  --color-map-water:       #2a5080;
  --color-map-water-flat:  #3a5878;
  --color-map-border:      #2a2018;
  --color-map-water-border: #3a4a50;
  --color-map-sand:        #c8a870;
  --color-link-water:      #4080a0;   /* neighbor water territory link */
  --color-link-land:       #a0a0cc;   /* neighbor land territory link */
  --overlay-hit-15:        rgba(224,80,80,0.15);
  --overlay-gray-10:       rgba(100,100,100,0.1);
  --overlay-blue-25:        rgba(77,171,247,0.25);
  --overlay-casualty-12:    rgba(160,64,64,0.12);
  --overlay-amber-12:       rgba(200,130,40,0.12);  /* rocket attack amber accent */
  --overlay-attacker-15:    rgba(224,96,64,0.15);   /* color-attacker at 15% */
  --overlay-attacker-30:    rgba(224,96,64,0.3);    /* color-attacker at 30% */
  --overlay-ocean-15:       rgba(80,144,208,0.15);  /* color-info blue at 15% */
  --overlay-ocean-30-alt:   rgba(80,144,208,0.3);   /* color-info blue at 30% */
  --overlay-bright-green-12: rgba(68,204,136,0.12); /* color-success-bright at 12% */
  --overlay-bright-green-15: rgba(68,204,136,0.15); /* color-success-bright at 15% */
  --overlay-bright-green-25: rgba(68,204,136,0.25); /* color-success-bright at 25% */
  --overlay-bright-green-30: rgba(68,204,136,0.3);  /* color-success-bright at 30% */
  --overlay-warning-15:     rgba(255,140,0,0.15);   /* color-warning at 15% */
  --gradient-panel-top-82:  rgba(40,35,30,0.82);    /* bottom panel gradient top (translucent) */
  --gradient-panel-bot-88:  rgba(30,26,22,0.88);    /* bottom panel gradient bottom (translucent) */
}

/* === Tighter text tokens for narrow viewports (≤ 1024px, e.g. iPhone landscape) === */
@media (max-width: 1024px) {
  :root {
    --text-xs:   clamp(0.5rem,    0.46rem + 0.13vw, 0.625rem);
    --text-sm:   clamp(0.5625rem, 0.52rem + 0.18vw, 0.6875rem);
    --text-base: clamp(0.6875rem, 0.63rem + 0.32vw, 0.8125rem);
    --text-lg:   clamp(0.875rem,  0.81rem + 0.41vw, 1rem);
    --text-xl:   clamp(1rem,      0.93rem + 0.47vw, 1.1875rem);
  }
}

/* === Root Font Size === */
html {
  /* Fixed 16px base — fluid sizing lives in --text-* / --space-* tokens,
     not the root, to avoid double-scaling clamp-inside-clamp.
     --text-scale (set by manual text-size preference) still works as a multiplier. */
  font-size: calc(16px * var(--text-scale, 1));
}

/* === Global Overrides === */
body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
}

/* Global film grain — subtle noise over all surfaces for analog richness */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px 200px;
  mix-blend-mode: overlay;
}

/* === Keyboard Focus === */
/* Suppress browser default outline for mouse/touch users */
*:focus:not(:focus-visible) {
  outline: none;
}
/* Gold ring for keyboard navigation — matches war-room accent */
*:focus-visible {
  outline: 2px solid var(--accent-gold);
  outline-offset: 2px;
}

/*
 * === Hover Convention ===
 *
 * Default:  filter: brightness(1.15) — works on any solid background.
 * Ghost/transparent elements: background swap to show interactivity.
 * Semantic buttons (danger, acknowledge): explicit color changes allowed.
 * Text-only feedback (dismiss, ghost-danger): color change only.
 */

/* === Beveled Button (modernized: flat) === */
.btn-bevel {
  background: var(--btn-bg);
  color: var(--btn-text);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
  cursor: pointer;
  transition: background var(--transition-fast), box-shadow var(--transition-fast), filter var(--transition-fast), transform var(--transition-fast);
  font-family: var(--font-body);
}
.btn-bevel:hover {
  filter: brightness(1.15);
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.btn-bevel:active {
  transform: translateY(1px);
  box-shadow: 0 0 1px rgba(0,0,0,0.3);
}
.btn-bevel:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: none;
  transform: none;
}

/* === END PHASE Button (modernized: subtle gradient) === */
.btn-end-phase {
  background: linear-gradient(180deg, #7b6a30 0%, #5a4a20 100%);
  color: var(--color-lobby-title);
  border: 2px solid var(--border-accent);
  border-top-color: var(--accent-gold);
  border-bottom-color: var(--btn-bg-primary);
  border-radius: var(--radius-md);
  box-shadow:
    0 0 6px rgba(180, 150, 50, 0.2),
    0 2px 4px rgba(0,0,0,0.4);
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition-normal);
}
.btn-end-phase:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
  box-shadow:
    0 0 10px rgba(200, 170, 60, 0.35),
    0 4px 8px rgba(0,0,0,0.5);
}
.btn-end-phase:active {
  transform: translateY(1px);
}
.btn-end-phase:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: none;
  transform: none;
}

/* === Leather Panel === */
.panel-leather {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 150 150'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.08'/%3E%3C/svg%3E"),
    linear-gradient(
      170deg,
      var(--surface-panel) 0%,
      var(--surface-panel) 40%,
      var(--surface-panel) 60%,
      #353228 100%
    );
  background-size: 150px 150px, 100% 100%;
  border: 1px solid var(--border-primary);
  box-shadow: var(--shadow-inset), var(--shadow-md);
}

/* === Unit Miniature Effect === */
.unit-miniature {
  filter: drop-shadow(1px 2px 2px rgba(0,0,0,0.6))
          contrast(1.15)
          brightness(1.05);
  image-rendering: auto;
}
.unit-miniature:hover {
  filter: drop-shadow(1px 2px 3px rgba(0,0,0,0.7))
          contrast(1.2)
          brightness(1.15);
}

/* === Heading Font === */
.heading-ww2 {
  font-family: var(--font-heading);
  color: var(--text-heading);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* === Phase Chips === */
.phase-chip {
  padding: 2px 5px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  line-height: 1.2;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  border: 1px solid var(--border-secondary);
  cursor: default;
  user-select: none;
  font: inherit;
}
.phase-chip--active {
  background: rgba(196, 164, 74, 0.12);
  color: var(--accent-gold);
  border-color: rgba(196, 164, 74, 0.3);
  padding: 1px 10px;
  line-height: 16px;
  font-size: var(--text-sm);
  position: relative;
  z-index: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.phase-chip-help-icon {
  opacity: 0.65;
  font-size: 0.75em;
  font-weight: bold;
  text-transform: none;
  letter-spacing: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4em;
  height: 1.4em;
  border-radius: 50%;
  border: 1px solid currentColor;
  line-height: 1;
  flex-shrink: 0;
}
.phase-chip--activating {
  animation: phaseActivate 0.4s ease-out;
}

/* === Scrollbar === */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-primary);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-accent);
}

.lobby-splash-exit {
  animation: lobby-splashFadeOut 0.6s ease-out forwards;
}

/* Lobby split panel base styles */
.lobby-panel-left {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 50%;
  clip-path: polygon(0 0, 100% 0, 85% 100%, 0 100%);
  overflow: hidden;
  z-index: 1;
}
.lobby-panel-right {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 50%;
  clip-path: polygon(15% 0, 100% 0, 100% 100%, 0 100%);
  overflow: hidden;
  z-index: 1;
}
.lobby-diagonal {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 4px;
  transform: skewX(-5deg);
  background: linear-gradient(to bottom, rgba(196,165,74,0.1), rgba(196,165,74,0.6), rgba(196,165,74,0.1));
  box-shadow: 0 0 20px rgba(196,165,74,0.3), 0 0 60px rgba(196,165,74,0.1);
  z-index: 2;
  animation: lobby-diagonalGlow 4s ease-in-out infinite;
  pointer-events: none;
}

/* Lobby: mobile — stack panels top/bottom */
@media (max-width: 600px) {
  .lobby-panel-left {
    width: 100% !important;
    height: 55vh !important;
    bottom: 45vh !important;
    top: 0 !important;
    clip-path: polygon(0 0, 100% 0, 100% 87%, 0 100%) !important;
  }
  .lobby-panel-right {
    width: 100% !important;
    height: 55vh !important;
    top: 45vh !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    clip-path: polygon(0 13%, 100% 0, 100% 100%, 0 100%) !important;
  }
  .lobby-diagonal {
    top: 50% !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: 6px !important;
    transform: skewY(-3deg) !important;
    box-shadow: 0 0 12px 2px rgba(196,165,74,0.5), 0 0 24px 4px rgba(196,165,74,0.25), 0 0 40px 8px rgba(196,165,74,0.1) !important;
  }
  .lobby-center-content {
    top: 50% !important;
  }
  .lobby-center-content::before {
    content: '';
    position: absolute;
    inset: -24px -32px;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    z-index: -1;
  }
  /* Subtitle: reduce bottom margin */
  .lobby-center-content > h1 + div {
    margin-bottom: 24px !important;
  }
  /* Decorative line: reduce bottom margin */
  .lobby-center-content > h1 + div + div {
    margin-bottom: 16px !important;
  }
}

/* === Dice Animation === */
.dice-rolling {
  display: inline-block;
  animation: diceRoll 0.5s ease-out;
}
.dice-tumble {
  animation: diceTumble 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.dice-hit {
  color: var(--color-hit);
  text-shadow: 0 0 6px rgba(224, 80, 80, 0.6);
  animation: hitPulse 0.4s ease-out;
}
.dice-miss {
  color: var(--color-miss);
  animation: missFall 0.3s ease-out forwards;
}

/* === Rolling Table (center column felt background) === */
.rolling-table {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E"),
    radial-gradient(ellipse 120% 80% at 50% 40%, rgba(52, 78, 52, 0.35) 0%, transparent 70%),
    linear-gradient(180deg, #1c2418 0%, #1a1e14 40%, #181a12 100%);
  position: relative;
}
.rolling-table::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow:
    inset 0 8px 20px rgba(0, 0, 0, 0.5),
    inset 0 -8px 20px rgba(0, 0, 0, 0.4),
    inset 8px 0 16px rgba(0, 0, 0, 0.3),
    inset -8px 0 16px rgba(0, 0, 0, 0.3);
  border-radius: inherit;
  z-index: 0;
}
.rolling-table > * {
  position: relative;
  z-index: 1;
}

/* === Map Viewport — vintage cartography styling === */
.map-viewport::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.55) 100%);
  z-index: 10;
}
/* === Acknowledge Hits Button === */
.btn-acknowledge-hits {
  font-family: var(--font-heading);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border: 2px solid var(--accent-red);
  background: linear-gradient(180deg, rgba(224, 80, 80, 0.18) 0%, rgba(180, 50, 50, 0.12) 100%);
  color: var(--accent-red-bright);
  box-shadow: 0 0 12px rgba(224, 80, 80, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
}
.btn-acknowledge-hits:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(224, 80, 80, 0.28) 0%, rgba(180, 50, 50, 0.2) 100%);
  box-shadow: 0 0 20px rgba(224, 80, 80, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.btn-acknowledge-hits:active:not(:disabled) {
  transform: scale(0.97);
}
.btn-acknowledge-hits--zero {
  border-color: var(--border-accent);
  background: linear-gradient(180deg, rgba(196, 164, 74, 0.12) 0%, rgba(160, 130, 50, 0.08) 100%);
  color: var(--accent-gold);
  box-shadow: 0 0 8px rgba(196, 164, 74, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.btn-acknowledge-hits--zero:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(196, 164, 74, 0.2) 0%, rgba(160, 130, 50, 0.14) 100%);
  box-shadow: 0 0 16px rgba(196, 164, 74, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* === Battle Board === */
.battle-power-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 34px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-sm);
  color: var(--accent-gold);
  font-size: var(--text-lg);
  font-weight: 700;
  flex-shrink: 0;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.battle-unit-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-secondary);
  transition: background var(--transition-fast);
}
.battle-unit-row:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}
.battle-noncombatant {
  opacity: 0.4;
  font-style: italic;
}

/* === Button Size Variants === */
.btn-sm {
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-sm);
  border-radius: var(--radius-sm);
}
.btn-md {
  padding: var(--space-sm) var(--space-md);
  font-size: var(--text-base);
  border-radius: var(--radius-md);
}

/* === Button Color Variants === */
.btn-primary {
  background: var(--btn-bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--accent-brass);
  transition: background var(--transition-fast), filter var(--transition-fast), transform var(--transition-fast);
}
.btn-danger {
  background: var(--btn-bg-danger);
  color: var(--text-primary);
  border: 1px solid var(--accent-red);
  transition: background var(--transition-fast), filter var(--transition-fast), transform var(--transition-fast);
}
.btn-success {
  background: var(--btn-bg-success);
  color: var(--text-primary);
  border: 1px solid var(--accent-green);
  transition: background var(--transition-fast), filter var(--transition-fast), transform var(--transition-fast);
}
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

/* === Button Shape Variants === */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast), filter var(--transition-fast), transform var(--transition-fast);
}
.btn-stepper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  font-size: var(--text-base);
  line-height: 22px;
  text-align: center;
  border-radius: var(--radius-sm);
  background: var(--btn-bg);
  color: var(--btn-text);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition-fast), filter var(--transition-fast), transform var(--transition-fast);
}

/* === Base Panel Button === */
.btn {
  padding: 4px 10px;
  font-size: var(--text-sm);
  background: var(--btn-bg);
  color: var(--btn-text);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}
.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  filter: brightness(1.1);
}
.btn:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 0 1px rgba(0, 0, 0, 0.3);
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* === Compact Button === */
.btn-xs {
  padding: 2px 6px;
  font-size: var(--text-xs);
}

/* === Header/Overlay Button === */
.btn-header {
  padding: 2px 8px;
  font-size: var(--text-xs);
  color: var(--text-primary);
  background: var(--btn-bg);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: var(--transition-fast);
}

/* === Overlay Close Button (shared across info panels) === */
.btn-close-overlay {
  padding: 2px var(--space-sm);
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: var(--btn-bg-danger);
  border: 1px solid var(--accent-red);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}
.btn-close-overlay:hover {
  filter: brightness(1.15);
}

/* === Lobby / Auth Button === */
.btn-lobby {
  background: linear-gradient(180deg, var(--border-accent) 0%, var(--btn-bg-primary) 50%, #5a4a20 100%);
  color: var(--color-lobby-title);
  border: 2px solid var(--border-accent);
  border-top-color: var(--accent-gold);
  border-bottom-color: var(--btn-bg-primary);
  border-radius: 5px;
  cursor: pointer;
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: 1px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 2px 6px rgba(0, 0, 0, 0.5);
  transition: var(--transition-fast);
}
.btn-lobby:hover:not(.btn-lobby--disabled) {
  transform: translateY(-1px);
  filter: brightness(1.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 4px 10px rgba(0, 0, 0, 0.6);
}
.btn-lobby--disabled {
  background: var(--surface-input);
  color: var(--text-muted);
  border-color: var(--btn-bg);
  cursor: not-allowed;
  box-shadow: none;
}

/* === Debug Panel Button === */
.btn-debug {
  background: var(--btn-bg);
  border: 1px solid var(--border-primary);
  border-radius: 3px;
  color: var(--text-primary);
  cursor: pointer;
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  padding: 2px 5px;
  line-height: 16px;
  min-width: 22px;
  text-align: center;
  transition: var(--transition-fast);
}

/* === Panel Overlay === */
.panel-overlay {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E"),
    var(--bg-overlay);
  background-size: 200px 200px, 100% 100%;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-lg);
  max-height: 90vh;
  max-height: 90dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  overscroll-behavior: contain;
}

/* === Card === */
.card {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 150 150'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.0' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E"),
    var(--bg-tertiary);
  background-size: 150px 150px, 100% 100%;
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.card:hover {
  border-color: var(--border-accent);
  box-shadow: 0 0 8px rgba(196, 164, 74, 0.1);
}

/* === Modal Backdrop === */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* === Toast === */
.toast {
  background: var(--surface-panel);
  color: var(--text-primary);
  border: 1px solid var(--border-primary);
  border-left: 3px solid var(--accent-gold);
  border-radius: 2px;
  box-shadow: var(--shadow-lg);
  padding: var(--space-sm) var(--space-lg);
  font-size: var(--text-base);
  z-index: var(--z-toast);
  position: relative;
  overflow: hidden;
}
.toast::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    135deg,
    rgba(196, 164, 74, 0.03) 0px,
    transparent 2px,
    transparent 6px
  );
  pointer-events: none;
}

/* === Divider === */
.divider {
  border: none;
  border-top: 1px solid var(--border-secondary);
  margin: var(--space-md) 0;
}

/* === Menu Item === */
.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  font-size: var(--text-base);
  color: var(--text-primary);
  border-left: 2px solid transparent;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.menu-item:hover {
  background: var(--surface-panel);
  border-left-color: var(--accent-gold);
}

/* === Toggle Switch === */
.toggle-switch {
  width: 36px;
  height: 18px;
  border-radius: 9px;
  border: 1px solid var(--border-primary);
  background: var(--btn-bg);
  position: relative;
  cursor: pointer;
  transition: background var(--transition-normal);
  flex-shrink: 0;
  padding: 0;
}
.toggle-switch--on {
  background: var(--btn-bg-success);
}
.toggle-switch--lg {
  width: 40px;
  height: 20px;
  border-radius: 10px;
}
.toggle-knob {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--toggle-knob);
  position: absolute;
  top: 1px;
  left: 1px;
  transition: left var(--transition-normal), background var(--transition-normal);
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.toggle-switch--on .toggle-knob {
  background: var(--toggle-knob-on);
  left: 19px;
}
.toggle-switch--lg .toggle-knob {
  width: 16px;
  height: 16px;
}
.toggle-switch--lg.toggle-switch--on .toggle-knob {
  left: 21px;
}

/* === Toast Variants === */
.toast--success::before,
.toast--error::before,
.toast--info::before {
  display: block;
  font-size: var(--text-xs);
  font-variant: small-caps;
  letter-spacing: 2px;
  font-weight: 700;
  margin-bottom: 4px;
}
.toast--success {
  background: var(--bg-tertiary);
  border-left-color: var(--accent-green);
  box-shadow: 0 4px 20px rgba(76, 175, 80, 0.3), 0 0 40px rgba(76, 175, 80, 0.1);
}
.toast--success::before {
  content: 'DISPATCH';
  color: var(--accent-green);
}
.toast--error {
  background: var(--bg-tertiary);
  border-left-color: var(--accent-red-bright);
  box-shadow: 0 4px 20px rgba(192, 64, 64, 0.3), 0 0 40px rgba(192, 64, 64, 0.1);
}
.toast--error::before {
  content: 'ALERT';
  color: var(--accent-red-bright);
}
.toast--info::before {
  content: 'NOTICE';
  color: var(--accent-gold);
}

/* === Stepper Button Hover === */
.btn-stepper-hover {
  transition: filter var(--transition-fast);
}
.btn-stepper-hover:hover:not(:disabled) {
  filter: brightness(1.15);
}

/* === Hover Highlight (interactive list item bg on hover) === */
.hover-highlight:hover {
  background: var(--btn-bg);
}

/* === Save/Load Slot Row States === */
.slot-row-hover {
  background: transparent;
  border-left: 2px solid transparent;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.slot-row-hover:hover {
  background: var(--surface-hover);
  border-left-color: var(--accent-gold);
}
.slot-row-selected {
  background: var(--surface-panel);
  transition: background var(--transition-fast);
}

/* === Auto-save Row === */
.slot-autosave-row {
  background: var(--bg-tertiary);
  border-left: 2px solid transparent;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.slot-autosave-row:hover {
  background: var(--surface-hover);
  border-left-color: var(--accent-gold);
}

/* === Ghost Button Danger Variant === */
.btn-ghost-danger {
  color: var(--text-muted);
}
.btn-ghost-danger:hover {
  color: var(--accent-red-bright);
}

/* === Dismiss Button (icon button with muted → primary on hover) === */
.btn-dismiss {
  color: var(--text-muted);
  transition: color var(--transition-fast);
}
.btn-dismiss:hover {
  color: var(--text-primary);
}

/* === Search Result Item === */
.search-result-item:hover {
  background: var(--surface-hover);
}

/* === Toolbar Title (game name in top bar) === */
.toolbar-title {
  flex: 1;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--accent-gold);
  font-family: var(--font-heading);
  white-space: nowrap;
}


/* === Responsive Toolbar Collapse === */
@media (max-width: 560px) {
  .toolbar-income {
    display: none !important;
  }
}
@media (max-width: 440px) {
  .toolbar-title {
    display: none !important;
  }
}

/* === Sidebar Toggle Tab (mobile drawer mode) === */
.sidebar-toggle-tab {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: var(--z-sidebar-backdrop);
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-right: none;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  padding: 12px 6px;
  cursor: pointer;
  color: var(--accent-gold);
  font-size: var(--text-lg);
  box-shadow: var(--shadow-md);
  transition: filter var(--transition-fast);
  line-height: 1;
}
.sidebar-toggle-tab:hover {
  filter: brightness(1.15);
}

/* === Loading Shimmer === */
.shimmer {
  background: linear-gradient(
    90deg,
    var(--bg-tertiary)   0%,
    var(--bg-secondary) 40%,
    var(--surface-card) 50%,
    var(--bg-secondary) 60%,
    var(--bg-tertiary)  100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

/* === Radio Shimmer — gold-tinted variant for game-context loading === */
.shimmer-radio {
  background: linear-gradient(
    90deg,
    var(--bg-tertiary)          0%,
    rgba(196, 164, 74, 0.06)   45%,
    rgba(196, 164, 74, 0.10)   50%,
    rgba(196, 164, 74, 0.06)   55%,
    var(--bg-tertiary)         100%
  );
  background-size: 200% 100%;
  animation: shimmer 2s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

/* === Waiting Room — radio/telegraph status indicator === */
.waiting-status {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 3px;
  color: var(--accent-gold);
  animation: transmit 2s ease-in-out infinite;
  text-align: center;
  margin-bottom: var(--space-sm);
}

/* === Signal Strength Indicator === */
.signal-bars {
  display: inline-flex;
  gap: 3px;
  align-items: flex-end;
  height: 14px;
  margin-left: var(--space-xs);
  vertical-align: middle;
}
.signal-bar {
  width: 3px;
  background: var(--accent-gold);
  border-radius: 1px;
  opacity: 0.25;
  transition: opacity 0.3s ease;
}
.signal-bar--active {
  opacity: 1;
}
.signal-bar:nth-child(1) { height: 4px; }
.signal-bar:nth-child(2) { height: 7px; }
.signal-bar:nth-child(3) { height: 10px; }
.signal-bar:nth-child(4) { height: 14px; }

/* === Error Banner === */
.error-banner {
  background: rgba(160, 64, 64, 0.12);
  border: 1px solid rgba(192, 80, 80, 0.3);
  border-left: 3px solid var(--accent-red-bright);
  border-radius: var(--radius-sm);
  color: var(--accent-red-bright);
  padding: var(--space-sm) var(--space-md);
  font-size: var(--text-sm);
}

/* ═══════════════════════════════════════════════════════════════
   ANIMATION KEYFRAMES
   All @keyframes consolidated here, grouped by category.
   prefers-reduced-motion coverage is handled globally below.
   ═══════════════════════════════════════════════════════════════ */

/* --- Entrance: elements appearing on screen --- */

/* fadeIn — simple opacity entrance
   Duration: varies | Easing: varies
   Consumers: general-purpose utility */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* toastSlideIn — telegram-style slide from right
   Duration: 0.4s | Easing: ease-out
   Consumers: TechBreakthroughToast, InvalidMoveToast, TransportLoadToast, IncomeBanner */
@keyframes toastSlideIn {
  0%   { transform: translateX(100%); opacity: 0; }
  60%  { transform: translateX(-4px); opacity: 1; }
  100% { transform: translateX(0); opacity: 1; }
}

/* slideUp — panel/element slides up into view
   Duration: 0.2s | Easing: ease
   Consumers: PhasePanel */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* slideUpBar — bottom bar entrance from below
   Duration: 200ms | Easing: ease-out
   Consumers: AttackPreviewBar, StagePreviewBar, TerritoryBottomPanel */
@keyframes slideUpBar {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* slideInRight — element slides in from the right
   Duration: varies | Easing: varies
   Consumers: general-purpose utility */
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* arrowAppear — movement arrow fade-in on the map
   Duration: 0.35s | Easing: ease-out
   Consumers: MapView .arrow-appear */
@keyframes arrowAppear {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* lobby-titleFade — lobby title/subtitle scale-up entrance
   Duration: 1.2–1.5s | Easing: ease-out
   Consumers: LobbyPage (title, subtitle, divider) */
@keyframes lobby-titleFade {
  0%   { opacity: 0; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1); }
}

/* lobby-ctaFade — delayed fade-in for lobby CTA text
   Duration: 2.5s | Easing: ease
   Consumers: LobbyPage (CTA section) */
@keyframes lobby-ctaFade {
  0%   { opacity: 0; }
  60%  { opacity: 0; }
  100% { opacity: 1; }
}

/* lobby-menuSlideUp — lobby menu items slide up with staggered delay
   Duration: 0.5–0.8s | Easing: ease-out
   Consumers: LobbyPage (menu items, game list, auth section) */
@keyframes lobby-menuSlideUp {
  0%   { opacity: 0; transform: translateY(40px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* --- Exit: elements leaving the screen --- */

/* fadeOut — simple opacity exit
   Duration: varies | Easing: varies
   Consumers: general-purpose utility */
@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* slideOutRight — element slides out to the right
   Duration: varies | Easing: varies
   Consumers: general-purpose utility */
@keyframes slideOutRight {
  from { transform: translateX(0); }
  to   { transform: translateX(100%); }
}

/* lobby-splashFadeOut — splash screen fade-out on lobby load
   Duration: 0.6s | Easing: ease-out
   Consumers: .lobby-splash-exit */
@keyframes lobby-splashFadeOut {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}

/* --- Feedback: response to user actions --- */

/* phaseActivate — brief flash when a phase chip becomes active
   Duration: 0.4s | Easing: ease-out
   Consumers: .phase-chip--activating */
@keyframes phaseActivate {
  0%   { opacity: 1; }
  20%  { opacity: 0.6; }
  100% { opacity: 1; }
}

/* diceTumble — bouncy dice entry with rotation and scale
   Duration: 0.45s | Easing: cubic-bezier(0.34, 1.56, 0.64, 1)
   Consumers: .dice-tumble */
@keyframes diceTumble {
  0%   { transform: translateY(-8px) rotate(-15deg) scale(0.6); opacity: 0; }
  25%  { transform: translateY(3px) rotate(12deg) scale(1.15); opacity: 0.7; }
  50%  { transform: translateY(-2px) rotate(-6deg) scale(0.95); opacity: 0.9; }
  75%  { transform: translateY(1px) rotate(3deg) scale(1.05); }
  100% { transform: translateY(0) rotate(0deg) scale(1); opacity: 1; }
}

/* hitPulse — red glow behind hit dice on landing
   Duration: 0.4s | Easing: ease-out
   Consumers: .dice-hit */
@keyframes hitPulse {
  0%   { box-shadow: 0 0 0 rgba(224, 80, 80, 0); }
  30%  { box-shadow: 0 0 12px rgba(224, 80, 80, 0.5); }
  100% { box-shadow: 0 0 4px rgba(224, 80, 80, 0.2); }
}

/* missFall — subtle downward drift and fade for missed dice
   Duration: 0.3s | Easing: ease-out
   Consumers: .dice-miss */
@keyframes missFall {
  0%   { transform: translateY(0); opacity: 0.8; }
  100% { transform: translateY(2px); opacity: 0.5; }
}

/* diceRoll — rapid spin and scale during dice roll
   Duration: 0.5s | Easing: ease-out
   Consumers: .dice-rolling */
@keyframes diceRoll {
  0%   { transform: rotate(0deg) scale(1); opacity: 0.3; }
  20%  { transform: rotate(72deg) scale(1.3); opacity: 0.6; }
  40%  { transform: rotate(144deg) scale(0.8); }
  60%  { transform: rotate(216deg) scale(1.2); }
  80%  { transform: rotate(288deg) scale(0.9); }
  100% { transform: rotate(360deg) scale(1); opacity: 1; }
}

/* shimmer — loading skeleton sweep effect
   Duration: 1.6s | Easing: ease-in-out | Iterations: infinite
   Consumers: .shimmer */
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

/* transmit — pulsing opacity for radio/telegraph status text
   Duration: 2s | Easing: ease-in-out | Iterations: infinite
   Consumers: .waiting-status */
@keyframes transmit {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 1; }
}

/* --- Attention: draw the user's eye --- */

/* turnPulse — pulsing opacity for turn indicator
   Duration: varies | Easing: varies
   Consumers: (available for turn-related highlights) */
@keyframes turnPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* arrowPulse — subtle opacity pulse for arrow indicators
   Duration: varies | Easing: varies
   Consumers: (available for arrow-related highlights) */
@keyframes arrowPulse {
  0%, 100% { opacity: 0.9; }
  50% { opacity: 0.6; }
}

/* lobby-ctaPulse — gentle scale+opacity pulse on lobby CTA
   Duration: 3s | Easing: ease-in-out | Iterations: infinite
   Consumers: LobbyPage (CTA button) */
@keyframes lobby-ctaPulse {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50%      { opacity: 1; transform: scale(1.02); }
}

/* lobby-diagonalGlow — pulsing glow on diagonal separator line
   Duration: 4s | Easing: ease-in-out | Iterations: infinite
   Consumers: LobbyPage (diagonal divider) */
@keyframes lobby-diagonalGlow {
  0%, 100% { opacity: 0.6; }
  50%      { opacity: 1; }
}

/* --- Ambient: continuous background motion --- */

/* lobby-subtlePan — slow scale/translate drift on lobby backgrounds
   Duration: 25s | Easing: ease-in-out | Iterations: infinite
   Consumers: LobbyPage (background panels, forward and reverse) */
@keyframes lobby-subtlePan {
  0%   { transform: scale(1.08) translateY(0); }
  50%  { transform: scale(1.12) translateY(-1%); }
  100% { transform: scale(1.08) translateY(0); }
}

/* spin-dash — DEPRECATED: was used for must-land dashed ring, replaced by SVG animate halo.
   Kept for backwards compat in case any other consumer references it. */
@keyframes spin-dash {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* lobby-slideLeft — slide-in from left edge
   Duration: varies | Easing: varies
   Consumers: LobbyPage (left panel entrance) */
@keyframes lobby-slideLeft {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(0); }
}

/* lobby-slideRight — slide-in from right edge
   Duration: varies | Easing: varies
   Consumers: LobbyPage (right panel entrance) */
@keyframes lobby-slideRight {
  0%   { transform: translateX(100%); }
  100% { transform: translateX(0); }
}

/* arrow-appear — helper class for arrowAppear keyframe */
.arrow-appear {
  animation: arrowAppear 0.35s ease-out forwards;
}

/* typewriter-in — clip-path reveal for new war diary entries
   Duration: 0.3s | Easing: ease-out
   Consumers: .tan-line-new */
@keyframes typewriter-in {
  from { clip-path: inset(0 100% 0 0); opacity: 0.6; }
  to   { clip-path: inset(0 0 0 0); opacity: 1; }
}
.tan-line-new {
  animation: typewriter-in 0.3s ease-out;
}

/* === Reduced Motion ===
 * Respect the user's OS-level "Reduce motion" preference.
 * Collapses all CSS animations to a single instant frame and
 * removes transition durations so state changes appear immediately.
 * JS animations (useMovementAnimation, D3 zoom) check
 * matchMedia('(prefers-reduced-motion: reduce)') separately.
 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* === Panel Layout Utilities === */
.panel-row {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}
.panel-row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}
.flex-1-min0 {
  flex: 1;
  min-width: 0;
}

/* === War Diary Panel === */
.wdiary-round-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 1px solid var(--btn-bg);
  font-size: var(--text-sm);
  font-weight: bold;
  color: var(--accent-gold);
}
.wdiary-nav-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: var(--text-sm);
  padding: 0 var(--space-xs);
  line-height: 1;
}
.wdiary-filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 1px solid var(--btn-bg);
  flex-wrap: wrap;
}
.wdiary-view-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 2px var(--space-sm);
  border-bottom: 1px solid var(--btn-bg);
  font-size: var(--text-xs);
}
.wdiary-toggle-btn {
  background: none;
  border: 1px solid var(--border-primary);
  border-radius: 3px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--text-xs);
  padding: 1px 6px;
  font-family: var(--font-mono);
  position: relative;
}
.wdiary-toggle-btn::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--accent-gold);
  transition: width var(--transition-normal), left var(--transition-normal);
}
.wdiary-toggle-btn:hover::after,
.wdiary-toggle-btn--active::after {
  width: 100%;
  left: 0;
}
.wdiary-toggle-btn--active {
  background: var(--btn-bg);
  color: var(--text-primary);
}

/* === Game Log === */
.gamelog-scroll,
.wdiary-body {
  font-family: var(--font-diary);
  background: linear-gradient(180deg, rgba(40,38,30,0.4) 0%, rgba(35,33,26,0.3) 100%);
}
.gamelog-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-xs);
  line-height: 1.6;
}
.wdiary-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  font-size: var(--text-xs);
  line-height: 1.5;
}

/* Details disclosure button inside BattleEntryCard / SBREntryCard */
.wdiary-details-btn {
  background: rgba(196, 165, 74, 0.08);
  border: 1px solid rgba(196, 165, 74, 0.25);
  border-radius: 3px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: var(--text-sm);
  padding: 4px 10px;
  margin-top: 4px;
  margin-left: 10px;
  display: inline-block;
  letter-spacing: 0.3px;
}
.wdiary-details-btn:hover {
  background: rgba(196, 165, 74, 0.15);
  color: var(--accent-gold);
  border-color: rgba(196, 165, 74, 0.45);
}
.tan-line-phase {
  color: var(--text-primary);
  font-weight: bold;
  margin-top: var(--space-sm);
  padding-top: var(--space-xs);
  display: flex;
  align-items: center;
  gap: 0.5em;
  text-transform: uppercase;
  font-size: calc(var(--text-xs) * 0.9);
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.tan-line-phase::before,
.tan-line-phase::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--tooltip-divider);
}
.tan-line-phase::before {
  max-width: 1.5em;
}
.tan-line-move     { color: var(--text-secondary); }
.tan-line-battle   { color: var(--text-accent); font-weight: bold; }
.tan-line-dice     { color: var(--color-log-dice); }
.tan-line-outcome  { color: var(--text-secondary); }
.tan-line-purchase  { color: var(--color-log-purchase); }
.tan-line-placement { color: var(--color-log-placement); }
.tan-line-income   { color: var(--color-log-income); }
.tan-line-text     { color: var(--text-secondary); }
.tan-line--highlighted {
  background: var(--tooltip-divider);
  border-radius: 2px;
  margin: 0 -4px;
  padding: 0 4px;
}
.tan-line-phase.tan-line--highlighted {
  padding: 2px 4px;
}

/* === Chat Panel === */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}
.chat-tab-bar {
  display: flex;
  padding: var(--space-xs) var(--space-sm) 0;
  border-bottom: 1px solid var(--border-primary);
}
.chat-tab {
  padding: 3px 10px;
  font-size: var(--text-xs);
  font-weight: normal;
  background: transparent;
  border: 1px solid var(--border-primary);
  border-bottom-color: var(--border-primary);
  border-radius: 3px 3px 0 0;
  color: var(--text-muted);
  cursor: pointer;
  margin-right: 2px;
  position: relative;
}
.chat-tab::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--accent-gold);
  transition: width var(--transition-normal), left var(--transition-normal);
}
.chat-tab:hover::after,
.chat-tab--active::after {
  width: 100%;
  left: 0;
}
.chat-tab--active {
  font-weight: bold;
  background: var(--btn-bg);
  border-bottom-color: var(--btn-bg);
  color: var(--accent-gold-bright);
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-sm);
}
.chat-emoji-picker {
  position: absolute;
  bottom: 44px;
  left: 4px;
  right: 4px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: 4px;
  padding: 6px;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 2px;
  z-index: 100;
}
.chat-emoji-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: var(--text-lg);
  padding: 2px;
  border-radius: 3px;
  line-height: 1;
}
.chat-input-row {
  display: flex;
  border-top: 1px solid var(--btn-bg);
  padding: var(--space-xs);
  gap: var(--space-xs);
}
.chat-emoji-toggle {
  background: var(--surface-input);
  border: 1px solid var(--border-primary);
  border-radius: 3px;
  font-size: var(--text-base);
  padding: 2px 6px;
  cursor: pointer;
  line-height: 1;
}
.chat-emoji-toggle--active {
  background: var(--btn-bg);
}
.chat-text-input {
  flex: 1;
  background: var(--surface-input);
  border: 1px solid var(--border-primary);
  border-radius: 3px;
  color: var(--text-primary);
  font-size: var(--text-sm);
  padding: var(--space-xs) 6px;
  outline: none;
}
.chat-send-btn {
  background: var(--surface-input);
  border: 1px solid var(--border-primary);
  border-radius: 3px;
  color: var(--text-muted);
  font-size: var(--text-sm);
  padding: var(--space-xs) var(--space-sm);
  cursor: default;
}
.chat-send-btn--active {
  background: var(--btn-bg-primary);
  color: var(--accent-gold-bright);
  cursor: pointer;
}

/* === Badge === */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  color: var(--text-primary);
  border: 1px solid var(--border-secondary);
  line-height: 1.4;
}
.badge-success {
  background: rgba(90, 138, 74, 0.2);
  color: var(--color-success-bright);
  border-color: var(--accent-green);
}
.badge-danger {
  background: rgba(160, 64, 64, 0.2);
  color: var(--accent-red-bright);
  border-color: var(--accent-red);
}
.badge-info {
  background: rgba(90, 122, 154, 0.2);
  color: var(--accent-blue-light);
  border-color: var(--accent-blue);
}
.badge-warning {
  background: rgba(255, 140, 0, 0.15);
  color: var(--color-warning);
  border-color: var(--color-warning);
}

/* === MapRoomBoard === */

/* Loading state before game state is available */
.board-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-secondary);
}

/* Hidden file input (load-from-file) */
.board-file-input-hidden {
  display: none;
}

/* Main content area: map + optional side panels */
.board-main-content {
  flex: 1;
  min-height: 0;
  display: flex;
  /* Keep map/UI clear of the notch when Dynamic Island is on the left in landscape */
  padding-left: env(safe-area-inset-left, 0px);
}

/* Map wrapper (fills remaining width) */
.board-map-wrapper {
  flex: 1;
  min-height: 0;
  position: relative;
}

/* Disconnection warning banner */
.board-disconnected-banner {
  background: var(--accent-red);
  color: var(--text-primary);
  padding: 6px var(--space-md);
  text-align: center;
  font-size: var(--font-body);
  font-size: var(--text-base);
  font-weight: bold;
  flex-shrink: 0;
}

/* Turn-tracker center group (flag strip with borders) */
.board-turn-tracker {
  display: flex;
  align-items: center;
  gap: 2px;
  border-left: 1px solid var(--border-secondary);
  border-right: 1px solid var(--border-secondary);
  padding-left: var(--space-sm);
  padding-right: var(--space-sm);
}

/* IPC income badge in the toolbar */
.board-income-badge {
  font-weight: 600;
  color: var(--accent-gold);
  margin-left: 6px;
  white-space: nowrap;
  background: rgba(196,164,74,0.12);
  border: 1px solid rgba(196,164,74,0.3);
  border-radius: var(--radius-sm);
  padding: 1px 5px;
  line-height: 16px;
}

/* Phase chip row (toolbar right-of-center group) */
.board-phase-row {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-left: var(--space-sm);
}

/* Right end of toolbar (undo/redo, fullscreen, chat, hamburger) */
.board-toolbar-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-xs);
}

/* Chat panel unread badge (absolute-positioned dot) */
.board-chat-unread-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--accent-red-bright);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 0 var(--space-xs);
  font-size: var(--text-xs);
  font-weight: bold;
  min-width: 14px;
  text-align: center;
}

/* Chat side panel container */
.board-chat-panel {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-tertiary);
  border-left: 1px solid var(--btn-bg);
  display: flex;
  flex-direction: column;
}

/* Chat side panel header row */
.board-chat-header {
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-sm);
  font-weight: bold;
  color: var(--accent-gold);
  border-bottom: 1px solid var(--btn-bg);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Chat close button */
.board-chat-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--text-base);
  padding: 0 2px;
  line-height: 1;
}

/* Resume-game prompt overlay backdrop */
.board-resume-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.75);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Resume-game prompt dialog box */
.board-resume-dialog {
  background: var(--bg-primary);
  border: 2px solid var(--btn-bg-primary);
  border-radius: 8px;
  padding: var(--space-xl);
  max-width: 340px;
  text-align: center;
}

/* Notes header row (Round label + Add button) */
.board-notes-header {
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-xs);
  color: var(--text-muted);
  border-bottom: 1px solid var(--btn-bg);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Notes Add button (text-only ghost) */
.board-notes-add-btn {
  background: none;
  border: none;
  color: var(--accent-gold);
  cursor: pointer;
  font-size: var(--text-sm);
  padding: 0;
  line-height: 1;
  font-weight: bold;
}

/* Sidebar icon strip (vertical tab rail) */
.board-sidebar-icon-strip {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-tertiary);
}

/* Sidebar icon strip: with right border (when expanded) */
.board-sidebar-icon-strip--expanded {
  border-right: 1px solid var(--btn-bg);
}

/* Sidebar content area background */
.board-sidebar-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: linear-gradient(170deg, var(--surface-panel) 0%, var(--surface-panel) 40%, var(--surface-panel) 60%, var(--bg-tertiary) 100%);
}

/* Sidebar phase name header (when phases tab active) */
.board-sidebar-phase-header {
  padding: 6px calc(10px + env(safe-area-inset-right, 0px)) 6px 10px;
  font-size: var(--text-sm);
  font-weight: 700;
  font-family: var(--font-heading);
  letter-spacing: 0.5px;
  color: var(--accent-gold);
  border-bottom: 1px solid var(--btn-bg);
  flex-shrink: 0;
}

/* Phase indicator pill inside sidebar phase header */
.board-phase-indicator-pill {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-gold);
  background: rgba(196,164,74,0.12);
  border: 1px solid rgba(196,164,74,0.3);
  border-radius: var(--radius-sm);
  padding: 1px 5px;
  line-height: 16px;
  white-space: nowrap;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Sidebar scrollable phase content */
.board-sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  /* Pad right for Dynamic Island / notch in landscape; content stays 10px from edge otherwise */
  padding: 6px calc(10px + env(safe-area-inset-right, 0px)) 6px 10px;
}

/* Sidebar End Phase footer area */
.board-sidebar-footer {
  /* Pad bottom for home indicator; pad right for Dynamic Island / notch in landscape */
  padding: var(--space-sm) calc(10px + env(safe-area-inset-right, 0px)) calc(var(--space-sm) + env(safe-area-inset-bottom, 0px)) 10px;
  border-top: 1px solid var(--btn-bg);
  flex-shrink: 0;
}

/* Pending moves summary header row (queued count + Review button) */
.board-moves-summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xs);
}

/* Phase warning buttons row */
.board-warning-btn-row {
  display: flex;
  gap: 6px;
}

/* Purchase summary / NCM summary modal header */
.board-modal-header {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-secondary);
  text-align: center;
}

/* Purchase summary / NCM summary modal footer (action buttons) */
.board-modal-footer {
  padding: var(--space-sm) var(--space-lg) var(--space-md);
  border-top: 1px solid var(--border-primary);
  display: flex;
  gap: var(--space-sm);
}

/* Purchase summary unit list */
.board-purchase-list {
  padding: var(--space-md) 18px;
}

/* Purchase summary unit row */
.board-purchase-unit-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
  font-size: var(--text-sm);
  color: var(--color-parchment);
}

/* NCM summary move list container */
.board-ncm-list {
  padding: var(--space-md) 18px;
  max-height: 50vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

@media (orientation: landscape) and (max-height: 500px) {
  .board-ncm-list {
    max-height: 30vh;
  }
}

/* NCM summary destination row header */
.board-ncm-dest-header {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

/* NCM summary unit entry row */
.board-ncm-unit-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: var(--space-lg);
  margin-bottom: 2px;
  font-size: var(--text-sm);
  color: var(--color-parchment);
}

/* NCM summary air units section */
.board-ncm-air-section {
  padding: var(--space-sm) 18px;
  border-top: 1px solid var(--border-primary);
}

/* NCM summary individual air unit row */
.board-ncm-air-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
  font-size: var(--text-sm);
}

/* === CombatBoard === */

/* Root combat board overlay (fixed full-screen grid) */
.combat-root {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 8, 5, 0.92);
  z-index: var(--z-battle);
  display: grid;
  grid-template-rows: auto 1fr auto;
  font-family: var(--font-body);
}

/* Main columns wrapper (fills center grid row) */
.combat-columns-outer {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Three-column flex row */
.combat-columns-inner {
  display: flex;
  flex-direction: row;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* "No units" placeholder inside attacker/defender column */
.combat-no-units {
  padding: var(--space-lg);
  font-size: var(--text-base);
  color: var(--text-muted);
  text-align: center;
}

/* Left portion of the header (title + round badge) */
.combat-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex: 1;
  min-width: 0;
}

/* Right portion of the header (simulate + close buttons) */
.combat-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Footer action buttons row */
.combat-footer-actions {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  align-items: center;
}

/* Hint text below roll / preReveal buttons ("Press to reveal...") */
.combat-roll-hint {
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-style: italic;
}

/* Dice power-level label ("@3:") above dice group */
.combat-dice-power-label {
  color: var(--text-muted);
  font-size: var(--text-xs);
  margin-bottom: var(--space-xs);
}

/* Dice group row (wrap of Die components) */
.combat-dice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

/* Individual die + count pair */
.combat-die-pair {
  display: flex;
  align-items: center;
  gap: 2px;
}

/* Collapsed center column — vertically centered content */
.combat-center-collapsed {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
}

/* Rotated step label inside collapsed center column */
.combat-center-step-label {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 0.6875rem;
  color: var(--text-muted);
  font-family: var(--font-heading);
  letter-spacing: 1px;
  white-space: nowrap;
}

/* Rotated hit counts inside collapsed center column */
.combat-center-hit-counts {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 0.625rem;
  white-space: nowrap;
}

/* "Awaiting decision..." italic hint in footer */
.combat-awaiting-hint {
  font-size: var(--text-base);
  color: var(--text-secondary);
  font-style: italic;
}

/* Start-battle wrapper (button + hint text, stacked) */
.combat-start-battle-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
}

/* === LobbyPage === */

/* Full-screen fixed overlay (shared base for all lobby views) */
.lobby-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Splash screen root — full screen, pointer, flex row */
.lobby-splash-screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  cursor: pointer;
  user-select: none;
}

/* Dark base layer behind split panels */
.lobby-bg-dark {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: var(--bg-darkest);
}

/* Poster image layer (used inside left and right split panels) */
.lobby-poster-image {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center top;
  animation: lobby-subtlePan 25s ease-in-out infinite;
  transform-origin: center center;
}

/* Reverse pan direction for allies side */
.lobby-poster-image--reverse {
  animation-direction: reverse;
}

/* Dark gradient overlay on Axis (left) panel */
.lobby-panel-overlay-axis {
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, rgba(0,0,0,0.3), rgba(0,0,0,0.7));
}

/* Dark gradient overlay on Allies (right) panel */
.lobby-panel-overlay-allies {
  position: absolute;
  inset: 0;
  background: linear-gradient(to left, rgba(0,0,0,0.3), rgba(0,0,0,0.7));
}

/* Red tint overlay for Axis panel */
.lobby-panel-tint-axis {
  position: absolute;
  inset: 0;
  background: rgba(80,0,0,0.15);
}

/* Blue tint overlay for Allies panel */
.lobby-panel-tint-allies {
  position: absolute;
  inset: 0;
  background: rgba(0,0,60,0.15);
}

/* Full-screen vignette (radial darkening toward edges) */
.lobby-vignette {
  position: fixed;
  inset: 0;
  z-index: 2;
  background: radial-gradient(ellipse at center, transparent 30%, rgba(0,0,0,0.6) 70%, rgba(0,0,0,0.9) 100%);
  pointer-events: none;
}

/* Centered content overlay on splash screen */
.lobby-splash-center {
  position: fixed;
  z-index: 10;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  padding: 0 20px;
}

/* Main title on splash */
.lobby-title-main {
  font-family: var(--font-heading);
  font-size: clamp(40px, 9vw, 84px);
  font-weight: 900;
  color: var(--accent-gold);
  text-shadow: 0 0 50px rgba(196,165,74,0.4), 0 4px 16px rgba(0,0,0,0.9);
  margin: 0 0 6px 0;
  letter-spacing: 8px;
  line-height: 1;
  animation: lobby-titleFade 1.5s ease-out 0.1s both;
}

/* Subtitle on splash ("Global 1940") */
.lobby-subtitle-splash {
  font-family: var(--font-heading);
  font-size: clamp(14px, 2.8vw, 24px);
  color: var(--text-primary);
  letter-spacing: 4px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.9);
  margin-bottom: 50px;
  animation: lobby-titleFade 1.2s ease-out 0.5s both;
}

/* Decorative gold horizontal rule on splash */
.lobby-decorative-line {
  width: 100px;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--accent-gold), transparent);
  margin: 0 auto 30px;
  animation: lobby-titleFade 1.2s ease-out 0.7s both;
}

/* CTA text ("Command Your Forces") */
.lobby-cta {
  font-family: var(--font-heading);
  font-size: clamp(11px, 1.8vw, 15px);
  color: var(--accent-gold);
  letter-spacing: 3px;
  text-transform: uppercase;
  animation: lobby-ctaFade 2.5s ease-out both, lobby-ctaPulse 3s ease-in-out 2.5s infinite;
  text-shadow: 0 0 20px rgba(196,165,74,0.3);
}

/* Main menu content wrapper with slide-up animation */
.lobby-menu-card {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: lobby-menuSlideUp 0.8s ease-out both;
  width: 100%;
  max-width: 420px;
  padding: 0 20px;
}
@media (max-height: 500px) and (orientation: landscape) {
  .lobby-menu-card {
    max-width: 640px;
    padding: 0 12px;
  }
}

/* Frosted-glass backdrop behind main menu content */
.lobby-backdrop-card {
  position: absolute;
  inset: -30px -40px;
  background: rgba(10,10,8,0.75);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(196,165,74,0.15);
  z-index: -1;
}

/* Frosted-glass backdrop for create/waiting panels (tighter inset) */
.lobby-backdrop-card--sm {
  position: absolute;
  inset: -20px -30px;
  background: rgba(10,10,8,0.8);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(196,165,74,0.1);
  z-index: -1;
}

/* Main menu title */
.lobby-menu-title {
  font-family: var(--font-heading);
  font-size: clamp(24px, 5vw, 36px);
  font-weight: 900;
  color: var(--accent-gold);
  text-shadow: 0 0 20px rgba(196,165,74,0.2);
  margin: 0 0 var(--space-xs) 0;
  letter-spacing: 5px;
}

/* Settings gear button */
.lobby-settings-btn {
  background: rgba(26,26,20,0.6);
  border: 1px solid rgba(196,165,74,0.3);
  color: var(--accent-gold);
  border-radius: 6px;
  padding: var(--space-sm) 20px;
  font-size: var(--text-base);
  cursor: pointer;
  font-family: var(--font-heading);
  letter-spacing: 2px;
}

/* Sign-out anchor link */
.lobby-signout-link {
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-family: var(--font-heading);
  letter-spacing: 1px;
  text-decoration: none;
}

/* Footer tagline ("N powers / 361 territories...") */
.lobby-footer-tagline {
  margin-top: var(--space-lg);
  font-size: var(--text-sm);
  color: var(--lobby-tagline-color);
}

/* Options/Create/Waiting view wrapper (with slide-up animation) */
.lobby-view-wrapper {
  position: relative;
  z-index: 10;
  animation: lobby-menuSlideUp 0.5s ease-out both;
  padding: 20px;
}
.lobby-view-wrapper--options {
  padding: 0;
}
@media (max-height: 500px) and (orientation: landscape) {
  .lobby-view-wrapper--options {
    padding: 12px 0;
  }
}

/* Section heading inside create/waiting views */
.lobby-section-heading {
  color: var(--accent-gold);
  margin-bottom: var(--space-xs);
  font-family: var(--font-heading);
  text-align: center;
}

/* Match ID display row */
.lobby-match-id-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: 20px;
  justify-content: center;
}

/* Match ID label */
.lobby-match-id-label {
  color: var(--text-muted);
  font-size: var(--text-base);
}

/* Match ID code block */
.lobby-match-id-code {
  background: rgba(51,51,42,0.8);
  padding: var(--space-xs) 10px;
  border-radius: 4px;
  color: var(--accent-blue);
  font-size: var(--text-lg);
  letter-spacing: 1px;
}

/* Copy-to-clipboard button */
.lobby-copy-btn {
  background: none;
  border: 1px solid var(--border-primary);
  color: var(--text-secondary);
  border-radius: 4px;
  padding: 2px var(--space-sm);
  font-size: var(--text-sm);
  cursor: pointer;
}

/* Create-view content container */
.lobby-create-section {
  width: 400px;
  max-width: 90vw;
  margin-bottom: var(--space-lg);
}

/* Sub-label above a list or control group */
.lobby-section-label {
  font-size: var(--text-base);
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

/* Row of quick-preset buttons */
.lobby-preset-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: var(--space-lg);
}

/* Individual quick-preset button */
.lobby-preset-btn {
  background: rgba(51,51,42,0.8);
  border: 1px solid var(--tooltip-divider);
  color: var(--border-secondary);
  border-radius: 4px;
  padding: var(--space-xs) 10px;
  font-size: var(--text-sm);
  cursor: pointer;
}

/* 2-column power selection grid */
.lobby-power-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

/* Inline error message */
.lobby-error-msg {
  color: var(--accent-red-bright);
  font-size: var(--text-sm);
}

/* Error message with spacing and centering (used in create/waiting views) */
.lobby-error-msg--spaced {
  color: var(--accent-red-bright);
  font-size: var(--text-sm);
  margin-bottom: var(--space-sm);
  text-align: center;
}

/* Row for primary action buttons (Back / Claim) */
.lobby-action-row {
  display: flex;
  gap: 8px;
  justify-content: center;
}

/* Waiting room player list container */
.lobby-waiting-list {
  width: 350px;
  max-width: 90vw;
  margin-bottom: 20px;
}

/* "All players joined!" success message */
.lobby-all-joined-msg {
  color: var(--accent-green);
  margin-bottom: var(--space-md);
  font-size: var(--text-base);
  font-weight: bold;
  text-align: center;
}

/* Center-aligned button container */
.lobby-btn-center {
  text-align: center;
}

/* "Online Multiplayer" section label */
.lobby-multiplayer-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
  font-family: var(--font-heading);
  letter-spacing: 2px;
}

/* Gold rule section divider in menu */
.lobby-divider {
  border-top: 1px solid rgba(196,165,74,0.2);
  margin: var(--space-xs) 0;
}

/* Portrait/desktop vertical menu column */
.lobby-menu-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  width: 100%;
}

/* Landscape vertical menu column (tighter gaps) */
.lobby-menu-col--landscape {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  width: 100%;
}

/* Landscape 2-column hotseat + online grid */
.lobby-landscape-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: start;
}

/* Right column in landscape grid (online multiplayer controls) */
.lobby-online-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* "Online Multiplayer" label in landscape layout */
.lobby-online-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-family: var(--font-heading);
  letter-spacing: 2px;
}

/* Match-ID input + Join button row (portrait) */
.lobby-join-row {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

/* Match-ID input + Join button row (landscape, tighter) */
.lobby-join-row--landscape {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* Footer row (settings button + sign-out link) */
.lobby-footer-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-top: 30px;
}
@media (max-height: 500px) and (orientation: landscape) {
  .lobby-footer-row {
    margin-top: 8px;
  }
}

/* Lobby form input */
.lobby-input {
  background: var(--lobby-input-bg);
  color: var(--text-primary);
  border: 1px solid var(--lobby-input-border);
  border-radius: 4px;
  padding: var(--space-sm) var(--space-md);
  font-size: var(--text-base);
  width: 100%;
  box-sizing: border-box;
}
.lobby-input[readonly] {
  opacity: 0.7;
  cursor: default;
}

/* Lobby subtitle ("Global 1940") */
.lobby-menu-subtitle {
  font-family: var(--font-heading);
  font-size: clamp(11px, 1.8vw, 14px);
  color: var(--color-lobby-subtitle);
  letter-spacing: 3px;
  margin-bottom: 32px;
}
@media (max-height: 500px) and (orientation: landscape) {
  .lobby-menu-subtitle {
    margin-bottom: 8px;
  }
}

/* Resume match button (green variant of btn-lobby) */
.btn-lobby--resume {
  background: var(--gradient-lobby-resume);
  border: 2px solid var(--accent-green);
  font-size: var(--text-lg);
  padding: 18px 24px;
  width: 100%;
  text-align: center;
}
@media (max-height: 500px) and (orientation: landscape) {
  .btn-lobby--resume {
    font-size: var(--text-sm);
    padding: 8px 16px;
  }
}

/* Muted/back button variant of btn-lobby */
.btn-lobby--muted {
  background: var(--lobby-muted-bg);
  border: 1px solid var(--border-primary);
  padding: 8px 16px;
  font-size: var(--text-base);
}

/* Sub-line inside a btn-lobby (e.g. "All players on one device") */
.btn-lobby__sub {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-xs);
  font-weight: 400;
}

/* Sub-line in success color (e.g. match details under Resume) */
.btn-lobby__sub--success {
  font-size: var(--text-sm);
  color: var(--color-success);
  margin-top: var(--space-xs);
  font-weight: 400;
}

/* Power selection button in create/join view */
.lobby-power-btn {
  background: var(--lobby-muted-bg);
  border: 1px solid var(--tooltip-divider);
  color: var(--tooltip-text);
  border-radius: 4px;
  padding: 6px 10px;
  font-size: var(--text-sm);
  cursor: pointer;
  text-align: left;
}
.lobby-power-btn[data-selected="true"][data-axis="true"] {
  background: var(--lobby-axis-selected-bg);
  border-color: var(--accent-red-bright);
}
.lobby-power-btn[data-selected="true"][data-axis="false"] {
  background: var(--lobby-allies-selected-bg);
  border-color: var(--accent-blue);
}
.lobby-power-btn[data-other="true"] {
  color: var(--text-muted);
  cursor: not-allowed;
}
.lobby-power-btn__name {
  font-weight: normal;
}
.lobby-power-btn[data-selected="true"] .lobby-power-btn__name {
  font-weight: bold;
}
.lobby-power-btn__badge {
  float: right;
  font-size: var(--text-xs);
}
.lobby-power-btn__badge--you {
  color: var(--accent-green);
}
.lobby-power-btn__badge--other {
  color: var(--text-muted);
}

/* Player row in waiting room */
.lobby-player-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-xs) var(--space-sm);
  background: transparent;
  border-radius: 3px;
  margin-bottom: 2px;
  font-size: var(--text-base);
}
.lobby-player-row[data-mine="true"][data-axis="true"] {
  background: var(--lobby-axis-mine-bg);
}
.lobby-player-row[data-mine="true"][data-axis="false"] {
  background: var(--lobby-allies-mine-bg);
}
.lobby-player-name[data-axis="true"] {
  color: var(--color-danger-soft);
}
.lobby-player-name[data-axis="false"] {
  color: var(--accent-blue);
}
.lobby-player-claim[data-claimed="true"] {
  color: var(--accent-green);
}
.lobby-player-claim[data-claimed="false"] {
  color: var(--text-muted);
}

/* Join count line in waiting room */
.lobby-join-count {
  font-size: var(--text-base);
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  text-align: center;
}

/* Screen variant with scroll (options/create views) */
.lobby-screen--scroll {
  overflow: auto;
}

/* === GameOptionsPanel === */

.options-card {
  background: var(--lobby-card-bg);
  border: 1px solid var(--lobby-gold-border-md);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  padding: 20px var(--space-xl);
  min-width: 340px;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
@media (max-height: 500px) and (orientation: landscape) {
  .options-card {
    padding: var(--space-md) var(--space-lg);
    min-width: auto;
    width: min(calc(100vw - 32px), 560px);
    max-width: 560px;
  }
}

.option-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-lg);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--lobby-gold-border);
}

.option-row--sub {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-lg);
  padding: 10px 0 10px 20px;
  border-bottom: 1px solid rgba(196,165,74,0.07);
  border-left: 2px solid rgba(196,165,74,0.15);
  margin-left: var(--space-sm);
}

.option-label {
  flex: 1;
}

.option-label__title {
  font-size: var(--text-base);
  font-weight: 700;
  margin-bottom: 3px;
}
.option-label__title--active {
  color: var(--tooltip-text);
}
.option-label__title--inactive {
  color: var(--text-muted);
}

.option-label__desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.4;
}

.toggle-btn {
  width: 40px;
  height: 22px;
  border-radius: 11px;
  border: 1px solid var(--border-primary);
  background: var(--surface-input);
  position: relative;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
  margin-top: 2px;
}
.toggle-btn[data-on="true"] {
  border-color: var(--accent-green);
  background: var(--btn-bg-success);
}

.toggle-knob {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-miss);
  position: absolute;
  top: 2px;
  left: 2px;
  transition: left 0.2s, background 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.toggle-knob[data-on="true"] {
  background: var(--color-success);
  left: 20px;
}

.options-confirm-btn {
  background: var(--gradient-lobby-confirm);
  color: var(--color-lobby-title);
  border: 2px solid var(--border-accent);
  border-radius: 5px;
  padding: var(--space-md) var(--space-xl);
  font-size: var(--text-lg);
  cursor: pointer;
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: 1px;
  width: 100%;
}
@media (max-height: 500px) and (orientation: landscape) {
  .options-confirm-btn {
    padding: var(--space-sm) var(--space-lg);
    font-size: var(--text-base);
  }
}

.options-resume-btn {
  background: var(--gradient-options-resume);
  color: var(--color-success-bright);
  border: 2px solid var(--accent-green);
  border-radius: 5px;
  padding: var(--space-md) var(--space-xl);
  font-size: var(--text-lg);
  cursor: pointer;
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: 1px;
  width: 100%;
}
@media (max-height: 500px) and (orientation: landscape) {
  .options-resume-btn {
    padding: var(--space-sm) var(--space-lg);
    font-size: var(--text-base);
  }
}

.options-load-btn {
  background: var(--lobby-muted-bg);
  color: var(--color-lobby-subtitle);
  border: 1px solid var(--border-primary);
  border-radius: 5px;
  padding: var(--space-sm) var(--space-lg);
  font-size: var(--text-base);
  cursor: pointer;
  font-family: var(--font-heading);
  letter-spacing: 1px;
  width: 100%;
}
@media (max-height: 500px) and (orientation: landscape) {
  .options-load-btn {
    padding: 6px var(--space-md);
  }
}

.options-back-btn {
  background: var(--lobby-muted-bg);
  color: var(--color-lobby-subtitle);
  border: 1px solid var(--border-primary);
  border-radius: 5px;
  padding: var(--space-sm) var(--space-lg);
  font-size: var(--text-base);
  cursor: pointer;
  font-family: var(--font-heading);
  letter-spacing: 1px;
  width: 100%;
  margin-top: var(--space-sm);
}
@media (max-height: 500px) and (orientation: landscape) {
  .options-back-btn {
    padding: 6px var(--space-md);
  }
}

.options-separator {
  border-top: 1px solid var(--lobby-gold-border);
  margin: var(--space-sm) 0;
}

.options-expanded-card {
  border: 2px solid var(--lobby-gold-border-lg);
  border-radius: 8px;
  overflow: hidden;
  background: var(--lobby-expanded-card-bg);
  box-shadow: 0 0 20px rgba(196,165,74,0.08), inset 0 1px 0 rgba(196,165,74,0.1);
}

.options-expanded-header {
  background: var(--lobby-expanded-header-bg);
  border-bottom: 1px solid var(--lobby-gold-border-header);
  padding: var(--space-md) var(--space-lg);
  cursor: pointer;
  color: var(--accent-gold);
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: var(--text-sm);
  letter-spacing: 2px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.options-expand-arrow {
  font-size: 0.625rem;
  opacity: 0.7;
  font-family: var(--font-mono);
}

.options-body {
  padding: 12px 16px;
}
@media (max-height: 500px) and (orientation: landscape) {
  .options-body {
    padding: 8px;
  }
}

.options-begin-section {
  padding: 12px 16px;
  border-top: 1px solid rgba(196,165,74,0.2);
}
@media (max-height: 500px) and (orientation: landscape) {
  .options-begin-section {
    padding: 8px;
  }
}

.options-landscape-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 6px;
}

.options-landscape-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: var(--space-sm) 10px;
  background: var(--lobby-cell-bg);
  border-radius: 6px;
  border: 1px solid var(--lobby-gold-border);
}

.options-landscape-cell--col {
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-xs);
}

.options-timer-row {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}

.options-segment-group {
  display: flex;
  gap: var(--space-xs);
}

.options-segment-btn {
  flex: 1;
  padding: 5px 0;
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--color-miss);
  background: var(--lobby-segment-inactive-bg);
  border: 1px solid var(--tooltip-divider);
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-heading);
  letter-spacing: 0.5px;
  text-transform: capitalize;
  text-align: center;
}
.options-segment-btn--active {
  font-weight: 700;
  color: var(--accent-gold);
  background: var(--lobby-segment-active-bg);
  border-color: var(--lobby-segment-active-border);
}
.options-segment-btn--sm {
  flex: none;
  padding: 3px 6px;
  font-size: var(--text-xs);
}

.options-fog-sub {
  border: 1px solid var(--lobby-gold-border);
  border-radius: 6px;
  padding: var(--space-sm);
  margin-bottom: 6px;
  background: var(--lobby-cell-bg);
}

.options-fog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

/* === TerritoryBottomPanel === */

/* Compact strip inner flex row */
.territory-strip-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  user-select: none;
  min-height: 44px;
}

/* Flag image in compact strip (24px) */
.territory-flag-img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.2);
  flex-shrink: 0;
}

/* Flag image in expanded header (36px) */
.territory-flag-img--lg {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.2);
  flex-shrink: 0;
}

/* Territory name in compact strip */
.territory-name-compact {
  font-weight: bold;
  font-size: var(--text-sm);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* Phase info span in compact strip */
.territory-strip-info {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  white-space: nowrap;
  flex: 1;
}

/* Compact strip primary action button (gold) */
.territory-strip-action-btn {
  padding: var(--space-xs) 10px;
  font-size: var(--text-xs);
  font-weight: bold;
  background: var(--accent-gold);
  color: var(--color-on-gold);
  border: none;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Chevron / close buttons inside compact strip */
.territory-strip-icon-btn {
  padding: var(--space-xs) 6px;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  line-height: 1;
  flex-shrink: 0;
}

/* Left section of expanded header (flag + name block) */
.territory-header-left {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-width: 0;
}

/* Name + IPC + markers row inside expanded header */
.territory-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Owner/metadata row under territory name */
.territory-meta-row {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: 1px;
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

/* Units center section (combat + installations + AV/DV) */
.territory-units-center {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Individual unit group block */
.territory-unit-group {
  flex: 0 1 auto;
  padding: var(--space-xs) var(--space-sm);
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
}

/* Unit group section label */
.territory-unit-group-label {
  font-size: var(--text-xs);
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
  padding-bottom: 3px;
  border-bottom: 1px solid rgba(196, 164, 74, 0.2);
}

/* Unit group items row */
.territory-unit-row {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  align-items: center;
}

/* Single unit entry (icon + count + name) */
.territory-unit-entry {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-base);
  color: var(--tooltip-text);
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}
.territory-unit-entry:hover {
  background: rgba(196, 164, 74, 0.08);
}

/* Responsive garrison — tablet */
@media (min-width: 481px) and (max-width: 1024px) {
  .territory-unit-entry {
    gap: 5px;
    padding: 4px 8px;
    font-size: var(--text-lg);
  }
}
/* Responsive garrison — mobile */
@media (max-width: 480px) {
  .territory-unit-entry {
    gap: 6px;
    padding: 6px 8px;
    font-size: var(--text-lg);
  }
  .territory-unit-group-label {
    font-size: var(--text-sm);
    margin-bottom: 8px;
  }
}

/* Fog of war intel block */
.territory-fog-block {
  flex: 0 0 auto;
}

/* "Last seen Turn N" label */
.territory-fog-label {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 3px;
}

/* Fog unit summary row */
.territory-fog-units {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

/* Single fog unit entry (faded) */
.territory-fog-unit-entry {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  opacity: 0.8;
}

/* AV/DV summary block */
.territory-avdv {
  flex: 0 0 auto;
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Right controls section (collapse + close buttons) */
.territory-panel-controls {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* Relationship badge (Own/Allied/Enemy) */
.territory-rel-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 2px;
  margin-left: 2px;
}
.territory-rel-own {
  background: rgba(90, 158, 111, 0.15);
  color: var(--color-valid);
  border: 1px solid rgba(90, 158, 111, 0.25);
}
.territory-rel-allied {
  background: rgba(91, 138, 191, 0.15);
  color: var(--color-info);
  border: 1px solid rgba(91, 138, 191, 0.25);
}
.territory-rel-enemy {
  background: rgba(196, 71, 58, 0.12);
  color: var(--color-hit);
  border: 1px solid rgba(196, 71, 58, 0.2);
}

/* Incoming units badge */
.territory-incoming-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(201, 168, 76, 0.15);
  border: 1px solid rgba(201, 168, 76, 0.25);
  border-radius: 3px;
  padding: 3px 8px;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--accent-gold, #d4a843);
  white-space: nowrap;
  animation: incomingPulse 2s ease-in-out infinite;
}
.territory-incoming-arrow {
  animation: incomingSlide 1.2s ease-in-out infinite;
}
@keyframes incomingPulse {
  0%, 100% { box-shadow: 0 0 0 rgba(201, 168, 76, 0); }
  50%      { box-shadow: 0 0 8px rgba(201, 168, 76, 0.15); }
}
@keyframes incomingSlide {
  0%, 100% { transform: translateX(0); }
  50%      { transform: translateX(3px); }
}

/* Full-width section divider for phase-actions area */
.territory-section-divider {
  width: 100%;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: var(--space-sm);
}

/* Full-width section divider for notes area (tighter padding) */
.territory-notes-divider {
  width: 100%;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 6px;
}

/* Notes section toggle header row */
.territory-notes-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  user-select: none;
}

/* Individual note item row */
.territory-note-item {
  padding: var(--space-xs) var(--space-sm);
  border-radius: 4px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-secondary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* Note add/edit form container */
.territory-note-form {
  padding: 6px;
  border-radius: 4px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-primary);
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

/* Note form select element */
.territory-note-select {
  background: var(--btn-bg);
  color: var(--text-primary);
  border: 1px solid var(--border-primary);
  border-radius: 4px;
  padding: 3px 6px;
  font-size: var(--text-sm);
}

/* Note form text input */
.territory-note-text-input {
  flex: 1;
  min-width: 120px;
  background: var(--btn-bg);
  color: var(--text-primary);
  border: 1px solid var(--border-primary);
  border-radius: 4px;
  padding: 3px 6px;
  font-size: var(--text-sm);
  font-family: inherit;
}

/* Phase section heading (e.g. "Declare War", "Plan Attack") */
.territory-phase-heading {
  font-size: var(--text-xs);
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(196, 164, 74, 0.25);
}

/* Phase description text */
.territory-phase-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: 6px;
}

/* Inline unit tag (icon + name, e.g. cargo items) */
.territory-unit-tag {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

/* Transport management card */
.territory-transport-card {
  margin-bottom: 6px;
  padding: var(--space-xs) 6px;
  background: rgba(80,144,208,0.08);
  border-radius: 3px;
  border: 1px solid rgba(80,144,208,0.2);
}

/* Transport card header (icon + name + capacity) */
.territory-transport-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}

/* Transport cargo grid */
.territory-transport-cargo {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-bottom: var(--space-xs);
}

/* Unit selector sub-section in sea zones */
.territory-unit-selector-sub {
  margin-top: 6px;
  border-top: 1px solid rgba(255,255,255,0.06);
  padding-top: 6px;
}

/* SBR / recon eligible aircraft list */
.territory-bomber-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* Battle combatant sides wrapper */
.territory-battle-sides {
  display: flex;
  gap: var(--space-xl);
  flex-wrap: wrap;
}

/* Unit type list inside a combatant side */
.territory-combatant-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Single combatant type entry (icon + count) */
.territory-combatant-entry {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* Placement stepper row */
.territory-placement-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 4px var(--space-xs);
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}
.territory-placement-row:hover {
  background: rgba(196, 164, 74, 0.08);
}
.territory-placement-row--active {
  background: rgba(196, 164, 74, 0.15);
}

/* Responsive placement stepper — tablet */
@media (min-width: 481px) and (max-width: 1024px) {
  .territory-placement-row {
    gap: var(--space-md);
    padding: 6px var(--space-sm);
    min-height: 40px;
  }
  .territory-placement-row .btn-stepper {
    width: 36px;
    height: 36px;
    font-size: var(--text-lg);
    line-height: 36px;
  }
}
/* Responsive placement stepper — mobile */
@media (max-width: 480px) {
  .territory-placement-row {
    gap: var(--space-md);
    padding: 8px var(--space-sm);
    min-height: 48px;
  }
  .territory-placement-row .btn-stepper {
    width: 44px;
    height: 44px;
    font-size: var(--text-xl);
    line-height: 44px;
  }
}

/* Note count badge button in compact strip */
.territory-notes-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  font-size: var(--text-xs);
  font-weight: bold;
  background: rgba(192,160,64,0.15);
  color: var(--accent-gold-bright);
  border: 1px solid rgba(192,160,64,0.3);
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Unload / load-adjacent button row */
.territory-transport-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

/* Load-from-adjacent section */
.territory-load-section {
  margin-top: var(--space-xs);
}

/* "N units assigned to this raid" note */
.territory-sbr-assigned {
  margin-bottom: 6px;
}

/* SBR undo button row */
.territory-sbr-undo-row {
  display: flex;
  gap: var(--space-xs);
  margin-top: 6px;
}

/* Attack planner button row */
.territory-attack-btn-row {
  display: flex;
  gap: 6px;
}

/* Win-bar percentage annotation */
.territory-winbar-pct {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

/* Win-bar wrapper with bottom margin */
.territory-winbar-block {
  margin-bottom: var(--space-sm);
}

/* Recon aircraft list */
.territory-recon-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

/* Adjacent territory load label */
.territory-load-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: 3px;
}

/* ===== SBR Battle Board ===== */

/* Three-column section layout (air / aa / bombing) */
.sbr-section-layout {
  display: flex;
  gap: var(--space-lg);
}
@media (max-width: 768px) {
  .sbr-section-layout { flex-direction: column; }
}

/* Side panels (attacker / defender columns) */
.sbr-side-panel {
  flex: 1;
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  padding: var(--space-md);
}
@media (max-width: 768px) {
  .sbr-side-panel { flex: none; }
}

/* Center column (actions / dice / decisions) */
.sbr-center-col {
  flex: 2;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}
@media (max-width: 768px) {
  .sbr-center-col { flex: none; order: -1; }
}

/* Section header (uppercase label above unit lists) */
.sbr-section-header {
  font-size: var(--text-sm);
  font-weight: bold;
  text-transform: uppercase;
  margin-bottom: var(--space-sm);
}

/* Mobile summary header (collapsible) */
.sbr-mobile-summary {
  font-size: var(--text-sm);
  font-weight: bold;
  text-transform: uppercase;
  cursor: pointer;
  margin-bottom: var(--space-xs);
}

/* Unit row: icon + name inline */
.sbr-unit-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
}

/* Unit display name text */
.sbr-unit-name {
  font-size: var(--text-base);
  color: var(--text-primary);
}

/* Dice results panel */
.sbr-dice-panel {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  padding: var(--space-lg);
}

/* Dice results title */
.sbr-dice-title {
  font-size: var(--text-base);
  font-weight: bold;
  color: var(--accent-gold);
  margin-bottom: 10px;
  text-align: center;
}

/* Footer action buttons — responsive sizing */
.sbr-footer-btn {
  font-size: 1rem;
  padding: 10px 40px;
}
@media (max-width: 768px) {
  .sbr-footer-btn {
    font-size: 0.875rem;
    padding: 8px 24px;
  }
}

/* Invalid-move reason banner */
.territory-invalid-move {
  background: rgba(180,40,40,0.18);
  border: 1px solid rgba(200,60,60,0.35);
  border-radius: 3px;
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-sm);
  color: var(--color-danger-soft);
  flex: 0 0 auto;
}
