/* ═══════════════════════════════════════════════════════════════
   LWServers V2 — base.css
   Global foundation. Every page loads this first.
   No page-specific styles here. Ever.
═══════════════════════════════════════════════════════════════ */

/* ── FONTS ── */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ─────────────────────────────────────────────────────────────
   DESIGN TOKENS
───────────────────────────────────────────────────────────── */
:root {

  /* Backgrounds — layered depth */
  --bg-root:      #080a0f;         /* page background */
  --bg-1:         #0d1117;         /* cards, panels */
  --bg-2:         #131920;         /* elevated surfaces */
  --bg-3:         #1a2230;         /* top-most surfaces */

  /* Glass system */
  --glass-bg:     rgba(13, 17, 23, 0.65);
  --glass-bg-2:   rgba(19, 25, 32, 0.72);
  --glass-bg-3:   rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-2: rgba(255, 255, 255, 0.14);
  --glass-shine:  rgba(255, 255, 255, 0.06);
  --blur-sm:      blur(8px);
  --blur-md:      blur(16px);
  --blur-lg:      blur(24px);

  /* Accent — single brand colour */
  --accent:       #00e87a;         /* primary green */
  --accent-2:     #00c466;         /* darker green */
  --accent-glow:  rgba(0, 232, 122, 0.18);
  --accent-glow-2:rgba(0, 232, 122, 0.08);
  --accent-border:rgba(0, 232, 122, 0.22);

  /* Semantic colours */
  --amber:        #f59e0b;
  --amber-glow:   rgba(245, 158, 11, 0.12);
  --amber-border: rgba(245, 158, 11, 0.25);
  --red:          #f87171;
  --red-glow:     rgba(248, 113, 113, 0.12);
  --red-border:   rgba(248, 113, 113, 0.25);
  --blue:         #60a5fa;
  --blue-glow:    rgba(96, 165, 250, 0.12);
  --blue-border:  rgba(96, 165, 250, 0.25);

  /* Tier colours */
  --tier-mega:    #f87171;
  --tier-whale:   #c084fc;
  --tier-shark:   #60a5fa;
  --tier-piranha: #00e87a;
  --tier-shrimp:  #6b7280;

  /* Text */
  --text-1:       #eaecf0;         /* primary */
  --text-2:       #8b95a1;         /* secondary / muted */
  --text-3:       #4b5563;         /* hints / disabled */

  /* Borders */
  --border-1:     rgba(255, 255, 255, 0.07);
  --border-2:     rgba(255, 255, 255, 0.12);
  --border-3:     rgba(255, 255, 255, 0.18);

  /* Typography */
  --font-ui:      'Outfit', system-ui, sans-serif;
  --font-data:    'JetBrains Mono', 'Fira Code', monospace;

  /* Spacing scale */
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  20px;
  --sp-6:  24px;
  --sp-8:  32px;
  --sp-10: 40px;

  /* Radius */
  --r-sm:  6px;
  --r-md:  10px;
  --r-lg:  14px;
  --r-xl:  20px;
  --r-2xl: 28px;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.6);
  --shadow-xl:  0 16px 48px rgba(0,0,0,0.7);
  --shadow-accent: 0 0 24px rgba(0, 232, 122, 0.2);

  /* Layout */
  --nav-h:         64px;           /* bottom nav height mobile */
  --sidebar-w:     220px;          /* desktop sidebar width */
  --content-max:   1100px;         /* max content width */
  --safe-bottom:   env(safe-area-inset-bottom, 0px);
  --page-px:       20px;           /* horizontal page padding mobile */
  --page-px-desk:  32px;           /* horizontal page padding desktop */

  /* Transitions */
  --ease:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --t-fast:  120ms;
  --t-base:  200ms;
  --t-slow:  350ms;

  /* Theme-flavour overlays (overridden in light theme) */
  --hover-overlay:    rgba(255, 255, 255, 0.04);
  --hover-overlay-2:  rgba(255, 255, 255, 0.07);
  color-scheme: dark;
}

