/* ═══════════════════════════════════════════════════════
   ARIA — Holographic AI Interface Stylesheet
   NSYSOps · nsysops.com/ai
═══════════════════════════════════════════════════════ */

:root {
  --aria-primary:   #00c8ff;
  --aria-secondary: #00ffcc;
  --aria-purple:    #9b6dff;
  --aria-gold:      #ffd700;
  --aria-red:       #ff4466;
  --aria-bg:        #000000;
  --aria-panel:     rgba(0, 10, 20, 0.75);
  --aria-border:    rgba(0, 200, 255, 0.25);
  --aria-text:      #c8e8f0;
  --aria-dim:       rgba(200, 232, 240, 0.45);
  --aria-font:      'JetBrains Mono', 'Fira Code', monospace;
}

/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--aria-bg);
  color: var(--aria-text);
  font-family: var(--aria-font);
  font-size: 13px;
}

/* ── Canvas ── */
#aria-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}

/* ── Scanline overlay ── */
#aria-scanlines {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(0, 200, 255, 0.018) 3px,
    rgba(0, 200, 255, 0.018) 4px
  );
  animation: scanline-flicker 8s linear infinite;
}

@keyframes scanline-flicker {
  0%,100%  { opacity: 1; }
  49%      { opacity: 1; }
  50%      { opacity: 0.92; }
  51%      { opacity: 1; }
  74%      { opacity: 1; }
  75%      { opacity: 0.95; }
  76%      { opacity: 1; }
}

/* Scanning line that sweeps top → bottom */
#aria-scan-sweep {
  position: fixed;
  left: 0; right: 0;
  height: 2px;
  background: linear-gradient(to right, transparent, rgba(0,200,255,0.4), transparent);
  z-index: 2;
  pointer-events: none;
  animation: scan-sweep 8s linear infinite;
}
@keyframes scan-sweep {
  0%   { top: 0;    opacity: 0; }
  2%   { opacity: 1; }
  98%  { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

/* ── CRT Vignette ── */
#aria-vignette {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(ellipse at center,
    transparent 55%,
    rgba(0,0,0,0.55) 100%
  );
}

/* ── Corner brackets ── */
.aria-corner {
  position: fixed;
  width: 48px;
  height: 48px;
  z-index: 10;
  pointer-events: none;
}
.aria-corner::before,
.aria-corner::after {
  content: '';
  position: absolute;
  background: var(--aria-primary);
  animation: bracket-pulse 3s ease-in-out infinite;
}
.aria-corner::before { width: 2px; height: 100%; }
.aria-corner::after  { width: 100%; height: 2px; }

.aria-corner.tl { top: 16px; left: 16px; }
.aria-corner.tr { top: 16px; right: 16px; transform: scaleX(-1); }
.aria-corner.bl { bottom: 16px; left: 16px; transform: scaleY(-1); }
.aria-corner.br { bottom: 16px; right: 16px; transform: scale(-1); }

@keyframes bracket-pulse {
  0%,100% { opacity: 0.6; }
  50%     { opacity: 1; }
}

/* ── Data stream background ── */
#aria-datastream {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  opacity: 0.12;
}

/* ── Main UI overlay ── */
#aria-ui {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

/* Allow pointer events only on interactive children */
#aria-ui .interactive { pointer-events: auto; }

/* ── Panel base ── */
.aria-panel {
  background: var(--aria-panel);
  border: 1px solid var(--aria-border);
  border-radius: 4px;
  padding: 12px 14px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  position: absolute;
}

/* ── TOP LEFT — identity ── */
#aria-identity {
  top: 28px;
  left: 28px;
  min-width: 210px;
  padding: 14px 18px;
}
.aria-brand {
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--aria-dim);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.aria-name-display {
  font-size: 28px;
  font-weight: 700;
  color: var(--aria-primary);
  letter-spacing: 0.12em;
  text-shadow: 0 0 20px var(--aria-primary), 0 0 40px rgba(0,200,255,0.4);
  line-height: 1;
  margin-bottom: 8px;
}
.aria-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
}
.aria-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--aria-secondary);
  box-shadow: 0 0 8px var(--aria-secondary);
  animation: status-blink 1.5s ease-in-out infinite;
  flex-shrink: 0;
}
.aria-status-dot.offline { background: #444; box-shadow: none; animation: none; }

@keyframes status-blink {
  0%,100% { opacity: 1; }
  50%     { opacity: 0.3; }
}
.aria-state-label {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--aria-secondary);
}

/* ── TOP RIGHT — stats ── */
#aria-stats {
  top: 28px;
  right: 28px;
  min-width: 180px;
  text-align: right;
}
.aria-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  gap: 16px;
}
.aria-stat-label {
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--aria-dim);
  text-transform: uppercase;
  white-space: nowrap;
}
.aria-stat-value {
  font-size: 13px;
  color: var(--aria-primary);
  font-weight: 700;
  letter-spacing: 0.05em;
}
.aria-stat-value.green { color: var(--aria-secondary); }
.aria-stat-value.red   { color: var(--aria-red); }

