/* ─── JARVIS / STARK INDUSTRIES Design System ─────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;600;700;800;900&family=Share+Tech+Mono&family=Rajdhani:wght@300;400;500;600;700&display=swap');

:root {
  /* Core palette — Stark blue/cyan */
  --bg:          #000820;
  --bg2:         #000d2a;
  --bg3:         #001040;
  --panel:       rgba(0, 12, 35, 0.92);
  --border:      rgba(0, 168, 255, 0.2);
  --border2:     rgba(0, 220, 255, 0.5);
  --border-hot:  rgba(0, 230, 255, 0.9);

  /* Glow colours */
  --cyan:        #00e5ff;
  --cyan-dim:    rgba(0, 229, 255, 0.12);
  --cyan-glow:   rgba(0, 229, 255, 0.5);
  --cyan-glow2:  rgba(0, 229, 255, 0.15);
  --blue:        #0088ff;
  --blue-dim:    rgba(0, 136, 255, 0.15);
  --blue-glow:   rgba(0, 136, 255, 0.4);
  --orange:      #ff6b00;
  --orange-dim:  rgba(255, 107, 0, 0.15);
  --red:         #ff2244;
  --red-dim:     rgba(255, 34, 68, 0.15);
  --amber:       #ffaa00;
  --amber-dim:   rgba(255, 170, 0, 0.15);
  --green:       #00ff88;
  --green-dim:   rgba(0, 255, 136, 0.12);

  /* Text */
  --text:        #c8eeff;
  --text-dim:    #4a7a9b;
  --text-muted:  #1a3a5c;

  /* Fonts */
  --display:  'Orbitron', monospace;
  --mono:     'Share Tech Mono', monospace;
  --sans:     'Rajdhani', sans-serif;

  --radius:    8px;
  --radius-sm: 4px;
}

/* ─── Reset ─────────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  cursor: crosshair;
}

/* ─── Multi-layer background ─────────────────────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(0,100,200,0.08) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(0,50,150,0.06) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* Scan line overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 180, 255, 0.015) 2px,
    rgba(0, 180, 255, 0.015) 4px
  );
  pointer-events: none;
  z-index: 999;
  animation: scanlines 8s linear infinite;
}

@keyframes scanlines {
  0% { background-position: 0 0; }
  100% { background-position: 0 -100vh; }
}

/* ─── Canvas layers ──────────────────────────────────────────────────────────── */
#particle-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

#hex-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.35;
}

/* ─── Layout ─────────────────────────────────────────────────────────────────── */
#app {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 2;
}

/* ─── Sidebar ────────────────────────────────────────────────────────────────── */
#sidebar {
  width: 230px;
  min-height: 100vh;
  background: linear-gradient(180deg, rgba(0,8,30,0.97) 0%, rgba(0,12,40,0.98) 100%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow: hidden;
}

/* Sidebar circuit trace decoration */
#sidebar::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 1px;
  height: 100%;
  background: linear-gradient(180deg,
    transparent 0%,
    var(--cyan) 20%,
    var(--border2) 50%,
    var(--cyan) 80%,
    transparent 100%
  );
  animation: trace-down 4s ease-in-out infinite;
  box-shadow: 0 0 8px var(--cyan-glow);
}

@keyframes trace-down {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

.sidebar-logo {
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.logo-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.logo-hex {
  width: 32px;
  height: 32px;
  position: relative;
  flex-shrink: 0;
}

.logo-text {
  font-family: var(--display);
  font-size: 14px;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 0.15em;
  text-shadow: 0 0 20px var(--cyan-glow), 0 0 40px var(--cyan-glow2);
}

.logo-sub {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding-left: 42px;
}

/* Score mini in sidebar */
.sidebar-score-mini {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  text-align: center;
  position: relative;
}

.score-mini-num {
  font-family: var(--display);
  font-size: 38px;
  font-weight: 900;
  color: var(--cyan);
  line-height: 1;
  text-shadow: 0 0 30px var(--cyan-glow), 0 0 60px var(--cyan-glow2);
  letter-spacing: 0.05em;
}

.score-mini-label {
  font-family: var(--mono);
  font-size: 8px;
  color: var(--text-dim);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-top: 4px;
}

/* Nav */
nav {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
}

.nav-section-label {
  font-family: var(--mono);
  font-size: 8px;
  color: var(--text-muted);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  padding: 10px 18px 4px;
  border-top: 1px solid rgba(0,100,200,0.1);
  margin-top: 4px;
}

.nav-section-label:first-child { border-top: none; margin-top: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  color: var(--text-dim);
  cursor: pointer;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  transition: all 0.2s;
  border-left: 2px solid transparent;
  text-decoration: none;
  user-select: none;
  position: relative;
}

.nav-item::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 60%;
  background: var(--cyan);
  transition: width 0.2s;
  opacity: 0.3;
}

.nav-item:hover {
  color: var(--cyan);
  background: rgba(0, 200, 255, 0.05);
  border-left-color: rgba(0,200,255,0.4);
}

.nav-item.active {
  color: var(--cyan);
  background: rgba(0, 200, 255, 0.08);
  border-left-color: var(--cyan);
}

.nav-item.active::after { width: 2px; }

.nav-icon {
  font-size: 14px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
}

/* ─── Main ───────────────────────────────────────────────────────────────────── */
#main {
  margin-left: 230px;
  flex: 1;
  padding: 0;
  min-height: 100vh;
}

