/* ═══════════════════════════════════════════════════════════════════════
   WatchFloor — Global Situational Awareness Dashboard
   Dark theme: NORAD ops center meets Bloomberg Terminal meets Liveuamap
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Reset + tokens ──────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Core palette */
  --bg:           #0a0e16;
  --panel-bg:     #141a26;
  --border:       #1f2a3d;
  --border-light: #263347;
  --text:         #e8eef5;
  --text-muted:   #6a7a95;
  --text-dim:     #3a4a62;

  /* Severity gradient */
  --sev-green:    #3ee06a;
  --sev-yellow:   #e0c33e;
  --sev-orange:   #e08a3e;
  --sev-red:      #e85d6f;
  --sev-critical: #ff1f3f;

  /* Accent */
  --accent:       #3a8fff;
  --accent-dim:   #1a4a99;

  /* Category colors */
  --cat-disasters: #e08a3e;
  --cat-weather:   #3a8fff;
  --cat-social:    #b03aff;
  --cat-markets:   #3ee0b0;

  /* Fonts */
  --font-ui:   system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "SF Mono", Monaco, Consolas, "Courier New", monospace;

  /* Layout */
  --header-h:   48px;
  --footer-h:   32px;
  --gap:        1px;          /* tight grid gap */
  --panel-p:    12px;
}

/* ── Base ────────────────────────────────────────────────────────────── */
html {
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--bg);
  overflow: hidden;
}

/* ── Ops grid (fills viewport between header and footer) ─────────────── */
#ops-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1.3fr) minmax(0, 1.1fr) minmax(0, 0.65fr);
  gap: 1px;
  background: var(--border);
}

#console-row {
  display: grid;
  grid-template-columns: 200px 1.6fr repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  min-height: 0;
}

#strip-row {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 1px;
  background: var(--border);
  min-height: 0;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Scrollbar ───────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

/* ── Animations ──────────────────────────────────────────────────────── */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes scanline {
  0%   { transform: translateY(-100%); }
  100% { transform: translateY(100vh); }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  49%      { opacity: 1; }
  50%      { opacity: 0; }
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

/* ── Header ──────────────────────────────────────────────────────────── */
#header {
  height: var(--header-h);
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--panel-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1000;
  flex-shrink: 0;
}

#header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  font-size: 20px;
  color: var(--accent);
  line-height: 1;
}

.brand-name {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--text);
}

.brand-sub {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  text-transform: uppercase;
  /* hide on very small screens, see breakpoints */
}

#header-meta {
  display: flex;
  align-items: center;
  gap: 20px;
}

/* UTC Clock */
.utc-clock {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.06em;
  min-width: 120px;
  text-align: right;
}

/* Sources indicator */
.sources-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.sources-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
}

.sources-indicator.sources-ok .sources-dot {
  background: var(--sev-green);
  box-shadow: 0 0 6px var(--sev-green);
  animation: pulse 2s ease-in-out infinite;
}

.sources-indicator.sources-warn .sources-dot {
  background: var(--sev-yellow);
  box-shadow: 0 0 6px var(--sev-yellow);
  animation: pulse 1.2s ease-in-out infinite;
}

.sources-indicator.sources-err .sources-dot {
  background: var(--sev-red);
  box-shadow: 0 0 6px var(--sev-red);
  animation: pulse 0.8s ease-in-out infinite;
}

.sources-indicator.sources-loading .sources-dot {
  background: var(--text-dim);
  animation: pulse 1.5s ease-in-out infinite;
}

/* ── Map section ─────────────────────────────────────────────────────── */
#map-section {
  background: #080c14;
  min-height: 0;
  overflow: hidden;
}

#map {
  height: 100%;
  width: 100%;
  background: #080c14;
}

/* Override Leaflet popup for dark theme */
.leaflet-popup-content-wrapper {
  background: var(--panel-bg) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  border-radius: 4px !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.6) !important;
  font-family: var(--font-ui) !important;
  font-size: 12px !important;
}

.leaflet-popup-tip { background: var(--panel-bg) !important; }
.leaflet-popup-close-button { color: var(--text-muted) !important; }
.leaflet-popup-content a { color: var(--accent) !important; }

/* Leaflet attribution small */
.leaflet-control-attribution {
  background: rgba(10, 14, 22, 0.8) !important;
  color: var(--text-dim) !important;
  font-size: 9px !important;
}
.leaflet-control-attribution a { color: var(--text-muted) !important; }

