/* ═══════════════════════════════════════════════════════════════
   J.A.R.V.I.S. — holographic HUD stylesheet
   Palette: deep space navy / arc-reactor cyan / repulsor gold
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg: #02060c;
  --bg-2: #041020;
  --cyan: #00e5ff;
  --cyan-soft: #7fdfff;
  --cyan-dim: rgba(0, 229, 255, 0.35);
  --cyan-faint: rgba(0, 229, 255, 0.12);
  --gold: #ffc861;
  --gold-dim: rgba(255, 200, 97, 0.4);
  --red: #ff5a5a;
  --text: #c9ecf7;
  --text-dim: #5f8ca0;
  --panel-bg: rgba(4, 18, 32, 0.72);
  --panel-border: rgba(0, 229, 255, 0.25);
  --font-display: "Orbitron", "Segoe UI", sans-serif;
  --font-body: "Rajdhani", "Segoe UI", sans-serif;
  --font-mono: "Share Tech Mono", "Consolas", monospace;
}

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

html, body { height: 100%; }

body {
  background: radial-gradient(ellipse at 50% 35%, var(--bg-2) 0%, var(--bg) 70%);
  color: var(--text);
  font-family: var(--font-body);
  overflow: hidden;
}

.hidden { display: none !important; }

/* ── ambient layers ─────────────────────────────────────────── */
.bg-grid {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(rgba(0, 229, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 229, 255, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 85%);
}

.scanlines {
  position: fixed; inset: 0; pointer-events: none; z-index: 50;
  background: repeating-linear-gradient(
    0deg, transparent 0 2px, rgba(0, 0, 0, 0.12) 2px 4px);
  opacity: 0.5;
}

.vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 51;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}

/* ═══ BOOT SEQUENCE ══════════════════════════════════════════ */
#boot {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2.2rem;
  background: radial-gradient(ellipse at 50% 40%, #05182c 0%, #01040a 75%);
  transition: opacity 0.9s ease;
}
#boot.fade { opacity: 0; pointer-events: none; }

.boot-reactor { position: relative; width: 150px; height: 150px; }
.boot-reactor .ring {
  position: absolute; border-radius: 50%;
  border: 2px solid var(--cyan-dim);
}
.boot-reactor .r1 { inset: 0; border-top-color: var(--cyan); animation: spin 2.4s linear infinite; }
.boot-reactor .r2 { inset: 16px; border-bottom-color: var(--cyan); animation: spin 1.7s linear infinite reverse; }
.boot-reactor .r3 { inset: 32px; border-left-color: var(--cyan); animation: spin 1.1s linear infinite; }
.boot-reactor .core {
  position: absolute; inset: 52px; border-radius: 50%;
  background: radial-gradient(circle, #eaffff 0%, var(--cyan) 45%, transparent 75%);
  animation: corePulse 1.6s ease-in-out infinite;
  box-shadow: 0 0 30px var(--cyan), 0 0 80px var(--cyan-dim);
}

#boot-log {
  font-family: var(--font-mono); font-size: 0.85rem; line-height: 1.65;
  color: var(--cyan-soft); width: min(640px, 88vw); height: 15em;
  text-shadow: 0 0 8px var(--cyan-dim);
  white-space: pre-wrap;
}
#boot-log .ok { color: var(--gold); }

#boot-skip {
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.35em;
  color: var(--text-dim); animation: blink 1.4s step-end infinite;
}

/* ═══ MAIN LAYOUT ════════════════════════════════════════════ */
#hud {
  position: relative; z-index: 1;
  display: grid; height: 100vh;
  grid-template-columns: 300px 1fr 320px;
  grid-template-rows: 72px 1fr 30px;
  grid-template-areas:
    "header header header"
    "left   center right"
    "footer footer footer";
  gap: 14px;
  padding: 14px 18px;
  animation: hudIn 0.8s ease both;
}

/* ── header ─────────────────────────────────────────────────── */
.hud-header {
  grid-area: header;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  clip-path: polygon(0 0, calc(100% - 24px) 0, 100% 24px, 100% 100%, 24px 100%, 0 calc(100% - 24px));
  backdrop-filter: blur(6px);
}

.hdr-left { display: flex; align-items: center; gap: 16px; }

