/* ── Variables (dark theme — default) ────────────────────── */
:root {
  --bg:          #08090f;
  --surface:     #0d1017;
  --surface-2:   #131720;
  --border:      #1e2535;
  --border-hi:   #2a3347;

  --blue:        #2563eb;
  --blue-light:  #3b82f6;
  --blue-dim:    rgba(37, 99, 235, 0.12);
  --blue-glow:   rgba(59, 130, 246, 0.2);

  --white:       #f8fafc;
  --white-dim:   #94a3b8;
  --white-muted: #475569;

  --red:         #ef4444;
  --orange:      #f97316;
  --yellow:      #eab308;
  --green:       #22c55e;
  --purple:      #a855f7;
  --cyan:        #06b6d4;

  --header-h:  56px;
  --sidebar-w: 236px;
  --feed-w:    272px;
  --bottom-h:  48px;

  --font:      'Inter', sans-serif;
  --mono:      'JetBrains Mono', monospace;

  --radius:    6px;
  --radius-sm: 4px;

  /* map tile tint — overridden per theme */
  --map-filter: none;
  --map-bg: #060b12;
}

/* ── Light theme ────────────────────────────────────────── */
html[data-theme="light"] {
  --bg:          #f0f4f8;
  --surface:     #ffffff;
  --surface-2:   #f1f5f9;
  --border:      #e2e8f0;
  --border-hi:   #cbd5e1;

  --blue:        #2563eb;
  --blue-light:  #2563eb;
  --blue-dim:    rgba(37, 99, 235, 0.08);
  --blue-glow:   rgba(37, 99, 235, 0.15);

  --white:       #0f172a;
  --white-dim:   #334155;
  --white-muted: #64748b;

  --red:         #dc2626;
  --orange:      #ea580c;
  --yellow:      #ca8a04;
  --green:       #16a34a;

  --map-bg:      #d1dce8;
}

/* ── Matrix / neon theme ────────────────────────────────── */
html[data-theme="neon"] {
  --bg:          #000800;
  --surface:     #010e01;
  --surface-2:   #001500;
  --border:      #082008;
  --border-hi:   #0d350d;

  --blue:        #00ff41;
  --blue-light:  #00ff41;
  --blue-dim:    rgba(0, 255, 65, 0.08);
  --blue-glow:   rgba(0, 255, 65, 0.18);

  --white:       #00ff41;
  --white-dim:   #00cc33;
  --white-muted: #006615;

  --red:         #ff3333;
  --orange:      #ff8800;
  --yellow:      #ffe000;
  --green:       #00ff41;
  --purple:      #bb00ff;
  --cyan:        #00ffdd;

  --map-filter:  hue-rotate(90deg) saturate(4) brightness(0.55);
  --map-bg:      #000800;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--white);
  font-family: var(--font);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: var(--mono); }

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

/* ── Header ────────────────────────────────────────────── */
#header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 1000;
  gap: 10px;
}

.header-left  { display: flex; align-items: center; gap: 12px; }
.header-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* Logo */
.logo { display: flex; align-items: center; gap: 10px; }

.logo-icon {
  width: 32px; height: 32px;
  background: var(--blue-dim);
  border: 1px solid rgba(37,99,235,0.35);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

html[data-theme="neon"] .logo-icon {
  border-color: rgba(0,255,65,0.35);
}

html[data-theme="neon"] .logo-icon svg path {
  stroke: #00ff41;
  fill: rgba(0,255,65,0.1);
}

html[data-theme="neon"] .logo-icon svg circle {
  fill: #00ff41;
}

.logo-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--blue-light);
  box-shadow: 0 0 10px var(--blue-glow);
  animation: dot-pulse 2s ease-in-out infinite;
}

@keyframes dot-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

.logo-text { display: flex; flex-direction: column; gap: 1px; }

.logo-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.01em;
  line-height: 1;
}

.logo-sub {
  font-size: 10px;
  color: var(--white-muted);
  letter-spacing: 0.03em;
}

/* Live chip */
.live-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.25);
  font-size: 11px;
  font-weight: 500;
  color: #ef4444;
  flex-shrink: 0;
}

.chip-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #ef4444;
  animation: chip-blink 1.4s ease-in-out infinite;
}

@keyframes chip-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* Nav */
.header-center { display: flex; align-items: center; gap: 20px; }

.nav-item {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--white-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.nav-item:hover  { color: var(--white); background: var(--surface-2); }
.nav-item.active { color: var(--blue-light); background: var(--blue-dim); }

/* Header stats */
.header-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; }

.hs-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--white-muted);
}

.hs-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--white);
  line-height: 1;
  font-family: var(--mono);
}