.section {
  display: none;
  padding: 28px 32px;
  min-height: 100vh;
  animation: section-in 0.4s ease;
}

.section.active { display: block; }

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

/* ─── Top bar ────────────────────────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.section-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 120px;
  height: 1px;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan-glow);
}

.section-title {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-shadow: 0 0 20px var(--cyan-glow2);
}

.section-subtitle {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ─── Cards ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(8px);
  transition: border-color 0.3s, box-shadow 0.3s;
}

/* Corner bracket decoration */
.card::before, .card::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: var(--cyan);
  border-style: solid;
  opacity: 0.6;
  transition: opacity 0.3s;
}

.card::before {
  top: -1px; left: -1px;
  border-width: 2px 0 0 2px;
  border-radius: 4px 0 0 0;
}

.card::after {
  bottom: -1px; right: -1px;
  border-width: 0 2px 2px 0;
  border-radius: 0 0 4px 0;
}

.card:hover {
  border-color: var(--border2);
  box-shadow: 0 0 20px rgba(0,180,255,0.08), inset 0 0 30px rgba(0,100,200,0.03);
}

.card:hover::before, .card:hover::after { opacity: 1; }

/* Additional corner brackets (top-right, bottom-left) */
.card-title {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 400;
  color: var(--cyan);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title::before {
  content: '//';
  color: var(--text-muted);
  font-size: 10px;
}

/* Card accent variants */
.card-accent        { border-color: rgba(0,229,255,0.4); }
.card-accent-blue   { border-color: rgba(0,136,255,0.4); }
.card-accent-amber  { border-color: rgba(255,170,0,0.4); }
.card-accent-red    { border-color: rgba(255,34,68,0.4); }
.card-accent-orange { border-color: rgba(255,107,0,0.4); }

/* ─── Grid ───────────────────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }

/* ─── Metric Display ─────────────────────────────────────────────────────────── */
.metric-big {
  font-family: var(--display);
  font-size: 44px;
  font-weight: 700;
  line-height: 1;
  color: var(--cyan);
  text-shadow: 0 0 20px var(--cyan-glow), 0 0 40px var(--cyan-glow2);
  letter-spacing: 0.05em;
}

.metric-big.blue   { color: var(--blue); text-shadow: 0 0 20px var(--blue-glow); }
.metric-big.amber  { color: var(--amber); text-shadow: 0 0 20px rgba(255,170,0,0.5); }
.metric-big.red    { color: var(--red); text-shadow: 0 0 20px rgba(255,34,68,0.5); }
.metric-big.green  { color: var(--green); text-shadow: 0 0 20px rgba(0,255,136,0.5); }
.metric-big.white  { color: var(--text); text-shadow: 0 0 10px rgba(200,238,255,0.3); }
.metric-big.orange { color: var(--orange); text-shadow: 0 0 20px rgba(255,107,0,0.5); }

.metric-unit {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  margin-left: 4px;
  letter-spacing: 0.1em;
}

.metric-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 4px;
  letter-spacing: 0.08em;
}

.metric-trend {
  font-family: var(--mono);
  font-size: 10px;
  margin-top: 4px;
  letter-spacing: 0.05em;
}

.trend-up        { color: var(--green); }
.trend-down      { color: var(--red); }
.trend-stable    { color: var(--text-dim); }
.trend-down-good { color: var(--green); }
.trend-up-bad    { color: var(--red); }

/* ─── Live Vitals Strip ──────────────────────────────────────────────────────── */
#vitals-strip {
  display: flex;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
  position: relative;
}

#vitals-strip::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  animation: sweep-h 3s ease-in-out infinite;
}

@keyframes sweep-h {
  0%, 100% { opacity: 0; }
  50% { opacity: 0.8; }
}

.ticker-item {
  flex: 1;
  padding: 12px 16px;
  text-align: center;
  border-right: 1px solid var(--border);
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}

.ticker-item:last-child { border-right: none; }
.ticker-item:hover { background: rgba(0,200,255,0.04); }

.ticker-label {
  font-family: var(--mono);
  font-size: 8px;
  color: var(--text-dim);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.ticker-value {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 600;
  color: var(--cyan);
  line-height: 1;
  text-shadow: 0 0 16px var(--cyan-glow);
  letter-spacing: 0.05em;
}

.ticker-unit {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-dim);
  margin-left: 2px;
}

.ticker-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--cyan);
  display: inline-block;
  animation: blink 1.5s ease infinite;
  box-shadow: 0 0 6px var(--cyan);
}

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

/* ─── Arc Reactor Score ──────────────────────────────────────────────────────── */
#score-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
}

.score-text { text-anchor: middle; }
.score-main {
  fill: var(--cyan);
  font-family: 'Orbitron', monospace;
  font-size: 48px;
  font-weight: 900;
  letter-spacing: 0.05em;
  filter: drop-shadow(0 0 10px rgba(0,229,255,0.8)) drop-shadow(0 0 30px rgba(0,229,255,0.4));
}
.score-label {
  fill: rgba(0,229,255,0.4);
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.3em;
}

/* ─── Pillar Gauges ──────────────────────────────────────────────────────────── */
#pillars-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.pillar-card {
  background: rgba(0, 8, 25, 0.8);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 8px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s;
  position: relative;
  overflow: hidden;
}