/* ── LEFT — Twitch chat feed ── */
#aria-chat-feed {
  top: 50%;
  left: 28px;
  transform: translateY(-50%);
  width: 260px;
  max-height: 320px;
  overflow: hidden;
}
.aria-chat-header {
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--aria-dim);
  margin-bottom: 10px;
  border-bottom: 1px solid var(--aria-border);
  padding-bottom: 6px;
}
.aria-chat-message {
  display: flex;
  flex-direction: column;
  margin-bottom: 10px;
  animation: chat-slide-in 0.3s ease;
  transition: opacity 0.5s;
}
@keyframes chat-slide-in {
  from { transform: translateX(-12px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
.aria-chat-username {
  font-size: 10px;
  color: var(--aria-primary);
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}
.aria-chat-text {
  font-size: 11px;
  color: var(--aria-dim);
  line-height: 1.4;
  word-break: break-word;
}
.aria-chat-message.responding {
  border-left: 2px solid var(--aria-secondary);
  padding-left: 8px;
}
.aria-chat-message.responding .aria-chat-username { color: var(--aria-secondary); }

/* ── Platform color-coding for dual-platform chat ── */
/* Twitch messages: Twitch purple (#9146ff)           */
/* Kick messages:   Kick green   (#53fc18)             */
.aria-chat-message[data-platform="twitch"] .aria-chat-username { color: #9146ff; }
.aria-chat-message[data-platform="kick"]   .aria-chat-username { color: #53fc18; }
/* Ensure platform color overrides the responding teal only when NOT responding */
.aria-chat-message[data-platform="twitch"].responding .aria-chat-username { color: var(--aria-secondary); }
.aria-chat-message[data-platform="kick"].responding   .aria-chat-username { color: var(--aria-secondary); }

/* ── Chat type badges (Change 11) ── */
.aria-chat-badge {
  display: inline-block;
  font-size: 8px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 1px 4px;
  border-radius: 2px;
  margin-left: 4px;
  vertical-align: middle;
  opacity: 0.75;
}
.aria-chat-badge--streamer { background: rgba(57,255,106,0.15); color: #39ff6a; border: 1px solid rgba(57,255,106,0.3); }
.aria-chat-badge--bot      { background: rgba(100,100,100,0.2);  color: #666;    border: 1px solid rgba(100,100,100,0.3); }
.aria-chat-badge--command  { background: rgba(0,200,255,0.12);   color: #00c8ff; border: 1px solid rgba(0,200,255,0.25); }
.aria-chat-badge--thread   { background: rgba(255,179,71,0.12);  color: #ffb347; border: 1px solid rgba(255,179,71,0.3); }
.aria-chat-badge--whisper  { background: rgba(180,80,255,0.15);  color: #b450ff; border: 1px solid rgba(180,80,255,0.3); }
.aria-chat-badge--event    { background: rgba(255,80,80,0.12);   color: #ff5050; border: 1px solid rgba(255,80,80,0.25); }
.aria-chat-message.streamer-msg .aria-chat-username--streamer { color: #39ff6a; }
.aria-chat-message.bot-msg { opacity: 0.5; }
.aria-chat-username--thread { color: #ffb347 !important; }

.aria-responding-label {
  font-size: 9px;
  color: var(--aria-secondary);
  letter-spacing: 0.15em;
  margin-bottom: 8px;
  animation: pulse-opacity 1s ease-in-out infinite;
}
@keyframes pulse-opacity {
  0%,100% { opacity: 1; }
  50%     { opacity: 0.4; }
}

/* ── RIGHT — mini stats ── */
#aria-mini-stats {
  top: 50%;
  right: 28px;
  transform: translateY(-50%);
  width: 200px;
}
.aria-mini-row {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
}
.aria-mini-label {
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--aria-dim);
  margin-bottom: 2px;
}
.aria-mini-value {
  font-size: 14px;
  color: var(--aria-primary);
  font-weight: 700;
}

/* ── BOTTOM — speech + waveform ── */
#aria-bottom {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  width: min(680px, 90vw);
  text-align: center;
}
.aria-speech-text {
  font-size: 15px;
  color: var(--aria-text);
  line-height: 1.6;
  min-height: 48px;
  margin-bottom: 14px;
  text-shadow: 0 0 12px rgba(0,200,255,0.3);
  white-space: pre-wrap;
  word-break: break-word;
}
.aria-waveform {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  height: 36px;
  margin-bottom: 12px;
}
.aria-wave-bar {
  width: 4px;
  background: var(--aria-primary);
  border-radius: 2px 2px 0 0;
  min-height: 3px;
  transition: height 0.05s ease;
  box-shadow: 0 0 6px var(--aria-primary);
}

/* ── Input area (manual mode) ── */
#aria-input-label {
  font-size: 9px;
  font-family: 'Space Mono', var(--aria-font);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--aria-dim);
  margin-bottom: 6px;
  text-align: left;
  padding-left: 2px;
  transition: color 0.3s;
}
#aria-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 200, 255, 0.06);
  border: 1px solid rgba(0, 200, 255, 0.3);
  border-radius: 4px;
  padding: 9px 12px;
  pointer-events: auto;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#aria-input-wrap:focus-within {
  border-color: var(--aria-primary);
  box-shadow: 0 0 12px rgba(0, 200, 255, 0.25), inset 0 0 8px rgba(0, 200, 255, 0.04);
}
#aria-input-wrap.input-twitch-mode {
  opacity: 0.22;
  transition: opacity 0.3s;
}
#aria-input-wrap.input-twitch-mode:hover {
  opacity: 0.85;
}
#aria-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #e0f4ff;
  font-family: 'Space Mono', var(--aria-font);
  font-size: 13px;
  caret-color: var(--aria-primary);
}
#aria-input::placeholder { color: rgba(200, 232, 240, 0.4); }
#aria-input:-webkit-autofill,
#aria-input:-webkit-autofill:hover,
#aria-input:-webkit-autofill:focus {
  -webkit-text-fill-color: #e0f4ff;
  -webkit-box-shadow: 0 0 0 1000px rgba(0, 5, 12, 0.9) inset;
  box-shadow: 0 0 0 1000px rgba(0, 5, 12, 0.9) inset;
  transition: background-color 5000s ease-in-out 0s;
}
#aria-send-btn {
  background: rgba(0, 200, 255, 0.08);
  border: 1px solid var(--aria-primary);
  color: var(--aria-primary);
  font-family: 'Space Mono', var(--aria-font);
  font-size: 10px;
  letter-spacing: 0.15em;
  padding: 6px 14px;
  border-radius: 3px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
}
#aria-send-btn:hover {
  background: rgba(0, 200, 255, 0.2);
  box-shadow: 0 0 12px rgba(0, 200, 255, 0.4);
}
#aria-send-btn:active {
  transform: scale(0.96);
}

