/* ============================================================================
   Torn War Tracker — shared design system (SECTION 11)
   Mobile-first: 375px base, scales to 1100px. Dark theme. Vanilla CSS.
   Ported and extended from the reference torn-war-tracker.html.
   ============================================================================ */

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

:root {
  --bg: #0a0c0f; --panel: #0f1318; --border: #1e2730; --border-bright: #2a3a4a;
  --blue: #4a9eff; --blue-dim: #1a3a66;
  --red: #e05252; --red-dim: #7a2222;
  --green: #42c97a; --green-dim: #1a5234;
  --amber: #e8a030; --amber-dim: #6b4510;
  --purple: #a78bfa; --purple-dim: #3b2a6e;
  --gold: #f5c518; --gold-dim: #5e4a06;
  --text: #c8d4e0; --text-dim: #5a6878; --text-bright: #eaf2ff;
  --mono: 'Share Tech Mono', monospace; --display: 'Rajdhani', sans-serif;
  --radius: 12px;
}

html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); min-height: 100vh; color: var(--text);
  font-family: var(--display);
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(74,158,255,0.04) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 100%, rgba(224,82,82,0.04) 0%, transparent 60%);
}
a { color: var(--blue); }

.app {
  max-width: 1100px; margin: 0 auto;
  padding: 20px 14px calc(80px + env(safe-area-inset-bottom));
}

/* ── Large-monitor readability ──────────────────────────────────────────────
   The UI is mobile-first with small fixed px text; on a big high-res monitor a
   1100px column of 9–14px text reads tiny. Rather than re-size dozens of
   selectors (and risk uneven scaling), zoom the whole app uniformly on wide
   viewports — text, spacing and the container scale together; laptop/mobile are
   untouched. Self-adapts to OS scaling: a 1440p screen at 100% reports ~2560px
   (more zoom), at 150% reports ~1707px (less zoom). The sticky bottom ad and
   modal overlays live outside .app, so they're unaffected. */
@media (min-width: 1600px) { .app { zoom: 1.15; } }
@media (min-width: 2000px) { .app { zoom: 1.30; } }
@media (min-width: 2400px) { .app { zoom: 1.45; } }


/* ── Demo-mode banner ──────────────────────────────────────────────────────
   Only shown on /tracker?demo=1 (revealed by tracker.js). Gives demo visitors
   a clear way back to the real site. */