.pillar-card::before {
  content: '';
  position: absolute;
  top: -1px; left: -1px;
  width: 8px; height: 8px;
  border-top: 1.5px solid var(--cyan);
  border-left: 1.5px solid var(--cyan);
}

.pillar-card::after {
  content: '';
  position: absolute;
  bottom: -1px; right: -1px;
  width: 8px; height: 8px;
  border-bottom: 1.5px solid var(--cyan);
  border-right: 1.5px solid var(--cyan);
}

.pillar-card:hover {
  border-color: var(--border2);
  background: rgba(0, 30, 80, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0,200,255,0.15);
}

.pillar-svg { display: block; margin: 0 auto 4px; }

.pillar-label {
  font-family: var(--mono);
  font-size: 8px;
  color: var(--text-dim);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.pillar-val {
  font-family: var(--display);
  font-size: 12px;
  font-weight: 700;
  color: var(--cyan);
  margin-top: 2px;
  text-shadow: 0 0 10px var(--cyan-glow);
}

/* ─── JARVIS Briefing ─────────────────────────────────────────────────────────── */
#jarvis-briefing {
  background: linear-gradient(135deg, rgba(0,12,40,0.95) 0%, rgba(0,30,80,0.3) 100%);
  border: 1px solid rgba(0,200,255,0.3);
  border-left: 3px solid var(--cyan);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}

#jarvis-briefing::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(45deg, transparent 0%, rgba(0,200,255,0.02) 50%, transparent 100%);
  animation: briefing-shimmer 4s ease-in-out infinite;
}

@keyframes briefing-shimmer {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

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

.jarvis-icon {
  width: 26px; height: 26px;
  background: rgba(0,200,255,0.1);
  border: 1px solid rgba(0,200,255,0.4);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  box-shadow: 0 0 12px rgba(0,200,255,0.2);
}

.jarvis-title {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 400;
  color: var(--cyan);
  letter-spacing: 0.25em;
  text-transform: uppercase;
}

.jarvis-timestamp {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-muted);
  margin-left: auto;
  letter-spacing: 0.1em;
}

.jarvis-text {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--text);
  line-height: 1.7;
  font-weight: 400;
  position: relative;
}

.jarvis-no-key {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.7;
}

/* ─── Protocol Checklist ─────────────────────────────────────────────────────── */
.protocol-section-label {
  font-family: var(--mono);
  font-size: 8px;
  color: var(--cyan);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 8px;
  margin-top: 16px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.protocol-section-label:first-child { margin-top: 0; }

.protocol-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
  user-select: none;
  border: 1px solid transparent;
}

.protocol-item:hover {
  background: rgba(0,200,255,0.05);
  border-color: var(--border);
}

.protocol-check {
  width: 16px; height: 16px;
  border: 1px solid var(--border2);
  border-radius: 2px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  transition: all 0.2s;
}

.protocol-item.done .protocol-check {
  background: var(--cyan);
  border-color: var(--cyan);
  color: var(--bg);
  box-shadow: 0 0 8px var(--cyan-glow);
}

.protocol-item-label {
  font-size: 12px;
  color: var(--text-dim);
  flex: 1;
  font-family: var(--sans);
  letter-spacing: 0.02em;
}

.protocol-item.done .protocol-item-label {
  color: rgba(0,229,255,0.5);
  text-decoration: line-through;
  text-decoration-color: rgba(0,229,255,0.3);
}

.protocol-item-icon { font-size: 13px; }

.protocol-progress-bar {
  background: rgba(0,50,100,0.5);
  border-radius: 2px;
  height: 3px;
  margin-top: 14px;
  overflow: hidden;
  border: none;
}

.protocol-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  box-shadow: 0 0 8px var(--cyan-glow);
  transition: width 0.5s ease;
}

/* ─── Alert Cards ────────────────────────────────────────────────────────────── */
.alert {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  border: 1px solid;
  position: relative;
  overflow: hidden;
}

.alert::before {
  content: '';
  position: absolute;
  top: -1px; left: -1px;
  width: 8px; height: 8px;
  border-top: 1.5px solid;
  border-left: 1.5px solid;
  border-color: inherit;
}

.alert.warning   { background: var(--amber-dim); border-color: rgba(255,170,0,0.3); }
.alert.alert-red { background: var(--red-dim);   border-color: rgba(255,34,68,0.3); }
.alert.info      { background: var(--cyan-dim);  border-color: rgba(0,229,255,0.3); }

.alert-icon  { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-text  { font-size: 12px; line-height: 1.5; }
.alert-title { font-family: var(--display); font-size: 11px; font-weight: 700; margin-bottom: 3px; letter-spacing: 0.05em; }

/* ─── Charts ─────────────────────────────────────────────────────────────────── */
.chart-wrap { position: relative; width: 100%; }
.chart-wrap canvas { max-width: 100%; }

/* ─── Biomarker Range Bars ───────────────────────────────────────────────────── */
.biomarker-row { margin-bottom: 18px; }

.biomarker-name {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: 0.03em;
}

.biomarker-range-wrap {
  position: relative;
  height: 6px;
  background: rgba(0,30,60,0.8);
  border-radius: 3px;
  overflow: visible;
  margin: 8px 0;
  border: 1px solid var(--border);
}

.range-zone { position: absolute; height: 100%; border-radius: 3px; }
.range-optimal { background: rgba(0,255,136,0.2); }
.range-normal  { background: rgba(0,136,255,0.15); }
.range-high    { background: rgba(255,34,68,0.15); }
.range-low     { background: rgba(255,170,0,0.15); }

.biomarker-dot {
  position: absolute;
  width: 10px; height: 10px;
  border-radius: 50%;
  top: -3px;
  transform: translateX(-50%);
  border: 1.5px solid var(--bg);
  z-index: 2;
  transition: left 0.5s ease;
  box-shadow: 0 0 8px currentColor;
}

.biomarker-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-muted);
  margin-top: 4px;
  letter-spacing: 0.05em;
}