/* ── Feature 1: Mic button ── */
#aria-mic-btn {
  background: rgba(0, 255, 204, 0.06);
  border: 1px solid var(--aria-secondary);
  color: var(--aria-secondary);
  font-size: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
  padding: 0;
  line-height: 1;
}
#aria-mic-btn:hover {
  background: rgba(0, 255, 204, 0.18);
  box-shadow: 0 0 14px rgba(0, 255, 204, 0.4);
}
#aria-mic-btn:active {
  transform: scale(0.93);
}
#aria-mic-btn.active {
  background: rgba(0, 255, 204, 0.22);
  box-shadow: 0 0 18px rgba(0, 255, 204, 0.7), 0 0 6px rgba(0, 255, 204, 0.5) inset;
  animation: mic-pulse 1s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 10px rgba(0,255,204,0.5), 0 0 5px rgba(0,255,204,0.3) inset; }
  50%       { box-shadow: 0 0 22px rgba(0,255,204,0.9), 0 0 10px rgba(0,255,204,0.6) inset; }
}

/* ── BOTTOM RIGHT — controls ── */
#aria-controls {
  bottom: 28px;
  right: 28px;
  min-width: 180px;
  pointer-events: auto;
}
.aria-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 12px;
}
.aria-toggle-label {
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--aria-dim);
}

/* Toggle switch */
.aria-toggle {
  position: relative;
  width: 36px;
  height: 18px;
  flex-shrink: 0;
}
.aria-toggle input { opacity: 0; width: 0; height: 0; }
.aria-toggle-track {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.1);
  border: 1px solid var(--aria-border);
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.3s;
}
.aria-toggle input:checked + .aria-toggle-track { background: rgba(0,200,255,0.3); border-color: var(--aria-primary); }
.aria-toggle-track::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--aria-dim);
  transition: transform 0.3s, background 0.3s;
}
.aria-toggle input:checked + .aria-toggle-track::after {
  transform: translateX(18px);
  background: var(--aria-primary);
  box-shadow: 0 0 8px var(--aria-primary);
}

/* Neural status bar */
.aria-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  min-height: 21px;
  gap: 8px;
}
.aria-status-neural {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
}
.aria-status-prefix {
  font-size: 8px;
  letter-spacing: 0.12em;
  color: var(--aria-dim);
  flex-shrink: 0;
}
.aria-status-state {
  font-size: 8px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--aria-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.aria-status-conn {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.aria-conn-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.aria-conn-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ff4444;
  box-shadow: 0 0 4px #ff4444;
  flex-shrink: 0;
  transition: background 0.3s, box-shadow 0.3s;
}
.aria-conn-dot.online {
  background: #00ff88;
  box-shadow: 0 0 4px #00ff88;
}
.aria-conn-dot.pulsing {
  animation: conn-pulse 0.6s ease-in-out;
}
.aria-conn-name {
  font-size: 7px;
  letter-spacing: 0.12em;
  color: var(--aria-dim);
}
@keyframes conn-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}
/* Mobile: neural state only — hide connectivity section */
.aria-status-bar-mobile .aria-status-conn {
  display: none;
}

