/* ============ MARVEL-SPYS — SHARED THEME ============ */
:root {
  --red: #ec1d24;
  --red-dark: #8f0f14;
  --red-glow: rgba(236, 29, 36, 0.55);
  --white: #f5f5f5;
  --dim: rgba(245, 245, 245, 0.55);
  --bg: #0a0507;
  --panel: rgba(20, 8, 10, 0.82);
  --panel-border: rgba(236, 29, 36, 0.35);
  --mono: "SF Mono", "JetBrains Mono", "Fira Code", ui-monospace, Menlo, monospace;
  --sans: "Helvetica Neue", "Arial Narrow", Arial, sans-serif;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--white);
  font-family: var(--mono);
  overflow: hidden;
  cursor: crosshair;
}

/* animated background grid */
body::before {
  content: "";
  position: fixed; inset: 0;
  background-image:
    linear-gradient(rgba(236, 29, 36, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(236, 29, 36, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  animation: gridDrift 24s linear infinite;
  pointer-events: none;
  z-index: 0;
}
@keyframes gridDrift { from { background-position: 0 0; } to { background-position: 48px 48px; } }

/* CRT scanlines over everything */
body::after {
  content: "";
  position: fixed; inset: 0;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0.22) 0px, rgba(0,0,0,0.22) 1px, transparent 2px, transparent 4px);
  pointer-events: none;
  z-index: 9998;
  mix-blend-mode: multiply;
}
.vignette {
  position: fixed; inset: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.65) 100%);
  pointer-events: none; z-index: 9997;
}

/* ============ LAYOUT ============ */
.screen {
  position: relative; z-index: 1;
  height: 100vh;
  display: flex; flex-direction: column;
  padding: 14px 18px;
  gap: 12px;
}

/* ============ TOP BAR ============ */
.topbar {
  display: flex; align-items: center; gap: 18px;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 10px;
  flex: 0 0 auto;
}
.marvel-logo {
  display: block;
  height: 44px;
  width: auto;
  box-shadow: 0 0 22px var(--red-glow);
  animation: logoPulse 3.2s ease-in-out infinite;
  user-select: none;
}
@keyframes logoPulse {
  0%, 100% { box-shadow: 0 0 18px var(--red-glow); }
  50% { box-shadow: 0 0 38px var(--red-glow), 0 0 70px rgba(236,29,36,0.25); }
}
.division {
  font-size: 13px; letter-spacing: 4px; text-transform: uppercase; color: var(--dim);
}
.division b { color: var(--white); }
.topbar .spacer { flex: 1; }
.clock { font-size: 20px; font-weight: 700; letter-spacing: 2px; color: var(--white); text-shadow: 0 0 12px var(--red-glow); }
.clock small { display: block; font-size: 10px; font-weight: 400; color: var(--dim); letter-spacing: 3px; text-align: right; }
.status-chip {
  border: 1px solid var(--red);
  color: var(--red);
  font-size: 11px; letter-spacing: 3px;
  padding: 5px 12px;
  text-transform: uppercase;
  animation: blinkChip 1.6s steps(2) infinite;
}
@keyframes blinkChip { 50% { background: var(--red); color: #fff; } }

/* ============ PANELS ============ */
.grid { display: grid; gap: 12px; flex: 1; min-height: 0; }
.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  position: relative;
  display: flex; flex-direction: column;
  min-height: 0;
  overflow: hidden;
  backdrop-filter: blur(2px);
}
.panel::before, .panel::after {
  content: ""; position: absolute; width: 14px; height: 14px; border: 2px solid var(--red); z-index: 2;
}
.panel::before { top: -2px; left: -2px; border-right: none; border-bottom: none; }
.panel::after { bottom: -2px; right: -2px; border-left: none; border-top: none; }
.panel-head {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(236,29,36,0.2);
  font-size: 11px; letter-spacing: 3px; text-transform: uppercase;
  color: var(--white);
  flex: 0 0 auto;
}
.panel-head .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--red); box-shadow: 0 0 8px var(--red);
  animation: dotBlink 1.2s ease-in-out infinite;
}
@keyframes dotBlink { 50% { opacity: 0.25; } }
.panel-head .tag { margin-left: auto; color: var(--dim); font-size: 10px; letter-spacing: 2px; }
.panel-body { flex: 1; min-height: 0; position: relative; padding: 10px 12px; overflow: hidden; }
.panel-body.nopad { padding: 0; }

/* ============ STATS ============ */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 12px; }
.stat {
  text-align: center; padding: 10px 6px;
  border: 1px solid rgba(236,29,36,0.18);
  background: rgba(236,29,36,0.04);
}
.stat .num { font-size: 32px; font-weight: 700; color: var(--white); text-shadow: 0 0 14px var(--red-glow); line-height: 1.1; }
.stat .lbl { font-size: 9px; letter-spacing: 2px; text-transform: uppercase; color: var(--dim); margin-top: 4px; }
.stat.alert .num { color: var(--red); animation: numFlash 1s steps(2) infinite; }
@keyframes numFlash { 50% { opacity: 0.4; } }