/* ─── Forms ──────────────────────────────────────────────────────────────────── */
.input {
  background: rgba(0,15,40,0.9);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  padding: 9px 12px;
  width: 100%;
  outline: none;
  transition: all 0.2s;
  letter-spacing: 0.05em;
}

.input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px var(--cyan-dim), 0 0 12px rgba(0,200,255,0.1);
  background: rgba(0,20,50,0.95);
}

.input::placeholder { color: var(--text-muted); }

select.input { cursor: pointer; }
textarea.input { resize: vertical; min-height: 72px; }

.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; }

label {
  display: block;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.form-row { margin-bottom: 14px; }

/* Buttons */
.btn {
  background: transparent;
  color: var(--cyan);
  border: 1px solid var(--cyan);
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  font-family: var(--display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--cyan);
  transform: translateX(-100%);
  transition: transform 0.2s;
  opacity: 0.1;
}

.btn:hover {
  box-shadow: 0 0 20px var(--cyan-glow), inset 0 0 20px rgba(0,200,255,0.1);
  text-shadow: 0 0 8px var(--cyan-glow);
}

.btn:hover::before { transform: translateX(0); }
.btn:active { transform: scale(0.97); }

.btn-ghost {
  border-color: var(--border2);
  color: var(--text-dim);
}

.btn-ghost:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 12px var(--cyan-glow2);
}

.btn-sm { padding: 5px 12px; font-size: 9px; }

.btn-red {
  border-color: var(--red);
  color: var(--red);
}
.btn-red:hover { box-shadow: 0 0 20px rgba(255,34,68,0.4); }

/* ─── Range slider ───────────────────────────────────────────────────────────── */
input[type=range] {
  -webkit-appearance: none;
  width: 100%;
  height: 3px;
  background: rgba(0,80,120,0.6);
  border-radius: 3px;
  outline: none;
  border: 1px solid var(--border);
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  background: var(--cyan);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 8px var(--cyan-glow);
}

/* ─── Bristol Scale ──────────────────────────────────────────────────────────── */
.bristol-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}

.bristol-btn {
  background: rgba(0,15,40,0.9);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 4px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}

.bristol-btn:hover, .bristol-btn.selected {
  border-color: var(--cyan);
  background: rgba(0,100,150,0.2);
  box-shadow: 0 0 12px rgba(0,200,255,0.15);
}

.bristol-num {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 700;
  color: var(--cyan);
  margin-bottom: 3px;
  text-shadow: 0 0 8px var(--cyan-glow);
}

.bristol-desc {
  font-size: 8px;
  font-family: var(--mono);
  color: var(--text-dim);
  line-height: 1.3;
}

/* ─── Heatmap ────────────────────────────────────────────────────────────────── */
.heatmap-grid { display: flex; gap: 3px; flex-wrap: wrap; }

.heatmap-cell {
  width: 12px; height: 12px;
  border-radius: 2px;
  background: rgba(0,30,60,0.8);
  border: 1px solid rgba(0,50,80,0.5);
  transition: all 0.2s;
}

.heatmap-cell[data-level="1"] { background: rgba(0,229,255,0.2); border-color: rgba(0,229,255,0.3); }
.heatmap-cell[data-level="2"] { background: rgba(0,229,255,0.45); border-color: rgba(0,229,255,0.5); box-shadow: 0 0 4px rgba(0,229,255,0.2); }
.heatmap-cell[data-level="3"] { background: rgba(255,170,0,0.5); border-color: rgba(255,170,0,0.6); box-shadow: 0 0 4px rgba(255,170,0,0.3); }
.heatmap-cell[data-level="4"] { background: rgba(255,34,68,0.6); border-color: rgba(255,34,68,0.7); }
.heatmap-cell[data-level="5"] { background: #ff2244; border-color: #ff4466; box-shadow: 0 0 6px rgba(255,34,68,0.5); }

/* Hypnogram legend */
.hypnogram-legend { display: flex; gap: 16px; margin-bottom: 10px; }
.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.legend-dot { width: 8px; height: 8px; border-radius: 2px; }

/* ─── Streak ─────────────────────────────────────────────────────────────────── */
.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--amber-dim);
  border: 1px solid rgba(255,170,0,0.4);
  border-radius: 20px;
  padding: 2px 10px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--amber);
  letter-spacing: 0.05em;
  box-shadow: 0 0 8px rgba(255,170,0,0.15);
}

/* ─── Experiment card ────────────────────────────────────────────────────────── */
.exp-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}

.exp-card::before {
  content: '';
  position: absolute;
  top: -1px; left: -1px;
  width: 10px; height: 10px;
  border-top: 1.5px solid var(--cyan);
  border-left: 1.5px solid var(--cyan);
}

.exp-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.exp-status-badge.active    { background: var(--cyan-dim);  color: var(--cyan);  border: 1px solid rgba(0,229,255,0.3); }
.exp-status-badge.completed { background: var(--green-dim); color: var(--green); border: 1px solid rgba(0,255,136,0.3); }