.logo-mark {
  width: 40px; height: 40px; border-radius: 50%;
  border: 2px solid var(--cyan-dim); position: relative;
  animation: spin 9s linear infinite;
}
.logo-mark::before {
  content: ""; position: absolute; inset: -2px; border-radius: 50%;
  border: 2px solid transparent; border-top-color: var(--cyan);
}
.logo-mark span {
  position: absolute; inset: 11px; border-radius: 50%;
  background: radial-gradient(circle, #eaffff 0%, var(--cyan) 60%);
  box-shadow: 0 0 14px var(--cyan);
}

.hud-header h1 {
  font-family: var(--font-display); font-size: 1.35rem; font-weight: 800;
  letter-spacing: 0.3em; color: #fff;
  text-shadow: 0 0 12px var(--cyan), 0 0 40px var(--cyan-dim);
}
.subtitle {
  font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.22em;
  color: var(--text-dim); text-transform: uppercase;
}

.hdr-center { text-align: center; }
#clock-time {
  font-family: var(--font-display); font-size: 1.5rem; font-weight: 600;
  color: var(--cyan-soft); text-shadow: 0 0 10px var(--cyan-dim);
  letter-spacing: 0.12em;
}
#clock-date {
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.3em;
  color: var(--text-dim); text-transform: uppercase;
}

.hdr-right { display: flex; gap: 10px; align-items: center; }

.badge {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.15em;
  padding: 6px 12px; border: 1px solid var(--panel-border); border-radius: 3px;
  color: var(--cyan-soft); background: var(--cyan-faint);
}
.badge.dim { color: var(--text-dim); background: transparent; }
.badge .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold); box-shadow: 0 0 8px var(--gold);
  animation: blink 2s ease-in-out infinite;
}
.badge.online .dot { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); animation: none; }
.badge.offline .dot { background: var(--red); box-shadow: 0 0 8px var(--red); }

/* ── panels ─────────────────────────────────────────────────── */
.panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 18px;
  overflow: hidden;
  display: flex; flex-direction: column;
  backdrop-filter: blur(6px);
  position: relative;
}
.panel::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan-dim), transparent);
}
.panel-left  { grid-area: left;  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 22px), calc(100% - 22px) 100%, 0 100%); }
.panel-right { grid-area: right; clip-path: polygon(0 0, 100% 0, 100% 100%, 22px 100%, 0 calc(100% - 22px)); }

.panel-title {
  font-family: var(--font-display); font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.28em; color: var(--cyan);
  text-shadow: 0 0 8px var(--cyan-dim);
  margin-bottom: 14px;
}
.panel-hint {
  font-size: 0.78rem; color: var(--text-dim); line-height: 1.4; margin-bottom: 12px;
}

/* ── gauges ─────────────────────────────────────────────────── */
.gauge-row { display: flex; gap: 14px; justify-content: space-around; margin-bottom: 18px; }

.gauge { position: relative; width: 108px; height: 108px; }
.gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge-track {
  fill: none; stroke: rgba(0, 229, 255, 0.12); stroke-width: 7;
}
.gauge-fill {
  fill: none; stroke: var(--cyan); stroke-width: 7; stroke-linecap: round;
  stroke-dasharray: 314.16; stroke-dashoffset: 314.16;
  filter: drop-shadow(0 0 5px var(--cyan));
  transition: stroke-dashoffset 0.8s ease;
}
.gauge-fill.gold { stroke: var(--gold); filter: drop-shadow(0 0 5px var(--gold)); }