.hs-value.accent { color: var(--blue-light); }
.hs-value.green  { color: var(--green); }

.header-divider {
  width: 1px; height: 28px;
  background: var(--border);
  flex-shrink: 0;
}

.clock-wrap { display: flex; flex-direction: column; align-items: center; gap: 2px; }

.clock-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--white-muted);
}

.clock-val {
  font-size: 13px;
  color: var(--white-dim);
  letter-spacing: 0.05em;
}

/* ── Playback controls ──────────────────────────────────── */
.ctrl-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ctrl-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--white-muted);
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
  line-height: 1;
}

.ctrl-btn:hover {
  background: var(--border);
  color: var(--white);
}

.ctrl-btn.paused {
  background: var(--blue-dim);
  border-color: rgba(59,130,246,0.3);
  color: var(--blue-light);
}

/* Speed buttons */
.speed-wrap {
  display: flex;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.speed-btn {
  background: transparent;
  border: none;
  border-right: 1px solid var(--border);
  color: var(--white-muted);
  font-size: 10px;
  font-weight: 600;
  font-family: var(--mono);
  padding: 0 8px;
  height: 28px;
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
}

.speed-btn:last-child { border-right: none; }

.speed-btn:hover { color: var(--white); background: var(--border); }

.speed-btn.active {
  background: var(--blue-dim);
  color: var(--blue-light);
}

/* ── Theme picker ───────────────────────────────────────── */
.theme-picker {
  display: flex;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.theme-btn {
  background: transparent;
  border: none;
  border-right: 1px solid var(--border);
  color: var(--white-muted);
  font-size: 13px;
  width: 28px; height: 28px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.12s;
}

.theme-btn:last-child { border-right: none; }

.theme-btn:hover { color: var(--white); background: var(--border); }

.theme-btn.active {
  background: var(--blue-dim);
  color: var(--blue-light);
}

/* ── Hamburger (mobile only) ────────────────────────────── */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4.5px;
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  width: 32px; height: 32px;
  flex-shrink: 0;
}

.hamburger span {
  display: block;
  width: 18px; height: 1.5px;
  background: var(--white-dim);
  border-radius: 1px;
  transition: all 0.25s ease;
  transform-origin: center;
}

/* animated X when sidebar is open */
.hamburger.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ── Layout shell ───────────────────────────────────────── */
#layout {
  position: fixed;
  top: var(--header-h);
  left: 0; right: 0;
  bottom: var(--bottom-h);
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr var(--feed-w);
}

/* ── Sidebar ────────────────────────────────────────────── */
#sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; }

.sidebar-section { padding: 16px 16px 12px; }

.section-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--white-muted);
  margin-bottom: 10px;
}

.section-dot {
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 50%;
  margin-right: 5px;
  flex-shrink: 0;
  vertical-align: middle;
}

.sidebar-sep {
  height: 1px;
  background: var(--border);
  margin: 0 16px;
}

.rank-list { display: flex; flex-direction: column; gap: 6px; }

.rank-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rank-num {
  font-size: 10px;
  color: var(--white-muted);
  width: 14px;
  flex-shrink: 0;
  font-family: var(--mono);
}

.rank-flag { font-size: 14px; flex-shrink: 0; }

.rank-info { flex: 1; min-width: 0; }

.rank-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--white-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}

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

.rank-fill {
  height: 100%;
  border-radius: 1px;
  transition: width 0.6s ease;
}

.rank-count {
  font-size: 10px;
  font-family: var(--mono);
  color: var(--white-muted);
  flex-shrink: 0;
}

.type-list { display: flex; flex-direction: column; gap: 5px; }

.type-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

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

.type-name { flex: 1; font-size: 11px; color: var(--white-dim); }

.type-pct {
  font-size: 10px;
  font-family: var(--mono);
  color: var(--white-muted);
  min-width: 30px;
  text-align: right;
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-label { font-size: 11px; color: var(--white-muted); }

.footer-val {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--white-dim);
}

.footer-val.green { color: var(--green); }
.footer-val.blue  { color: var(--blue-light); }
.footer-val.muted { color: var(--white-muted); }

/* ── Map ────────────────────────────────────────────────── */
#map-wrap { position: relative; overflow: hidden; }

#map {
  width: 100%; height: 100%;
  background: var(--map-bg);
  transition: background 0.4s;
}

/* Leaflet overrides */
.leaflet-container { font-family: var(--font); background: var(--map-bg); }
.leaflet-control-zoom { display: none !important; }
.leaflet-control-attribution { display: none !important; }

/* apply theme tint to map tiles */
.leaflet-tile-pane {
  filter: var(--map-filter);
  transition: filter 0.4s;
}