/* ─────────────────────────────────────────────────────────────
   LIGHT THEME — warm paper, never flat white
───────────────────────────────────────────────────────────── */
:root[data-theme="light"] {
  /* ─────────────────────────────────────────────────────────
     Palette sampled from the Last War game UI:
       desert sand background, warm gold buildings,
       cyan-blue structures, terracotta red soldiers.
     Cards lift slightly cooler than the ground so they read
     as "buildings on sand" rather than flat paper.
  ─────────────────────────────────────────────────────────── */

  /* Backgrounds — sandy desert, cards lift cooler */
  --bg-root:      #d8c39a;          /* desert sand floor */
  --bg-1:         #ece1c6;           /* sand card */
  --bg-2:         #f4ecd6;           /* elevated sand */
  --bg-3:         #fbf6e6;           /* near-top */

  /* Glass — warm sand translucency */
  --glass-bg:     rgba(244, 236, 214, 0.80);
  --glass-bg-2:   rgba(251, 246, 230, 0.85);
  --glass-bg-3:   rgba(60, 38, 12, 0.05);
  --glass-border: rgba(60, 38, 12, 0.11);
  --glass-border-2: rgba(60, 38, 12, 0.18);
  --glass-shine:  rgba(255, 248, 230, 0.65);

  /* Accent — tuned to the game's grass/foliage green so it
     stays "green" across themes (brand) but reads richly on
     sandy backgrounds.  Dark theme uses brighter #00e87a. */
  --accent:       #3d8a32;          /* rich grass green */
  --accent-2:     #2f6e26;
  --accent-glow:  rgba(61, 138, 50, 0.14);
  --accent-glow-2:rgba(61, 138, 50, 0.07);
  --accent-border:rgba(61, 138, 50, 0.36);

  /* Semantic — game gold + terracotta red + sky blue */
  --amber:        #d49616;           /* game gold buildings */
  --amber-glow:   rgba(212, 150, 22, 0.14);
  --amber-border: rgba(212, 150, 22, 0.36);
  --red:          #c44a3e;           /* soldier-red terracotta */
  --red-glow:     rgba(196, 74, 62, 0.12);
  --red-border:   rgba(196, 74, 62, 0.34);
  --blue:         #3d92b8;
  --blue-glow:    rgba(61, 146, 184, 0.12);
  --blue-border:  rgba(61, 146, 184, 0.34);

  /* Tier colours — pulled toward the game's palette */
  --tier-mega:    #c44a3e;
  --tier-whale:   #8a5cb0;
  --tier-shark:   #3d92b8;
  --tier-piranha: #4ea832;           /* foliage green */
  --tier-shrimp:  #8a7857;           /* tan */

  /* Text — warm browns on sand, not slate */
  --text-1:       #2a1d0c;           /* warm near-black */
  --text-2:       #5c4528;           /* medium warm brown */
  --text-3:       #8c7651;           /* tan */

  /* Borders — warm dark hairlines */
  --border-1:     rgba(60, 38, 12, 0.09);
  --border-2:     rgba(60, 38, 12, 0.16);
  --border-3:     rgba(60, 38, 12, 0.25);

  /* Shadows — soft warm drops */
  --shadow-sm:    0 1px 2px  rgba(80, 50, 10, 0.10);
  --shadow-md:    0 4px 14px rgba(80, 50, 10, 0.12);
  --shadow-lg:    0 8px 28px rgba(80, 50, 10, 0.16);
  --shadow-xl:    0 16px 44px rgba(80, 50, 10, 0.22);
  --shadow-accent: 0 0 24px rgba(61, 138, 50, 0.22);

  /* Hover overlays — warmer than slate */
  --hover-overlay:   rgba(60, 38, 12, 0.06);
  --hover-overlay-2: rgba(60, 38, 12, 0.10);

  color-scheme: light;
}

/* Smooth theme switch */
html { transition: background-color var(--t-base) var(--ease); }
body { transition: background-color var(--t-base) var(--ease), color var(--t-base) var(--ease); }

/* ─────────────────────────────────────────────────────────────
   FSP PILL — shared across intel / dsb / clans / vs.
   Tier-coloured pill for displaying First Squad Power inline.
   Apply `.fsp-pill.tier-<mega|whale|shark|piranha|shrimp>`.
───────────────────────────────────────────────────────────── */
.fsp-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid;
  font-family: var(--font-data);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
  line-height: 1.3;
}
.fsp-pill.tier-mega {
  color: var(--tier-mega);
  background: rgba(248, 113, 113, 0.10);
  border-color: rgba(248, 113, 113, 0.32);
}
.fsp-pill.tier-whale {
  color: var(--tier-whale);
  background: rgba(192, 132, 252, 0.10);
  border-color: rgba(192, 132, 252, 0.32);
}
.fsp-pill.tier-shark {
  color: var(--tier-shark);
  background: rgba(96, 165, 250, 0.10);
  border-color: rgba(96, 165, 250, 0.32);
}
.fsp-pill.tier-piranha {
  color: var(--tier-piranha);
  background: rgba(0, 232, 122, 0.10);
  border-color: rgba(0, 232, 122, 0.32);
}
.fsp-pill.tier-shrimp {
  color: var(--tier-shrimp);
  background: rgba(107, 114, 128, 0.12);
  border-color: rgba(107, 114, 128, 0.32);
}

