/* ============================================================================
 * Last War Tracker — Tactical Command Center theme
 * Retro-futurism / dark mode, optimized for data-dense game intelligence.
 * ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@600;700;900&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* Material Symbols Outlined — self-hosted variable font (whole catalogue
   in one file, no CDN dependency). Variable axes: opsz / wght / FILL / GRAD.
   font-display: block holds painting until the font is ready, so ligatures
   like content_copy / shield_lock / gpp_bad render correctly on first paint
   instead of showing the literal text fallback. */
@font-face {
  font-family: 'Material Symbols Outlined';
  font-style: normal;
  font-weight: 100 700;
  font-display: block;
  src: url('/static/fonts/MaterialSymbolsOutlined.woff2') format('woff2-variations'),
       url('/static/fonts/MaterialSymbolsOutlined.woff2') format('woff2');
}

/* --- Design tokens --- */
:root {
  /* Surfaces */
  --bg:           #020617;
  --bg-grid:      #0a1020;
  --surface:      #0f172a;
  --surface-2:    #131c33;
  --elevated:     #1a253f;
  --border:       #1f2a44;
  --border-soft:  #15203a;

  /* Text */
  --text:         #e6edf7;
  --text-muted:   #8b9bb8;
  --text-dim:     #5a6a85;

  /* Accents */
  --accent:       #22d39a;          /* primary success / active */
  --accent-glow:  rgba(34, 211, 154, 0.35);
  --primary:      #38bdf8;          /* cyan info */
  --primary-glow: rgba(56, 189, 248, 0.35);
  --warning:      #f59e0b;
  --danger:       #ef4444;
  --danger-glow:  rgba(239, 68, 68, 0.35);
  --gold:         #fbbf24;
  --silver:       #d4d4d8;
  --bronze:       #b45309;

  /* Effects */
  --radius-sm: 4px;
  --radius:    8px;
  --radius-lg: 12px;
  --shadow-soft:  0 1px 0 rgba(255,255,255,0.04) inset, 0 4px 24px rgba(0,0,0,0.4);
  --shadow-glow:  0 0 0 1px var(--border), 0 0 24px rgba(34, 211, 154, 0.06);
}

/* --- Base --- */
* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0.005em;
}
body {
  background-image:
    radial-gradient(circle at 15% 0%, rgba(34, 211, 154, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 95% 90%, rgba(56, 189, 248, 0.04) 0%, transparent 35%),
    linear-gradient(180deg, #020617 0%, #050b1c 100%);
  min-height: 100vh;
}

/* Subtle CRT scanlines — very faint overlay */
body::before {
  content: "";
  position: fixed; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0, transparent 2px, rgba(255,255,255,0.012) 2px, rgba(255,255,255,0.012) 3px);
  z-index: 1;
  mix-blend-mode: overlay;
}
@media (prefers-reduced-motion: reduce) {
  body::before { display: none; }
}

/* --- Topbar --- */
.app-topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 24px;
  padding: 14px 28px;
  background: linear-gradient(180deg, rgba(15,23,42,0.92) 0%, rgba(15,23,42,0.84) 100%);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 rgba(34, 211, 154, 0.15);
}
.app-brand {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: 18px;
  letter-spacing: 0.08em;
  color: var(--text);
  display: flex; align-items: center; gap: 12px;
  text-transform: uppercase;
}
.app-brand .brand-mark {
  display: inline-block; width: 10px; height: 10px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 14px var(--accent-glow), 0 0 0 4px rgba(34, 211, 154, 0.1);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { transform: scale(1); opacity: 1; }
  50%     { transform: scale(1.15); opacity: 0.7; }
}
.app-brand .brand-sub {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 400;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.2em;
  margin-left: 4px;
}
.topbar-spacer { flex: 1; }
.topbar-meta { display: flex; align-items: center; gap: 14px; }
.kingdom-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
/* --- Kingdom combobox + scan banner --- */
.kingdom-combobox { position: relative; }
.kingdom-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 320px;
  max-height: 360px;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 500;
  padding: 4px;
}
.kingdom-dropdown-item {
  display: block; width: 100%;
  padding: 8px 10px;
  background: transparent;
  border: none;
  text-align: left;
  color: var(--text);
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  border-radius: 3px;
}
.kingdom-dropdown-item:hover { background: var(--border); }
.kingdom-dropdown-item .text-dim { font-size: 11px; }
.kingdom-dropdown-empty {
  padding: 14px 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}
.kingdom-dropdown-empty .btn-scan-from-search {
  margin-top: 8px;
}

/* Send-tab warzone combobox. Same shell as the topbar kingdom picker, but it
   sits inside a form grid, so the list hangs from the LEFT edge and takes the
   control's width instead of the topbar's right-aligned 320px. */
.wz-combobox { position: relative; }
.wz-dropdown {
  left: 0;
  right: auto;
  min-width: 100%;
  max-height: 260px;
}
.kingdom-dropdown-item.is-active { background: var(--border); }

.scan-banner {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 12px;
  padding: 12px 16px;
}
.scan-banner-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.scan-banner-title { font-weight: 600; font-size: 14px; }
.scan-banner-progress {
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
}
.scan-banner.is-running .btn { opacity: 0.6; cursor: progress; }