/* Volume */
.aria-volume-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.aria-volume-label {
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--aria-dim);
  flex-shrink: 0;
}
input[type=range].aria-slider {
  flex: 1;
  -webkit-appearance: none;
  height: 2px;
  background: var(--aria-border);
  border-radius: 1px;
  outline: none;
}
input[type=range].aria-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--aria-primary);
  box-shadow: 0 0 6px var(--aria-primary);
  cursor: pointer;
}

/* ── iOS tap-to-activate overlay ── */
#aria-ios-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  transition: opacity 0.6s ease;
  cursor: pointer;
}
#aria-ios-overlay .ios-ring {
  width: 80px;
  height: 80px;
  border: 2px solid var(--aria-primary);
  border-radius: 50%;
  box-shadow: 0 0 20px var(--aria-primary), inset 0 0 20px rgba(0,200,255,0.1);
  animation: ios-ring-pulse 1.5s ease-in-out infinite;
}
@keyframes ios-ring-pulse {
  0%, 100% { transform: scale(1);    opacity: 0.6; }
  50%       { transform: scale(1.15); opacity: 1;   }
}
#aria-ios-overlay .ios-name {
  font-size: 48px;
  font-weight: 700;
  color: var(--aria-primary);
  letter-spacing: 0.2em;
  text-shadow: 0 0 30px var(--aria-primary), 0 0 60px rgba(0,200,255,0.4);
}
#aria-ios-overlay .ios-tap-label {
  font-family: 'Space Mono', var(--aria-font);
  font-size: 16px;
  letter-spacing: 0.35em;
  color: #e0f4ff;
  text-transform: uppercase;
  animation: pulse-opacity 1.2s ease-in-out infinite;
}
#aria-ios-overlay .ios-hint {
  font-size: 11px;
  color: var(--aria-dim);
  letter-spacing: 0.12em;
}

/* ── Mobile mute button (inside #aria-input-wrap-mobile) ── */
#aria-mute-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: none;
  border: 1px solid rgba(0, 200, 255, 0.5);
  border-radius: 50%;
  color: var(--aria-primary);
  font-size: 16px;
  cursor: pointer;
  pointer-events: auto;
  transition: box-shadow 0.2s, border-color 0.2s;
}
#aria-mute-btn:active {
  box-shadow: 0 0 16px rgba(0, 200, 255, 0.6);
  border-color: var(--aria-primary);
}
#aria-mute-btn.muted {
  border-color: rgba(200, 232, 240, 0.3);
  color: var(--aria-dim);
}

/* ── Typing indicator (FEATURE 2) ── */
.aria-typing-dots {
  display: none;
  gap: 6px;
  align-items: center;
  justify-content: center;
  height: 24px;
  margin: 4px 0 8px;
}
.aria-typing-dots.active { display: flex; }
.aria-typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--aria-primary);
  box-shadow: 0 0 6px var(--aria-primary);
  animation: typing-bounce 1.2s ease-in-out infinite;
}
.aria-typing-dot:nth-child(2) { animation-delay: 0.18s; }
.aria-typing-dot:nth-child(3) { animation-delay: 0.36s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0);    opacity: 0.35; }
  30%           { transform: translateY(-8px); opacity: 1;    }
}

/* ── Boot sequence overlay ── */
#aria-boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--aria-font);
  transition: opacity 0.8s ease;
}
#aria-boot.hidden { opacity: 0; pointer-events: none; }

.boot-line {
  font-size: 13px;
  color: var(--aria-primary);
  letter-spacing: 0.08em;
  margin-bottom: 6px;
  opacity: 0;
  transition: opacity 0.3s;
}
.boot-line.visible { opacity: 1; }
.boot-line.dim     { color: var(--aria-dim); }
.boot-line.success { color: var(--aria-secondary); }
.boot-line.large   { font-size: 32px; font-weight: 700; letter-spacing: 0.2em;
                     text-shadow: 0 0 30px var(--aria-primary); margin: 16px 0; }

.boot-progress-wrap {
  width: 320px;
  height: 2px;
  background: rgba(0,200,255,0.15);
  border-radius: 1px;
  margin: 20px 0;
  overflow: hidden;
}
.boot-progress-bar {
  height: 100%;
  width: 0;
  background: var(--aria-primary);
  box-shadow: 0 0 8px var(--aria-primary);
  transition: width 0.1s linear;
}

/* ── OFFLINE overlay ── */
#aria-offline-label {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
  font-size: 14px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: rgba(100,100,100,0.6);
  pointer-events: none;
  display: none;
}

/* ── Glitch flash ── */
@keyframes glitch-flash {
  0%,100% { filter: none; }
  10%     { filter: hue-rotate(90deg) brightness(1.5); }
  20%     { filter: none; }
  30%     { filter: hue-rotate(-40deg); }
  40%     { filter: none; }
}
.glitching { animation: glitch-flash 0.18s steps(1) forwards; }