/* ─── Cognitive Test ─────────────────────────────────────────────────────────── */
#rt-test-arena {
  background: rgba(0,8,25,0.95);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: crosshair;
  user-select: none;
  position: relative;
  overflow: hidden;
  transition: border-color 0.1s;
}

#rt-test-arena::before {
  content: '';
  position: absolute;
  inset: 20px;
  border: 1px solid rgba(0,100,150,0.2);
  border-radius: 4px;
}

.rt-dot {
  width: 54px; height: 54px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--cyan), #006b99);
  box-shadow: 0 0 40px var(--cyan-glow), 0 0 80px rgba(0,200,255,0.2), inset 0 0 20px rgba(0,200,255,0.3);
  animation: dot-pop 0.1s ease;
}

@keyframes dot-pop {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.rt-dot.red {
  background: radial-gradient(circle at 35% 35%, var(--red), #660011);
  box-shadow: 0 0 40px rgba(255,34,68,0.6);
}

.rt-instruction {
  font-family: var(--display);
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
  letter-spacing: 0.08em;
}

/* N-back grid */
#nback-grid {
  display: grid;
  grid-template-columns: repeat(3, 80px);
  gap: 8px;
  margin: 0 auto;
}

.nback-cell {
  width: 80px; height: 80px;
  background: rgba(0,15,40,0.9);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all 0.1s;
  position: relative;
}

.nback-cell::before {
  content: '';
  position: absolute;
  top: -1px; left: -1px;
  width: 6px; height: 6px;
  border-top: 1px solid var(--border2);
  border-left: 1px solid var(--border2);
}

.nback-cell.active {
  background: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 30px var(--cyan-glow), inset 0 0 20px rgba(0,200,255,0.5);
}

/* ─── Tags ───────────────────────────────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.tag-teal   { background: var(--cyan-dim); color: var(--cyan); border: 1px solid rgba(0,229,255,0.25); }
.tag-blue   { background: var(--blue-dim); color: var(--blue); border: 1px solid rgba(0,136,255,0.25); }
.tag-amber  { background: var(--amber-dim); color: var(--amber); border: 1px solid rgba(255,170,0,0.25); }
.tag-red    { background: var(--red-dim); color: var(--red); border: 1px solid rgba(255,34,68,0.25); }
.tag-green  { background: var(--green-dim); color: var(--green); border: 1px solid rgba(0,255,136,0.25); }

/* ─── Food Entry ─────────────────────────────────────────────────────────────── */
.food-result-card {
  background: rgba(0,15,40,0.9);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-top: 10px;
}

.food-macros {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.macro-item {
  text-align: center;
  background: rgba(0,10,30,0.8);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 4px;
}

.macro-val {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 700;
  color: var(--cyan);
  text-shadow: 0 0 8px var(--cyan-glow);
}

.macro-label {
  font-family: var(--mono);
  font-size: 8px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: 2px;
}

/* ─── Fibre Progress ─────────────────────────────────────────────────────────── */
.fibre-bar-wrap {
  background: rgba(0,30,60,0.6);
  border-radius: 3px;
  height: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.fibre-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  box-shadow: 0 0 10px var(--cyan-glow);
  transition: width 0.6s ease;
  min-width: 3px;
  position: relative;
}

.fibre-bar-fill::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  background: rgba(255,255,255,0.5);
  filter: blur(2px);
}

/* ─── Scatter controls ───────────────────────────────────────────────────────── */
.scatter-controls { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }

.scatter-btn {
  background: rgba(0,15,40,0.9);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 4px 12px;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.scatter-btn.active, .scatter-btn:hover {
  background: rgba(0,100,150,0.2);
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 8px rgba(0,200,255,0.15);
}

/* ─── Table ──────────────────────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }

.data-table th {
  text-align: left;
  padding: 7px 12px;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 400;
  color: var(--text-dim);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(0,50,80,0.4);
  color: var(--text);
  font-family: var(--sans);
}

.data-table tr:hover td { background: rgba(0,100,150,0.06); }
.data-table .mono { font-family: var(--mono); color: var(--cyan); }

/* ─── Status dot ─────────────────────────────────────────────────────────────── */
.status-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  animation: blink 2s infinite;
}

.status-dot.teal   { background: var(--cyan); box-shadow: 0 0 6px var(--cyan); }
.status-dot.green  { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.amber  { background: var(--amber); box-shadow: 0 0 6px var(--amber); }
.status-dot.red    { background: var(--red); box-shadow: 0 0 6px var(--red); }

/* ─── Empty state ────────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 40px 24px; color: var(--text-dim); }
.empty-state .empty-icon  { font-size: 36px; margin-bottom: 10px; opacity: 0.5; }
.empty-state .empty-title { font-family: var(--display); font-size: 13px; font-weight: 700; color: var(--text-dim); margin-bottom: 6px; letter-spacing: 0.08em; }
.empty-state .empty-desc  { font-family: var(--mono); font-size: 11px; line-height: 1.6; max-width: 300px; margin: 0 auto; color: var(--text-muted); }

/* ─── Divider ────────────────────────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ─── Skeleton ───────────────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, rgba(0,30,60,0.8) 25%, rgba(0,50,100,0.5) 50%, rgba(0,30,60,0.8) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 3px;
  height: 14px;
}

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

/* ─── Scrollbar ──────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: rgba(0,100,150,0.6); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--cyan); }

/* ─── Utilities ──────────────────────────────────────────────────────────────── */
.flex           { display: flex; }
.flex-col       { flex-direction: column; }
.items-center   { align-items: center; }
.justify-between{ justify-content: space-between; }
.gap-2          { gap: 8px; }
.gap-3          { gap: 12px; }
.gap-4          { gap: 16px; }
.mb-2           { margin-bottom: 8px; }
.mb-3           { margin-bottom: 12px; }
.mb-4           { margin-bottom: 16px; }
.mb-6           { margin-bottom: 24px; }
.mt-3           { margin-top: 12px; }
.mt-auto        { margin-top: auto; }
.w-full         { width: 100%; }
.text-teal      { color: var(--cyan); }
.text-dim       { color: var(--text-dim); }
.text-mono      { font-family: var(--mono); }
.text-display   { font-family: var(--display); }
.text-sm        { font-size: 12px; }
.text-xs        { font-size: 10px; }
.font-bold      { font-weight: 700; }
.hidden         { display: none !important; }
.glow-cyan      { text-shadow: 0 0 20px var(--cyan-glow), 0 0 40px var(--cyan-glow2); }
.glow-amber     { text-shadow: 0 0 20px rgba(255,170,0,0.5); }
.glow-red       { text-shadow: 0 0 20px rgba(255,34,68,0.5); }

/* ─── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 1400px) {
  #pillars-grid { grid-template-columns: repeat(4, 1fr) !important; }
}

/* ─── Mobile header bar ──────────────────────────────────────────────────────── */
#mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: linear-gradient(180deg, rgba(0,8,30,0.98) 0%, rgba(0,12,40,0.97) 100%);
  border-bottom: 1px solid var(--border);
  z-index: 200;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  backdrop-filter: blur(12px);
}

#mobile-header::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0;
  width: 80px; height: 1px;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan-glow);
}