.gauge-label {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.gauge-label span {
  font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; color: #fff;
  text-shadow: 0 0 10px var(--cyan-dim); line-height: 1;
}
.gauge-label small { font-size: 0.65rem; color: var(--text-dim); }
.gauge-label em {
  font-style: normal; font-family: var(--font-mono); font-size: 0.6rem;
  letter-spacing: 0.3em; color: var(--text-dim); margin-top: 3px;
}

/* ── spec list ──────────────────────────────────────────────── */
.specs { display: flex; flex-direction: column; gap: 9px; flex: 1; }
.specs > div {
  display: flex; justify-content: space-between; gap: 10px;
  border-bottom: 1px dashed rgba(0, 229, 255, 0.12); padding-bottom: 7px;
}
.specs dt {
  font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.18em;
  color: var(--text-dim); flex-shrink: 0;
}
.specs dd {
  font-size: 0.8rem; color: var(--cyan-soft); text-align: right;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── connected devices ──────────────────────────────────────── */
/* The block shrinks (and its list scrolls) before the waveform/gauges do, so
   the left panel never overflows its hidden box on short viewports. */
.devices-block { margin-top: 14px; display: flex; flex-direction: column; min-height: 0; flex: 0 1 auto; }
.sub-title {
  font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.2em;
  color: var(--cyan); margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px;
}
.sub-title span {
  background: var(--cyan-faint); border: 1px solid var(--panel-border);
  border-radius: 10px; padding: 0 7px; font-size: 0.6rem; color: var(--cyan-soft);
}
.device-list { display: flex; flex-direction: column; gap: 6px; min-height: 0; overflow-y: auto; padding-right: 2px; }
.device-list::-webkit-scrollbar { width: 4px; }
.device-list::-webkit-scrollbar-thumb { background: var(--cyan-dim); border-radius: 3px; }
.dev-empty {
  font-family: var(--font-mono); font-size: 0.66rem; color: var(--text-dim);
  padding: 4px 0; letter-spacing: 0.08em;
}
.dev-chip {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
  border: 1px solid var(--panel-border); border-radius: 4px;
  padding: 6px 9px; background: rgba(0, 229, 255, 0.04);
  cursor: default;
}
.dev-chip:focus-visible, .mod-card:focus-visible {
  outline: 1px solid var(--cyan); outline-offset: 2px;
  box-shadow: 0 0 10px var(--cyan-dim);
}
.dev-chip .dev-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  background: var(--cyan); box-shadow: 0 0 7px var(--cyan);
}
.dev-chip.pc .dev-icon::before { content: "🖥"; }
.dev-chip.android .dev-icon::before { content: "📱"; }
.dev-chip .dev-icon { font-size: 0.8rem; }
.dev-chip .dev-meta { flex: 1; min-width: 0; }
/* name and caps stack on their own lines (spans would run together inline) */
.dev-chip .dev-name {
  display: block;
  font-size: 0.75rem; color: var(--cyan-soft); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.dev-chip .dev-caps {
  display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: var(--font-mono); font-size: 0.58rem; color: var(--text-dim);
}
.dev-chip.pending { border-color: var(--gold-dim); background: rgba(255, 200, 97, 0.05); }
.dev-chip.pending .dev-dot { background: var(--gold); box-shadow: 0 0 7px var(--gold); animation: blink 1.2s ease-in-out infinite; }
.dev-chip.offline { opacity: 0.5; }
.dev-chip.offline .dev-dot { background: var(--text-dim); box-shadow: none; }
.dev-chip.stale { border-style: dashed; }
.dev-btn {
  flex-shrink: 0; border: 1px solid var(--panel-border); background: var(--cyan-faint);
  color: var(--cyan); font-family: var(--font-mono); font-size: 0.58rem; letter-spacing: 0.08em;
  border-radius: 3px; padding: 3px 7px; cursor: pointer;
}
.dev-btn.approve { border-color: var(--gold); color: var(--gold); background: rgba(255, 200, 97, 0.1); }
.dev-btn.approve:hover { background: rgba(255, 200, 97, 0.22); }
.dev-btn.revoke { color: var(--red); border-color: rgba(255, 90, 90, 0.4); }
.dev-btn.revoke:hover { background: rgba(255, 90, 90, 0.12); }
.dev-btn.remove { font-size: 0.62rem; }
.dev-chip.flash { animation: devFlash 0.7s ease; }
@keyframes devFlash {
  0%, 100% { border-color: var(--panel-border); }
  40% { border-color: var(--gold); box-shadow: 0 0 12px var(--gold-dim); }
}

/* ── tool-activity lines in chat ────────────────────────────── */
.msg.tool { align-self: stretch; max-width: 100%; animation: msgIn 0.2s ease both; }
.msg.tool .body {
  font-family: var(--font-mono); font-size: 0.72rem;
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px; border-radius: 4px;
  border-left: 2px solid var(--gold);
  background: rgba(255, 200, 97, 0.05); color: var(--gold);
}
.msg.tool .body .spin {
  width: 9px; height: 9px; border-radius: 50%;
  border: 2px solid var(--gold-dim); border-top-color: var(--gold);
  animation: spin 0.8s linear infinite;
}
.msg.tool.ok .body { border-left-color: var(--cyan); background: var(--cyan-faint); color: var(--cyan-soft); }
.msg.tool.err .body { border-left-color: var(--red); background: rgba(255,90,90,0.06); color: var(--red); }
.msg.tool .t-dev { color: var(--text-dim); }

/* ── waveform ───────────────────────────────────────────────── */
.waveform {
  display: flex; align-items: center; justify-content: center; gap: 3px;
  height: 46px; margin-top: 14px; flex-shrink: 0;
}
.waveform i {
  width: 3px; height: 12%; border-radius: 2px;
  background: var(--cyan); opacity: 0.75;
  box-shadow: 0 0 6px var(--cyan-dim);
  animation: wave 1.3s ease-in-out infinite;
}
.waveform i:nth-child(3n)  { animation-delay: -0.4s; }
.waveform i:nth-child(3n+1){ animation-delay: -0.8s; }
.waveform i:nth-child(5n)  { animation-delay: -1.1s; }
.waveform i:nth-child(7n)  { animation-delay: -0.2s; }
.waveform.speaking i { animation-duration: 0.45s; }

/* ═══ CENTER — reactor + console ═════════════════════════════ */
.center {
  grid-area: center;
  display: flex; flex-direction: column; align-items: center;
  min-height: 0; gap: 6px;
}

.reactor-wrap {
  position: relative; width: 190px; height: 190px; flex-shrink: 0;
  margin-top: 4px;
}

.hud-ring { position: absolute; border-radius: 50%; }
.hud-ring.ticks {
  inset: 0;
  background:
    repeating-conic-gradient(var(--cyan-dim) 0deg 1.6deg, transparent 1.6deg 6deg);
  mask: radial-gradient(circle, transparent 62%, black 63%, black 70%, transparent 71%);
  -webkit-mask: radial-gradient(circle, transparent 62%, black 63%, black 70%, transparent 71%);
  animation: spin 24s linear infinite;
}
.hud-ring.dashes {
  inset: 18px;
  border: 2px dashed var(--cyan-dim);
  animation: spin 14s linear infinite reverse;
}
.hud-ring.arcs {
  inset: 34px;
  border: 3px solid transparent;
  border-top-color: var(--cyan);
  border-right-color: var(--cyan);
  filter: drop-shadow(0 0 6px var(--cyan));
  animation: spin 4.5s cubic-bezier(0.6, 0.1, 0.4, 0.9) infinite;
}

.reactor-core { position: absolute; inset: 56px; }
.core-inner {
  position: absolute; inset: 0; border-radius: 50%;
  background:
    radial-gradient(circle, #f2ffff 0%, #9ff2ff 30%, var(--cyan) 62%, rgba(0, 90, 130, 0.6) 100%);
  box-shadow:
    0 0 24px var(--cyan),
    0 0 70px rgba(0, 229, 255, 0.5),
    inset 0 0 18px rgba(255, 255, 255, 0.9);
  animation: corePulse 2.6s ease-in-out infinite;
}
.core-glow {
  position: absolute; inset: -34px; border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 229, 255, 0.28) 0%, transparent 65%);
  pointer-events: none;
}

/* reactor "thinking" state */
#reactor.thinking .hud-ring.arcs { animation-duration: 0.9s; border-top-color: var(--gold); }
#reactor.thinking .core-inner { animation-duration: 0.8s; }

/* ── console ────────────────────────────────────────────────── */
.console {
  width: min(860px, 100%); flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  clip-path: polygon(24px 0, calc(100% - 24px) 0, 100% 18px, 100% 100%, 0 100%, 0 18px);
  backdrop-filter: blur(6px);
}

.armed-strip {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 16px;
  background: rgba(255, 200, 97, 0.08);
  border-bottom: 1px solid var(--gold-dim);
  font-family: var(--font-mono); font-size: 0.7rem;
}
.armed-tag {
  color: var(--gold); letter-spacing: 0.2em;
  animation: blink 2.2s ease-in-out infinite;
}
#armed-name { color: var(--text); letter-spacing: 0.08em; }
#disarm-btn {
  margin-left: auto; background: none; border: 1px solid var(--gold-dim);
  color: var(--gold); width: 20px; height: 20px; border-radius: 3px;
  cursor: pointer; font-size: 0.7rem; line-height: 1;
}
#disarm-btn:hover { background: rgba(255, 200, 97, 0.15); }