.demo-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: rgba(232,160,48,0.10); border: 1px solid var(--amber-dim); border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 16px;
}
.demo-banner-label { font-family: var(--mono); font-size: 12px; letter-spacing: 0.5px; color: var(--amber); }
.demo-banner-btn {
  font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--amber); border: 1px solid var(--amber); border-radius: 8px;
  padding: 7px 14px; text-decoration: none; white-space: nowrap; transition: all 0.15s;
}
.demo-banner-btn:hover { background: var(--amber); color: #1a1206; }

/* ── No-AA-key banner ──────────────────────────────────────────────────────
   Shown to any member when the faction has no AA-level key linked, so live
   chain tracking + the planner can't run until a leader / AA member connects. */
.no-aa-banner {
  display: flex; align-items: flex-start; gap: 10px;
  background: rgba(74,158,255,0.08); border: 1px solid var(--blue-dim); border-radius: var(--radius);
  padding: 11px 15px; margin-bottom: 16px;
  font-family: var(--mono); font-size: 12px; line-height: 1.55; color: var(--text);
}
.no-aa-banner strong { color: var(--blue); }
.no-aa-icon { font-size: 16px; line-height: 1.3; flex-shrink: 0; }

/* ── Chain panel (War Intel) + chain risk banner (Hospital) ────────────────*/
.chain-panel {
  background: linear-gradient(135deg, rgba(245,197,24,0.06), rgba(74,158,255,0.05));
  border: 1px solid var(--gold-dim); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 18px;
}
.chain-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.chain-tag {
  font-family: var(--display); font-size: 13px; font-weight: 700; letter-spacing: 1.5px;
  color: var(--gold); text-transform: uppercase;
}
.chain-timer {
  font-family: var(--mono); font-size: 30px; font-weight: 600; color: var(--green);
  letter-spacing: 1px; line-height: 1;
}
.chain-timer.urgent { color: var(--amber); }
.chain-timer.out { color: var(--red); animation: blink 1s step-end infinite; }
.chain-meta { font-family: var(--mono); font-size: 12px; color: var(--text-dim); margin-left: auto; }
.chain-state-pill {
  font-family: var(--mono); font-size: 11px; letter-spacing: 1px; text-transform: uppercase;
  padding: 2px 8px; border-radius: 10px;
}
.chain-state-pill.cooldown { background: rgba(90,104,120,0.15); color: var(--text-dim); border: 1px solid var(--border); }
.chain-cd-note { font-family: var(--mono); font-size: 12px; color: var(--text-dim); margin-top: 8px; }
.chain-ms { margin-top: 12px; }
.chain-ms-label { font-family: var(--mono); font-size: 12px; color: var(--text); margin-bottom: 5px; }
.chain-ms-label strong { color: var(--gold); }
.chain-ms-bar { background: var(--border); border-radius: 4px; height: 5px; overflow: hidden; }
.chain-ms-fill { height: 100%; background: linear-gradient(90deg, var(--blue), var(--gold)); border-radius: 4px; transition: width 0.4s; }
.chain-plan { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.chain-plan-head {
  font-family: var(--display); font-size: 12px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--text-dim); margin-bottom: 8px;
  display: flex; align-items: center; gap: 10px;
}
.chain-verdict {
  font-family: var(--mono); font-size: 10px; letter-spacing: 1px; padding: 2px 8px; border-radius: 10px;
}
.chain-verdict.sustainable { background: rgba(66,201,122,0.12); color: var(--green); border: 1px solid var(--green-dim); }
.chain-verdict.tight       { background: rgba(232,160,48,0.14); color: var(--amber); border: 1px solid var(--amber-dim); }
.chain-verdict.risk        { background: rgba(224,82,82,0.12);  color: var(--red);   border: 1px solid var(--red-dim); }
.chain-plan-row { font-family: var(--mono); font-size: 12px; color: var(--text); margin-bottom: 5px; line-height: 1.5; }
.chain-plan-row strong { color: var(--text-bright); }
.chain-plan-note { font-family: var(--mono); font-size: 11px; color: var(--text-dim); margin-top: 6px; line-height: 1.5; }
.plan-ok  { color: var(--green); }
.plan-bad { color: var(--red); }
.chain-risk {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  background: rgba(245,197,24,0.07); border: 1px solid var(--gold-dim); border-radius: var(--radius);
  padding: 9px 14px; margin-bottom: 14px;
}
.chain-risk .chain-timer { font-size: 18px; }

/* ── Header ──────────────────────────────────────────────────────────────*/
.header { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 22px; }
.header-icon {
  width: 46px; height: 46px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--red-dim), #2a0a0a);
  border: 1px solid var(--red-dim); border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; box-shadow: 0 0 20px rgba(224,82,82,0.15);
}
.header-text h1 {
  font-size: 24px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
  color: var(--text-bright); line-height: 1;
}
.header-text p {
  font-family: var(--mono); font-size: 11px; color: var(--text-dim);
  margin-top: 5px; letter-spacing: 1px;
}

/* ── Panels & fields ─────────────────────────────────────────────────────*/
.panel {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 18px; margin-bottom: 14px;
}
.panel h3 {
  font-size: 12px; font-family: var(--mono); letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--text-dim); margin-bottom: 14px;
}
.field { margin-bottom: 0; }
.field label {
  display: block; font-family: var(--mono); font-size: 10px; letter-spacing: 1.5px;
  color: var(--text-dim); text-transform: uppercase; margin-bottom: 6px;
}
.field input {
  width: 100%; background: #080a0d; border: 1px solid var(--border);
  border-radius: 7px; padding: 12px 13px; font-family: var(--mono); font-size: 14px;
  color: var(--text-bright); outline: none; transition: border-color 0.2s;
  min-height: 44px;
}
.field input:focus { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(74,158,255,0.1); }
.field input::placeholder { color: var(--text-dim); }
.field small { display: block; font-family: var(--mono); font-size: 10px; color: var(--text-dim); margin-top: 5px; }