/* Zoom controls */
.leaflet-control-zoom a {
  background-color: var(--panel-bg) !important;
  color: var(--text-muted) !important;
  border-color: var(--border) !important;
}
.leaflet-control-zoom a:hover {
  background-color: var(--border) !important;
  color: var(--text) !important;
}

/* ── Shared panel chrome ─────────────────────────────────────────────── */
.panel {
  background: var(--panel-bg);
  border: 1px solid var(--border);
}

.panel-header {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 8px var(--panel-p) 6px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.panel-header--disasters { color: var(--cat-disasters); }
.panel-header--weather   { color: var(--cat-weather); }
.panel-header--social    { color: var(--cat-social); }
.panel-header--markets   { color: var(--cat-markets); }

/* Per-source online dot in panel headers */
.panel-status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-dim);
  margin-left: auto;
  flex-shrink: 0;
  cursor: default;
}

.panel-status-dot.online  { background: var(--sev-green); box-shadow: 0 0 5px var(--sev-green); }
.panel-status-dot.offline { background: var(--sev-red);   animation: pulse 1s infinite; }

/* ── Status panel ────────────────────────────────────────────────────── */
#status-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

#status-body {
  padding: 10px var(--panel-p);
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#global-status-value {
  font-family: var(--font-mono);
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
  display: inline-block;
}

.status-scale-label {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-muted);
  margin-top: -4px;
}

.status-bar-wrap {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin: 4px 0;
}

.status-bar {
  height: 100%;
  border-radius: 3px;
  background: var(--sev-green);
  transition: width 0.8s ease, background-color 0.8s ease;
}

/* Color-codes the bar by value */
.status-bar[data-level="low"]      { background: var(--sev-green); }
.status-bar[data-level="moderate"] { background: var(--sev-yellow); }
.status-bar[data-level="elevated"] { background: var(--sev-orange); }
.status-bar[data-level="high"]     { background: var(--sev-red); }
.status-bar[data-level="critical"] { background: var(--sev-critical); box-shadow: 0 0 8px var(--sev-critical); }

#global-status-delta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

#global-status-delta .up   { color: var(--sev-red); }
#global-status-delta .down { color: var(--sev-green); }
#global-status-delta .same { color: var(--text-dim); }

.status-quiet-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  margin-top: 8px;
}

#quiet-hours {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--sev-green);
}

/* Ticker */
#ticker-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
}

.ticker-count {
  font-size: 9px;
  color: var(--text-dim);
  margin-left: auto;
  font-weight: 400;
  letter-spacing: 0.06em;
}

.ticker-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding: 4px 0;
}

.ticker-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px var(--panel-p);
  border-bottom: 1px solid rgba(31, 42, 61, 0.5);
  animation: fadeIn 0.3s ease;
  cursor: default;
  transition: background 0.15s;
}

.ticker-item:hover { background: rgba(255,255,255,0.03); }
.ticker-item:last-child { border-bottom: none; }

.ticker-time {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 60px;
}

.ticker-sev {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-bottom: 1px;
}

.ticker-title {
  font-size: 12px;
  color: var(--text);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticker-source {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-dim);
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
}

/* New event flash */
.ticker-item.new {
  background: rgba(58, 143, 255, 0.08);
}

/* ── Data panel (lives in console-row) ───────────────────────────────── */
.data-panel {
  background: var(--panel-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
}

/* Event list (disasters / weather / social) */
.event-list {
  list-style: none;
  padding: 4px 0;
  overflow-y: auto;
  flex: 1;
}

.event-item {
  padding: 7px var(--panel-p);
  border-bottom: 1px solid rgba(31, 42, 61, 0.5);
  cursor: default;
  transition: background 0.15s;
  animation: fadeIn 0.3s ease;
}

.event-item:hover { background: rgba(255,255,255,0.03); }
.event-item:last-child { border-bottom: none; }

.event-time {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.event-sev-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.event-title {
  font-size: 12px;
  color: var(--text);
  line-height: 1.35;
  word-break: break-word;
}

.event-title a {
  color: inherit;
  text-decoration: none;
}

.event-title a:hover { color: var(--accent); }

/* Markets panel */
.markets-body {
  padding: var(--panel-p);
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  flex: 1;
}

.market-section-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-top: 4px;
}

.market-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 3px 0;
  border-bottom: 1px solid rgba(31, 42, 61, 0.4);
}