.chat-log {
  flex: 1; overflow-y: auto; padding: 18px 22px;
  display: flex; flex-direction: column; gap: 14px;
  scroll-behavior: smooth;
}
.chat-log::-webkit-scrollbar { width: 5px; }
.chat-log::-webkit-scrollbar-thumb { background: var(--cyan-dim); border-radius: 3px; }

.msg { max-width: 82%; animation: msgIn 0.25s ease both; }
.msg .who {
  font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.28em;
  margin-bottom: 5px; opacity: 0.85;
}
.msg .body {
  font-size: 0.95rem; line-height: 1.55;
  padding: 10px 14px; border-radius: 4px;
  white-space: pre-wrap; word-break: break-word;
}
.msg.user { align-self: flex-end; text-align: right; }
.msg.user .who { color: var(--gold); }
.msg.user .body {
  background: rgba(255, 200, 97, 0.07);
  border: 1px solid rgba(255, 200, 97, 0.3);
  border-right: 3px solid var(--gold);
  text-align: left;
}
.msg.jarvis { align-self: flex-start; }
.msg.jarvis .who { color: var(--cyan); }
.msg.jarvis .body {
  background: var(--cyan-faint);
  border: 1px solid var(--panel-border);
  border-left: 3px solid var(--cyan);
  color: var(--text);
}
.msg.system { align-self: center; max-width: 95%; }
.msg.system .body {
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-dim);
  background: none; border: none; padding: 2px; text-align: center;
}