/* Live scan progress inside the banner: overall bar + per-agent bars. */
.scan-banner { flex-wrap: wrap; }
.scan-banner-live { flex-basis: 100%; margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.scan-progress-track {
  position: relative; height: 16px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--border); overflow: hidden;
}
.scan-progress-fill {
  height: 100%; width: 0;
  display: flex; align-items: center; justify-content: flex-end;
  padding-right: 6px; box-sizing: border-box;
  font-size: 10px; font-family: 'JetBrains Mono', monospace; color: #04120c;
  background: linear-gradient(90deg, rgba(34,211,154,.75), var(--accent));
  transition: width .4s ease;
}
.scan-agents-head {
  font-size: 11px; font-family: 'JetBrains Mono', monospace;
}
.scan-agents { display: flex; flex-direction: column; gap: 4px; }
.scan-agent-row { display: flex; align-items: center; gap: 8px; }
.scan-agent-name {
  flex: 0 0 120px; font-size: 11px; font-family: 'JetBrains Mono', monospace;
  color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.scan-agent-track {
  flex: 1; height: 8px; border-radius: 4px;
  background: var(--surface-2); border: 1px solid var(--border-soft); overflow: hidden;
}
.scan-agent-fill {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, #7c5cff, #a78bfa);
  transition: width .4s ease;
}
.scan-agent-num {
  flex: 0 0 auto; font-size: 10px; font-family: 'JetBrains Mono', monospace;
  color: var(--text-dim); min-width: 54px; text-align: right;
}

/* Onboarding banner — shown until config/local.json is wired up. */
.onboarding-banner {
  display: flex; align-items: flex-start; gap: 14px;
  margin-bottom: 16px;
  padding: 14px 18px;
  border-left: 4px solid #f5a524;
  background: rgba(245, 165, 36, 0.06);
}
.onboarding-banner-icon {
  flex: 0 0 28px;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  border-radius: 50%;
  background: #f5a524;
  color: #1a1a1a;
}
.onboarding-banner-body { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.onboarding-banner-title { font-weight: 600; font-size: 14px; }
.onboarding-banner-text { font-size: 13px; line-height: 1.5; }
.onboarding-banner-text code {
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 12px;
}
.onboarding-banner-actions {
  display: flex; align-items: center; gap: 12px;
  margin-top: 4px;
}

/* --- Sortable table headers --- */
.data-table th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 18px;
}
.data-table th.sortable::after {
  content: "↕";
  position: absolute;
  right: 6px;
  opacity: 0.3;
  font-size: 10px;
}
.data-table th.sortable:hover { color: var(--accent); }
.data-table th.sortable.sort-asc::after  { content: "▲"; opacity: 1; color: var(--accent); }
.data-table th.sortable.sort-desc::after { content: "▼"; opacity: 1; color: var(--accent); }

/* --- Player row expand --- */
.btn-expand-row {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 10px;
  padding: 0 4px;
  margin-right: 4px;
  border-radius: 3px;
  vertical-align: middle;
  transition: color 0.15s, border-color 0.15s;
}
.btn-expand-row:hover { color: var(--accent); border-color: var(--border); }
.btn-expand-row.expanded { color: var(--accent); }

.player-detail-row > td {
  background: var(--bg);
  border-bottom: 1px solid var(--accent-glow, rgba(0,255,170,0.1));
  padding: 14px 18px !important;
}
.player-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px 24px;
}
.player-detail-section {
  background: var(--bg-elev, rgba(255,255,255,0.02));
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.player-detail-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 6px;
}
.player-detail-list {
  margin: 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 12px;
}
.player-detail-list dt {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}
.player-detail-list dd {
  margin: 0;
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  word-break: break-all;
}

.kingdom-select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
  min-width: 280px;
  transition: border-color 150ms, box-shadow 150ms;
  cursor: pointer;
}
.kingdom-select:hover { border-color: var(--accent); }
.kingdom-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* --- Tabs --- */
.tabbar {
  display: flex; gap: 2px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky; top: 60px; z-index: 40;
}
.tab-link {
  padding: 14px 20px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-decoration: none;
  position: relative;
  transition: color 150ms;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
}
.tab-link::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px; bottom: -1px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 200ms ease-out;
  box-shadow: 0 0 12px var(--accent-glow);
}
.tab-link:hover { color: var(--text); }
.tab-link.active { color: var(--accent); }
.tab-link.active::after { transform: scaleX(1); }
.tab-link .tab-icon { font-family: 'JetBrains Mono', monospace; font-size: 11px; opacity: 0.6; }

/* Watch and Trace is what the product is FOR — it should not read as the third
   of five equal things. Cyan rather than the active-green, so it stays visibly
   different in kind even while another tab is selected, and it keeps a faint
   underline when inactive instead of relying on colour alone. */
.tab-link.is-primary-tab { color: var(--primary); font-weight: 600; }
.tab-link.is-primary-tab:hover,
.tab-link.is-primary-tab.active { color: #7dd3fc; }
.tab-link.is-primary-tab::after {
  background: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
}
.tab-link.is-primary-tab:not(.active)::after { transform: scaleX(1); opacity: 0.25; }
.tab-link.is-primary-tab .tab-icon { opacity: 0.85; }

/* --- Content --- */
.content {
  padding: 24px 28px 64px;
  max-width: 1800px;
  margin: 0 auto;
  position: relative; z-index: 2;
}
.tab-pane.d-none { display: none !important; }
.d-none { display: none !important; }
.section-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin: 0 0 14px;
  display: flex; align-items: center; gap: 12px;
}
.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border) 0%, transparent 100%);
}

/* --- Grid system --- */
.grid { display: grid; gap: 16px; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1024px) { .grid-cols-4, .grid-cols-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-cols-3 { grid-template-columns: 1fr; } }
@media (max-width: 640px)  { .grid-cols-2, .grid-cols-3, .grid-cols-4, .grid-cols-6 { grid-template-columns: 1fr; } }

/* --- Cards --- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
  transition: border-color 200ms, transform 200ms;
}
.card:hover { border-color: var(--border-soft); }
.card-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin: 0 0 12px;
}

/* Stat tiles */
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
  transition: border-color 200ms, transform 200ms;
}
.stat-tile::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}
.stat-tile.is-warning::before { background: var(--warning); box-shadow: 0 0 12px rgba(245, 158, 11, 0.4); }
.stat-tile.is-danger::before  { background: var(--danger); box-shadow: 0 0 12px var(--danger-glow); }
.stat-tile.is-info::before    { background: var(--primary); box-shadow: 0 0 12px var(--primary-glow); }
.stat-tile:hover { transform: translateY(-1px); border-color: var(--border-soft); }
.stat-tile .stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}
.stat-tile .stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}
.stat-tile .stat-sub {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
  font-family: 'JetBrains Mono', monospace;
}

/* --- Toolbar (filters) --- */
.toolbar {
  display: flex; gap: 10px; flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 16px;
  align-items: center;
}
.toolbar input,
.toolbar select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  transition: border-color 150ms, box-shadow 150ms;
}
.toolbar input::placeholder { color: var(--text-dim); }
.toolbar input:focus, .toolbar select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.toolbar input { min-width: 180px; }
.toolbar input[type=number] { min-width: 120px; }
.toolbar .spacer { flex: 1; }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 150ms;
  font-family: inherit;
  text-decoration: none;
}
.btn-primary {
  background: var(--accent);
  color: #052012;
  box-shadow: 0 0 16px var(--accent-glow);
}
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-danger {
  background: var(--danger);
  color: #2a0808;
  box-shadow: 0 0 16px var(--danger-glow);
}
.btn-danger:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