.market-row:last-child { border-bottom: none; }

.market-name {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

.market-value {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.market-change {
  font-family: var(--font-mono);
  font-size: 10px;
  min-width: 70px;
  text-align: right;
}

.market-change.up   { color: var(--sev-green); }
.market-change.down { color: var(--sev-red); }
.market-change.flat { color: var(--text-dim); }

.market-fear-bar {
  margin-top: 8px;
}

.market-fear-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
}

.market-fear-label .fear-value { color: var(--text); }

.fear-bar-wrap {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.fear-bar {
  height: 100%;
  border-radius: 2px;
  background: var(--sev-green);
  transition: width 0.8s ease, background 0.8s ease;
}

/* ── Footer ──────────────────────────────────────────────────────────── */
#footer {
  height: var(--footer-h);
  min-height: var(--footer-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--panel-bg);
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.footer-update {
  color: var(--text-muted);
}

/* ── Skeleton / loading states ───────────────────────────────────────── */
.skeleton-text {
  background: linear-gradient(90deg,
    var(--border) 25%,
    var(--border-light) 50%,
    var(--border) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.8s infinite;
  border-radius: 3px;
  color: transparent !important;
  user-select: none;
  min-width: 60px;
}

.ticker-skeleton .skeleton-text,
.event-skeleton .skeleton-text {
  display: inline-block;
  width: 100%;
  height: 12px;
  border-radius: 2px;
}

/* ── Alert pulse on high-severity events ─────────────────────────────── */
.alert-pulse {
  animation: pulse 1.2s ease-in-out infinite;
}

/* ── Severity color utility classes ──────────────────────────────────── */
.sev-green    { color: var(--sev-green); }
.sev-yellow   { color: var(--sev-yellow); }
.sev-orange   { color: var(--sev-orange); }
.sev-red      { color: var(--sev-red); }
.sev-critical { color: var(--sev-critical); }


/* ═══════════════════════════════════════════════════════════════════════
   Markets hero strip
   ═══════════════════════════════════════════════════════════════════════ */

#markets-hero {
  background: var(--panel-bg);
  padding: 6px 10px 8px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.markets-hero-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  flex-shrink: 0;
}
.markets-hero-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--cat-markets);
  font-weight: 700;
}
.markets-stale-flag {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 1px;
  background: var(--cat-disasters);
  color: var(--bg);
  padding: 2px 6px;
  border-radius: 2px;
  font-weight: 700;
}
.markets-stale-flag.hidden { display: none; }
.markets-cards {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 4px;
  flex: 1;
  min-height: 0;
}
.market-card {
  background: #0f1620;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 5px 7px 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  overflow: hidden;
}
.market-card .mc-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  font-weight: 600;
}
.market-card .mc-value {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.market-card .mc-delta {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
}
.market-card .mc-delta.up   { color: var(--sev-green); }
.market-card .mc-delta.down { color: var(--sev-red); }
.market-card .mc-delta.flat { color: var(--text-muted); }

.market-fear-card .mc-value { font-size: 16px; }
.market-fear-card .mc-bar-wrap {
  height: 4px;
  background: #1f2a3d;
  border-radius: 2px;
  margin-top: 4px;
}
.market-fear-card .mc-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s ease, background 0.5s ease;
}

/* ═══════════════════════════════════════════════════════════════════════
   Polymarket strip
   ═══════════════════════════════════════════════════════════════════════ */