.msg .body code {
  font-family: var(--font-mono); font-size: 0.85em;
  background: rgba(0, 229, 255, 0.09); padding: 1px 5px; border-radius: 3px;
  color: var(--cyan-soft);
}
.msg .body pre {
  background: rgba(0, 10, 20, 0.8); border: 1px solid var(--panel-border);
  border-radius: 4px; padding: 10px 12px; overflow-x: auto; margin: 8px 0;
}
.msg .body pre code { background: none; padding: 0; }
.msg .body strong { color: #fff; }
.msg .body em { color: var(--cyan-soft); }
.msg .body a {
  color: var(--cyan-soft); text-decoration: underline;
  text-decoration-color: var(--cyan-dim); text-underline-offset: 2px;
}
.msg .body a:hover { color: var(--cyan); text-decoration-color: var(--cyan); }

.cursor-blink::after {
  content: "▌"; color: var(--cyan); animation: blink 0.8s step-end infinite;
}

/* ── input row ──────────────────────────────────────────────── */
.chat-input-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--panel-border);
  background: rgba(0, 15, 28, 0.5);
}
.prompt-chevron { color: var(--cyan); font-size: 1rem; text-shadow: 0 0 8px var(--cyan-dim); }

#chat-input {
  flex: 1; background: none; border: none; outline: none;
  color: #eaffff; font-family: var(--font-mono); font-size: 0.95rem;
  caret-color: var(--cyan);
}
#chat-input::placeholder { color: var(--text-dim); }

.icon-btn {
  width: 38px; height: 38px; flex-shrink: 0;
  background: var(--cyan-faint); border: 1px solid var(--panel-border);
  border-radius: 4px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease;
}
.icon-btn svg { width: 19px; height: 19px; fill: var(--text-dim); }
.icon-btn:hover { border-color: var(--cyan); box-shadow: 0 0 12px var(--cyan-dim); }
.icon-btn:hover svg { fill: var(--cyan); }
.icon-btn.active svg { fill: var(--cyan); }
.icon-btn.send { background: rgba(0, 229, 255, 0.18); }
.icon-btn.send svg { fill: var(--cyan); }
.icon-btn.listening {
  border-color: var(--red); background: rgba(255, 90, 90, 0.12);
  animation: micPulse 1s ease-in-out infinite;
}
.icon-btn.listening svg { fill: var(--red); }
.icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ═══ RIGHT — module browser ═════════════════════════════════ */
.mod-tabs {
  display: flex; gap: 4px; margin-bottom: 12px;
}
.mod-tabs button {
  flex: 1; padding: 7px 2px;
  background: none; border: 1px solid var(--panel-border); border-radius: 3px;
  color: var(--text-dim); cursor: pointer;
  font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.12em;
  transition: all 0.2s ease;
}
.mod-tabs button:hover { color: var(--cyan-soft); border-color: var(--cyan-dim); }
.mod-tabs button.active {
  color: var(--cyan); border-color: var(--cyan);
  background: var(--cyan-faint); text-shadow: 0 0 6px var(--cyan-dim);
}