/* ─────────────────────────────────────────────────────────────
   RESET
───────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  height: 100%;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100%;
  background: var(--bg-root);
  color: var(--text-1);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* hidden made <body> a non-scrolling scroll container, which silently
     broke EVERY position:sticky on the site (app-bar, tab rows) — clip
     guards against sideways overflow without creating a scroll container.
     html keeps overflow-x:hidden as the old-browser fallback. */
  overflow-x: clip;
}

/* Background ambient glow — subtle radial behind everything */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(0, 232, 122, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 110%, rgba(96, 165, 250, 0.04) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

img, video, svg {
  display: block;
  max-width: 100%;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

button { cursor: pointer; }

a {
  color: inherit;
  text-decoration: none;
}

ul, ol { list-style: none; }

/* ─────────────────────────────────────────────────────────────
   TYPOGRAPHY SCALE
───────────────────────────────────────────────────────────── */

/* Display — warzone numbers, hero stats */
.text-display {
  font-family: var(--font-ui);
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -1.5px;
  line-height: 1;
  color: var(--text-1);
}

/* Heading 1 — page titles */
.text-h1 {
  font-family: var(--font-ui);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.2;
  color: var(--text-1);
}

/* Heading 2 — section titles */
.text-h2 {
  font-family: var(--font-ui);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.2px;
  color: var(--text-1);
}

/* Heading 3 — card titles */
.text-h3 {
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-1);
}

/* Body */
.text-body  { font-size: 14px; color: var(--text-1); line-height: 1.6; }
.text-small { font-size: 12px; color: var(--text-2); line-height: 1.5; }
.text-tiny  { font-size: 11px; color: var(--text-3); }

/* Data / mono */
.text-data  {
  font-family: var(--font-data);
  font-size: 13px;
  color: var(--text-1);
  letter-spacing: 0.2px;
}
.text-data-lg {
  font-family: var(--font-data);
  font-size: 20px;
  font-weight: 500;
  color: var(--text-1);
  letter-spacing: -0.3px;
}

/* Label — section headers, eyebrows */
.text-label {
  font-family: var(--font-data);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-3);
}

/* Accent text */
.text-accent { color: var(--accent); }
.text-amber  { color: var(--amber); }
.text-red    { color: var(--red); }
.text-muted  { color: var(--text-2); }

/* ─────────────────────────────────────────────────────────────
   GLASS SYSTEM
   The core visual language — frosted surfaces with depth
───────────────────────────────────────────────────────────── */

/* Base glass — most cards and panels */
.glass {
  background: var(--glass-bg);
  backdrop-filter: var(--blur-md);
  -webkit-backdrop-filter: var(--blur-md);
  border: 1px solid var(--glass-border);
  position: relative;
}

/* Glass with inner shine (top edge highlight) */
.glass::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    135deg,
    var(--glass-shine) 0%,
    transparent 50%
  );
  pointer-events: none;
  z-index: 0;
}

/* Elevated glass — modals, bottom sheets */
.glass-2 {
  background: var(--glass-bg-2);
  backdrop-filter: var(--blur-lg);
  -webkit-backdrop-filter: var(--blur-lg);
  border: 1px solid var(--glass-border-2);
  position: relative;
}

.glass-2::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    135deg,
    rgba(255,255,255,0.08) 0%,
    transparent 40%
  );
  pointer-events: none;
  z-index: 0;
}

/* Accent glass — highlighted/active elements */
.glass-accent {
  background: rgba(0, 232, 122, 0.07);
  backdrop-filter: var(--blur-md);
  -webkit-backdrop-filter: var(--blur-md);
  border: 1px solid var(--accent-border);
}

/* Ensure content inside glass sits above pseudo-elements */
.glass > *, .glass-2 > *, .glass-accent > * { position: relative; z-index: 1; }

/* ─────────────────────────────────────────────────────────────
   CARD VARIANTS
───────────────────────────────────────────────────────────── */

.card {
  border-radius: var(--r-lg);
  overflow: hidden;
}