/* ── Neural load indicator ── */
.aria-neural-load {
  position: relative;
  width: 100%;
  height: 3px;
  background: rgba(0,200,255,0.1);
  border-radius: 1px;
  margin-top: 8px;
  overflow: hidden;
}
.aria-neural-bar {
  height: 100%;
  background: var(--aria-primary);
  box-shadow: 0 0 6px var(--aria-primary);
  transition: width 1s ease;
}

/* ── Twitch status badge ── */
.aria-twitch-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 2px;
  border: 1px solid;
}
.aria-twitch-badge.connected { color: var(--aria-secondary); border-color: rgba(0,255,204,0.4); }
.aria-twitch-badge.offline   { color: var(--aria-dim);       border-color: rgba(200,232,240,0.15); }

/* Hidden on desktop — shown via CSS on mobile (and JS sets display:flex at runtime) */
#aria-mobile-panel { display: none; }

/* ═══════════════════════════════════════════════════════
   MOBILE LAYOUT
═══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Hide desktop panels */
  #aria-chat-feed,
  #aria-mini-stats,
  #aria-stats {
    display: none;
  }

  /* Canvas: fixed below topbar so Three.js gets correct dimensions. */
  #aria-canvas {
    position: fixed;
    top: 40px;
    left: 0;
    right: 0;
    height: calc(55vh - 40px);
    width: 100%;
    z-index: 1;
  }

  /* Hide the desktop identity panel */
  #aria-identity { display: none !important; }
  .aria-name-display { font-size: 18px; }
  .aria-brand { display: none; }

  /* Remove duplicate status bar from mobile panel */
  #aria-status-bar-mobile { display: none; }

  /* Site nav above canvas on mobile */
  #site-nav { position: fixed; top: 0; left: 0; right: 0; z-index: 500; }
  body { overflow: hidden; }

  /* Bottom panel: scrollable companion UI */
  #aria-mobile-panel {
    position: fixed;
    bottom: 0;
    left: 0; right: 0;
    height: 42vh;
    background: rgba(0, 5, 12, 0.95);
    border-top: 1px solid var(--aria-border);
    border-radius: 12px 12px 0 0;
    z-index: 20;
    overflow-y: auto;
    padding: 16px;
    /* keep input above browser chrome on iOS/Android */
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  /* Hide entire desktop speech/waveform/input area — mobile uses its own conversation view */
  #aria-bottom { display: none; }

  /* Hide desktop controls panel — mobile panel has equivalent status info */
  #aria-controls { display: none; }
}

/* On phones with the top bar (≤430px): shift canvas below the 40px top bar */

/* Stack status bar vertically on very narrow screens */
@media (max-width: 375px) {
  .aria-status-bar-mobile {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}

/* ── Mobile top bar ─────────────────────────────────────────────────────────── */
#aria-topbar {
  position: fixed;
  top: env(safe-area-inset-top, 0px);
  left: 0;
  right: 0;
  height: 40px;
  background: rgba(0,8,18,0.97);
  border-bottom: 1px solid rgba(0,200,255,0.12);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
  z-index: 9999;
  box-sizing: border-box;
  font-family: 'Share Tech Mono', monospace;
}

/* Hide on desktop — desktop has its own controls */
@media (min-width: 431px) {
  #aria-topbar { display: none !important; }
}

#tb-left {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

#tb-dot {
  font-size: 8px;
  color: #00ff88;
  line-height: 1;
}

#tb-dot.offline { color: #ff4444; }

#tb-state {
  font-size: 10px;
  letter-spacing: 2px;
  color: #00c8ff;
}

#tb-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 10px;
  letter-spacing: 3px;
  color: rgba(0,200,255,0.45);
}

#ariaToggle { display: none; }

#tb-toggle-ui {
  display: block;
  width: 34px;
  height: 18px;
  background: rgba(0,200,255,0.15);
  border-radius: 9px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}

#tb-toggle-label:has(#ariaToggle:checked) #tb-toggle-ui {
  background: #00c8ff;
}

#tb-toggle-ui::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: white;
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
}

#tb-toggle-label:has(#ariaToggle:checked) #tb-toggle-ui::after {
  transform: translateX(16px);
}

#tb-right {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

#volSlider {
  width: 60px;
  height: 40px;
  accent-color: #00c8ff;
  cursor: pointer;
}

/* Push content below top bar on mobile */

/* ── OBS transparent mode ── */
body.obs-mode {
  background: transparent !important;
}
body.obs-mode #aria-canvas { background: transparent; }
body.obs-mode #aria-controls,
body.obs-mode #aria-stats,
body.obs-mode #aria-mini-stats,
body.obs-mode #aria-input-wrap { display: none; }
body.obs-mode #aria-scanlines { opacity: 0.4; }

/* ── Minimal mode ── */
body.minimal-mode #aria-ui    { display: none; }
body.minimal-mode #aria-scanlines,
body.minimal-mode #aria-vignette { display: none; }

