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

:root {
  --cyan: #00d4ff;
  --cyan-dim: rgba(0, 212, 255, 0.35);
  --cyan-glow: rgba(0, 212, 255, 0.15);
  --gold: #f3cf53;
  --gold-dim: rgba(243, 207, 83, 0.4);
  --bg: #020810;
  --bg-panel: rgba(2, 12, 24, 0.75);
  --border: rgba(0, 212, 255, 0.25);
  --text: #c8e8f4;
  --text-dim: rgba(200, 232, 244, 0.45);
  --ok: #00ff88;
  --warn: #ffaa00;
  --err: #ff4466;
  --font-display: 'Orbitron', sans-serif;
  --font-ui: 'Rajdhani', sans-serif;
  --font-mono: 'Share Tech Mono', monospace;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.4;
}

.mono { font-family: var(--font-mono); font-size: 0.85rem; letter-spacing: 0.05em; }

#hud-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

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

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

.hud {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: 280px 1fr 280px;
  grid-template-areas:
    "top top top"
    "left center right"
    "bottom bottom bottom";
  height: 100vh;
  padding: 0.75rem;
  padding-bottom: 9rem;
  gap: 0.75rem;
}

/* ── Top bar ── */
.hud-top {
  grid-area: top;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  backdrop-filter: blur(12px);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
}

.hud-top__left, .hud-top__right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sys-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sys-badge__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan), 0 0 16px var(--cyan-dim);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}

.sys-badge__label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.15em;
  color: var(--cyan);
}

.hud-top__sep {
  width: 1px;
  height: 16px;
  background: var(--border);
}

.status-ok { color: var(--ok); }
.status-warn { color: var(--warn); }
.status-err { color: var(--err); }

.waveform {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 24px;
}

.waveform span {
  display: block;
  width: 3px;
  height: 4px;
  background: var(--cyan);
  border-radius: 1px;
  animation: wave 1.2s ease-in-out infinite;
  opacity: 0.6;
}

.waveform span:nth-child(odd) { animation-delay: 0.1s; }
.waveform span:nth-child(3n) { animation-delay: 0.25s; }
.waveform span:nth-child(4n) { animation-delay: 0.4s; }
.waveform span:nth-child(5n) { animation-delay: 0.55s; }

@keyframes wave {
  0%, 100% { height: 4px; opacity: 0.3; }
  50% { height: 20px; opacity: 1; }
}

/* ── Panels ── */
.panel {
  position: relative;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  backdrop-filter: blur(12px);
  padding: 1rem;
  overflow: hidden;
}

.panel--left { grid-area: left; }
.panel--right { grid-area: right; }

.panel__corner {
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: var(--cyan);
  border-style: solid;
  opacity: 0.7;
}

.panel__corner--tl { top: 4px; left: 4px; border-width: 2px 0 0 2px; }
.panel__corner--bl { bottom: 4px; left: 4px; border-width: 0 0 2px 2px; }
.panel__corner--tr { top: 4px; right: 4px; border-width: 2px 2px 0 0; }
.panel__corner--br { bottom: 4px; right: 4px; border-width: 0 2px 2px 0; }

.panel__title {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--cyan);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.panel__title--sub { margin-top: 1.25rem; }

/* ── Systems list ── */
.sys-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sys-list__item {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid transparent;
  border-radius: 2px;
  transition: border-color 0.2s, background 0.2s;
  cursor: default;
}

.sys-list__item:hover {
  border-color: var(--cyan-dim);
  background: var(--cyan-glow);
}

.sys-list__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
}