.card-sm { border-radius: var(--r-md); overflow: hidden; }
.card-xl { border-radius: var(--r-xl); overflow: hidden; }

/* Interactive card hover */
.card-interactive {
  transition: border-color var(--t-base) var(--ease),
              transform var(--t-base) var(--ease),
              box-shadow var(--t-base) var(--ease);
  cursor: pointer;
}

.card-interactive:hover {
  border-color: var(--border-3) !important;
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.card-interactive:active {
  transform: translateY(0);
  transition-duration: var(--t-fast);
}

/* Accent-bordered card (top players, #1 ranked) */
.card-accent {
  border-color: var(--accent-border) !important;
  box-shadow: 0 0 0 1px var(--accent-border), var(--shadow-accent);
}

/* ─────────────────────────────────────────────────────────────
   TIER BADGES
───────────────────────────────────────────────────────────── */

.tier {
  font-family: var(--font-data);
  font-size: 10px;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: var(--r-sm);
  font-weight: 500;
  display: inline-block;
  white-space: nowrap;
}

.tier-mega    { color: var(--tier-mega);    background: rgba(248,113,113,0.1);  border: 1px solid rgba(248,113,113,0.2); }
.tier-whale   { color: var(--tier-whale);   background: rgba(192,132,252,0.1);  border: 1px solid rgba(192,132,252,0.2); }
.tier-shark   { color: var(--tier-shark);   background: rgba(96,165,250,0.1);   border: 1px solid rgba(96,165,250,0.2); }
.tier-piranha { color: var(--tier-piranha); background: rgba(0,232,122,0.08);   border: 1px solid rgba(0,232,122,0.18); }
.tier-shrimp  { color: var(--tier-shrimp);  background: rgba(107,114,128,0.1);  border: 1px solid rgba(107,114,128,0.2); }

/* ─────────────────────────────────────────────────────────────
   STATUS PILLS
───────────────────────────────────────────────────────────── */

.pill {
  font-family: var(--font-data);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-2);
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.pill-live   { color: var(--accent);  border-color: var(--accent-border); background: var(--accent-glow-2); }
.pill-warn   { color: var(--amber);   border-color: var(--amber-border);  background: var(--amber-glow); }
.pill-danger { color: var(--red);     border-color: var(--red-border);    background: var(--red-glow); }
.pill-info   { color: var(--blue);    border-color: var(--blue-border);   background: var(--blue-glow); }

.pill-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* ─────────────────────────────────────────────────────────────
   BUTTONS
───────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 10px 18px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-ui);
  letter-spacing: 0.2px;
  transition: all var(--t-base) var(--ease);
  white-space: nowrap;
  user-select: none;
  border: 1px solid var(--border-2);
  color: var(--text-2);
  background: var(--glass-bg);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
}

.btn:hover {
  color: var(--text-1);
  border-color: var(--border-3);
  background: var(--glass-bg-2);
}

.btn:active { transform: scale(0.97); transition-duration: var(--t-fast); }

.btn-primary {
  background: rgba(0, 232, 122, 0.12);
  border-color: var(--accent-border);
  color: var(--accent);
}

.btn-primary:hover {
  background: rgba(0, 232, 122, 0.2);
  box-shadow: var(--shadow-accent);
  color: var(--accent);
}

.btn-sm { padding: 7px 14px; font-size: 12px; border-radius: var(--r-sm); }
.btn-lg { padding: 13px 24px; font-size: 15px; border-radius: var(--r-lg); }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-3);
}
.btn-ghost:hover { color: var(--text-1); background: var(--glass-bg); border-color: var(--border-1); }

/* ─────────────────────────────────────────────────────────────
   INPUTS
───────────────────────────────────────────────────────────── */

.input {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-family: var(--font-ui);
  color: var(--text-1);
  background: var(--glass-bg);
  border: 1px solid var(--border-2);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  transition: border-color var(--t-base), box-shadow var(--t-base);
}

.input::placeholder { color: var(--text-3); }

.input:focus {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-glow-2);
}

/* ─────────────────────────────────────────────────────────────
   SECTION DIVIDERS
───────────────────────────────────────────────────────────── */

.sec-label {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
  padding: 0 var(--page-px);
}

.sec-label-text {
  font-family: var(--font-data);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-3);
  white-space: nowrap;
}

.sec-label-action {
  font-size: 12px;
  color: var(--accent);
  margin-left: auto;
  white-space: nowrap;
}

/* ─────────────────────────────────────────────────────────────
   STAT CELLS — compact metric blocks
───────────────────────────────────────────────────────────── */