/* ── Chat-only mode ── */
body.chatonly-mode #aria-canvas,
body.chatonly-mode #aria-scanlines,
body.chatonly-mode #aria-vignette,
body.chatonly-mode #aria-identity,
body.chatonly-mode #aria-stats,
body.chatonly-mode #aria-mini-stats,
body.chatonly-mode #aria-bottom,
body.chatonly-mode #aria-controls { display: none; }
body.chatonly-mode #aria-chat-feed {
  top: 28px;
  left: 28px;
  transform: none;
  display: block;
}

/* ══════════════════════════════════════════════════════
   OBS OVERLAY SYSTEM — Centered + Dashboard modes
   ══════════════════════════════════════════════════════ */

/* All OBS overlay elements hidden in manual mode */
#obs-overlay { display: none; pointer-events: none; }

/* Show overlay in OBS mode */
body.obs-mode #obs-overlay { display: block; }

/* Explicit guards on position:fixed OBS children — prevents iOS mobile bleed
   where position:fixed children can escape a parent's display:none.
   Also stops CSS animations from running while hidden. */
body:not(.obs-mode) #obs-crosshair-h,
body:not(.obs-mode) #obs-crosshair-v,
body:not(.obs-mode) .obs-bracket,
body:not(.obs-mode) #obs-scan-line,
body:not(.obs-mode) #obs-neural-ring,
body:not(.obs-mode) #obs-viewer-callout,
body:not(.obs-mode) #obs-waveform,
body:not(.obs-mode) #obs-response-box,
body:not(.obs-mode) .obs-corner-stat,
body:not(.obs-mode) #obs-now-playing,
body:not(.obs-mode) #obs-right-panel {
  display: none !important;
  animation: none !important;
  visibility: hidden !important;
}

/* ── Atmospheric: crosshair lines ── */
#obs-crosshair-h,
#obs-crosshair-v {
  position: fixed;
  background: rgba(0, 200, 255, 0.07);
  pointer-events: none;
  z-index: 2;
}
#obs-crosshair-h {
  top: 50%; left: 0; right: 0;
  height: 1px;
  transform: translateY(-50%);
}
#obs-crosshair-v {
  left: 50%; top: 0; bottom: 0;
  width: 1px;
  transform: translateX(-50%);
}

/* ── Atmospheric: corner brackets ── */
.obs-bracket {
  position: fixed;
  width: 24px; height: 24px;
  z-index: 3;
  pointer-events: none;
}
.obs-bracket-tl { top: 16px; left: 16px; border-top: 1px solid rgba(0,200,255,0.2); border-left: 1px solid rgba(0,200,255,0.2); }
.obs-bracket-tr { top: 16px; right: 16px; border-top: 1px solid rgba(0,200,255,0.2); border-right: 1px solid rgba(0,200,255,0.2); }
.obs-bracket-bl { bottom: 16px; left: 16px; border-bottom: 1px solid rgba(0,200,255,0.2); border-left: 1px solid rgba(0,200,255,0.2); }
.obs-bracket-br { bottom: 16px; right: 16px; border-bottom: 1px solid rgba(0,200,255,0.2); border-right: 1px solid rgba(0,200,255,0.2); }

/* ── Atmospheric: scan line ── */
#obs-scan-line {
  position: fixed;
  left: 15%; right: 15%;
  height: 1px;
  background: rgba(0, 200, 255, 0.1);
  z-index: 2;
  pointer-events: none;
  animation: obs-scan 6s linear infinite;
}
@keyframes obs-scan {
  0%   { top: 0;    opacity: 0; }
  5%   { opacity: 1; }
  95%  { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

/* ── Neural activity ring ── */
#obs-neural-ring {
  position: fixed;
  top: 50%; left: 50%;
  width: 320px; height: 320px;
  margin: -160px 0 0 -160px;
  border-radius: 50%;
  border: 2px solid rgba(0, 200, 255, 0.0);
  z-index: 2;
  pointer-events: none;
  transition: border-color 0.4s, box-shadow 0.4s;
}
#obs-neural-ring.ring-idle {
  border-color: rgba(0,200,255,0.12);
  box-shadow: 0 0 12px rgba(0,200,255,0.08);
  animation: ring-idle-pulse 4s ease-in-out infinite;
}
#obs-neural-ring.ring-thinking {
  border-color: rgba(0,200,255,0.35);
  box-shadow: 0 0 20px rgba(0,200,255,0.2);
  animation: ring-spin 2s linear infinite;
}
#obs-neural-ring.ring-speaking {
  border-color: rgba(0,200,255,0.5);
  box-shadow: 0 0 30px rgba(0,200,255,0.3);
  animation: ring-speak-pulse 0.8s ease-in-out infinite alternate;
}
#obs-neural-ring.ring-listening {
  border-style: dashed;
  border-color: rgba(0,200,255,0.3);
  animation: ring-spin 8s linear infinite;
}
#obs-neural-ring.ring-excited {
  border-color: rgba(0,200,255,0.7);
  box-shadow: 0 0 40px rgba(0,200,255,0.4);
  animation: ring-excited-pulse 0.4s ease-in-out infinite alternate;
}
@keyframes ring-idle-pulse {
  0%,100% { opacity: 0.8; }
  50%     { opacity: 0.4; }
}
@keyframes ring-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes ring-speak-pulse {
  from { transform: scale(1.0); }
  to   { transform: scale(1.04); }
}
@keyframes ring-excited-pulse {
  from { transform: scale(0.98); opacity: 0.6; }
  to   { transform: scale(1.06); opacity: 1.0; }
}