.mobile-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--display);
  font-size: 13px;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 0.15em;
  text-shadow: 0 0 20px var(--cyan-glow);
}

.mobile-score-badge {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 900;
  color: var(--cyan);
  text-shadow: 0 0 20px var(--cyan-glow);
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  background: rgba(0,229,255,0.05);
}

#hamburger {
  background: none;
  border: 1px solid var(--border);
  color: var(--cyan);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0;
  transition: all 0.2s;
  flex-shrink: 0;
}

#hamburger:hover,
#hamburger.open {
  border-color: var(--cyan);
  background: rgba(0,229,255,0.08);
  box-shadow: 0 0 12px rgba(0,229,255,0.2);
}

#hamburger span {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--cyan);
  transition: all 0.25s;
  transform-origin: center;
}

#hamburger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
#hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
#hamburger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* Sidebar overlay backdrop */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 99;
  backdrop-filter: blur(2px);
}

#sidebar-overlay.visible { display: block; }

@media (max-width: 900px) {
  #mobile-header { display: flex; }

  /* Sidebar becomes a slide-in drawer */
  #sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 150;
    top: 0;
    box-shadow: 4px 0 30px rgba(0,0,0,0.6);
  }

  #sidebar.open { transform: translateX(0); }

  #main {
    margin-left: 0;
    padding-top: 56px;
  }

  #main::before { left: 0; }
  #main::after { display: none; }

  .section { padding: 20px 16px; }

  .section::before, .section::after { display: none; }

  .section-header {
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .section-header::before { display: none; }

  .section-title { font-size: 15px; }

  .grid-4 { grid-template-columns: 1fr 1fr; gap: 12px; }
  .grid-3 { grid-template-columns: 1fr 1fr; gap: 12px; }
  .grid-2 { gap: 12px; }
  .grid-auto { grid-template-columns: 1fr 1fr; gap: 12px; }

  #pillars-grid { grid-template-columns: repeat(4, 1fr) !important; gap: 8px; }

  .metric-big { font-size: 32px; }

  /* Vitals strip — horizontal scroll */
  #vitals-strip {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }
  #vitals-strip::-webkit-scrollbar { display: none; }
  .vitals-cell {
    min-width: 100px;
    flex-shrink: 0;
    scroll-snap-align: start;
  }

  /* Cards */
  .card { padding: 14px 14px; }
  .card-title { font-size: 10px; }

  /* Tables */
  .data-table { font-size: 12px; }
  .data-table th, .data-table td { padding: 8px 10px; }

  /* Buttons */
  .btn { padding: 10px 16px; font-size: 12px; min-height: 44px; }
  .btn-sm { min-height: 38px; }

  /* Forms */
  .form-group { margin-bottom: 14px; }
  .form-input, .form-select, .form-textarea { min-height: 44px; font-size: 14px; }

  /* Protocol checklist */
  .protocol-item { padding: 10px 14px; min-height: 44px; }

  /* Command center score */
  #score-ring-container { transform: scale(0.85); transform-origin: center; }

  /* Tick strip — scroll on mobile */
  #tick-strip {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    flex-wrap: nowrap;
    scrollbar-width: none;
    padding-bottom: 4px;
  }
  #tick-strip::-webkit-scrollbar { display: none; }
  .tick-cell {
    min-width: 80px;
    flex-shrink: 0;
    scroll-snap-align: start;
  }

  /* Gut section */
  .body-map-wrap { max-width: 100%; }

  /* Body comp form grid */
  .bc-form-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }

  /* Correlation scatter — full width */
  .scatter-controls { flex-wrap: wrap; gap: 6px; }
  .scatter-controls .btn-sm { flex: 1 1 calc(50% - 6px); text-align: center; }
}