.stat-strip {
  display: grid;
  gap: 1px;
  background: var(--border-1);
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--border-1);
}

/* `1fr` is shorthand for minmax(auto, 1fr), and a grid track's auto MINIMUM
   refuses to shrink below its content. Four stat columns need 422px of
   content, so they overflowed every container that holds them — including
   the player modal's own 416px sheet — and .stat-strip's overflow:hidden
   then CLIPPED the last stat away silently. "Est. FSP" was invisible on
   desktop; on a 320px phone both "Kills" and "Est. FSP" were gone.
   minmax(0, 1fr) lets tracks shrink so nothing is ever clipped.

   cols-4 also WRAPS TO 2×2 at every width: measured, four stat values
   ("142.95M") cannot fit four-across in a 460px modal sheet even at a
   reduced font size — the value text overflows its own cell. 2×2 is the
   only layout that renders all four stats intact from 320px up. */
.stat-strip.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat-strip.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.stat-cell {
  background: var(--glass-bg);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  padding: 14px 12px;
  text-align: center;
  position: relative;
}

.stat-cell::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--glass-shine), transparent);
}

.stat-val {
  font-family: var(--font-ui);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1;
  letter-spacing: -0.5px;
}

.stat-val-accent { color: var(--accent); }
.stat-val-amber  { color: var(--amber); }
.stat-val-red    { color: var(--red); }

.stat-lbl {
  font-family: var(--font-data);
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-3);
  margin-top: 5px;
}

/* ─────────────────────────────────────────────────────────────
   ALLIANCE TAG — small identifier pill
───────────────────────────────────────────────────────────── */

.alliance-tag {
  font-family: var(--font-data);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--glass-bg-3);
  border: 1px solid var(--border-1);
  color: var(--text-2);
  display: inline-block;
  white-space: nowrap;
}

/* ─────────────────────────────────────────────────────────────
   PROGRESS / LWS BAR
───────────────────────────────────────────────────────────── */

.bar-track {
  height: 3px;
  background: var(--border-1);
  border-radius: 2px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
  transition: width var(--t-slow) var(--ease);
}

.bar-fill-dim  { background: var(--text-3); }
.bar-fill-amber { background: var(--amber); }
.bar-fill-red  { background: var(--red); }

/* ─────────────────────────────────────────────────────────────
   SCROLLBAR — thin, minimal
───────────────────────────────────────────────────────────── */

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-3); }

/* ─────────────────────────────────────────────────────────────
   UTILITIES
───────────────────────────────────────────────────────────── */

.hidden   { display: none !important; }
.sr-only  { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.truncate { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.flex        { display: flex; }
.flex-col    { display: flex; flex-direction: column; }
.items-center{ align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--sp-1); }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }

/* Spacing helpers */
.px-page     { padding-left: var(--page-px); padding-right: var(--page-px); }
.mb-section  { margin-bottom: var(--sp-5); }

/* Horizontal scroll strip */
.h-scroll {
  display: flex;
  gap: var(--sp-3);
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 var(--page-px);
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.h-scroll::-webkit-scrollbar { display: none; }
.h-scroll > * { scroll-snap-align: start; flex-shrink: 0; }

/* ─────────────────────────────────────────────────────────────
   LOADER — fullscreen page loading state
───────────────────────────────────────────────────────────── */

.page-loader {
  position: fixed;
  inset: 0;
  background: var(--bg-root);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  z-index: 9999;
  transition: opacity var(--t-slow) var(--ease);
}

.page-loader.hidden {
  opacity: 0;
  pointer-events: none;
}

.loader-ring {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--border-2);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

.loader-text {
  font-family: var(--font-data);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-3);
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─────────────────────────────────────────────────────────────
   ANIMATIONS
───────────────────────────────────────────────────────────── */

@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes scale-in {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 8px rgba(0, 232, 122, 0.2); }
  50%       { box-shadow: 0 0 20px rgba(0, 232, 122, 0.45); }
}

.animate-fade-in  { animation: fade-in  var(--t-slow) var(--ease) both; }
.animate-fade-up  { animation: fade-up  var(--t-slow) var(--ease) both; }
.animate-scale-in { animation: scale-in var(--t-slow) var(--ease) both; }

/* Stagger helpers */
.delay-1 { animation-delay: 50ms; }
.delay-2 { animation-delay: 100ms; }
.delay-3 { animation-delay: 150ms; }
.delay-4 { animation-delay: 200ms; }
.delay-5 { animation-delay: 250ms; }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ─────────────────────────────────────────────────────────────
   MOBILE PADDING ADJUSTMENTS
   (content must clear the bottom nav on mobile)