.btn-copy-uid {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 4px;
  margin-left: 6px;
  font-size: 12px;
  line-height: 1;
  border-radius: 3px;
  vertical-align: middle;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.btn-copy-uid:hover { color: var(--text); border-color: var(--border); }
.btn-copy-uid.copied { color: var(--accent); border-color: var(--accent); }
.btn-copy-uid.failed { color: #e57373; border-color: #e57373; }

/* Per-row refresh button (refresh this player's data via their alliance). */
.btn-refresh-row {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 5px;
  margin-left: 4px;
  font-size: 12px;
  line-height: 1;
  border-radius: 3px;
  vertical-align: middle;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.btn-refresh-row:hover { color: var(--accent); border-color: var(--border); }
.btn-refresh-row.copied { color: var(--accent); border-color: var(--accent); }
.btn-refresh-row.failed { color: #e57373; border-color: #e57373; }
.btn-refresh-row:disabled { cursor: progress; opacity: 0.7; }

/* Spin animation for refresh buttons during a scan request. */
@keyframes spin-cw { to { transform: rotate(360deg); } }
.spinning { animation: spin-cw 1s linear infinite; display: inline-block; }
.btn-refresh-row.spinning,
.btn-refresh-alliance.spinning,
.btn-refresh-alliance .spinning {
  animation: spin-cw 1s linear infinite;
  display: inline-block;
}

/* Dim a table while it's being refreshed, so the row reload feels intentional. */
.is-refreshing tbody { opacity: 0.45; transition: opacity 0.15s; pointer-events: none; }
.is-refreshing tbody::after { content: ""; }   /* placeholder for future overlay */

/* Larger inline spinner used in toolbar status lines (e.g. alliance scan). */
.spinner-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin-cw 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

.btn-alert-row {
  background: transparent;
  border: 1px solid transparent;
  color: var(--gold, #facc15);
  cursor: pointer;
  padding: 0 5px;
  margin-left: 4px;
  font-size: 13px;
  line-height: 1;
  border-radius: 3px;
  vertical-align: middle;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.btn-alert-row:hover { color: var(--gold, #facc15); border-color: var(--gold, #facc15); }

/* Trailing per-row "actions" cell — keeps refresh/copy/share grouped together
 * with consistent spacing instead of trailing the player name.
 */
.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.row-actions .btn-refresh-row,
.row-actions .btn-copy-uid {
  margin-left: 0;
}

/* --- Send tab --- */
.form-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 12px 16px;
  align-items: center;
}
.form-row {
  display: contents;
}
.form-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.form-control {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  transition: border-color 150ms, box-shadow 150ms;
}
.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
textarea.form-control { font-family: 'Inter', sans-serif; min-height: 70px; resize: vertical; }

/* A control must never fall back to its intrinsic size (a textarea's `cols`
   default is ~20 chars, which is what made the Send and Share message boxes
   render as a tiny misaligned box). Inline width styles still win over this. */
.form-control { width: 100%; }

/* .form-row is display:contents — it only works as a direct child of the grid,
   where its label + control become the two grid columns. Outside a grid the
   label box vanishes and the control collapses, so standalone rows use
   .form-block instead: label stacked above a full-width control, which is the
   right shape for a multi-line field anyway. */
.form-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
/* Multi-line controls: align the label to the first line, not the box's middle. */
.form-grid > .form-row.is-tall > .form-label { align-self: start; padding-top: 9px; }

.send-results {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 280px;
  overflow-y: auto;
}
.send-result-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  transition: border-color 150ms, background 150ms;
}
.send-result-row:hover { border-color: var(--accent); background: var(--bg-elev, var(--bg)); }
.send-result-name { font-weight: 600; flex: 1; min-width: 100px; }

.send-target {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent-glow);
}
.send-target-header { display: flex; align-items: center; gap: 10px; }
.send-target-name { font-weight: 600; font-size: 14px; }
.send-target-uid { margin-top: 6px; font-size: 12px; color: var(--text-muted); }

.send-stages { font-size: 13px; color: var(--text); }
.send-stage { display: flex; align-items: center; gap: 8px; }
.send-stage-active .send-stage-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent);
  animation: send-pulse 1.4s ease-out infinite;
}
@keyframes send-pulse {
  0%   { box-shadow: 0 0 0 0 var(--accent-glow); }
  100% { box-shadow: 0 0 0 12px transparent; }
}

.send-result { margin-top: 12px; }
.send-result-ok   { color: var(--accent); font-size: 14px; font-weight: 600; }
.send-result-fail { color: #e57373; font-size: 14px; font-weight: 600; }
.status-ok   { color: var(--accent); }
.status-fail { color: #e57373; }

/* --- Share-coords per-row button + modal --- */
.btn-share-row {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 8px;
  font-size: 11px;
  line-height: 1.4;
  border-radius: 3px;
  font-family: 'Inter', sans-serif;
  transition: all 0.15s;
}
.btn-share-row:hover { color: var(--accent); border-color: var(--accent); }

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: min(560px, 95vw);
  max-height: 85vh;
  display: flex; flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 16px 18px; overflow-y: auto; flex: 1; }
.modal-footer {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; border-top: 1px solid var(--border);
}
.modal-target { font-size: 12px; }
.btn-icon {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 16px; padding: 4px 8px; border-radius: 3px;
}
.btn-icon:hover { color: var(--text); background: var(--border); }

/* --- Tables --- */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table thead th {
  background: var(--surface-2);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  white-space: nowrap;
}
.data-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}
.data-table tbody tr:hover td { background: rgba(34, 211, 154, 0.04); }
.data-table .num { font-family: 'JetBrains Mono', monospace; text-align: right; }
.data-table .mono { font-family: 'JetBrains Mono', monospace; }
.data-table .text-end { text-align: right; }
.data-table .text-nowrap { white-space: nowrap; }

/* Scrollable table region */
.table-scroll {
  max-height: 70vh;
  overflow: auto;
}

/* --- Badges --- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: 'JetBrains Mono', monospace;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-alliance {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
  font-weight: 700;
}
.badge-success { background: rgba(34, 211, 154, 0.12); color: var(--accent); border-color: rgba(34, 211, 154, 0.3); }
.badge-warning { background: rgba(245, 158, 11, 0.12); color: var(--warning); border-color: rgba(245, 158, 11, 0.3); }
.badge-danger  { background: rgba(239, 68, 68, 0.12);  color: var(--danger);  border-color: rgba(239, 68, 68, 0.3); }
.badge-info    { background: rgba(56, 189, 248, 0.12); color: var(--primary); border-color: rgba(56, 189, 248, 0.3); }
.badge-muted   { background: var(--surface-2); color: var(--text-muted); border-color: var(--border); }
.badge-running { background: rgba(34, 211, 154, 0.12); color: var(--accent); border-color: var(--accent); animation: badge-pulse 1.6s ease-in-out infinite; }
.badge-busy    { background: rgba(124, 92, 255, 0.15); color: #a78bfa; border-color: rgba(124, 92, 255, 0.4); animation: badge-pulse 1.6s ease-in-out infinite; }
@keyframes badge-pulse {
  0%,100% { box-shadow: 0 0 0 0 var(--accent-glow); }
  50%     { box-shadow: 0 0 0 6px rgba(34, 211, 154, 0); }
}

/* Mission rarity badges */
.rarity-Blue     { background: rgba(56, 189, 248, 0.15); color: var(--primary); border-color: rgba(56, 189, 248, 0.4); }
.rarity-Purple   { background: rgba(167, 139, 250, 0.15); color: #a78bfa; border-color: rgba(167, 139, 250, 0.4); }
.rarity-Gold     { background: rgba(251, 191, 36, 0.15); color: var(--gold);   border-color: rgba(251, 191, 36, 0.4); }
.rarity-GoldStar { background: rgba(251, 191, 36, 0.25); color: var(--gold); border: 1px solid rgba(251, 191, 36, 0.7); box-shadow: 0 0 6px rgba(251, 191, 36, 0.3); font-weight: 800; }
.rarity-Silver   { background: rgba(212, 212, 216, 0.12); color: var(--silver); border-color: rgba(212, 212, 216, 0.3); }
.rarity-Bronze   { background: rgba(180, 83, 9, 0.15);   color: #fbbf24; border-color: rgba(180, 83, 9, 0.4); }
.rarity-Iron     { background: var(--surface-2); color: var(--text-muted); border-color: var(--border); }

/* --- Status icons in player table --- */
.status-icons { display: inline-flex; gap: 6px; align-items: center; }
.status-icons span { font-size: 11px; font-family: 'JetBrains Mono', monospace; }
.status-shield   { color: var(--accent); }
.status-gather   { color: var(--gold); }
.status-mud      { color: var(--danger); }
.status-march    { color: var(--primary); }

/* Always-rendered shield icon — green when ON (active), gray when OFF.
 * Used for both the Players tab and the Alliance Roster member rows. */
.shield-icon {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
}
.shield-icon.on {
  color: var(--accent);
  text-shadow: 0 0 6px var(--accent-glow);
}
.shield-icon.off {
  color: var(--text-muted);
  opacity: 0.55;
  filter: grayscale(1);
}

.alliance-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px 24px;
  font-size: 12px;
}
.alliance-meta-grid .text-dim { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; }

/* Alliance grid (clickable cards) */
.alliance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.alliance-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s, box-shadow 0.15s;
  font-family: 'Inter', sans-serif;
  text-align: left;
}
.alliance-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--accent-glow);
}
.alliance-card .ac-abbr {
  font-size: 18px; font-weight: 700; color: var(--text);
  font-family: 'JetBrains Mono', monospace;
}
.alliance-card .ac-row {
  display: flex; justify-content: space-between;
  font-size: 12px; margin-top: 6px; color: var(--text-muted);
}
.alliance-card .ac-row strong { color: var(--text); font-weight: 600; }
.alliance-card .ac-row.ac-row-meta {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
  font-size: 11px;
}
.alliance-card .ac-row.ac-row-meta strong {
  color: var(--text-muted);
  font-weight: 500;
  font-family: 'JetBrains Mono', monospace;
}

/* Rank badge in the top-right corner of each card. Top 3 get medals. */
.alliance-card { position: relative; }
.alliance-rank-badge {
  position: absolute;
  top: 8px; right: 10px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.2);
  display: flex; align-items: center; gap: 4px;
}
.alliance-rank-badge .medal { font-size: 14px; line-height: 1; }
.alliance-rank-badge.gold {
  color: #FFD700; border-color: #FFD700;
  background: rgba(255,215,0,0.10);
  text-shadow: 0 0 6px rgba(255,215,0,0.4);
}
.alliance-rank-badge.silver {
  color: #C0C0C0; border-color: #C0C0C0;
  background: rgba(192,192,192,0.08);
}
.alliance-rank-badge.bronze {
  color: #CD7F32; border-color: #CD7F32;
  background: rgba(205,127,50,0.10);
}
.alliance-card.podium-gold   { border-color: rgba(255,215,0,0.55); }
.alliance-card.podium-silver { border-color: rgba(192,192,192,0.55); }
.alliance-card.podium-bronze { border-color: rgba(205,127,50,0.55); }
.alliance-card.podium-gold .ac-abbr,
.alliance-card.podium-silver .ac-abbr,
.alliance-card.podium-bronze .ac-abbr { padding-right: 60px; }
.alliance-card .ac-abbr { padding-right: 50px; }