/* ── Buttons ─────────────────────────────────────────────────────────────*/
.btn {
  font-family: var(--display); font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; cursor: pointer; border-radius: 8px;
  transition: all 0.2s; min-height: 44px; padding: 12px 24px; font-size: 14px;
  border: 1px solid var(--border-bright); background: var(--panel); color: var(--text);
}
.btn:hover:not(:disabled) { border-color: var(--blue); color: var(--text-bright); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, #1a3a6a, #0d2040); border-color: var(--blue-dim);
  color: var(--blue); font-size: 16px; padding: 16px 28px; width: 100%;
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #1e4480, #122850);
  border-color: var(--blue); color: #fff; box-shadow: 0 0 18px rgba(74,158,255,0.25);
}
.btn-secondary { width: 100%; }
.btn-danger {
  background: linear-gradient(135deg, #5a1414, #2a0a0a); border-color: var(--red-dim); color: var(--red);
}
.btn-danger:hover:not(:disabled) { border-color: var(--red); color: #fff; box-shadow: 0 0 16px rgba(224,82,82,0.25); }
.btn-google {
  background: #fff; color: #1a1a1a; border-color: #fff; display: inline-flex;
  align-items: center; gap: 10px; justify-content: center;
}
.btn-row { display: grid; gap: 10px; }
@media (min-width: 560px){ .btn-row.two { grid-template-columns: 2fr 1fr; align-items: stretch; } }

/* ── Status bar ──────────────────────────────────────────────────────────*/
.status-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.faction-title { font-size: 20px; font-weight: 700; letter-spacing: 1px; color: var(--text-bright); }
.faction-title .badge {
  font-family: var(--mono); font-size: 11px; margin-left: 8px;
  border-radius: 4px; padding: 2px 8px; vertical-align: middle;
}
.badge-red { color: var(--red); background: rgba(224,82,82,0.1); border: 1px solid var(--red-dim); }
.badge-green { color: var(--green); background: rgba(66,201,122,0.1); border: 1px solid var(--green-dim); }
.badge-amber { color: var(--amber); background: rgba(232,160,48,0.1); border: 1px solid var(--amber-dim); }
.meta { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.meta-item { font-family: var(--mono); font-size: 11px; color: var(--text-dim); }
.meta-item strong { color: var(--amber); }

/* Source health dots (Torn / FFScouter / TornStats) */
.source-dots { display: flex; gap: 12px; align-items: center; }
.src-health { display: inline-flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 10px; color: var(--text-dim); text-transform: uppercase; }
.src-health .led { width: 7px; height: 7px; border-radius: 50%; background: var(--text-dim); }
.led.up   { background: var(--green); box-shadow: 0 0 6px var(--green); }
.led.degraded { background: var(--amber); box-shadow: 0 0 6px var(--amber); }
.led.down { background: var(--red); box-shadow: 0 0 6px var(--red); }

.refresh-ring { display: flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 11px; color: var(--text-dim); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1}50%{opacity:0.3} }

/* ── Boxes ───────────────────────────────────────────────────────────────*/
.error-box { background: rgba(224,82,82,0.07); border: 1px solid var(--red-dim); border-radius: 8px; padding: 14px 18px; font-family: var(--mono); font-size: 13px; color: var(--red); margin-bottom: 16px; }
.info-box { background: rgba(74,158,255,0.07); border: 1px solid var(--blue-dim); border-radius: 8px; padding: 12px 16px; font-family: var(--mono); font-size: 11px; color: var(--blue); margin-bottom: 16px; line-height: 1.6; }

/* ── Empty / loading ─────────────────────────────────────────────────────*/
.empty-state { text-align: center; padding: 56px 20px; color: var(--text-dim); }
.empty-state .big { font-size: 46px; margin-bottom: 12px; }
.empty-state h3 { font-size: 18px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-state p { font-family: var(--mono); font-size: 12px; }
.loading-state { text-align: center; padding: 40px 20px; color: var(--text-dim); font-family: var(--mono); font-size: 12px; letter-spacing: 1.5px; }
.loading-state .step { margin-bottom: 6px; transition: color 0.3s; }
.loading-state .step.active { color: var(--blue); }
.loading-state .step.done { color: var(--green); }
.spinner { width: 32px; height: 32px; border: 2px solid var(--border-bright); border-top-color: var(--blue); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 20px; }
@keyframes spin { to{transform:rotate(360deg)} }

/* ── Tabs ────────────────────────────────────────────────────────────────*/
.tabs {
  display: flex; flex-wrap: wrap; gap: 2px; margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.tab-btn {
  font-family: var(--display); font-size: 13px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; padding: 12px 18px; background: none; border: none;
  color: var(--text-dim); cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: all 0.2s; white-space: nowrap; min-height: 44px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Sticky tabs on mobile */
@media (max-width: 700px) {
  .tabs { position: sticky; top: 0; z-index: 20; background: var(--bg); }
}

/* ── Tables ──────────────────────────────────────────────────────────────*/
.table-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; overflow-x: auto; -webkit-overflow-scrolling: touch; animation: fadeIn 0.4s; }
@keyframes fadeIn { from{opacity:0}to{opacity:1} }
table { width: 100%; border-collapse: collapse; min-width: 760px; }

/* Tracker tables use a fixed layout with balanced columns so the data-dense
   right side (Growth / Priority / Confidence) always gets room and the left
   columns (Player / Status) don't hog width. Scoped to the two tracker tables
   via their wrappers — the ToS disclosure table is unaffected. */
.roster-cols table, #hospWrap table { table-layout: fixed; }
.roster-cols td, #hospWrap td { word-wrap: break-word; overflow-wrap: break-word; }

/* Roster + War Intel targets share ONE column template (.roster-cols on both
   wraps) so the two tables read identically:
   # | Player | Status | War Stats | Growth | Online Activity | Confidence */
.roster-cols th:nth-child(1), .roster-cols td:nth-child(1) { width: 4%; }
.roster-cols th:nth-child(2), .roster-cols td:nth-child(2) { width: 15%; }
.roster-cols th:nth-child(3), .roster-cols td:nth-child(3) { width: 11%; }
.roster-cols th:nth-child(4), .roster-cols td:nth-child(4) { width: 19%; }
.roster-cols th:nth-child(5), .roster-cols td:nth-child(5) { width: 19%; }
.roster-cols th:nth-child(6), .roster-cols td:nth-child(6) { width: 17%; }
.roster-cols th:nth-child(7), .roster-cols td:nth-child(7) { width: 15%; }

/* Hospital: # | Player | Out At | Time Left | Online Activity | War Stats | Confidence */
#hospWrap th:nth-child(1), #hospWrap td:nth-child(1) { width: 4%; }
#hospWrap th:nth-child(2), #hospWrap td:nth-child(2) { width: 15%; }
#hospWrap th:nth-child(3), #hospWrap td:nth-child(3) { width: 13%; }
#hospWrap th:nth-child(4), #hospWrap td:nth-child(4) { width: 12%; }
#hospWrap th:nth-child(5), #hospWrap td:nth-child(5) { width: 18%; }
#hospWrap th:nth-child(6), #hospWrap td:nth-child(6) { width: 23%; }
#hospWrap th:nth-child(7), #hospWrap td:nth-child(7) { width: 15%; }
thead { background: #0c1016; border-bottom: 1px solid var(--border-bright); }
th { font-family: var(--mono); font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-dim); padding: 12px 14px; text-align: left; white-space: nowrap; }
/* Sortable headers (Roster + War Intel). Click to sort, click again to flip. */
th.sortable { cursor: pointer; user-select: none; transition: color 0.15s; }
th.sortable:hover { color: var(--text); }
th.sortable.sorted { color: var(--blue); }
th.sortable .arrow { display: inline-block; min-width: 8px; color: var(--blue); font-size: 9px; }
tr { border-bottom: 1px solid var(--border); transition: background 0.15s; }
tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(74,158,255,0.03); }
td { padding: 12px 14px; font-size: 14px; vertical-align: middle; }

.rank { font-family: var(--mono); font-size: 12px; color: var(--text-dim); width: 36px; }
.player-name { font-weight: 600; font-size: 15px; color: var(--text-bright); }
/* Member name → Torn profile (new tab). Inherits the name styling; underline on
   hover only, so it reads as plain text until you reach for it. */
.player-link { color: inherit; text-decoration: none; }
.player-link:hover { text-decoration: underline; color: var(--blue); }
.level-badge { display: inline-block; font-family: var(--mono); font-size: 11px; color: var(--text-dim); background: var(--border); border-radius: 4px; padding: 2px 6px; margin-left: 7px; }
.out-time { font-family: var(--mono); font-size: 12px; color: var(--text-dim); }
.countdown { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--green); letter-spacing: 0.5px; white-space: nowrap; }
.countdown.urgent { color: var(--amber); }
.countdown.out { color: var(--red); animation: blink 1s step-end infinite; }
@keyframes blink { 50%{opacity:0.2} }

.progress-bar-wrap { display: flex; gap: 3px; margin-top: 6px; }
.bar-wrap { background: var(--border); border-radius: 3px; height: 3px; overflow: hidden; flex: 1; }
.bar-fill { height: 100%; border-radius: 3px; }
.bar-fill.green { background: var(--green); }
.bar-fill.amber { background: var(--amber); }

.new-member { animation: flashNew 2s ease-out; }
@keyframes flashNew { from { background: rgba(74,158,255,0.12); } to { background: transparent; } }

/* Live-update flash for realtime stat cell changes */
.stat-updated { animation: flashStat 1.4s ease-out; }
@keyframes flashStat { from { background: rgba(66,201,122,0.18); } to { background: transparent; } }

/* ── Stat cells + source badges ──────────────────────────────────────────*/
.stats-cell { min-width: 180px; }
.stat-source {
  display: inline-block; font-family: var(--mono); font-size: 9px; letter-spacing: 1px;
  text-transform: uppercase; padding: 1px 5px; border-radius: 3px; margin-bottom: 4px;
}
.src-verified { background: rgba(245,197,24,0.15); color: var(--gold);  border: 1px solid var(--gold-dim); }
.src-spy      { background: rgba(66,201,122,0.15); color: var(--green); border: 1px solid var(--green-dim); }
.src-ffown    { background: rgba(74,158,255,0.18); color: var(--blue);  border: 1px solid var(--blue-dim); }
.src-ff       { background: rgba(74,158,255,0.12); color: var(--blue);  border: 1px solid var(--blue-dim); }
.src-rank     { background: rgba(232,160,48,0.15); color: var(--amber); border: 1px solid var(--amber-dim); }
.src-none     { background: rgba(90,104,120,0.15); color: var(--text-dim); border: 1px solid var(--border); }

.stat-value { font-family: var(--mono); font-size: 14px; color: var(--text-bright); font-weight: 600; }
.stat-age { font-family: var(--mono); font-size: 10px; color: var(--text-dim); margin-top: 2px; }
.stat-breakdown { font-family: var(--mono); font-size: 10px; color: var(--text-dim); margin-top: 2px; }

.confidence-bar { display: flex; gap: 3px; margin-top: 6px; }
.conf-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.conf-dot.lit-gold  { background: var(--gold); }
.conf-dot.lit-green { background: var(--green); }
.conf-dot.lit-blue  { background: var(--blue); }
.conf-dot.lit-amber { background: var(--amber); }
.conf-label { font-family: var(--mono); font-size: 10px; margin-top: 3px; }

/* Roster stat breakdown bars */
.stat-bar-row { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.stat-bar-bg { flex: 1; background: var(--border); border-radius: 2px; height: 4px; overflow: hidden; max-width: 140px; }
.stat-bar-fg { height: 100%; border-radius: 2px; background: var(--blue); }
.stat-bar-label { font-family: var(--mono); font-size: 10px; color: var(--text-dim); white-space: nowrap; }

/* ── Status pills ────────────────────────────────────────────────────────*/
.status-pill { display: inline-block; font-family: var(--mono); font-size: 10px; padding: 2px 8px; border-radius: 10px; letter-spacing: 0.5px; }
.pill-ok      { background: rgba(66,201,122,0.12); color: var(--green); border: 1px solid var(--green-dim); }
.pill-idle    { background: rgba(232,160,48,0.12); color: var(--amber); border: 1px solid var(--amber-dim); }
.pill-offline { background: rgba(90,104,120,0.12); color: var(--text-dim); border: 1px solid var(--border); }
.pill-hosp    { background: rgba(224,82,82,0.12);  color: var(--red);   border: 1px solid var(--red-dim); }
.pill-travel  { background: rgba(167,139,250,0.12); color: var(--purple); border: 1px solid var(--purple-dim); }
.pill-abroad  { background: rgba(74,158,255,0.12);  color: var(--blue);   border: 1px solid var(--blue-dim); }
.pill-other   { background: rgba(90,104,120,0.12); color: var(--text-dim); border: 1px solid var(--border); }

/* ── Growth + priority ───────────────────────────────────────────────────*/
.growth { font-family: var(--mono); font-size: 12px; }
.growth .arrow { font-weight: 700; }
.growth.up   .arrow { color: var(--green); }
.growth.down .arrow { color: var(--red); }
.growth.flat .arrow { color: var(--text-dim); }
.growth-proj { font-family: var(--mono); font-size: 10px; color: var(--text-dim); margin-top: 2px; }

.priority-badge { display: inline-flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; padding: 3px 8px; border-radius: 10px; }
.prio-critical { background: rgba(224,82,82,0.14);  color: var(--red);    border: 1px solid var(--red-dim); }
.prio-high     { background: rgba(232,160,48,0.14); color: var(--amber);  border: 1px solid var(--amber-dim); }
.prio-medium   { background: rgba(245,197,24,0.10); color: var(--gold);   border: 1px solid var(--gold-dim); }
.prio-low      { background: rgba(66,201,122,0.12); color: var(--green);  border: 1px solid var(--green-dim); }

/* ── Activity strip (SECTION 6) ──────────────────────────────────────────*/
.activity { display: flex; align-items: flex-end; gap: 8px; }
.activity-tct { font-family: var(--mono); font-size: 11px; color: var(--text-bright); white-space: nowrap; }
.activity-tct small { display: block; color: var(--text-dim); font-size: 9px; }
.strip { display: flex; align-items: flex-end; gap: 3px; height: 28px; }
.strip-bar { width: 7px; border-radius: 2px 2px 0 0; background: var(--border); position: relative; }
.strip-bar.green { background: var(--green); }
.strip-bar.amber { background: var(--amber); }
.strip-bar.dark  { background: #1a222c; }
.strip-bar.grey  { background: var(--border); }
.strip-bar.current { outline: 2px solid var(--text-bright); outline-offset: 1px; }
.activity-note { font-family: var(--mono); font-size: 9px; color: var(--text-dim); margin-top: 3px; }

/* Hospital release + activity alert */
.release-alert { border-radius: 8px; padding: 10px 12px; font-family: var(--mono); font-size: 11px; line-height: 1.5; margin-top: 8px; }
.release-alert.low  { border: 1px solid var(--green-dim); background: rgba(66,201,122,0.06); color: var(--text); }
.release-alert.high { border: 1px solid var(--red-dim);   background: rgba(224,82,82,0.06);  color: var(--text); }

/* ── Hospital faction toggle ─────────────────────────────────────────────*/
.hosp-toggle { display: inline-flex; gap: 2px; margin-bottom: 14px; border: 1px solid var(--border); border-radius: 8px; padding: 3px; background: var(--panel); }
.hosp-toggle-btn {
  font-family: var(--display); font-weight: 700; font-size: 13px; letter-spacing: 0.5px;
  padding: 8px 16px; min-height: 40px; border: none; border-radius: 6px; cursor: pointer;
  background: none; color: var(--text-dim); transition: all 0.15s; white-space: nowrap;
}
.hosp-toggle-btn:hover { color: var(--text); }
.hosp-toggle-btn.active { background: var(--border); color: var(--text-bright); }
.hosp-toggle-btn[data-scope="enemy"].active { background: rgba(224,82,82,0.15); color: var(--red); }

/* ── Hints ───────────────────────────────────────────────────────────────*/
.hint { margin-top: 14px; font-family: var(--mono); font-size: 11px; color: var(--text-dim); text-align: center; letter-spacing: 0.5px; line-height: 1.8; }

/* ── War Intel cards ─────────────────────────────────────────────────────*/
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.summary-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.summary-card .k { font-family: var(--mono); font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-dim); }
.summary-card .v { font-family: var(--mono); font-size: 24px; font-weight: 700; color: var(--text-bright); margin-top: 6px; }
.summary-card .sub { font-family: var(--mono); font-size: 10px; color: var(--text-dim); margin-top: 2px; }

.section-title { font-size: 13px; font-family: var(--mono); letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-dim); margin: 22px 0 12px; }

.target-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; }
.target-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.history-row { display: flex; justify-content: space-between; gap: 10px; font-family: var(--mono); font-size: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.history-row:last-child { border-bottom: none; }

/* War Intel target-card body: stats | growth | activity as a balanced grid.
   (Was a flex row where the stat cell's flex:1 pushed growth + activity to the
   far edge, leaving a dead gap in the middle.) Stacks on narrow screens. */
.target-body { display: grid; grid-template-columns: 1fr; gap: 14px; align-items: start; margin-top: 10px; }
.target-body .stats-cell { min-width: 0; }
@media (min-width: 560px) {
  /* Fixed-width activity column (not auto) so the two flexible columns compute
     identically on every card — otherwise a card with a narrower activity strip
     redistributes the slack and the middle column drifts out of alignment. */
  .target-body { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.1fr) 150px; gap: 18px; }
  .target-body .target-activity { min-width: 0; }
}

/* ── ToS disclosure table (SECTION 2) ────────────────────────────────────*/
.tos-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; overflow-x: auto; margin-bottom: 12px; }
.tos-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.tos-table th { background: #0c1016; color: var(--text-bright); font-family: var(--display); font-weight: 700; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border-bright); }
.tos-table td { font-family: var(--mono); font-size: 11px; line-height: 1.6; color: var(--text); padding: 14px; vertical-align: top; border-right: 1px solid var(--border); }
.tos-table td:last-child { border-right: none; }
.tos-consent { font-style: italic; font-size: 12px; color: var(--text-dim); margin: 6px 0 16px; }
.fineprint { font-size: 12px; color: var(--text-dim); font-style: italic; line-height: 1.7; margin: 10px 0 18px; }
.fineprint a { color: var(--blue); }

/* ── Ad placeholders (SECTION 12) ────────────────────────────────────────*/
.ad-slot {
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--border-bright); border-radius: 8px; color: var(--text-dim);
  font-family: var(--mono); font-size: 10px; letter-spacing: 1px; text-transform: uppercase;
  background: rgba(255,255,255,0.01); margin: 16px auto;
}
/* Single site-wide banner (tracker, below tabs / above table) — responsive,
   mobile-first: 320×50 on mobile, 728×90 on desktop. The one ad unit anywhere. */