.sys-list__dot--ok { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.sys-list__dot--warn { background: var(--warn); box-shadow: 0 0 6px var(--warn); }
.sys-list__dot--err { background: var(--err); box-shadow: 0 0 6px var(--err); }

.sys-list__name {
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sys-list__ms {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
}

.sys-list__loading {
  font-size: 0.85rem;
  color: var(--text-dim);
  animation: blink 1.5s step-end infinite;
}

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

/* ── Center / JARVIS Stage ── */
.hud-center {
  grid-area: center;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.jarvis-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  min-height: 0;
  border: 1px solid var(--border);
  background:
    radial-gradient(ellipse 70% 45% at 50% 22%, rgba(0, 212, 255, 0.12) 0%, transparent 65%),
    radial-gradient(ellipse 100% 80% at 50% 50%, rgba(2, 16, 32, 0.95) 0%, rgba(2, 8, 16, 0.88) 100%);
  backdrop-filter: blur(14px);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
  overflow: hidden;
}

.jarvis-bracket {
  position: absolute;
  width: 28px;
  height: 28px;
  border: 2px solid var(--cyan);
  opacity: 0.55;
  z-index: 4;
  pointer-events: none;
}

.jarvis-bracket--tl { top: 10px; left: 10px; border-width: 2px 0 0 2px; }
.jarvis-bracket--tr { top: 10px; right: 10px; border-width: 2px 2px 0 0; }
.jarvis-bracket--bl { bottom: 10px; left: 10px; border-width: 0 0 2px 2px; }
.jarvis-bracket--br { bottom: 10px; right: 10px; border-width: 0 2px 2px 0; }

.jarvis-radar {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(340px, 85%);
  aspect-ratio: 1;
  pointer-events: none;
  opacity: 0.7;
}

.jarvis-radar__svg {
  width: 100%;
  height: 100%;
  animation: radar-spin 60s linear infinite;
}

@keyframes radar-spin { to { transform: rotate(360deg); } }

.jarvis-radar__sweep {
  position: absolute;
  inset: 0;
  background: conic-gradient(from 0deg, transparent 0deg, rgba(0, 212, 255, 0.18) 30deg, transparent 60deg);
  border-radius: 50%;
  animation: radar-sweep 4s linear infinite;
}

@keyframes radar-sweep { to { transform: rotate(360deg); } }

.jarvis-core {
  position: relative;
  z-index: 2;
  width: min(200px, 42vw);
  height: min(200px, 42vw);
  margin-top: 0.75rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.5s ease, filter 0.5s ease;
}

.jarvis-core__orbit {
  position: absolute;
  border-radius: 50%;
  border: 1px solid var(--cyan-dim);
}

.jarvis-core__orbit--a {
  inset: -8%;
  border-style: dashed;
  animation: spin 18s linear infinite;
  opacity: 0.35;
}

.jarvis-core__orbit--b {
  inset: 2%;
  border-color: var(--gold-dim);
  animation: spin 11s linear infinite reverse;
  opacity: 0.5;
}

.jarvis-core__orbit--c {
  inset: 12%;
  border-width: 2px;
  border-color: var(--cyan);
  animation: spin 7s linear infinite;
  opacity: 0.65;
  box-shadow: 0 0 24px var(--cyan-glow), inset 0 0 24px var(--cyan-glow);
}

.jarvis-core__pulse {
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 212, 255, 0.35) 0%, transparent 70%);
  animation: core-pulse 2.8s ease-in-out infinite;
}

@keyframes core-pulse {
  0%, 100% { transform: scale(0.92); opacity: 0.6; }
  50% { transform: scale(1.08); opacity: 1; }
}

.jarvis-core__svg {
  width: 72%;
  height: 72%;
  position: relative;
  z-index: 1;
}

.jarvis-core__label {
  position: absolute;
  bottom: -1.6rem;
  text-align: center;
  width: 140%;
}

.jarvis-core__name {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1rem, 2.5vw, 1.35rem);
  font-weight: 800;
  letter-spacing: 0.35em;
  color: var(--cyan);
  text-shadow: 0 0 24px rgba(0, 212, 255, 0.5);
}

.jarvis-core__tag {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.22em;
  color: var(--text-dim);
  margin-top: 0.2rem;
}

.jarvis-core.is-thinking {
  transform: scale(1.06);
  filter: brightness(1.25);
}

.jarvis-core.is-thinking .jarvis-core__orbit--c {
  animation-duration: 2s;
  border-color: var(--gold);
}

.jarvis-core.is-listening {
  transform: scale(1.1);
  filter: brightness(1.35);
}