.alliance-grid-footer {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 14px 16px;
  margin-top: 4px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
}
.alliance-grid-footer .footer-count {
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

/* Alliance summary stat row inside the roster view */
.alliance-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px 24px;
}
.alliance-stat {
  display: flex; flex-direction: column; gap: 2px;
}
.alliance-stat .stat-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted);
}
.alliance-stat .stat-value {
  font-size: 18px; font-weight: 700; color: var(--text);
  font-family: 'JetBrains Mono', monospace;
}
.alliance-stat .stat-sub {
  font-size: 11px; color: var(--text-muted);
}

.thp-rank {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 10px;
  border-radius: 8px;
  background: var(--accent-glow, rgba(0,255,170,0.12));
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
  vertical-align: middle;
}

/* --- Map --- */
#map {
  height: 76vh;
  background: #050b1c;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.leaflet-container { background: #020617 !important; }
.map-wrap { position: relative; }
.map-watch-hint {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  z-index: 500; pointer-events: none;
  padding: 5px 12px; border-radius: 999px;
  font-size: 12px; font-family: 'JetBrains Mono', monospace;
  color: #22d39a; background: rgba(5, 11, 28, 0.88);
  border: 1px solid rgba(34, 211, 154, 0.5);
  box-shadow: 0 2px 12px rgba(0,0,0,.4);
  animation: badge-pulse 1.8s ease-in-out infinite;
}
.leaflet-popup-content-wrapper {
  background: var(--elevated) !important;
  color: var(--text) !important;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
}
.leaflet-popup-tip { background: var(--elevated) !important; }

/* --- Bulk Scan progress --- */
.progress-shell {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  height: 28px;
  position: relative;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--primary) 100%);
  box-shadow: 0 0 16px var(--accent-glow);
  transition: width 600ms ease-out;
  position: relative;
  display: flex; align-items: center; justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  color: #052012;
  letter-spacing: 0.1em;
}
.progress-fill.is-running::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.25) 50%, transparent 100%);
  animation: shimmer 2s linear infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* --- Raw log block --- */
.raw-log {
  background: #050b1c;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  line-height: 1.6;
  max-height: 50vh;
  overflow: auto;
  white-space: pre-wrap;
}

/* --- Empty / loading states --- */
.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 20px;
  font-size: 13px;
}
.empty .empty-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 14px;
  letter-spacing: 0.16em;
  color: var(--text);
  margin-bottom: 8px;
  text-transform: uppercase;
}

/* --- Form switch (Bootstrap-compatible) --- */
.switch {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
}
.switch input { accent-color: var(--accent); }