/* progress bars */
.bar { margin: 8px 0; }
.bar .bar-lbl { display: flex; justify-content: space-between; font-size: 10px; letter-spacing: 1.5px; color: var(--dim); margin-bottom: 4px; text-transform: uppercase; }
.bar .bar-lbl b { color: var(--white); }
.bar .track { height: 6px; background: rgba(255,255,255,0.08); position: relative; overflow: hidden; }
.bar .fill {
  height: 100%; background: linear-gradient(90deg, var(--red-dark), var(--red));
  box-shadow: 0 0 10px var(--red-glow);
  transition: width 0.9s cubic-bezier(.22,1,.36,1);
}
.bar .fill.stripe {
  background-image: repeating-linear-gradient(45deg, rgba(255,255,255,0.25) 0 6px, transparent 6px 12px), linear-gradient(90deg, var(--red-dark), var(--red));
  animation: stripeMove 0.8s linear infinite;
}
@keyframes stripeMove { to { background-position: 17px 0, 0 0; } }

/* ============ FEED / TERMINAL ============ */
.feed { font-size: 12px; line-height: 1.75; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.feed .line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; animation: lineIn 0.25s ease-out; }
@keyframes lineIn { from { opacity: 0; transform: translateX(-8px); } }
.feed .t { color: var(--red); margin-right: 8px; }
.feed .ok { color: #7dff9b; }
.feed .warn { color: #ffd24d; }
.feed .crit { color: var(--red); font-weight: 700; animation: numFlash 0.9s steps(2) infinite; }
.cursor::after { content: "█"; animation: curBlink 0.9s steps(2) infinite; color: var(--red); }
@keyframes curBlink { 50% { opacity: 0; } }

/* ============ TICKER ============ */
.ticker-wrap {
  flex: 0 0 auto;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  overflow: hidden;
  display: flex; align-items: center;
  height: 36px;
}
.ticker-label {
  background: var(--red); color: #fff; font-weight: 700;
  font-size: 11px; letter-spacing: 2px;
  padding: 0 14px; height: 100%; display: flex; align-items: center;
  flex: 0 0 auto; z-index: 2;
}
.ticker { white-space: nowrap; display: inline-block; padding-left: 100%; animation: tick 60s linear infinite; font-size: 12px; letter-spacing: 1px; }
.ticker span { margin-right: 60px; color: var(--dim); }
.ticker span b { color: var(--white); }
.ticker span.red { color: var(--red); }
@keyframes tick { to { transform: translateX(-100%); } }

/* ============ TABLES ============ */
table.data { width: 100%; border-collapse: collapse; font-size: 11.5px; }
table.data th { text-align: left; color: var(--dim); font-weight: 400; letter-spacing: 2px; text-transform: uppercase; font-size: 9.5px; padding: 5px 8px; border-bottom: 1px solid rgba(236,29,36,0.25); }
table.data td { padding: 6px 8px; border-bottom: 1px solid rgba(255,255,255,0.05); }
table.data tr:hover td { background: rgba(236,29,36,0.08); }
.pill { font-size: 9px; letter-spacing: 1.5px; padding: 2px 8px; border: 1px solid; text-transform: uppercase; }
.pill.ok { color: #7dff9b; border-color: rgba(125,255,155,0.5); }
.pill.warn { color: #ffd24d; border-color: rgba(255,210,77,0.5); }
.pill.crit { color: var(--red); border-color: var(--red); animation: numFlash 1s steps(2) infinite; }

/* ============ GLITCH ============ */
.glitch { position: relative; display: inline-block; }
.glitch-active { animation: glitchShake 0.25s steps(3) 2; }
@keyframes glitchShake {
  0% { transform: translate(0); filter: none; }
  25% { transform: translate(-3px, 1px); filter: hue-rotate(40deg); }
  50% { transform: translate(3px, -2px); opacity: 0.7; }
  75% { transform: translate(-2px, -1px); }
  100% { transform: translate(0); }
}

/* big headline typography */
.hud-title { font-family: var(--sans); font-weight: 900; text-transform: uppercase; letter-spacing: 2px; }

/* scrollless helper */
canvas.fill { display: block; width: 100%; height: 100%; }

/* boot overlay */
#boot {
  position: fixed; inset: 0; background: var(--bg); z-index: 10000;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  transition: opacity 0.6s ease; font-family: var(--mono);
}
#boot.done { opacity: 0; pointer-events: none; }
#boot .boot-logo {
  width: 300px; height: auto; display: block;
  box-shadow: 0 0 60px var(--red-glow);
  animation: bootIn 0.9s cubic-bezier(.22,1,.36,1);
}
@keyframes bootIn { from { transform: scale(3); opacity: 0; filter: blur(14px); } }
#boot .boot-sub { letter-spacing: 8px; font-size: 13px; color: var(--dim); text-transform: uppercase; }
#boot .boot-bar { width: 320px; height: 4px; background: rgba(255,255,255,0.1); }
#boot .boot-bar i { display: block; height: 100%; width: 0; background: var(--red); box-shadow: 0 0 12px var(--red); }
#boot .boot-log { font-size: 11px; color: var(--dim); height: 16px; letter-spacing: 1px; }