@media (max-width: 540px) {
  .grid-4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .grid-3 { grid-template-columns: 1fr; gap: 10px; }
  .grid-2 { grid-template-columns: 1fr; gap: 10px; }
  .grid-auto { grid-template-columns: 1fr; gap: 10px; }

  #pillars-grid { grid-template-columns: repeat(4, 1fr) !important; gap: 6px; }
  .pillar-card { padding: 8px 4px 6px; }
  .pillar-label { font-size: 7px; }

  .section { padding: 16px 12px; }
  .metric-big { font-size: 28px; }
  .section-title { font-size: 13px; }

  /* Score ring smaller on very small screens */
  #score-ring-container { transform: scale(0.72); transform-origin: center; }

  /* Stack section header */
  .section-header { flex-direction: column; align-items: flex-start; gap: 6px; }

  /* Body comp form — single column on tiny screens */
  .bc-form-grid { grid-template-columns: 1fr !important; }

  /* Chart containers */
  .chart-container canvas { max-height: 200px !important; }

  /* Scatter buttons */
  .scatter-controls .btn-sm { flex: 1 1 calc(50% - 6px); font-size: 10px; padding: 6px 8px; }
}

/* Safe area for iOS notch/home indicator */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  #main { padding-bottom: env(safe-area-inset-bottom); }
  #mobile-header { padding-top: env(safe-area-inset-top); height: calc(56px + env(safe-area-inset-top)); }
  #sidebar { padding-top: env(safe-area-inset-top); }
}

/* ─── Boot sequence ──────────────────────────────────────────────────────────── */
#boot-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: boot-fade 0.5s ease 2.5s forwards;
  pointer-events: none;
}

@keyframes boot-fade {
  to { opacity: 0; visibility: hidden; }
}

.boot-text {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--cyan);
  letter-spacing: 0.2em;
  margin: 4px 0;
  opacity: 0;
  animation: boot-line 0.1s ease forwards;
}

@keyframes boot-line {
  to { opacity: 1; }
}

/* ─── JARVIS watermark ───────────────────────────────────────────────────────── */
#main::after {
  content: 'STARK INDUSTRIES — PERSONAL HEALTH OS';
  position: fixed;
  bottom: 14px;
  right: 24px;
  font-family: var(--display);
  font-size: 9px;
  letter-spacing: 0.25em;
  color: rgba(0,150,220,0.12);
  pointer-events: none;
  z-index: 3;
}

/* ─── Live scan line (slow sweep) ───────────────────────────────────────────── */
#main::before {
  content: '';
  position: fixed;
  left: 230px;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,229,255,0.4), rgba(0,229,255,0.6), rgba(0,229,255,0.4), transparent);
  z-index: 10;
  animation: scan-sweep 6s ease-in-out infinite;
  pointer-events: none;
  box-shadow: 0 0 8px rgba(0,229,255,0.3);
}

@keyframes scan-sweep {
  0%   { top: 0%; opacity: 0; }
  5%   { opacity: 0.8; }
  95%  { opacity: 0.6; }
  100% { top: 100%; opacity: 0; }
}

/* ─── Hex canvas visibility ──────────────────────────────────────────────────── */
#hex-canvas { opacity: 0.35; }

/* ─── Corner frame on entire section ────────────────────────────────────────── */
.section::before {
  content: '';
  position: fixed;
  top: 14px; right: 14px;
  width: 20px; height: 20px;
  border-top: 1.5px solid rgba(0,200,255,0.4);
  border-right: 1.5px solid rgba(0,200,255,0.4);
  pointer-events: none;
  z-index: 50;
}

.section::after {
  content: '';
  position: fixed;
  bottom: 14px; right: 14px;
  width: 20px; height: 20px;
  border-bottom: 1.5px solid rgba(0,200,255,0.4);
  border-right: 1.5px solid rgba(0,200,255,0.4);
  pointer-events: none;
  z-index: 50;
}

/* ─── Section header enhancements ────────────────────────────────────────────── */
.section-header::before {
  content: 'SYS:' attr(data-sys);
  position: absolute;
  right: 80px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 8px;
  color: var(--text-muted);
  letter-spacing: 0.15em;
}

.header-live {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 9px;
  color: rgba(0,200,255,0.5);
  letter-spacing: 0.1em;
  margin-left: auto;
  padding-right: 8px;
}

/* ─── Vitals strip enhancements ─────────────────────────────────────────────── */
#vitals-strip {
  border: 1px solid rgba(0,150,220,0.25);
}

.ticker-item::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,200,255,0.4), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.ticker-item:hover::before { opacity: 1; }

/* ─── Card inner glow on hover ───────────────────────────────────────────────── */
.card-accent:hover {
  box-shadow: 0 0 30px rgba(0,180,255,0.1), 0 0 60px rgba(0,100,200,0.05),
              inset 0 0 40px rgba(0,80,160,0.04);
}

/* ─── Arc reactor container enhancement ─────────────────────────────────────── */
#score-container::before {
  content: '';
  position: absolute;
  width: 240px; height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,100,200,0.08) 0%, transparent 70%);
  animation: reactor-pulse 3s ease-in-out infinite;
}