/* ── Viewer callout ── */
#obs-viewer-callout {
  position: fixed;
  top: calc(50% - 200px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  letter-spacing: 2px;
  color: #00ffaa;
  background: rgba(0,255,170,0.06);
  border: 1px solid rgba(0,255,170,0.15);
  padding: 4px 10px;
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  white-space: nowrap;
}
#obs-viewer-callout.visible { opacity: 1; }

/* ── Waveform canvas ── */
#obs-waveform {
  position: fixed;
  bottom: calc(50% - 220px);
  left: 50%;
  transform: translateX(-50%);
  width: 400px;
  height: 40px;
  z-index: 5;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}
#obs-waveform.active { opacity: 0.6; }

/* ── Cinematic response text box ── */
#obs-response-box {
  position: fixed;
  bottom: calc(50% - 280px);
  left: 50%;
  transform: translateX(-50%);
  width: min(700px, 90vw);
  background: rgba(0, 8, 16, 0.6);
  border-top: 1px solid rgba(0,200,255,0.1);
  padding: 14px 24px 16px;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s;
}
#obs-response-box.visible { opacity: 1; }
#obs-response-label {
  font-size: 9px;
  letter-spacing: 4px;
  color: rgba(0,200,255,0.35);
  margin-bottom: 6px;
}
#obs-response-text {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 300;
  font-size: 20px;
  color: rgba(220, 245, 255, 0.92);
  line-height: 1.6;
  max-height: 2.8em;    /* 2 lines at 1.6 line-height */
  overflow: hidden;
}
/* Typewriter cursor in response text */
#obs-response-text.typing::after {
  content: '|';
  animation: cursor-blink 0.6s step-end infinite;
  color: var(--aria-primary);
  margin-left: 2px;
}

/* ── Corner stats ── */
.obs-corner-stat {
  position: fixed;
  font-size: 10px;
  color: rgba(0,200,255,0.3);
  letter-spacing: 0.08em;
  z-index: 10;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.obs-corner-sep { color: rgba(0,200,255,0.15); }
#obs-corner-tl { top: 16px; left: 16px; }
#obs-corner-tr { top: 20px; right: 20px; }
#obs-corner-bl { bottom: 16px; left: 16px; }
#obs-corner-br { bottom: 16px; right: 16px; }

/* ── OBS centered mode: last-2-messages chat display ── */
/* Newest message on top (column-reverse), older dimmed.  */
/* Each message fades out independently via JS (CHAT_TTL). */
body.obs-mode #aria-chat-messages {
  display: flex;
  flex-direction: column-reverse;
}
body.obs-mode #aria-chat-messages .aria-chat-message {
  display: none;
}
body.obs-mode #aria-chat-messages .aria-chat-message:nth-last-child(1),
body.obs-mode #aria-chat-messages .aria-chat-message:nth-last-child(2) {
  display: flex;
}
/* Older of the two visible messages */
body.obs-mode #aria-chat-messages .aria-chat-message:nth-last-child(2) {
  opacity: 0.5;
}

.obs-conn-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(0,200,255,0.3);
  display: inline-block;
}
.obs-conn-dot.online { background: rgba(57,255,106,0.8); }

/* ── Now Playing ── */
#obs-now-playing {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: rgba(0,200,255,0.2);
  letter-spacing: 0.1em;
  z-index: 8;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1s;
}
#obs-now-playing.visible { opacity: 1; }

/* ── Dashboard mode: canvas left 60%, right panel ── */
body.obs-mode.obs-dashboard #aria-canvas {
  width: 60% !important;
  left: 0 !important;
  right: auto !important;
}
/* Crosshairs and ring shift to canvas center in dashboard mode */
body.obs-mode.obs-dashboard #obs-crosshair-h,
body.obs-mode.obs-dashboard #obs-crosshair-v,
body.obs-mode.obs-dashboard #obs-neural-ring,
body.obs-mode.obs-dashboard #obs-waveform,
body.obs-mode.obs-dashboard #obs-response-box,
body.obs-mode.obs-dashboard #obs-viewer-callout {
  left: 30%;
}
body.obs-mode.obs-dashboard #obs-crosshair-h { right: 40%; left: 0; }
body.obs-mode.obs-dashboard #obs-crosshair-v { left: 30%; }
body.obs-mode.obs-dashboard #obs-corner-tr,
body.obs-mode.obs-dashboard #obs-corner-br { display: none; }

/* ── Right panel (Mode B) ── */
#obs-right-panel {
  display: none;
  position: fixed;
  top: 0; right: 0;
  width: 40%;
  height: 100%;
  border-left: 1px solid rgba(0,200,255,0.08);
  flex-direction: column;
  font-family: var(--aria-font);
  z-index: 15;
  pointer-events: none;
}
body.obs-mode.obs-dashboard #obs-right-panel { display: flex; }