───────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .mobile-pb { padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 20px); }
}

/* ─────────────────────────────────────────────────────────────
   TIMEZONE PICKER SHEET (js/zone-picker.js, `zp-` prefix)

   Lives in base.css, not a page sheet: /wartime (wartime.css) and
   /home + /president (home.css) both import the module, and per
   DESIGN.md two page stylesheets must never co-load. Follows the
   bottom-sheet idiom already used by the intel / ranking modals.
───────────────────────────────────────────────────────────── */

.zp-overlay {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: flex;
  align-items: flex-end;
  background: rgba(8, 10, 15, 0.85);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
}
.zp-overlay.hidden { display: none; }

.zp-sheet {
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-1);
  border-top: 1px solid var(--border-2);
  border-radius: var(--r-2xl) var(--r-2xl) 0 0;
  padding: 12px var(--page-px) calc(var(--safe-bottom) + 12px);
  animation: slide-up var(--t-slow) var(--ease) both;
}

.zp-handle {
  width: 36px; height: 4px;
  flex: none;
  margin: 0 auto 14px;
  border-radius: 2px;
  background: var(--border-2);
}

.zp-head {
  flex: none;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.zp-title { font: 700 16px/1.2 var(--font-ui); color: var(--text-1); }
.zp-count { margin-top: 3px; font: 600 11.5px/1 var(--font-data); color: var(--accent); }
.zp-close {
  flex: none;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border-1);
  background: var(--glass-bg-3);
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
}
.zp-close:hover { color: var(--text-1); background: var(--border-1); }

.zp-hint {
  flex: none;
  margin: 10px 0 4px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-3);
}

.zp-body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0 8px;
}

.zp-group {
  margin: 12px 0 6px;
  font: 700 10.5px/1 var(--font-data);
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--text-3);
}
.zp-group:first-child { margin-top: 0; }

.zp-row {
  width: 100%;
  min-height: 48px;                 /* thumb target */
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  margin-bottom: 6px;
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  background: var(--glass-bg);
  color: var(--text-2);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast), color var(--t-fast);
}
.zp-row.on {
  border-color: var(--accent-border);
  background: var(--accent-glow-2);
  color: var(--text-1);
}

.zp-tick {
  flex: none;
  width: 18px; height: 18px;
  border-radius: 5px;
  border: 1.5px solid var(--border-2);
  position: relative;
}
.zp-row.on .zp-tick { border-color: var(--accent); background: var(--accent); }
.zp-row.on .zp-tick::after {
  content: '';
  position: absolute;
  left: 5px; top: 1px;
  width: 4px; height: 9px;
  border: solid var(--bg-0);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.zp-label { flex: 1 1 auto; font: 600 13.5px/1.3 var(--font-ui); }
.zp-time  { flex: none; font: 600 12.5px/1 var(--font-data); color: var(--text-3); }
.zp-row.on .zp-time { color: var(--accent); }

.zp-foot { flex: none; padding-top: 10px; }
.zp-done { width: 100%; }

/* Desktop keeps the chip grid; the sheet is a phone affordance. */
@media (min-width: 769px) {
  .zp-overlay { align-items: center; padding: 24px; }
  .zp-sheet { max-width: 420px; margin: 0 auto; border-radius: var(--r-2xl); border: 1px solid var(--border-2); }
  .zp-handle { display: none; }
}

/* ── Custom select — one look for EVERY dropdown, site-wide ─────
   The closed control is fully ours (flat surface, token border, LWS
   chevron); the opened list stays native — on phones that's the OS
   picker, which is the best UX for our mobile-heavy audience.
   `select[class]` (0-1-1) outguns single-class rules like .hm-input
   (0-1-0), so the chevron + appearance survive page-level classes
   that set `background:`/`padding:` shorthands. */
select, select[class] {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2398a2b3' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 32px;
  cursor: pointer;
}
/* Canonical look for selects that carry no page class of their own. */
select {
  background-color: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: 10px;
  padding: 9px 32px 9px 12px;
  color: var(--text-1);
  font: 500 14px/1.2 var(--font-ui);
}
select:focus-visible { outline: none; border-color: var(--accent); }
/* Desktop option lists inherit the surface; mobile uses the OS sheet. */
select option { background-color: var(--bg-2); color: var(--text-1); }