/* Filter bar (over map) */
#filter-bar {
  position: absolute;
  top: 12px; left: 12px;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(13,16,23,0.88);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  backdrop-filter: blur(8px);
  max-width: calc(100% - 24px);
  overflow: hidden;
}

html[data-theme="light"] #filter-bar {
  background: rgba(255,255,255,0.92);
}

html[data-theme="neon"] #filter-bar {
  background: rgba(0,10,0,0.92);
}

.filter-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--white-muted);
  flex-shrink: 0;
}

#filter-chips {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
#filter-chips::-webkit-scrollbar { display: none; }

.fchip {
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
}

.fchip.active {
  background: var(--blue-dim);
  border-color: rgba(59,130,246,0.3);
  color: var(--blue-light);
}

.fchip:not(.active) {
  background: transparent;
  border-color: var(--border);
  color: var(--white-muted);
}

.fchip:hover:not(.active) { border-color: var(--border-hi); color: var(--white-dim); }

/* Attack detail card */
#attack-card {
  position: absolute;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  background: var(--surface);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  padding: 14px 16px;
  min-width: 320px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  animation: card-in 0.2s ease;
}

@keyframes card-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

#attack-card.hidden { display: none; }

.ac-header {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
}

.ac-type-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.ac-type { font-size: 12px; font-weight: 600; flex: 1; }

.ac-sev {
  font-size: 10px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 20px;
}

.ac-close {
  background: none; border: none; cursor: pointer;
  color: var(--white-muted); font-size: 12px; padding: 0 2px;
  transition: color 0.15s;
}
.ac-close:hover { color: var(--white); }

.ac-route {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.ac-side { flex: 1; }
.ac-side.right { text-align: right; }

.ac-flag    { font-size: 18px; margin-bottom: 2px; }
.ac-country { font-size: 12px; font-weight: 500; color: var(--white); margin-bottom: 2px; }
.ac-ip      { font-size: 10px; color: var(--white-muted); }
.ac-arrow   { font-size: 16px; color: var(--blue-light); flex-shrink: 0; }
.ac-meta    { font-size: 10px; color: var(--white-muted); border-top: 1px solid var(--border); padding-top: 8px; }

/* Mobile floating feed button */
.mobile-feed-btn {
  display: none;
  position: absolute;
  bottom: 16px;
  right: 12px;
  z-index: 500;
  background: var(--surface);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  color: var(--white-dim);
  font-size: 11px;
  font-weight: 500;
  padding: 6px 12px;
  cursor: pointer;
  align-items: center;
  gap: 5px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  transition: all 0.15s;
}

.mobile-feed-btn:hover { background: var(--surface-2); color: var(--white); }

/* ── Right feed ─────────────────────────────────────────── */
#feed-panel {
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.feed-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.feed-title-row { display: flex; align-items: center; gap: 7px; }

.panel-title { font-size: 12px; font-weight: 600; color: var(--white); }

.feed-close {
  background: none; border: none; cursor: pointer;
  color: var(--white-muted); font-size: 12px; padding: 2px 4px;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  display: none;
}
.feed-close:hover { color: var(--white); background: var(--surface-2); }

.feed-count { font-size: 10px; color: var(--white-muted); }

#feed-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; }

.feed-row {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
  animation: row-in 0.25s ease;
}

.feed-row:hover { background: var(--surface-2); }

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

.fr-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  gap: 6px;
}

.fr-left { display: flex; align-items: center; gap: 6px; }

.fr-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.fr-type { font-size: 11px; font-weight: 600; }

.fr-sev {
  font-size: 9px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 20px;
}

.fr-real {
  font-size: 9px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 20px;
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.2);
  color: var(--green);
}

.fr-time { font-size: 9px; color: var(--white-muted); flex-shrink: 0; }