/* Panel header */
.obs-panel-header {
  height: 28px;
  background: rgba(0,15,25,0.95);
  border-bottom: 1px solid rgba(0,200,255,0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  flex-shrink: 0;
}
.obs-panel-header-left {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 8px;
  letter-spacing: 0.15em;
  color: rgba(0,200,255,0.5);
}
.obs-panel-live {
  font-size: 7px;
  letter-spacing: 0.2em;
  color: rgba(0,200,255,0.25);
}
.obs-panel-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: rgba(0,200,255,0.6);
  flex-shrink: 0;
}
.obs-panel-dot.obs-dot-amber { background: rgba(255,180,50,0.6); }
.obs-panel-dot.pulsing {
  animation: obs-dot-pulse 2s ease-in-out infinite;
}
@keyframes obs-dot-pulse {
  0%,100% { opacity: 1; }
  50%     { opacity: 0.3; }
}

/* Interactions panel */
#obs-interactions-panel {
  flex: 55;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: rgba(0,5,12,0.9);
}
#obs-interactions-list {
  flex: 1;
  overflow: hidden;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.obs-empty-state {
  font-size: 8px;
  letter-spacing: 0.15em;
  color: rgba(0,200,255,0.2);
  text-align: center;
  margin: auto;
  animation: obs-dot-pulse 3s ease-in-out infinite;
}
.obs-interact-card {
  background: rgba(0,200,255,0.03);
  border-left: 2px solid rgba(0,200,255,0.12);
  padding: 7px 9px;
}
.obs-interact-card.active {
  border-left-color: rgba(0,200,255,0.5);
  background: rgba(0,200,255,0.07);
}
.obs-interact-viewer {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 2px;
}
.obs-interact-name { font-size: 9px; color: #00ffaa; }
.obs-interact-time { font-size: 8px; color: rgba(0,200,255,0.25); }
.obs-interact-msg  { font-size: 9px; color: rgba(0,200,255,0.6); font-style: italic; margin-bottom: 4px; }
.obs-interact-reply-row { display: flex; gap: 5px; align-items: flex-start; }
.obs-interact-aria-tag  { font-size: 8px; color: #00c8ff; font-family: var(--aria-font); flex-shrink: 0; margin-top: 1px; }
.obs-interact-reply     { font-size: 9px; color: rgba(255,255,255,0.78); font-weight: 300; line-height: 1.4; }

/* Neural panel */
#obs-neural-panel {
  flex: 45;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: rgba(0,5,12,0.92);
  border-top: 1px solid rgba(0,200,255,0.06);
}
.obs-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  flex: 1;
  padding: 8px;
  background: rgba(0,200,255,0.03);
}
.obs-stat-cell {
  padding: 8px;
  background: rgba(0,5,12,0.8);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.obs-stat-wide { grid-column: 1 / -1; }
.obs-stat-label { font-size: 7px; letter-spacing: 0.15em; color: rgba(0,200,255,0.25); }
.obs-stat-value { font-size: 22px; color: var(--aria-primary); line-height: 1; }
.obs-stat-sub   { font-size: 7px; color: rgba(0,200,255,0.2); }
.obs-mini-bars  { display: flex; align-items: flex-end; gap: 2px; height: 16px; margin-top: 4px; }
.obs-mini-bar   { width: 6px; background: rgba(0,200,255,0.25); border-top: 1px solid rgba(0,200,255,0.5); min-height: 2px; }

/* Neural activity segments */
.obs-neural-segments {
  display: flex;
  gap: 3px;
  align-items: flex-end;
  justify-content: flex-end;
  margin-top: 4px;
}
.obs-seg {
  width: 8px; height: 12px;
  background: rgba(0,200,255,0.1);
  transition: background 0.2s, box-shadow 0.2s;
}
.obs-seg.active {
  background: rgba(0,200,255,0.55);
  box-shadow: 0 0 4px rgba(0,200,255,0.4);
}

/* ── OBS size variants ── */
/* ?obs=true&size=small — sphere + status bar only, no right panel */
body.obs-mode.obs-small #aria-chat-feed,
body.obs-mode.obs-small #aria-mini-stats,
body.obs-mode.obs-small #obs-right-panel,
body.obs-mode.obs-small #obs-corner-tl,
body.obs-mode.obs-small #obs-corner-tr,
body.obs-mode.obs-small #obs-corner-bl,
body.obs-mode.obs-small #obs-corner-br { display: none !important; }

/* ── Utility ── */
.hidden    { display: none !important; }
.invisible { visibility: hidden; }

/* Typewriter cursor */
.typewriter-cursor::after {
  content: '█';
  animation: cursor-blink 0.8s step-end infinite;
  color: var(--aria-primary);
  margin-left: 2px;
}
@keyframes cursor-blink {
  0%,100% { opacity: 1; }
  50%     { opacity: 0; }
}
