:root {
  --bg: #060a10;
  --panel: #0b141d;
  --panel-2: #0d1a24;
  --cyan: #4ce8ff;
  --cyan-dim: #1c7f96;
  --cyan-soft: rgba(76, 232, 255, 0.5);
  --text: #dff6ff;
  --text-dim: #7fa8b8;
  --danger: #ff5d6c;
  --mint: #6dffc4;
}

* { box-sizing: border-box; }

/* The [hidden] attribute's UA-stylesheet default (display:none) loses to any
   author rule of equal specificity - e.g. .comm-panel/.chat-form both set
   their own `display: flex`, which silently wins and keeps them visible even
   with the hidden attribute present. This makes `hidden` actually work
   everywhere in this app, not just for elements that happen to have no
   competing display rule. */
[hidden] { display: none !important; }

/* Hide the whole HUD until auth.js confirms a session (or removes this
   class once one exists) — the auth-gate below is deliberately outside
   this scope so it stays visible. */
.auth-pending .boot-overlay,
.auth-pending .hud-shell { display: none; }

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
/* [hidden] is a plain author-stylesheet-overridable UA rule, so the
   unconditional display:flex above would otherwise always win the cascade
   regardless of the hidden attribute — this reasserts it explicitly. */
.auth-gate[hidden] { display: none; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.auth-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 280px;
  padding: 40px 32px;
  border: 1px solid var(--cyan-dim);
  border-radius: 4px;
  background: var(--panel);
  box-shadow: 0 0 40px rgba(76, 232, 255, 0.08);
}

.auth-mark {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--cyan);
  border-radius: 50%;
  color: var(--cyan);
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 4px;
}

.auth-title {
  color: var(--text);
  font-size: 15px;
  letter-spacing: 0.14em;
  font-weight: 600;
}

.auth-sub {
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 0.12em;
  margin-bottom: 12px;
}

.auth-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--cyan-dim);
  border-radius: 3px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-align: center;
}
.auth-input:focus {
  outline: none;
  border-color: var(--cyan);
}

.auth-submit {
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid var(--cyan);
  border-radius: 3px;
  color: var(--cyan);
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 0.12em;
  cursor: pointer;
}
.auth-submit:hover:not(:disabled) { background: rgba(76, 232, 255, 0.1); }
.auth-submit:disabled { opacity: 0.5; cursor: not-allowed; }

.auth-error {
  color: var(--danger);
  font-size: 12px;
  text-align: center;
}

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Consolas", monospace;
  overflow: hidden;
}

/* ===================== Layered background ===================== */

.bg-grid {
  position: fixed;
  inset: -10%;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(76, 232, 255, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(76, 232, 255, 0.055) 1px, transparent 1px);
  background-size: 64px 64px;
  animation: grid-drift 80s linear infinite;
  mask-image: radial-gradient(circle at 50% 45%, rgba(0, 0, 0, 0.9), transparent 75%);
}

@keyframes grid-drift {
  from { transform: translate(0, 0); }
  to   { transform: translate(64px, 64px); }
}

#particle-field {
  position: fixed;
  inset: 0;
  z-index: 1;
}

#particle-field-fg {
  position: fixed;
  inset: 0;
  z-index: 2;
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 38%, rgba(76, 232, 255, 0.07), transparent 55%),
    radial-gradient(ellipse at 50% 100%, rgba(0, 0, 0, 0.55), transparent 60%),
    radial-gradient(ellipse at 50% 0%, rgba(0, 0, 0, 0.4), transparent 55%);
}

/* Radar-style scan sweep, passes down the whole viewport on a loop */
.scan-sweep {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  overflow: hidden;
}

.scan-sweep::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -2px;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(76, 232, 255, 0.85), transparent);
  box-shadow: 0 0 14px 2px rgba(76, 232, 255, 0.5);
  animation: scan-sweep-move 7s linear infinite;
}