.jarvis-core.is-listening .jarvis-core__pulse {
  animation-duration: 0.8s;
  background: radial-gradient(circle, rgba(255, 68, 102, 0.4) 0%, transparent 70%);
}

.jarvis-readout {
  z-index: 2;
  text-align: center;
  padding: 2rem 1rem 0.75rem;
  flex-shrink: 0;
}

.jarvis-readout__main {
  display: block;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--ok);
  text-transform: uppercase;
}

.jarvis-readout__sub {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 0.35rem;
  letter-spacing: 0.06em;
}

.jarvis-console {
  position: relative;
  z-index: 3;
  flex: 1;
  width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-top: 0.25rem;
  border-top: 1px solid rgba(0, 212, 255, 0.2);
  background: linear-gradient(180deg, rgba(0, 212, 255, 0.04) 0%, rgba(0, 0, 0, 0.35) 100%);
}

.jarvis-console__edge--top {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0.5;
}

.jarvis-console__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 1rem;
  border-bottom: 1px solid rgba(0, 212, 255, 0.12);
}

.jarvis-console__tag {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  color: var(--cyan);
  opacity: 0.8;
}

.jarvis-console__pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
  animation: pulse-dot 2s ease-in-out infinite;
}

.jarvis-hud-data {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 1.5rem;
  z-index: 4;
  pointer-events: none;
}

.jarvis-hud-data__col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}

.jarvis-stage.has-conversation .jarvis-core {
  transform: scale(0.72);
  margin-top: 0;
  opacity: 0.85;
}

.jarvis-stage.has-conversation .jarvis-radar {
  opacity: 0.25;
  transform: translateX(-50%) scale(0.85);
}

.jarvis-stage.has-conversation .jarvis-readout {
  padding-top: 0.5rem;
  padding-bottom: 0.35rem;
}

.jarvis-stage.has-conversation .jarvis-readout__main {
  font-size: 0.65rem;
}

.jarvis-stage.has-conversation .jarvis-hud-data {
  opacity: 0.5;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem 1rem 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-height: 100px;
}

.chat-messages::-webkit-scrollbar { width: 5px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--cyan-dim); }

.msg {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-width: 94%;
  animation: msg-in 0.4s ease;
}

.msg--user {
  align-self: flex-end;
  align-items: flex-end;
}

.msg--assistant {
  align-self: flex-start;
  align-items: flex-start;
}

.msg__meta {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  color: var(--cyan);
  opacity: 0.55;
  padding-left: 0.25rem;
}

.msg--user .msg__meta {
  color: var(--gold);
  padding-left: 0;
  padding-right: 0.25rem;
}

.msg__bubble {
  padding: 0.75rem 0.95rem;
  border-radius: 2px;
  border: 1px solid rgba(0, 212, 255, 0.2);
  background: rgba(0, 12, 24, 0.75);
  font-size: 0.92rem;
  line-height: 1.6;
  box-shadow: inset 0 0 20px rgba(0, 212, 255, 0.03);
  position: relative;
}

.msg__bubble::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--cyan), transparent);
  opacity: 0.7;
}

.msg--user .msg__bubble {
  background: rgba(0, 212, 255, 0.07);
  border-color: rgba(0, 212, 255, 0.35);
}

.msg--user .msg__bubble::before {
  left: auto;
  right: 0;
  background: linear-gradient(180deg, var(--gold), transparent);
}

.msg--system .msg__bubble {
  border-color: rgba(0, 255, 136, 0.25);
  background: rgba(0, 255, 136, 0.04);
}

.msg--system .msg__bubble::before {
  background: linear-gradient(180deg, var(--ok), transparent);
}

.msg__bubble p { margin-bottom: 0.65rem; }
.msg__bubble p:last-child { margin-bottom: 0; }
.msg__bubble strong { color: var(--cyan); font-weight: 600; }

.typing {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--cyan);
  font-style: normal;
  border-top: 1px solid rgba(0, 212, 255, 0.1);
}

.typing__ring {
  width: 14px;
  height: 14px;
  border: 2px solid var(--cyan-dim);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.typing.hidden { display: none; }

.typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  animation: typing-dot 1.2s ease-in-out infinite;
}