#polymarket-strip {
  background: var(--panel-bg);
  padding: 6px 10px 8px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.polymarket-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  flex-shrink: 0;
}
.polymarket-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: #a866dd;
  font-weight: 700;
}
.polymarket-sub {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
}
.polymarket-cards {
  display: flex;
  gap: 4px;
  flex: 1;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
}
.poly-card {
  background: #0f1620;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 5px 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 0 0 200px;
  min-width: 0;
  overflow: hidden;
}
.poly-card .poly-question {
  font-size: 11px;
  line-height: 1.3;
  color: #d8dfe9;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.poly-card .poly-question a {
  color: inherit;
  text-decoration: none;
}
.poly-card .poly-question a:hover { color: #a866dd; }
.poly-card .poly-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.poly-card .poly-prob {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.poly-card .poly-outcome {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}
.poly-card .poly-volume {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-dim);
}
.poly-card .poly-bar-wrap {
  height: 4px;
  background: #1f2a3d;
  border-radius: 2px;
}
.poly-card .poly-bar {
  height: 100%;
  background: #a866dd;
  border-radius: 2px;
}

/* ── Cyber panel header color ─────────────────────────────────────────── */
.panel-header--cyber { color: #e85d6f; }

/* ── Severity-tier highlighting (ticker + category panels) ────────────── */

.ticker-item.event-tier-critical,
.event-item.event-tier-critical {
  border-left: 4px solid var(--sev-critical);
  background: rgba(255, 31, 63, 0.07);
  animation: pulse 1.2s ease-in-out infinite;
}

.ticker-item.event-tier-severe,
.event-item.event-tier-severe {
  border-left: 3px solid var(--sev-red);
  background: rgba(232, 93, 111, 0.05);
}

.ticker-item.event-tier-elevated,
.event-item.event-tier-elevated {
  border-left: 3px solid var(--sev-orange);
}


/* ═══════════════════════════════════════════════════════════════════════
   Responsive breakpoints
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Narrow desktop / large tablet: ≤ 1280px ─────────────────────────── */
@media (max-width: 1280px) {
  #console-row {
    grid-template-columns: 170px 1.3fr repeat(4, 1fr);
  }
  .market-card .mc-value { font-size: 13px; }
}

/* ── Tablet: ≤ 1024px ────────────────────────────────────────────────── */
/* Compress the status rail; let panels share remaining space. */
@media (max-width: 1024px) {
  #console-row {
    grid-template-columns: 150px 1.2fr repeat(4, 1fr);
  }
  #global-status-value { font-size: 28px; }
  .brand-sub { display: none; }
  .market-card { padding: 4px 5px 5px; }
  .market-card .mc-value { font-size: 12px; }
}

/* ──────────────────────────────────────────────────────────────────────
   Tablet portrait + phone: ≤ 900px
   The no-scroll-above-the-fold contract is desktop-only. On narrow
   viewports the page becomes vertically scrollable so sections stay
   legible at full width instead of being squeezed to micro-text.
   ─────────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  body {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible;
    overflow-x: hidden;
  }
  #ops-grid {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
  }
  #map-section {
    height: 42vh;
    min-height: 260px;
    max-height: 480px;
    flex: 0 0 auto;
  }
  #console-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: minmax(180px, auto);
    flex: 0 0 auto;
  }
  #status-panel,
  #ticker-panel,
  .data-panel {
    min-height: 180px;
  }
  .ticker-list,
  .event-list {
    max-height: 260px;
  }
  #strip-row {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
  }
  #markets-hero,
  #polymarket-strip {
    min-height: 150px;
    padding: 10px 12px;
  }
  .markets-cards {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }
  .market-card {
    padding: 8px 10px 9px;
    min-height: 64px;
  }
  .market-card .mc-value { font-size: 16px; }
  .market-card .mc-label { font-size: 10px; }
  .market-fear-card .mc-value { font-size: 18px; }
  .polymarket-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow-x: hidden;
    overflow-y: auto;
    gap: 6px;
  }
  .poly-card {
    flex: 1 1 auto;
    padding: 8px 10px;
  }
  .poly-card .poly-question { font-size: 12px; }
  .poly-card .poly-prob { font-size: 15px; }
}

/* ── Phone: ≤ 600px ──────────────────────────────────────────────────── */
@media (max-width: 600px) {
  :root { --header-h: 44px; }

  /* Header: prevent brand from wrapping; hide subtitle */
  .brand-name { font-size: 12px; letter-spacing: 0.12em; }
  .brand-sub { display: none; }
  .sources-label { display: none; }
  .utc-clock { font-size: 13px; min-width: auto; }

  /* Map: shorter on phone to leave room for content below */
  #map-section { height: 35vh; min-height: 220px; max-height: 320px; }

  /* Console panels: single column, each full-width, generous min-height */
  #console-row {
    grid-template-columns: 1fr;
    grid-auto-rows: minmax(200px, auto);
  }
  #status-panel,
  #ticker-panel,
  .data-panel {
    min-height: 200px;
  }
  .ticker-list,
  .event-list {
    max-height: 300px;
    overflow-y: auto;
  }
  #global-status-value { font-size: 32px; }

  /* Markets: 2-column grid so 8 cards become 4 rows of 2 */
  #markets-hero {
    min-height: auto;
    padding: 10px 12px 14px;
    overflow: visible;
  }
  .markets-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .market-card {
    padding: 10px 12px 11px;
    min-height: 72px;
  }
  .market-card .mc-label {
    font-size: 10px;
    letter-spacing: 0.1em;
  }
  .market-card .mc-value {
    font-size: 17px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .market-card .mc-delta { font-size: 11px; }
  .market-fear-card .mc-value { font-size: 17px; }

  /* Polymarket: single-column vertical list, internal scroll if many cards */
  #polymarket-strip {
    min-height: auto;
    padding: 10px 12px 14px;
  }
  .polymarket-cards {
    display: grid;
    grid-template-columns: 1fr;
    overflow-x: hidden;
    overflow-y: auto;
    max-height: 400px;
    gap: 8px;
    /* cancel the flex sizing from the default rule */
    flex: none;
  }
  .poly-card {
    flex: none;
    padding: 10px 12px;
    min-height: 80px;
  }
  .poly-card .poly-question {
    font-size: 13px;
    -webkit-line-clamp: 3;
  }
  .poly-card .poly-prob { font-size: 16px; }
}