@keyframes scan-sweep-move {
  0%   { top: -2px; opacity: 0; }
  4%   { opacity: 1; }
  92%  { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

body[data-state="thinking"] .scan-sweep::before {
  animation-duration: 3.2s;
  background: linear-gradient(90deg, transparent, rgba(76, 232, 255, 0.95), transparent);
}

body[data-state="responding"] .scan-sweep::before,
body[data-state="speaking"] .scan-sweep::before {
  animation-duration: 1.8s;
  height: 3px;
  background: linear-gradient(90deg, transparent, rgba(200, 250, 255, 1), transparent);
  box-shadow: 0 0 20px 3px rgba(76, 232, 255, 0.75);
}

/* Permanent faint CRT scanline texture for a screen/sensor-glass feel */
.crt-scanlines {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(200, 250, 255, 0.05) 0px,
    rgba(200, 250, 255, 0.05) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: overlay;
  opacity: 0.5;
}

/* Brief digital glitch/flicker fired on state transitions, see app.js triggerGlitch() */
body.glitching .hud-frame {
  animation: hud-glitch-slice 240ms steps(4, end);
}

@keyframes hud-glitch-slice {
  0%, 100% {
    filter: drop-shadow(0 0 0 transparent) drop-shadow(0 0 0 transparent);
    clip-path: inset(0 0 0 0);
    transform: translate(0, 0);
  }
  20% {
    filter: drop-shadow(2px 0 0 rgba(255, 60, 90, 0.65)) drop-shadow(-2px 0 0 rgba(76, 232, 255, 0.65));
    clip-path: inset(8% 0 55% 0);
    transform: translate(-3px, 0);
  }
  40% {
    filter: drop-shadow(-2px 0 0 rgba(255, 60, 90, 0.6)) drop-shadow(2px 0 0 rgba(76, 232, 255, 0.6));
    clip-path: inset(60% 0 5% 0);
    transform: translate(3px, 0);
  }
  60% {
    filter: drop-shadow(1px 0 0 rgba(255, 60, 90, 0.5)) drop-shadow(-1px 0 0 rgba(76, 232, 255, 0.5));
    clip-path: inset(30% 0 40% 0);
    transform: translate(-2px, 0);
  }
  80% {
    filter: drop-shadow(0 0 0 transparent) drop-shadow(0 0 0 transparent);
    clip-path: inset(0 0 0 0);
    transform: translate(0, 0);
  }
}

body.glitching::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 91;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(76, 232, 255, 0.1) 0px,
    rgba(76, 232, 255, 0.1) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: overlay;
  animation: static-flicker 240ms steps(2, end);
}

@keyframes static-flicker {
  0%, 100% { opacity: 0; }
  20% { opacity: 0.55; }
  50% { opacity: 0.12; }
  70% { opacity: 0.4; }
}

/* ===================== Boot sequence ===================== */

.boot-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  transition: opacity 0.6s ease;
}

body.booted .boot-overlay {
  opacity: 0;
  pointer-events: none;
}

.boot-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.boot-mark {
  position: relative;
  width: 110px;
  height: 110px;
  display: grid;
  place-items: center;
  margin-bottom: 30px;
}

.boot-mark-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.boot-mark-ring {
  fill: none;
  stroke: rgba(76, 232, 255, 0.55);
  stroke-width: 1.4;
  stroke-dasharray: 6 10;
  transform-origin: 50px 50px;
  animation: boot-ring-spin 9s linear infinite;
}

.boot-mark-ring-2 {
  stroke: rgba(76, 232, 255, 0.3);
  stroke-dasharray: 3 7;
  animation: boot-ring-spin 6s linear infinite reverse;
}

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

.boot-mark-letter {
  font-size: 36px;
  font-weight: 700;
  color: var(--cyan);
  text-shadow: 0 0 22px rgba(76, 232, 255, 0.85);
  animation: boot-letter-flicker 2.4s ease-in-out infinite;
}

@keyframes boot-letter-flicker {
  0%, 100% { opacity: 1; }
  92% { opacity: 1; }
  94% { opacity: 0.4; }
  96% { opacity: 1; }
}

.boot-lines {
  min-height: 100px;
  text-align: center;
}

.boot-line {
  margin: 6px 0;
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-dim);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.boot-line.show {
  opacity: 1;
  transform: none;
}