.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
.typing span:nth-child(4) { animation-delay: 0.45s; }

@keyframes typing-dot {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.85); }
  40% { opacity: 1; transform: scale(1); }
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(10px); filter: blur(4px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

@keyframes spin { to { transform: rotate(360deg); } }

.chat-input {
  display: flex;
  align-items: flex-end;
  gap: 0.65rem;
  padding: 0;
  border: none;
  background: transparent;
}

.chat-input textarea {
  flex: 1;
  resize: none;
  border: 2px solid var(--cyan-dim);
  background: rgba(0, 0, 0, 0.55);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 1.05rem;
  line-height: 1.5;
  padding: 0.85rem 1rem;
  border-radius: 6px;
  outline: none;
  min-height: 52px;
  max-height: 140px;
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.08), inset 0 0 20px rgba(0, 212, 255, 0.03);
}

.chat-input textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.25), 0 0 24px rgba(0, 212, 255, 0.15);
}

.chat-input textarea::placeholder {
  color: rgba(200, 232, 244, 0.55);
  font-size: 1rem;
}

/* ── Fixed bottom composer (where people type) ── */
.composer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  padding: 0.75rem 1rem 1rem;
  background: linear-gradient(to top, rgba(2, 8, 16, 0.98) 70%, rgba(2, 8, 16, 0));
  border-top: 1px solid var(--border);
  backdrop-filter: blur(16px);
}

.composer__inner {
  max-width: 820px;
  margin: 0 auto;
}

.composer__label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--cyan);
  margin-bottom: 0.45rem;
  text-transform: uppercase;
}

.composer__hint {
  margin-top: 0.45rem;
  font-size: 0.72rem;
  color: var(--text-dim);
  text-align: center;
}

.composer__hint kbd {
  display: inline-block;
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  background: rgba(0, 212, 255, 0.06);
  color: var(--text);
}

.btn-send, .btn-voice {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border: 2px solid var(--border);
  background: rgba(0, 212, 255, 0.1);
  color: var(--cyan);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border-radius: 6px;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.btn-send {
  width: auto;
  min-width: 52px;
  padding: 0 1rem;
}

.btn-send__text {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

@media (min-width: 640px) {
  .btn-send__text { display: inline; }
}

@media (max-width: 639px) {
  .btn-send__text { display: none; }
  .composer__hint kbd:nth-child(3),
  .composer__hint kbd:nth-child(4) { display: none; }
}

.btn-send:hover, .btn-voice:hover {
  border-color: var(--cyan);
  background: var(--cyan-glow);
  box-shadow: 0 0 12px var(--cyan-glow);
}

.btn-send:disabled, .btn-voice:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-voice.is-listening {
  border-color: var(--err);
  color: var(--err);
  box-shadow: 0 0 16px rgba(255, 68, 102, 0.35);
  animation: pulse-dot 1s ease-in-out infinite;
}

/* ── Side panels (chat mode) ── */
.prompt-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.prompt-chip {
  text-align: left;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  background: rgba(0, 212, 255, 0.03);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.prompt-chip:hover {
  border-color: var(--cyan);
  background: var(--cyan-glow);
}

.btn-ghost {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  cursor: pointer;
}

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

.cap-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.cap-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.4;
}

.cap-list__icon {
  color: var(--cyan);
  flex-shrink: 0;
}

.panel-note {
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.55;
}

.hidden { display: none !important; }

.reactor-wrap {
  position: relative;
  width: min(280px, 40vw);
  height: min(280px, 40vw);
  display: flex;
  align-items: center;
  justify-content: center;
}

.reactor-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid var(--cyan-dim);
}

.reactor-ring--outer {
  inset: 0;
  animation: spin 20s linear infinite;
  border-style: dashed;
  opacity: 0.3;
}

.reactor-ring--mid {
  inset: 15%;
  animation: spin 12s linear infinite reverse;
  border-color: var(--gold-dim);
  opacity: 0.5;
}

.reactor-ring--inner {
  inset: 28%;
  animation: spin 8s linear infinite;
  border-width: 2px;
  border-color: var(--cyan);
  opacity: 0.6;
  box-shadow: 0 0 20px var(--cyan-glow), inset 0 0 20px var(--cyan-glow);
}

@keyframes spin { to { transform: rotate(360deg); } }

.reactor-core {
  width: 55%;
  height: 55%;
  animation: core-pulse 3s ease-in-out infinite;
}

@keyframes core-pulse {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.05); filter: brightness(1.2); }
}