/* ── Very small: ≤ 375px ─────────────────────────────────────────────── */
@media (max-width: 375px) {
  #header-meta { gap: 8px; }
  .utc-clock { font-size: 12px; }

  /* Keep 2-column market cards but tighten spacing */
  .markets-cards { gap: 6px; }
  .market-card {
    padding: 8px 8px 9px;
    min-height: 68px;
  }
  .market-card .mc-value { font-size: 15px; }
  .market-card .mc-delta { font-size: 10px; }

  /* Tighten poly cards */
  .poly-card { padding: 8px 10px; }
  .poly-card .poly-question { font-size: 12px; }
}

/* ══════════════════════════════════════════════════════════════════════
   Agenda Free TV — live-stream pin (inside NEWS panel)
   Pinned at top of #dp-social above the news list. Hidden when offline.
   ══════════════════════════════════════════════════════════════════════ */

.aftv-news-pin {
  display: block;
  flex-shrink: 0;
  background: #1c0800;
  border-left: 3px solid #ff4400;
  border-bottom: 1px solid #ff4400;
  padding: 7px var(--panel-p) 8px;
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
  animation: fadeIn 0.3s ease;
}

.aftv-news-pin:hover {
  background: rgba(255, 68, 0, 0.14);
  text-decoration: none;
}

/* Hidden state: removed from flow entirely */
.aftv-news-pin--hidden {
  display: none;
}

/* Top row: pulse dot + LIVE badge + channel label */
.aftv-pin-header {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 3px;
}

/* Pulsing red dot — reuses existing @keyframes pulse */
.aftv-pin-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ff4400;
  box-shadow: 0 0 6px #ff4400;
  flex-shrink: 0;
  animation: pulse 1s ease-in-out infinite;
}

.aftv-pin-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #1a0800;
  background: #ff4400;
  padding: 1px 5px;
  border-radius: 2px;
  flex-shrink: 0;
}

.aftv-pin-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: #ff8866;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* Second line: static descriptor */
.aftv-pin-subline {
  display: block;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: #ff6633;
  text-transform: uppercase;
  margin-bottom: 3px;
}

/* Third line: stream title from oEmbed, truncated with ellipsis */
.aftv-pin-title {
  display: block;
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════════════════
   Markets open/closed status indicator  (#markets-status)
   ══════════════════════════════════════════════════════════════════════ */

#markets-status {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  white-space: nowrap;
  flex-shrink: 0;
  /* default: muted until state is known */
  color: var(--text-muted);
}

#markets-status[data-state="open"] {
  color: var(--sev-green);
}

#markets-status[data-state="closed"] {
  color: var(--text-muted);
}

/* Animate the separator dot when open */
#markets-status[data-state="open"]::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--sev-green);
  box-shadow: 0 0 5px var(--sev-green);
  margin-right: 5px;
  vertical-align: middle;
  animation: pulse 1.8s ease-in-out infinite;
}

#markets-status[data-state="closed"]::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-dim);
  margin-right: 5px;
  vertical-align: middle;
}