.mod-list {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px;
  padding-right: 4px;
}
.mod-list::-webkit-scrollbar { width: 5px; }
.mod-list::-webkit-scrollbar-thumb { background: var(--cyan-dim); border-radius: 3px; }

.mod-loading {
  font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-dim);
  letter-spacing: 0.2em; text-align: center; padding: 30px 0;
  animation: blink 1.2s step-end infinite;
}

.mod-card {
  border: 1px solid var(--panel-border); border-radius: 4px;
  padding: 10px 12px; cursor: pointer;
  background: rgba(0, 229, 255, 0.03);
  transition: all 0.18s ease;
}
.mod-card:hover {
  border-color: var(--cyan); background: var(--cyan-faint);
  box-shadow: 0 0 14px rgba(0, 229, 255, 0.15);
  transform: translateX(-2px);
}
.mod-card.armed {
  border-color: var(--gold); background: rgba(255, 200, 97, 0.07);
  box-shadow: 0 0 14px rgba(255, 200, 97, 0.2);
}
.mod-card h3 {
  font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.08em;
  color: var(--cyan-soft); margin-bottom: 4px;
  display: flex; justify-content: space-between; align-items: center;
}
.mod-card.armed h3 { color: var(--gold); }
.mod-card h3 .mod-flag {
  font-size: 0.55rem; letter-spacing: 0.2em; color: var(--gold);
}
.mod-card p {
  font-size: 0.72rem; line-height: 1.4; color: var(--text-dim);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ═══ FOOTER ═════════════════════════════════════════════════ */
.hud-footer {
  grid-area: footer;
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 10px;
  font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.25em;
  color: var(--text-dim);
}
#ticker { color: var(--cyan-dim); animation: tickerGlow 4s ease-in-out infinite; }

/* ═══ ANIMATIONS ═════════════════════════════════════════════ */
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes corePulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.93); opacity: 0.82; }
}

@keyframes blink { 50% { opacity: 0.25; } }

@keyframes wave {
  0%, 100% { height: 12%; }
  50% { height: 88%; }
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes hudIn {
  from { opacity: 0; transform: scale(0.985); filter: blur(4px); }
  to { opacity: 1; transform: none; filter: none; }
}

@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 90, 90, 0.5); }
  50% { box-shadow: 0 0 0 8px rgba(255, 90, 90, 0); }
}

@keyframes tickerGlow {
  0%, 100% { color: var(--cyan-dim); }
  50% { color: var(--cyan-soft); text-shadow: 0 0 8px var(--cyan-dim); }
}

/* ═══ RESPONSIVE ═════════════════════════════════════════════ */
/* Short viewports (e.g. 1280x720): compact the diagnostics so gauges, specs,
   three device chips and the waveform all fit inside the left panel. */
@media (max-height: 780px) {
  .gauge { width: 90px; height: 90px; }
  .gauge-label span { font-size: 1.25rem; }
  .gauge-row { margin-bottom: 12px; }
  .specs { gap: 5px; }
  .specs > div { padding-bottom: 4px; }
  .devices-block { margin-top: 10px; }
  .dev-chip { padding: 4px 8px; }
  .waveform { height: 30px; margin-top: 8px; }
}

@media (max-width: 1180px) {
  #hud {
    grid-template-columns: 250px 1fr 260px;
  }
}

@media (max-width: 940px) {
  body { overflow-y: auto; }
  #hud {
    height: auto; min-height: 100vh;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto auto;
    grid-template-areas: "header" "center" "left" "right" "footer";
  }
  .reactor-wrap { width: 140px; height: 140px; }
  .reactor-core { inset: 42px; }
  .console { min-height: 420px; }
  .panel-left, .panel-right { clip-path: none; }
}

/* generated images (engines) */
.img-msg figure { margin: 0; max-width: min(520px, 100%); }
.img-msg img { display: block; width: auto; max-width: 100%; max-height: min(46vh, 420px); height: auto; border: 1px solid rgba(120, 200, 255, 0.35); border-radius: 8px; cursor: zoom-in; box-shadow: 0 0 18px rgba(60, 160, 255, 0.25); }
.img-msg figcaption { font-size: 11px; opacity: 0.7; margin-top: 4px; letter-spacing: 0.04em; }