.reactor-svg { width: 100%; height: 100%; }

.reactor-label {
  position: absolute;
  bottom: -2rem;
  text-align: center;
}

.reactor-label__main {
  display: block;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 0.3em;
  color: var(--cyan);
  text-shadow: 0 0 20px var(--cyan-dim);
}

.reactor-label__sub {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.25em;
  color: var(--text-dim);
  margin-top: 0.25rem;
}

/* ── Terminal ── */
.terminal {
  width: 100%;
  max-width: 560px;
  border: 1px solid var(--border);
  background: rgba(0, 8, 16, 0.85);
  backdrop-filter: blur(8px);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%);
}

.terminal__head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 212, 255, 0.05);
}

.terminal__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.terminal__dot--r { background: #ff5f57; }
.terminal__dot--y { background: #febc2e; }
.terminal__dot--g { background: #28c840; }

.terminal__title {
  margin-left: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  color: var(--text-dim);
}

.terminal__body {
  padding: 0.75rem;
  height: 120px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.6;
}

.terminal__body::-webkit-scrollbar { width: 4px; }
.terminal__body::-webkit-scrollbar-thumb { background: var(--cyan-dim); }

.terminal__line { margin-bottom: 0.25rem; }
.terminal__line--sys { color: var(--cyan); }
.terminal__line--ok { color: var(--ok); }
.terminal__line--warn { color: var(--warn); }
.terminal__line--err { color: var(--err); }

.prompt { color: var(--cyan); margin-right: 0.35rem; }

.terminal__input-row {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-top: 1px solid var(--border);
}

.terminal__input-row input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  caret-color: var(--cyan);
}

.terminal__input-row input::placeholder { color: var(--text-dim); }

/* ── Modules ── */
.module-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.module-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  padding: 0.6rem;
  border: 1px solid var(--border);
  background: rgba(0, 212, 255, 0.03);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%);
}

.module-card:hover {
  border-color: var(--cyan);
  background: var(--cyan-glow);
  box-shadow: 0 0 12px var(--cyan-glow);
}

.module-card__icon {
  font-size: 1rem;
  color: var(--cyan);
}

.module-card__name {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.module-card__desc {
  font-size: 0.7rem;
  color: var(--text-dim);
}

/* ── Telemetry ── */
.telemetry { display: flex; flex-direction: column; gap: 0.5rem; }

.telemetry__row {
  display: grid;
  grid-template-columns: 32px 1fr 36px;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.telemetry__bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
}

.telemetry__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan-dim), var(--cyan));
  border-radius: 2px;
  transition: width 0.8s ease;
}

.telemetry__fill--gold {
  background: linear-gradient(90deg, var(--gold-dim), var(--gold));
}

/* ── Bottom ticker ── */
.hud-bottom {
  grid-area: bottom;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  backdrop-filter: blur(12px);
  overflow: hidden;
  padding: 0.4rem 0;
}

.ticker {
  display: flex;
  gap: 4rem;
  animation: ticker 30s linear infinite;
  white-space: nowrap;
}

.ticker__item {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}

@keyframes ticker {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .hud {
    grid-template-columns: 1fr;
    grid-template-areas:
      "top"
      "center"
      "left"
      "right"
      "bottom";
    overflow-y: auto;
    height: auto;
    min-height: 100vh;
    padding-bottom: 10rem;
  }

  body { overflow: auto; }

  .panel--left, .panel--right { max-height: none; }
  .hud-center { min-height: 55vh; }
  .jarvis-core { width: 160px; height: 160px; }
  .jarvis-radar { width: 240px; }
  .jarvis-hud-data { display: none; }
  .msg { max-width: 100%; }
}