.boot-line-final.show {
  color: var(--cyan);
  text-shadow: 0 0 14px rgba(76, 232, 255, 0.7);
  letter-spacing: 4px;
}

.boot-bar {
  width: 260px;
  height: 3px;
  margin-top: 26px;
  border-radius: 2px;
  overflow: hidden;
  background: rgba(76, 232, 255, 0.15);
}

.boot-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan-dim), var(--cyan));
  box-shadow: 0 0 10px rgba(76, 232, 255, 0.6);
  transition: width 2.3s linear;
}

/* ===================== Shell layout ===================== */

.hud-shell {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: clamp(16px, 2.4vh, 30px) clamp(20px, 3.5vw, 48px);
  gap: clamp(10px, 1.6vh, 20px);
}

.top-bar,
.orb-column,
.comm-panel,
.command-bar {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

body.booted .top-bar      { opacity: 1; transform: none; transition-delay: 0.05s; }
body.booted .orb-column   { opacity: 1; transform: none; transition-delay: 0.2s; }
body.booted .comm-panel   { opacity: 1; transform: none; transition-delay: 0.35s; }
body.booted .command-bar  { opacity: 1; transform: none; transition-delay: 0.5s; }

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--cyan-dim);
  border-radius: 8px;
  color: var(--cyan);
  font-weight: 700;
  font-size: 16px;
  box-shadow: 0 0 14px rgba(76, 232, 255, 0.15) inset;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-name {
  font-size: 15px;
  letter-spacing: 5px;
  color: var(--text);
}

.brand-sub {
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--text-dim);
}

.telemetry {
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.8vw, 26px);
}

.tele-item {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.tele-label {
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--text-dim);
}

.tele-value {
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(76, 232, 255, 0.35);
  font-variant-numeric: tabular-nums;
}

.tele-value.tele-ok { color: var(--mint); text-shadow: 0 0 8px rgba(109, 255, 196, 0.4); }

.reset-btn {
  background: transparent;
  border: 1px solid var(--cyan-dim);
  color: var(--text-dim);
  padding: 8px 14px;
  border-radius: 4px;
  font-size: 10px;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.reset-btn:hover {
  color: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 12px rgba(76, 232, 255, 0.2);
}

/* ===================== Stage: orb + comm panel ===================== */

.stage {
  flex: 1;
  display: flex;
  align-items: stretch;
  gap: clamp(20px, 3vw, 40px);
  min-height: 0;
}

.orb-column {
  flex: 1 1 60%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-width: 0;
  position: relative;
  animation: orb-column-breathe 9s ease-in-out infinite;
}

@keyframes orb-column-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.012); }
}