.ad-banner { width: 320px; max-width: 100%; height: 50px; }
@media (min-width: 760px) {
  .ad-banner { width: 728px; height: 90px; }
}
/* Keep ad slots out of the UI until a REAL ad is injected (ads.js adds .ad-live
   only when it fills a slot with a configured unit). While ads are disabled or
   awaiting approval, the placeholder boxes don't show at all. */
.ad-slot:not(.ad-live) { display: none !important; }
/* When a real ad is injected, drop the dashed placeholder chrome. */
.ad-slot.ad-live { border: none; background: transparent; color: transparent; }

/* ── Footer ──────────────────────────────────────────────────────────────*/
.site-footer {
  margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--border);
  text-align: center; color: var(--text-dim);
}
.site-footer-links { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; margin-bottom: 10px; }
.site-footer-links a {
  font-family: var(--mono); font-size: 11px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--text-dim); text-decoration: none;
}
.site-footer-links a:hover { color: var(--blue); }
.site-footer p { font-family: var(--mono); font-size: 10px; line-height: 1.7; max-width: 620px; margin: 0 auto; }

/* ── Content / doc pages (About, Privacy) ─────────────────────────────────*/
.doc h2 {
  font-family: var(--display); font-size: 18px; font-weight: 700;
  color: var(--text-bright); letter-spacing: 0.5px; margin: 22px 0 8px;
}
.doc h2:first-of-type { margin-top: 4px; }
.doc h3 {
  font-family: var(--display); font-size: 14px; font-weight: 600; color: var(--text-bright);
  letter-spacing: 0.5px; text-transform: none; margin: 16px 0 6px;
}
.doc p { font-size: 14px; line-height: 1.7; margin-bottom: 10px; color: var(--text); }
.doc ul, .doc ol { margin: 0 0 12px 20px; }
.doc li { font-size: 14px; line-height: 1.7; margin-bottom: 6px; }

/* ── Utilities ───────────────────────────────────────────────────────────*/
.hidden { display: none !important; }
.center { text-align: center; }
.muted { color: var(--text-dim); }
.mono { font-family: var(--mono); }
.spacer-sm { height: 8px; } .spacer { height: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }

/* Landing hero */
.hero { text-align: center; padding: 8px 0 18px; }
.hero h2 { font-size: 22px; color: var(--text-bright); letter-spacing: 1px; }
.hero p { font-family: var(--mono); font-size: 12px; color: var(--text-dim); margin-top: 8px; line-height: 1.6; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.7); display: none; align-items: center; justify-content: center; padding: 16px; z-index: 100; }
.modal-backdrop.open { display: flex; }
.modal { background: var(--panel); border: 1px solid var(--border-bright); border-radius: var(--radius); padding: 22px; max-width: 420px; width: 100%; }
.modal h3 { font-size: 18px; color: var(--text-bright); margin-bottom: 10px; }
.modal p { font-family: var(--mono); font-size: 12px; color: var(--text-dim); line-height: 1.6; margin-bottom: 16px; }