/* --- Pill-style ON/OFF toggle --- */
.toggle-switch {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer; user-select: none;
  font-size: 12px; color: var(--text-muted);
}
.toggle-switch input { display: none; }
.toggle-switch .toggle-track {
  position: relative;
  width: 36px; height: 18px;
  background: var(--border);
  border-radius: 999px;
  transition: background 0.15s ease;
  flex-shrink: 0;
}
.toggle-switch .toggle-track::after {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  background: #fff;
  border-radius: 50%;
  top: 2px; left: 2px;
  transition: left 0.15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.toggle-switch input:checked + .toggle-track { background: var(--accent); }
.toggle-switch input:checked + .toggle-track::after { left: 20px; }
.toggle-switch .toggle-state {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700; font-size: 10px; letter-spacing: 0.5px;
  padding: 2px 6px; border-radius: 4px;
  background: var(--border-soft); color: var(--text-dim);
}
.toggle-switch input:checked ~ .toggle-state {
  background: var(--accent); color: #0b1426;
}

/* --- Filter chip group (multi-select checkboxes) --- */
.filter-group {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.filter-group-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
  color: var(--text-dim);
  text-transform: uppercase;
  padding-right: 4px;
  border-right: 1px solid var(--border-soft);
  margin-right: 2px;
}
.filter-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  font-size: 11px; font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-dim);
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}
.filter-chip input { display: none; }
.filter-chip:hover { background: var(--border-soft); color: var(--text); }
.filter-chip:has(input:checked) {
  background: var(--accent);
  color: #0b1426;
  border-color: var(--accent);
}

/* Mission rarity color hints inside chips */
.filter-chip[data-mfilter="rarity"] { /* base styling via CSS attr */ }

/* --- Status filter (segmented button group) --- */
.status-filter {
  display: inline-flex; gap: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
}
.status-filter .btn-status {
  border: 0; background: transparent; color: var(--text-muted);
  padding: 6px 12px; font-size: 11px; font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.5px; cursor: pointer;
  border-right: 1px solid var(--border-soft);
  transition: background 0.1s, color 0.1s;
}
.status-filter .btn-status:last-child { border-right: 0; }
.status-filter .btn-status:hover { background: var(--border-soft); color: var(--text); }
.status-filter .btn-status.active { background: var(--accent); color: #0b1426; }

/* --- Health monitor cards --- */
.health-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: border-color 200ms;
}
.health-card::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--text-dim);
}
.health-card.health-up::before { background: var(--accent); box-shadow: 0 0 12px var(--accent-glow); }
.health-card.health-degraded::before { background: var(--warning); box-shadow: 0 0 12px rgba(245, 158, 11, 0.4); }
.health-card.health-down::before { background: var(--danger); box-shadow: 0 0 12px var(--danger-glow); }

.health-card-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-soft);
}
.health-card-title {
  margin: 0;
  font-family: 'Orbitron', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text);
  text-transform: uppercase;
}
.health-card-body { display: flex; flex-direction: column; gap: 8px; }
.health-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px;
  gap: 12px;
}
.health-row-label {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 10.5px;
  flex-shrink: 0;
}
.health-row-value {
  color: var(--text);
  text-align: right;
  word-break: break-all;
}
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }

/* Utility */
.text-end { text-align: right; }
.text-nowrap { white-space: nowrap; }
.text-muted { color: var(--text-muted) !important; }
.text-dim { color: var(--text-dim) !important; }
.flex { display: flex; align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.ml-auto { margin-left: auto; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.py-3 { padding-top: 12px; padding-bottom: 12px; }

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* Stat-tile success variant — for fresh snapshot indicator */
.stat-tile.is-success::before {
  background: var(--accent);
  box-shadow: 0 0 16px rgba(34, 211, 154, 0.6);
}

/* Freshness dot for "Last seen" column */
.freshness-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.freshness-fresh {
  background: #22d39a;
  box-shadow: 0 0 6px rgba(34, 211, 154, 0.7);
  animation: fresh-pulse 1.6s ease-in-out infinite;
}
.freshness-stale { background: #5a6a85; }
.text-fresh { color: #22d39a; font-weight: 600; }

@keyframes fresh-pulse {
  0%, 100% { box-shadow: 0 0 4px rgba(34, 211, 154, 0.5); transform: scale(1); }
  50%      { box-shadow: 0 0 12px rgba(34, 211, 154, 1);   transform: scale(1.15); }
}

/* --- Celebration banner --- */
.celebration-banner {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(-180%);
  z-index: 9999;
  min-width: 380px;
  max-width: 560px;
  padding: 16px 56px 16px 24px;
  border-radius: 14px;
  background: linear-gradient(120deg, #22d39a 0%, #38bdf8 25%, #a78bfa 50%, #f472b6 75%, #fbbf24 100%);
  background-size: 300% 300%;
  animation: celebration-shimmer 4s linear infinite;
  color: #0b1224;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.45),
              0 0 0 1px rgba(255, 255, 255, 0.25) inset,
              0 0 40px rgba(34, 211, 154, 0.5);
  cursor: pointer;
  transition: transform 0.6s cubic-bezier(0.2, 0.85, 0.3, 1.4), opacity 0.35s ease;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}
.celebration-banner-show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.celebration-content { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.celebration-text {
  font-size: 15px;
  letter-spacing: 0.2px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}
.celebration-sub {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.78;
  font-family: 'JetBrains Mono', monospace;
}
.celebration-emoji {
  font-size: 28px;
  display: inline-block;
  animation: celebration-bounce 0.9s ease-in-out infinite alternate;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3));
}
.celebration-emoji-r { animation-delay: 0.4s; }
.celebration-close {
  position: absolute;
  top: 8px; right: 10px;
  background: transparent;
  border: 0;
  color: rgba(11, 18, 36, 0.55);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}
.celebration-close:hover { color: #0b1224; }

.celebration-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  border-radius: 14px;
}
.celebration-confetti::before,
.celebration-confetti::after {
  content: "";
  position: absolute;
  width: 8px; height: 8px;
  opacity: 0;
}
.celebration-banner-show .celebration-confetti::before {
  left: 12%; top: -10%;
  background: #fff;
  animation: confetti-fall 2.6s ease-in 0.2s 2;
}
.celebration-banner-show .celebration-confetti::after {
  left: 78%; top: -10%;
  background: #ffe066;
  animation: confetti-fall 2.4s ease-in 0.5s 2;
}

@keyframes celebration-shimmer {
  0%   { background-position:   0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position:   0% 50%; }
}
@keyframes celebration-bounce {
  from { transform: translateY(0)  rotate(-6deg); }
  to   { transform: translateY(-6px) rotate(8deg); }
}
@keyframes confetti-fall {
  0%   { opacity: 0; transform: translateY(0) rotate(0deg); }
  10%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(120px) rotate(540deg); }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* Squad lineup cards (Player Details → Squads section) */
.squad-block {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 10px;
}
.squad-block-header {
  display: flex;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.squad-heroes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 10px;
  justify-items: center;
}
/* One scouted hero: card art + name + rank/weapon caption underneath. */
.sqhero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 84px;
  text-align: center;
}
.sqhero .herocard { --herocard-w: 78px; }
.sqhero-name {
  font-weight: 600;
  color: var(--text);
  font-size: 11px;
  line-height: 1.15;
  word-break: break-word;
}
.sqhero-sub {
  color: var(--text-dim);
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
}
/* UAV chip in the squad header: level-banded drone icon + level/equip text. */
.uav-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.uav-icon {
  width: 30px;
  height: 30px;
  object-fit: contain;
  border-radius: 6px;
  background: rgba(120, 170, 255, 0.12);
  padding: 1px;
}

/* "Scouted" indicator — set on rows whose uid has cached squad data in
   player_squads. Lives in the row-actions cell, immediately left of Share,
   so intel + action icons cluster together. Material Symbols chess_knight
   with a gold glow that breathes once every ~2.4s. */
.scouted-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  margin: 0 2px;
  color: #ffd54a;
  font-size: 18px;
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
  text-shadow: 0 0 3px rgba(255, 213, 74, 0.4);
  cursor: help;
  vertical-align: middle;
  animation: scouted-glow 3.2s ease-in-out infinite;
}
@keyframes scouted-glow {
  0%, 100% { text-shadow: 0 0 3px rgba(255, 213, 74, 0.35); }
  50%      { text-shadow: 0 0 5px rgba(255, 213, 74, 0.55); }
}
/* Invisible spacer matching .scouted-badge dimensions — emitted on rows
   that don't have cached squads, so the Share button stays aligned with
   rows that do. Same width/height/margin as the real badge. */
.scouted-badge-empty {
  display: inline-block;
  width: 24px;
  height: 24px;
  margin: 0 2px;
  vertical-align: middle;
}

/* Material Symbols sizing inside row buttons + shield indicator. The
   default font-size of the parent button/span is much smaller than the
   Material default 24px, so we constrain it here to match the existing
   layout density. */
.btn-copy-uid .material-symbols-outlined {
  font-size: 14px;
  vertical-align: -3px;
  font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 20;
}
.btn-alert-row .material-symbols-outlined {
  font-family: 'Material Symbols Outlined' !important;
  font-feature-settings: 'liga' !important;
  font-size: 14px;
  vertical-align: -3px;
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 20;
}
.shield-icon .material-symbols-outlined {
  /* Explicitly re-state font-family + ligature here — the parent
     .shield-icon sets font-family: 'JetBrains Mono', and although the
     general .material-symbols-outlined rule should override, some browsers
     prefer the parent's font when the inner rule doesn't restate it. */
  font-family: 'Material Symbols Outlined' !important;
  font-feature-settings: 'liga' !important;
  -webkit-font-feature-settings: 'liga' !important;
  font-size: 14px;
  vertical-align: -3px;
  font-variation-settings: 'FILL' 1, 'wght' 600, 'GRAD' 0, 'opsz' 20;
}
.shield-icon.on .material-symbols-outlined {
  color: var(--accent, #22d39a);
  text-shadow: 0 0 4px rgba(34, 211, 154, 0.6);
}
.shield-icon.off .material-symbols-outlined {
  color: rgba(255,255,255,0.25);
}

/* ---------------------------------------------------------------------------
 * Material Symbols icon system
 * --------------------------------------------------------------------------
 * Use <span class="lw-icon">refresh</span> for a generic icon. Modifiers:
 *   .lw-icon-sm / .lw-icon-md / .lw-icon-lg → 14 / 18 / 24 px
 *   .lw-icon-fill                          → filled variant (FILL=1)
 *   .lw-icon-bold                          → wght=700
 *   .lw-icon-accent / .lw-icon-danger / .lw-icon-warn / .lw-icon-dim → tint
 *   .lw-icon-glow                          → soft accent halo (active state)
 *
 * Material Symbols requires the special `material-symbols-outlined` class
 * to apply the right ligature font + opsz axis. .lw-icon adds it implicitly
 * via its descendant rule, but you can also write
 * `<span class="material-symbols-outlined lw-icon-md">refresh</span>` if
 * you prefer to spell the font class out (legacy markup uses this form).
 * ------------------------------------------------------------------------ */
.lw-icon, .material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal; font-style: normal;
  font-size: 18px;
  display: inline-block;
  line-height: 1;
  text-transform: none;
  letter-spacing: normal;
  word-wrap: normal;
  white-space: nowrap;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'liga';
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  vertical-align: -4px;
  user-select: none;
  -webkit-user-select: none;
}
.lw-icon-sm   { font-size: 14px; vertical-align: -3px; font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 20; }
.lw-icon-md   { font-size: 18px; vertical-align: -4px; font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24; }
.lw-icon-lg   { font-size: 24px; vertical-align: -5px; font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24; }

/* Filled variant — give a visual emphasis (active states, primary actions). */
.lw-icon-fill { font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24; }
.lw-icon-bold { font-variation-settings: 'FILL' 0, 'wght' 700, 'GRAD' 0, 'opsz' 24; }

/* Color tints — keep a small palette so the dashboard feels consistent. */
.lw-icon-accent  { color: var(--accent, #22d39a); }
.lw-icon-primary { color: var(--primary, #38bdf8); }
.lw-icon-warn    { color: var(--warning, #f59e0b); }
.lw-icon-danger  { color: var(--danger, #ef4444); }
.lw-icon-gold    { color: var(--gold, #fbbf24); }
.lw-icon-dim     { color: rgba(255,255,255,0.35); }

/* Soft glow halo — pair with -accent or -gold for an "alive" look on
   things like the chess_knight scouted badge or active shield. */
.lw-icon-glow {
  filter: drop-shadow(0 0 4px currentColor);
  text-shadow: 0 0 8px rgba(255,255,255,0.15);
}

/* When an icon sits inside a button as the only label, equalize the click
   target to a square and remove text-baseline drift. Use <button> with
   class="btn-icon-only" + a single .lw-icon child. */
.btn-icon-only {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  padding: 0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted, #8b9bb8);
  border-radius: 4px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.btn-icon-only:hover {
  color: var(--accent, #22d39a);
  border-color: var(--border, #1f2a44);
  background: rgba(34, 211, 154, 0.06);
}
.btn-icon-only > .lw-icon, .btn-icon-only > .material-symbols-outlined {
  font-size: 16px;
  vertical-align: 0;
}

/* Big squad-power total — the headline number per squad (matches the
   "47.4M" lwatlas shows). Drawn in accent green so it stands out from
   secondary metadata like soldier count and UAV power. */
.squad-power-total {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--accent);
  font-size: 14px;
}

/* Squad source badge — indicates whether the row came from
   kof.battle.preview (rich, arena bracket only) or
   train.record.detail (lighter, captured passively from any clicked truck). */
.squad-source-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-right: 6px;
  cursor: help;
}
.squad-source-badge.arena {
  background: rgba(255, 213, 74, 0.12);
  border: 1px solid rgba(255, 213, 74, 0.4);
  color: #ffd54a;
}
.squad-source-badge.train {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
}

/* march source badge — passive captures from kingdom-sweep pushes. */
.squad-source-badge.march {
  background: rgba(244, 114, 182, 0.12);
  border: 1px solid rgba(244, 114, 182, 0.4);
  color: #f472b6;
}

/* ============================================================================
 * Area Watch panel
 * Was a single flex-wrap row of 15 controls with no grouping — every control
 * carried equal visual weight, labels were placeholders that truncated, and the
 * row rewrapped as values changed. Rebuilt as a labelled field grid: header
 * (identity + live state), body (six named field groups), footer (the one
 * primary action). Same controls, given a hierarchy.
 * ========================================================================== */
.watch-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 10px);
  margin-bottom: 12px;
  overflow: visible;
}

.watch-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-soft);
}
.watch-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}
.watch-meta {
  font-size: 11px;
  color: var(--text-dim);
  margin-left: auto;
  text-align: right;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.watch-panel-head .btn { flex: none; }

/* Body — six groups on an explicit 3/2/1 column grid rather than auto-fit, so
   the last row is never left ragged with one stranded group. At 3 columns the
   rows read as what/who/where then when/notify/account. */
.watch-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px 20px;
  padding: 14px;
}
@media (min-width: 760px)  { .watch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1180px) { .watch-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.watch-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.watch-field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
}
/* Helper text carries the explanation that used to live in a truncating
   placeholder, so the field reads the same whether it is empty or filled. */
.watch-help,
.field-help {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-dim);
}
.watch-help.is-warning { color: var(--warning); }

/* COMPACT BY DEFAULT.
 *
 * The panel is above the map, and with every help paragraph expanded it filled
 * the viewport on its own — so "Draw on map" sat on screen while the thing you
 * draw on was below the fold, and selecting or zooming meant scrolling up and
 * down (operator, 2026-08-23). The prose is worth keeping, so it hides behind
 * the head's ? toggle rather than being deleted.
 *
 * Two are exempt and must never hide: #watch-area is a STATUS ("No area
 * selected yet." / the chosen rectangle), and #watch-mode-help is the one-line
 * description of the selected tab.
 */
.watch-panel:not(.show-help) .watch-help:not(#watch-area):not(#watch-mode-help) {
  display: none;
}
.watch-panel.show-help .watch-help { display: block; }

/* Tighter rhythm: the grid gap and field padding were tuned for a panel that
   was the whole page. */
.watch-panel:not(.show-help) .watch-grid { gap: 10px 20px; padding: 10px 14px; }
.watch-panel:not(.show-help) .watch-field { gap: 6px; }
.watch-panel:not(.show-help) .watch-panel-head { padding: 7px 14px; }
.watch-panel:not(.show-help) .watch-tabs { padding-top: 4px; padding-bottom: 4px; }
.watch-panel:not(.show-help) .watch-panel-foot { padding-top: 8px; padding-bottom: 8px; }
.watch-help-btn.is-on { color: var(--accent); border-color: var(--accent); }

/* Armed to draw: fold the panel to its header so the map owns the screen. The
   head stays so the "Drag a rectangle…" message and Escape-to-cancel remain
   visible — folding it away entirely would leave no sign of what to do. */
/* The tab row is no longer inside #watch-bar (it spans both columns now), so
   the fold hides it via #watch-modebar in setDrawingMode instead of from here. */
.watch-panel.is-drawing .watch-grid,
.watch-panel.is-drawing .watch-panel-foot,
.watch-panel.is-drawing .watch-running-head,
.watch-panel.is-drawing .watch-running { display: none; }
.watch-panel.is-drawing { margin-bottom: 8px; }

/* --- Watch and Trace: the form is a rail beside the map ------------------
 *
 * Stacked, the panel pushed the map off the bottom: 62px of map visible on a
 * 770px window, so drawing a rectangle and zooming both meant scrolling.
 *
 * Every mode uses the rail. It started as Area Watch and Shield Watch only —
 * they are the two drawn ON the map — but the same "form here, map there"
 * reading is what the other two wanted as well, and one layout beats a rule
 * about which tab you are on.
 *
 * Under 1100px it stacks: a 370px column plus a usable map is not two things a
 * narrow window can hold.
 */
.watch-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.watch-col, .map-col { min-width: 0; }
.watch-layout.is-side { grid-template-columns: minmax(320px, 370px) minmax(0, 1fr); }
.watch-layout.is-side .watch-col {
  max-height: calc(100vh - 190px);
  overflow-y: auto;
}
/* The field grid's breakpoints watch the VIEWPORT, so on a wide screen it would
   still try three columns inside a 370px rail. In the rail it is always one. */
.watch-layout.is-side .watch-grid { grid-template-columns: minmax(0, 1fr); }
.watch-layout.is-side .watch-panel { margin-bottom: 8px; }
@media (max-width: 1100px) {
  .watch-layout.is-side { grid-template-columns: minmax(0, 1fr); }
  .watch-layout.is-side .watch-col { max-height: none; overflow: visible; }
  .watch-layout.is-side .watch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .watch-layout.is-side #map { height: 72vh; }
}

/* The map takes the room the panel gave back. It is the point of the tab, and
   76vh assumed nothing but a thin toolbar above it. */
#map { height: 72vh; min-height: 420px; }
.watch-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Count pill next to a group label — "all" / "3" / "0" reads as part of the
   heading rather than as a stray word floating between controls. */
.watch-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--accent);
  background: rgba(34, 211, 154, 0.1);
  border: 1px solid rgba(34, 211, 154, 0.3);
  border-radius: 999px;
  padding: 1px 7px;
}
.watch-pill.is-empty {
  color: var(--text-dim);
  background: var(--bg);
  border-color: var(--border);
}

/* Mode picker. The three options are mutually exclusive states of one setting,
   so they are radios in a segmented control, not checkboxes — checkboxes imply
   independent toggles and allow states the watch cannot actually run. */
/* Segments size to their own text (not equal columns) so a long option name
   like "Alliance Center" stays on one line at every breakpoint. */
.segmented {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  padding: 3px;
  gap: 3px;
}
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
  min-height: 32px;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  transition: background 150ms, color 150ms;
}
.segmented label:hover { color: var(--text); background: var(--surface-2); }
.segmented input:checked + label {
  background: var(--accent);
  color: #04140e;
}
/* Keyboard focus must stay visible — the real input is offscreen. */
.segmented input:focus-visible + label {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Search + dropdown */
.watch-combo { position: relative; }
.watch-drop {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: min(340px, 90vw);
  max-height: 260px;
  overflow-y: auto;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  z-index: 1200;
}
.watch-drop:empty { display: none; }
.watch-drop-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  border-bottom: 1px solid var(--border-soft);
}
.watch-drop-row:last-child { border-bottom: 0; }
.watch-drop-row:hover { background: var(--surface-2); }
.watch-drop-row input { accent-color: var(--accent); cursor: pointer; }
.watch-drop-row .row-meta {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-dim);
}
.watch-drop-empty { padding: 8px 10px; font-size: 12px; color: var(--text-dim); }

/* Selected chips */
.watch-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-height: 76px;
  overflow-y: auto;
}
.watch-chips:empty { display: none; }
.watch-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 4px 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 11px;
  color: var(--text);
  max-width: 100%;
}
.watch-chip > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.watch-chip button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}
.watch-chip button:hover { background: var(--danger); color: #fff; }

/* Turbo Scan — a latching toggle, not a one-shot action, so the pressed state
   has to be visible at a glance from across the panel. */
.watch-turbo.is-on {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(34, 211, 154, 0.12);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Number + unit, so the unit is part of the control instead of loose text. */
.watch-num-field {
  display: inline-flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  padding-right: 8px;
}
.watch-num-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
/* Turbo makes the interval meaningless, not merely ignored — say so visually
   rather than leaving a live-looking box that has no effect. */
.watch-num-field.is-disabled {
  opacity: 0.45;
}
.watch-num-field input {
  width: 58px;
  background: transparent;
  border: 0;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  padding: 7px 4px 7px 10px;
  -moz-appearance: textfield;
}
.watch-num-field input:focus { outline: none; }
.watch-num-field input::-webkit-outer-spin-button,
.watch-num-field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.watch-num-field .unit {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Footer — one primary action, clearly separated from configuration. */
.watch-panel-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-top: 1px solid var(--border-soft);
  background: var(--bg-grid);
  border-radius: 0 0 var(--radius-md, 10px) var(--radius-md, 10px);
}
/* Running scans: one row per detector, each stopping on its own. Deliberately
   flat rows rather than cards — the list can hold a dozen scans during a
   multi-scan run and must stay scannable at a glance. */
.watch-running-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px 0;
}
.watch-running { padding: 6px 14px 12px; }
.watch-run-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  margin-bottom: 6px;
  background: var(--bg-grid);
}
.watch-run-icon { width: 16px; text-align: center; opacity: .85; }
.watch-run-what { flex: 1; font-size: 12px; }
.watch-run-meta { font-size: 11px; color: var(--text-muted); }
.watch-run-stop { padding: 2px 10px; font-size: 11px; }