@keyframes reactor-pulse {
  0%, 100% { transform: scale(0.9); opacity: 0.5; }
  50% { transform: scale(1.1); opacity: 1; }
}

/* ─── JARVIS Chat ─────────────────────────────────────────────────────────── */
#jarvis-chat-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(0,8,30,0.96) 0%, rgba(0,20,60,0.96) 100%);
  border: 1px solid var(--border2);
  border-radius: 28px;
  padding: 10px 18px 10px 12px;
  cursor: pointer;
  font-family: var(--display);
  font-size: 12px;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 0.12em;
  box-shadow: 0 0 20px rgba(0,229,255,0.2), 0 4px 24px rgba(0,0,0,0.5);
  transition: all 0.25s;
  user-select: none;
}
#jarvis-chat-btn:hover, #jarvis-chat-btn.active {
  border-color: var(--cyan);
  box-shadow: 0 0 30px rgba(0,229,255,0.4), 0 4px 30px rgba(0,0,0,0.6);
  background: linear-gradient(135deg, rgba(0,15,50,0.98) 0%, rgba(0,30,80,0.98) 100%);
}
.chat-notif {
  width: 8px; height: 8px;
  background: var(--cyan);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--cyan);
  animation: pulse-dot 1.5s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.7); }
}

#jarvis-chat-panel {
  position: fixed;
  bottom: 84px;
  right: 28px;
  width: 380px;
  max-height: 540px;
  background: linear-gradient(180deg, rgba(0,8,30,0.98) 0%, rgba(0,12,40,0.99) 100%);
  border: 1px solid var(--border2);
  border-radius: 16px;
  z-index: 499;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 40px rgba(0,229,255,0.15), 0 20px 60px rgba(0,0,0,0.7);
  backdrop-filter: blur(20px);
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#jarvis-chat-panel.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

#chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--display);
  font-size: 12px;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 0.15em;
}
.chat-status-dot {
  width: 6px; height: 6px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--green);
  animation: pulse-dot 2s ease-in-out infinite;
}
.chat-close {
  background: none; border: none;
  color: var(--text-dim); cursor: pointer;
  font-size: 14px; padding: 2px 6px;
  border-radius: 4px; transition: all 0.15s;
}
.chat-close:hover { color: var(--cyan); background: rgba(0,229,255,0.08); }

#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,229,255,0.2) transparent;
}
#chat-messages::-webkit-scrollbar { width: 4px; }
#chat-messages::-webkit-scrollbar-track { background: transparent; }
#chat-messages::-webkit-scrollbar-thumb { background: rgba(0,229,255,0.2); border-radius: 2px; }

.chat-msg {
  display: flex;
  animation: chat-in 0.2s ease;
}
@keyframes chat-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.chat-msg.user { justify-content: flex-end; }
.chat-msg.jarvis { justify-content: flex-start; }

.chat-bubble {
  max-width: 86%;
  padding: 10px 13px;
  border-radius: 12px;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.5;
}
.chat-msg.jarvis .chat-bubble {
  background: rgba(0,229,255,0.06);
  border: 1px solid rgba(0,229,255,0.15);
  color: var(--text);
  border-radius: 4px 12px 12px 12px;
}
.chat-msg.user .chat-bubble {
  background: rgba(0,136,255,0.15);
  border: 1px solid rgba(0,136,255,0.25);
  color: var(--text);
  border-radius: 12px 4px 12px 12px;
}
.chat-logged {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.chat-logged span {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--green);
  background: rgba(0,255,136,0.08);
  border: 1px solid rgba(0,255,136,0.2);
  border-radius: 3px;
  padding: 2px 6px;
  letter-spacing: 0.05em;
}

#chat-typing {
  padding: 6px 18px 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.typing-dot {
  width: 5px; height: 5px;
  background: var(--cyan);
  border-radius: 50%;
  animation: typing-bounce 1.2s ease-in-out infinite;
  opacity: 0.5;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce {
  0%, 100% { transform: translateY(0); opacity: 0.4; }
  50% { transform: translateY(-4px); opacity: 1; }
}

#chat-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
#chat-voice-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 36px; height: 36px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  transition: all 0.15s;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
#chat-voice-btn:hover, #chat-voice-btn.listening {
  border-color: var(--cyan);
  background: rgba(0,229,255,0.08);
  color: var(--cyan);
}
#chat-voice-btn.listening {
  animation: pulse-dot 0.8s ease-in-out infinite;
  border-color: var(--red);
  background: rgba(255,34,68,0.1);
}
#chat-input {
  flex: 1;
  background: rgba(0,229,255,0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
  transition: border-color 0.2s;
  min-height: 36px;
}
#chat-input:focus {
  border-color: var(--border2);
  background: rgba(0,229,255,0.06);
}
#chat-input::placeholder { color: var(--text-muted); }
#chat-send-btn {
  background: rgba(0,229,255,0.08);
  border: 1px solid var(--border2);
  width: 36px; height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
#chat-send-btn:hover {
  background: rgba(0,229,255,0.15);
  border-color: var(--cyan);
  box-shadow: 0 0 12px rgba(0,229,255,0.2);
}

/* Mobile chat adjustments */
@media (max-width: 900px) {
  #jarvis-chat-panel {
    width: calc(100vw - 32px);
    right: 16px;
    bottom: 80px;
    max-height: 65vh;
  }
  #jarvis-chat-btn {
    bottom: 20px;
    right: 16px;
  }
}