.hud-frame {
  position: relative;
  width: clamp(260px, 32vw, 460px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.hud-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.hud-bracket {
  fill: none;
  stroke: rgba(76, 232, 255, 0.55);
  stroke-width: 1.5;
  filter: drop-shadow(0 0 4px rgba(76, 232, 255, 0.55));
}

.hud-line {
  fill: none;
  stroke: rgba(76, 232, 255, 0.3);
  stroke-width: 1;
  stroke-dasharray: 3 7;
  animation: hud-flow 3s linear infinite;
  transition: stroke 0.4s ease;
}

@keyframes hud-flow {
  to { stroke-dashoffset: -100; }
}

.hud-frame[data-state="thinking"] .hud-line {
  animation-duration: 1s;
  stroke: rgba(76, 232, 255, 0.5);
}

.hud-frame[data-state="responding"] .hud-line,
.hud-frame[data-state="speaking"] .hud-line {
  animation-duration: 0.5s;
  stroke: rgba(76, 232, 255, 0.8);
}

.hud-frame[data-state="listening"] .hud-line {
  animation-duration: 1.6s;
  stroke: rgba(109, 255, 196, 0.5);
}

.hud-frame[data-state="ambient"] .hud-line {
  animation-duration: 4.5s;
  stroke: rgba(109, 255, 196, 0.2);
}

/* Radar-style tick bezel, generated in app.js */
.hud-tick-ring {
  transform-origin: 210px 210px;
  animation: hud-ring-spin 46s linear infinite;
}

.hud-tick {
  stroke: rgba(76, 232, 255, 0.3);
  stroke-width: 1;
}

.hud-tick-major {
  stroke: rgba(76, 232, 255, 0.55);
  stroke-width: 1.4;
}

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

.hud-frame[data-state="thinking"] .hud-tick-ring { animation-duration: 16s; }
.hud-frame[data-state="responding"] .hud-tick-ring,
.hud-frame[data-state="speaking"] .hud-tick-ring { animation-duration: 7s; }

/* Orbiting call-sign text ring, slower and independent of the tick bezel */
.hud-orbit-group {
  transform-origin: 210px 210px;
  animation: hud-ring-spin 110s linear infinite reverse;
}

.hud-orbit-ring {
  fill: none;
  stroke: rgba(76, 232, 255, 0.22);
  stroke-width: 1;
  stroke-dasharray: 1 5;
}

.hud-orbit-text {
  fill: rgba(76, 232, 255, 0.55);
  font-size: 9px;
  letter-spacing: 3px;
  text-transform: uppercase;
}

/* Bright pulse traveling along each connector line, riding the same path
   coordinates as the .hud-line elements via offset-path. */
.hud-pulse {
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 4px;
  margin: -2px 0 0 -2px;
  border-radius: 50%;
  background: #eafffe;
  box-shadow: 0 0 8px 2px rgba(76, 232, 255, 0.9), 0 0 18px 4px rgba(76, 232, 255, 0.4);
  offset-distance: 0%;
  opacity: 0;
  animation: hud-pulse-travel 3s linear infinite;
}

.hud-pulse:nth-of-type(2) { animation-delay: -0.75s; }
.hud-pulse:nth-of-type(3) { animation-delay: -1.5s; }
.hud-pulse:nth-of-type(4) { animation-delay: -2.25s; }

@keyframes hud-pulse-travel {
  0%   { offset-distance: 0%; opacity: 0; }
  8%   { opacity: 1; }
  92%  { opacity: 1; }
  100% { offset-distance: 100%; opacity: 0; }
}

.hud-frame[data-state="thinking"] .hud-pulse { animation-duration: 1s; }
.hud-frame[data-state="responding"] .hud-pulse,
.hud-frame[data-state="speaking"] .hud-pulse { animation-duration: 0.5s; }

#orb {
  position: relative;
  z-index: 1;
  width: 78%;
  height: 78%;
}

.status-label {
  font-size: 12px;
  letter-spacing: 5px;
  text-transform: uppercase;
  color: var(--text-dim);
  text-shadow: 0 0 8px rgba(76, 232, 255, 0.3);
  transition: color 0.3s ease;
}

.mic-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* Persistent indicator for an open multi-turn conversation, distinct from
   the per-turn status label above it. */
.conversation-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px 5px 12px;
  border: 1px solid rgba(109, 255, 196, 0.4);
  border-radius: 20px;
  background: rgba(109, 255, 196, 0.06);
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--mint);
}

.conversation-badge[hidden] { display: none; }

.conversation-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 6px rgba(109, 255, 196, 0.9);
  animation: conversation-dot-pulse 1.6s ease-in-out infinite;
}

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

.conversation-end-btn {
  background: transparent;
  border: 1px solid rgba(109, 255, 196, 0.5);
  color: var(--mint);
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 9px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.conversation-end-btn:hover {
  background: rgba(109, 255, 196, 0.15);
  box-shadow: 0 0 10px rgba(109, 255, 196, 0.3);
}

.mic-label {
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--text-dim);
}

.hud-icon-btn {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--cyan-dim);
  background: rgba(76, 232, 255, 0.04);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s ease;
}

.hud-icon-btn svg {
  width: 20px;
  height: 20px;
}

.hud-icon-btn:hover {
  color: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 14px rgba(76, 232, 255, 0.25);
}

.hud-icon-btn.active {
  color: var(--bg);
  background: var(--cyan);
  border-color: var(--cyan);
  animation: mic-pulse 1.4s ease-in-out infinite;
}

@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(76, 232, 255, 0.55); }
  50% { box-shadow: 0 0 0 10px rgba(76, 232, 255, 0); }
}