.watch-msg { font-size: 12px; color: var(--text-muted); }
.watch-msg.is-error { color: var(--danger); }
.watch-msg.is-ok { color: var(--accent); }
/* Not a failure, but not "fine" either — a fitted area that leaves members
   outside it protects fewer people than the operator just asked for, and that
   has to be legible at a glance rather than reading as success. */
.watch-msg.is-warn { color: var(--warn, #f0b429); font-weight: 600; }

/* A disabled group must read as disabled, not merely faded. */
.watch-field.is-off { opacity: 0.45; }
.watch-field.is-off .watch-combo,
.watch-field.is-off .watch-chips { pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .segmented label { transition: none; }
}

/* Visually hidden but announced by screen readers — used for labels on inputs
   whose visible label sits on the surrounding field group. */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================================================
 * Overview tab
 * ========================================================================== */

/* Qualifier that rides on a card title: says how a chart is ranked or how old
   its numbers are, so the chart itself needs no subtitle row. */
.card-note {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-dim);
  margin-left: 6px;
}
.card-note.is-warning { color: var(--warning); }

/* Third line of a stat tile — the caption slot that already existed in the
   stylesheet but was never used on this page. Carries the qualifier that stops
   a number being read out of context ("42% of the kingdom", "measured 5h ago"). */
.stat-tile .stat-sub:empty { display: none; }

.mission-summary { display: flex; flex-direction: column; gap: 14px; }
.mission-group { display: flex; flex-direction: column; gap: 6px; }
.mission-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mission-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
}
.mission-chip .mc-k { font-size: 11px; color: var(--text-muted); }
.mission-chip .mc-v {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

/* Scope disclaimer under the Overview title — the page reports the top
   alliances only, and that has to be stated, not inferred. */
.overview-scope {
  margin: -4px 0 12px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}
.overview-scope strong { color: var(--text); font-weight: 600; }

/* Topbar utility button — for panes that are not part of the main flow. */
.topbar-btn { padding: 4px 10px; font-size: 11px; }

/* Drag-and-drop target. Big enough to aim at, and it says what it wants —
   a bare file dialog gives the operator no idea what file or why. */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 26px 16px;
  margin: 12px 0;
  border: 1px dashed var(--border);
  border-radius: var(--radius, 8px);
  background: var(--bg);
  cursor: pointer;
  text-align: center;
  transition: border-color 150ms, background 150ms;
}
.dropzone:hover, .dropzone:focus-visible {
  border-color: var(--accent);
  background: var(--surface-2);
  outline: none;
}
.dropzone.is-over {
  border-color: var(--accent);
  border-style: solid;
  background: rgba(34, 211, 154, 0.08);
}
.dropzone-icon { font-size: 20px; color: var(--accent); line-height: 1; }
.dropzone-main { font-size: 13px; color: var(--text); }
.dropzone-sub  { font-size: 11px; color: var(--text-dim); }