.fr-route {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fr-side { flex: 1; min-width: 0; }
.fr-side.right { text-align: right; }

.fr-flag-name {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 1px;
}

.fr-flag-name.right { justify-content: flex-end; }

.fr-flag    { font-size: 11px; }
.fr-country {
  font-size: 10px; font-weight: 500; color: var(--white-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.fr-ip {
  font-size: 9px; font-family: var(--mono); color: var(--white-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.fr-arrow { flex-shrink: 0; }

.fr-pulse {
  margin-top: 5px;
  font-size: 9px;
  color: rgba(34,197,94,0.55);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Bottom bar ─────────────────────────────────────────── */
#bottom-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottom-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 1000;
  gap: 12px;
}

#type-stats {
  display: flex;
  align-items: center;
  flex: 1;
  overflow-x: auto;
  height: 100%;
  scrollbar-width: none;
}
#type-stats::-webkit-scrollbar { display: none; }

.ts-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 14px;
  border-right: 1px solid var(--border);
  height: 100%;
  flex-shrink: 0;
}

.ts-dot   { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.ts-name  { font-size: 10px; font-weight: 500; color: var(--white-muted); white-space: nowrap; }
.ts-count { font-size: 14px; font-weight: 700; font-family: var(--mono); color: var(--white); min-width: 20px; transition: color 0.3s; }

.bottom-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  padding-left: 16px;
  border-left: 1px solid var(--border);
}

.legend-label { font-size: 10px; color: var(--white-muted); white-space: nowrap; }

.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--white-muted);
  white-space: nowrap;
}

.ldot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

/* ── Severity colors ────────────────────────────────────── */
.sev-critical { color: var(--red);    background: rgba(239,68,68,0.1);  border: 1px solid rgba(239,68,68,0.2); }
.sev-high     { color: var(--orange); background: rgba(249,115,22,0.1); border: 1px solid rgba(249,115,22,0.2); }
.sev-medium   { color: var(--yellow); background: rgba(234,179,8,0.1);  border: 1px solid rgba(234,179,8,0.2); }
.sev-low      { color: var(--green);  background: rgba(34,197,94,0.1);  border: 1px solid rgba(34,197,94,0.2); }

/* Arc SVG overlay */
#arc-svg {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 450;
  overflow: visible;
}

/* Paused state overlay hint */
#map-wrap.paused::after {
  content: '⏸ PAUSED';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--white-muted);
  pointer-events: none;
  z-index: 600;
  background: rgba(0,0,0,0.5);
  padding: 6px 14px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

html[data-theme="light"] #map-wrap.paused::after {
  background: rgba(240,244,248,0.85);
}

/* Data badge utility */
.data-badge { display:flex; align-items:center; gap:6px; font-size:11px; color:var(--white-muted); font-family: var(--mono); letter-spacing:0.04em; }
.badge-dot  { width:6px; height:6px; border-radius:50%; background:var(--green); box-shadow:0 0 5px var(--green); animation:dot-pulse 2s ease-in-out infinite; }

/* Arc pulse ring animation */
@keyframes pulse-ring {
  0%   { r:4;  stroke-opacity:0.8; stroke-width:2; }
  100% { r:18; stroke-opacity:0;   stroke-width:0.5; }
}

/* ── Mobile overlay (darkens map when sidebar/feed is open) */
#mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 850;
  backdrop-filter: blur(2px);
}

#mobile-overlay.show { display: block; }

/* ── Mobile responsive ───────────────────────────────────── */
@media (max-width: 768px) {

  /* show hamburger, hide desktop-only bits */
  .hamburger     { display: flex; }
  .hide-mobile   { display: none !important; }
  .hide-desktop  { display: flex !important; }
  .feed-close    { display: flex; }

  #header { padding: 0 12px; gap: 8px; }

  /* single-column layout, map takes everything */
  #layout {
    grid-template-columns: 1fr;
  }

  /* sidebar slides in from the left */
  #sidebar {
    position: fixed;
    left: -290px;
    top: var(--header-h);
    bottom: var(--bottom-h);
    width: 270px;
    z-index: 900;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
  }

  #sidebar.open { left: 0; }

  /* feed panel slides in from the right */
  #feed-panel {
    position: fixed;
    right: -290px;
    top: var(--header-h);
    bottom: var(--bottom-h);
    width: 270px;
    z-index: 900;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -4px 0 24px rgba(0,0,0,0.5);
  }

  #feed-panel.open { right: 0; }

  /* show the floating feed toggle button */
  .mobile-feed-btn { display: flex; }

  /* filter bar wraps on small screens */
  #filter-bar {
    max-width: calc(100% - 24px);
    flex-wrap: wrap;
  }

  /* attack card is full-width on mobile */
  #attack-card {
    left: 12px;
    right: 12px;
    bottom: 12px;
    transform: none;
    min-width: 0;
  }

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

  /* bottom bar: hide type stats on tiny screens, keep legend */
  #type-stats { display: none; }

  .bottom-legend {
    border-left: none;
    padding-left: 0;
    width: 100%;
    justify-content: center;
  }

  /* speed buttons label tweak */
  .speed-wrap { display: none; }

  /* keep ctrl group compact */
  .ctrl-group { gap: 3px; }

  /* logo sub text hidden on very small screens */
  .logo-sub { display: none; }
}

/* even smaller phones */
@media (max-width: 420px) {
  .live-chip span:not(.chip-dot) { display: none; }
  .live-chip { padding: 3px 7px; }
}