#mute-btn .icon-muted { display: none; }
#mute-btn.is-muted .icon-unmuted { display: none; }
#mute-btn.is-muted .icon-muted { display: block; }
#mute-btn.is-muted { color: var(--danger); border-color: rgba(255, 93, 108, 0.5); }

/* "Always listening" wake-word toggle */
.wake-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
}

.wake-toggle-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.wake-toggle-track {
  position: relative;
  width: 34px;
  height: 18px;
  border-radius: 10px;
  border: 1px solid var(--cyan-dim);
  background: rgba(76, 232, 255, 0.05);
  transition: border-color 0.2s ease, background 0.2s ease;
  flex-shrink: 0;
}

.wake-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.wake-toggle-input:checked + .wake-toggle-track {
  border-color: var(--mint);
  background: rgba(109, 255, 196, 0.1);
}

.wake-toggle-input:checked + .wake-toggle-track .wake-toggle-thumb {
  transform: translateX(16px);
  background: var(--mint);
  box-shadow: 0 0 8px rgba(109, 255, 196, 0.8);
}

.wake-toggle-input:focus-visible + .wake-toggle-track {
  box-shadow: 0 0 0 2px rgba(76, 232, 255, 0.35);
}

.wake-toggle-text {
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--text-dim);
  transition: color 0.2s ease;
}

.wake-toggle-input:checked ~ .wake-toggle-text {
  color: var(--mint);
}

/* ===================== Comm panel ===================== */

.comm-panel {
  flex: 0 0 clamp(280px, 27vw, 400px);
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-left: clamp(16px, 2vw, 28px);
  border-left: 1px solid rgba(76, 232, 255, 0.15);
}

.comm-panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 14px;
  flex-shrink: 0;
}

.comm-panel-header-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(76, 232, 255, 0.4), transparent);
}

.chat-log {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 2px 8px 12px 2px;
}

.chat-log::-webkit-scrollbar { width: 5px; }
.chat-log::-webkit-scrollbar-thumb { background: var(--cyan-dim); border-radius: 3px; }

.log-entry {
  border-left: 2px solid var(--cyan-dim);
  padding: 2px 0 2px 12px;
  animation: log-in 0.35s ease both;
}

@keyframes log-in {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: none; }
}

.log-entry.user { border-left-color: rgba(76, 232, 255, 0.45); }
.log-entry.assistant { border-left-color: var(--cyan); }
.log-entry.error { border-left-color: var(--danger); }

.log-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.log-entry.assistant .log-tag { color: var(--cyan); }
.log-entry.error .log-tag { color: var(--danger); }

.log-text {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.log-entry.error .log-text { color: var(--danger); }

.log-text.decoding {
  color: var(--cyan);
  opacity: 0.9;
  text-shadow: 0 0 6px rgba(76, 232, 255, 0.5);
}

/* ===================== Command bar ===================== */

.command-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: clamp(10px, 1.6vh, 18px);
  border-top: 1px solid rgba(76, 232, 255, 0.12);
}

.chat-form {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--cyan-dim);
  border-radius: 8px;
  padding: 4px 4px 4px 16px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-form:focus-within {
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px rgba(76, 232, 255, 0.3), 0 0 18px rgba(76, 232, 255, 0.15);
}

.prompt-caret {
  color: var(--cyan);
  font-weight: 700;
  font-size: 15px;
}

.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 13px 8px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}

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

.send-btn {
  background: rgba(76, 232, 255, 0.1);
  border: 1px solid var(--cyan);
  color: var(--cyan);
  padding: 0 22px;
  height: 40px;
  border-radius: 6px;
  font-size: 12px;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.send-btn:hover:not(:disabled) {
  background: rgba(76, 232, 255, 0.2);
  box-shadow: 0 0 16px rgba(76, 232, 255, 0.25);
}

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

/* ===================== Responsive ===================== */

@media (max-width: 880px) {
  .stage { flex-direction: column; }
  .comm-panel {
    flex: 1;
    border-left: none;
    border-top: 1px solid rgba(76, 232, 255, 0.15);
    padding-left: 0;
    padding-top: 16px;
  }
  .orb-column { flex: 0 0 auto; }
}