.arena-file-info {
  padding: 10px 12px;
  border-radius: var(--radius-sm, 6px);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12px;
}
.arena-file-info .ok   { color: var(--accent); }
.arena-file-info .bad  { color: var(--danger); }
.arena-file-info dl { display: grid; grid-template-columns: 90px 1fr; gap: 2px 10px; margin: 6px 0 0; }
.arena-file-info dt { color: var(--text-muted); }
.arena-file-info dd { margin: 0; font-family: 'JetBrains Mono', monospace; color: var(--text); }

/* Missions tab — one tab per warzone in the plunder pool */
.missions-wz-tabs { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:10px; }
.missions-wz-tab { padding:5px 12px; border:1px solid var(--border, #444); border-radius:6px;
  background:transparent; color:inherit; cursor:pointer; font:inherit; font-size:12px; }
.missions-wz-tab.active { background:var(--primary, #2f6fed); color:#04121f; border-color:var(--primary, #2f6fed); }
.missions-wz-tab .wz-count { opacity:.7; margin-left:6px; font-family:monospace; }
.missions-wz-tab .wz-remove { opacity:.45; margin-left:8px; font-size:11px; padding:0 2px; }
.missions-wz-tab .wz-remove:hover { opacity:1; color:var(--danger, #e5484d); }

/* Alliance Stats — day strip above the donation table */
.stats-days { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:10px; }
.stats-day { padding:3px 8px; border:1px solid var(--border); border-radius:6px; font-size:11px; font-family:monospace; }
.stats-day.final { border-color: var(--accent); }
.stats-day.partial { border-color: var(--warning); color: var(--warning); }
.stats-day.missing, .stats-day.partial-stale { border-color: var(--danger); color: var(--danger); }
.stats-day.open, .stats-day.future { opacity:.55; }
.stats-track-chip { display:inline-block; margin:0 6px 4px 0; padding:2px 8px; border:1px solid var(--border); border-radius:12px; }
.stats-track-chip button { background:none; border:0; color:inherit; cursor:pointer; margin-left:4px; }
.stats-picked { display:inline-flex; align-items:center; gap:6px; padding:4px 10px; border:1px solid var(--accent); border-radius:6px; font-size:12px; }
.stats-picked button { background:none; border:0; color:inherit; cursor:pointer; }
