:root {
  --bg0: #090f1d;
  --bg1: #0d1d2d;
  --bg2: #111f31;
  --panel: rgba(16, 24, 38, 0.92);
  --panel-soft: rgba(18, 30, 47, 0.9);
  --border: rgba(128, 152, 188, 0.25);
  --highlight: rgba(126, 172, 255, 0.14);
  --text: #edf5ff;
  --muted: #a7b7cd;
  --soft: #dfeaff;
  --green: #7ae1bd;
  --green-strong: #41c29a;
  --blue: #98c9ff;
  --red: #f4a7a1;
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(180deg, #09111d 0%, #0a1423 100%);
  color: var(--text);
}

body {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 20%, rgba(121, 163, 255, 0.3), transparent 16%),
    radial-gradient(circle at 82% 76%, rgba(86, 214, 190, 0.22), transparent 18%),
    radial-gradient(circle at 50% 30%, rgba(150, 170, 255, 0.14), transparent 28%),
    linear-gradient(180deg, #050b14 0%, #0a1425 38%, #061119 100%);
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(120deg, rgba(116, 164, 255, 0.08), transparent 40%, rgba(104, 224, 178, 0.05) 100%),
    repeating-linear-gradient(
      0deg,
      rgba(255,255,255,0.02),
      rgba(255,255,255,0.02) 1px,
      transparent 1px,
      transparent 4px
    );
  pointer-events: none;
}

.background-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px),
    radial-gradient(circle, rgba(126, 166, 255, 0.18) 0, transparent 62%);
  background-size: 36px 36px, 36px 36px, 100% 100%;
  mask-image: radial-gradient(circle at center, black 42%, transparent 100%);
  animation: gridFloat 22s linear infinite;
  pointer-events: none;
}

.background-glow {
  position: fixed;
  width: 42vw;
  height: 42vw;
  border-radius: 50%;
  filter: blur(92px);
  opacity: 0.38;
  pointer-events: none;
  animation: driftGlow 15s ease-in-out infinite alternate;
}

.glow-left {
  left: -12vw;
  top: 8vh;
  background: rgba(112, 154, 255, 0.2);
}

.glow-right {
  right: -8vw;
  bottom: 8vh;
  background: rgba(84, 220, 190, 0.18);
}

@keyframes gridFloat {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(0, 12px, 0) scale(1.04); }
  100% { transform: translate3d(0, 0, 0) scale(1); }
}

@keyframes driftGlow {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(20px, -18px, 0) scale(1.12); }
}

button, input, textarea {
  font: inherit;
}

.app-shell {
  position: relative;
  width: min(1200px, 100%);
  min-height: 760px;
  border-radius: 24px;
  border: 1px solid rgba(164, 196, 255, 0.22);
  background: linear-gradient(180deg, rgba(8, 15, 25, 0.87), rgba(14, 22, 36, 0.96));
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.58),
    inset 0 0 22px rgba(122, 174, 255, 0.08),
    inset 0 0 80px rgba(75, 95, 128, 0.12);
  overflow: hidden;
  isolation: isolate;
}

.app-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 0%, rgba(110, 143, 255, 0.06) 50%, transparent 100%),
    repeating-linear-gradient(
      180deg,
      rgba(255,255,255,0.02),
      rgba(255,255,255,0.02) 1px,
      transparent 1px,
      transparent 4px
    );
  pointer-events: none;
  z-index: -1;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(16, 26, 40, 0.8);
  box-shadow: inset 0 -1px 0 rgba(255,255,255,0.03);
}

.assistant-stage {
  position: relative;
  height: 220px;
  margin: 18px 18px 0;
  overflow: hidden;
  border: 1px solid rgba(137, 190, 255, 0.22);
  border-radius: 16px;
  background:
    radial-gradient(circle at center, rgba(45, 112, 158, 0.2), transparent 42%),
    linear-gradient(180deg, rgba(8, 23, 37, 0.9), rgba(8, 16, 28, 0.96));
}

.assistant-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(121, 199, 255, 0.18), transparent 22%, transparent 78%, rgba(121, 199, 255, 0.18)),
    repeating-linear-gradient(90deg, transparent 0 37px, rgba(130, 190, 255, 0.05) 38px 39px);
}

#nebulaCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.stage-hud {
  position: absolute;
  top: 22px;
  left: 24px;
  display: grid;
  gap: 4px;
  z-index: 1;
}

.stage-kicker,
.stage-readout {
  color: #91b3d6;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.stage-hud strong {
  color: #e7f7ff;
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  letter-spacing: 0.08em;
}

#assistantStateDetail {
  color: #92e4d5;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.stage-readout {
  position: absolute;
  right: 22px;
  bottom: 18px;
  display: grid;
  gap: 6px;
  text-align: right;
  z-index: 1;
}

.title-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.eyebrow {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

h1 {
  margin: 0;
  font-size: clamp(2.2rem, 2.2vw, 3.2rem);
  line-height: 1.1;
  font-weight: 700;
}

.status-pill {
  border: 1px solid rgba(144, 182, 255, 0.26);
  border-radius: 18px;
  padding: 10px 18px;
  background: linear-gradient(135deg, rgba(120, 150, 255, 0.18), rgba(111, 220, 186, 0.12));
  color: var(--soft);
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(109, 154, 255, 0.15);
  animation: pulseStatus 2.4s ease-in-out infinite;
}

@keyframes pulseStatus {
  0%, 100% { box-shadow: 0 0 0 rgba(109, 154, 255, 0.2), inset 0 0 0 rgba(255,255,255,0); }
  50% { box-shadow: 0 0 20px rgba(109, 154, 255, 0.32), inset 0 0 12px rgba(109, 154, 255, 0.1); }
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(420px, 1.3fr);
  gap: 18px;
  padding: 18px;
}

.mobile-view-tabs {
  display: none;
}

.panel {
  border-radius: 18px;
  background: rgba(17, 28, 43, 0.92);
  border: 1px solid var(--border);
  padding: 18px 18px 16px;
}

.input-panel {
  display: flex;
  flex-direction: column;
}

.panel-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.mode-control {
  display: grid;
  grid-template-columns: auto repeat(4, minmax(0, 1fr));
  gap: 5px;
  align-items: center;
  margin: 2px 0 12px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: rgba(5, 14, 26, 0.68);
}

.mode-label {
  padding: 0 6px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.mode-button {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.mode-button.is-active {
  background: rgba(89, 205, 209, 0.2);
  box-shadow: inset 0 0 0 1px rgba(119, 232, 224, 0.4);
  color: #e8ffff;
}

.provider-strip {
  margin: -4px 0 10px;
  color: rgba(167, 208, 255, 0.58);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.panel h2 {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
}

.loading-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(120, 149, 255, 0.12);
  border: 1px solid rgba(140, 169, 255, 0.24);
  box-shadow: 0 0 12px rgba(125, 170, 255, 0.2);
}

.loading-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9ec2ff;
  animation: loadingPulse 1s infinite ease-in-out;
}

.loading-dot:nth-child(2) { animation-delay: 0.15s; }
.loading-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes loadingPulse {
  0%, 80%, 100% { transform: scale(0.5); opacity: 0.3; }
  40% { transform: scale(1); opacity: 1; }
}

.voice-monitor {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: rgba(69, 165, 255, 0.08);
  border: 1px solid rgba(116, 170, 255, 0.19);
  border-radius: 12px;
}

.voice-wave {
  display: flex;
  align-items: end;
  gap: 4px;
  height: 18px;
}

.voice-wave span {
  display: block;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, #d6ecff, #7ec7ff);
  animation: voicePulse 1.1s ease-in-out infinite alternate;
}

.voice-wave span:nth-child(1) { height: 8px; animation-delay: 0.1s; }
.voice-wave span:nth-child(2) { height: 12px; animation-delay: 0.2s; }
.voice-wave span:nth-child(3) { height: 16px; animation-delay: 0.3s; }
.voice-wave span:nth-child(4) { height: 13px; animation-delay: 0.4s; }
.voice-wave span:nth-child(5) { height: 9px; animation-delay: 0.5s; }
.voice-wave span:nth-child(6) { height: 15px; animation-delay: 0.6s; }

@keyframes voicePulse {
  0% { transform: scaleY(0.45); opacity: 0.45; }
  100% { transform: scaleY(1); opacity: 1; }
}

.voice-monitor-label {
  color: #dfeeff;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.wave-panel,
.digital-dashboard {
  margin-top: 12px;
  border-radius: 12px;
  border: 1px solid rgba(130, 165, 255, 0.18);
  background: rgba(12, 22, 34, 0.76);
  padding: 10px 12px 12px;
}

.panel-mini-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.digital-readout {
  color: #a7ebff;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.graph-scan {
  position: relative;
  display: flex;
  align-items: end;
  gap: 5px;
  height: 52px;
  padding: 0 2px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(23, 42, 59, 0.6), rgba(11, 18, 28, 0.8));
  border-radius: 10px;
}

.graph-scan::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(154, 206, 255, 0.22), transparent);
  transform: translateX(-100%);
  animation: scanLine 2.4s linear infinite;
}

.graph-scan span {
  display: block;
  flex: 1;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, rgba(137, 219, 255, 0.92), rgba(88, 107, 255, 0.5));
  box-shadow: 0 0 16px rgba(98, 168, 255, 0.28);
  animation: graphFloat 1.4s ease-in-out infinite alternate;
}

.graph-scan span:nth-child(1) { height: 24%; animation-delay: 0.08s; }
.graph-scan span:nth-child(2) { height: 34%; animation-delay: 0.15s; }
.graph-scan span:nth-child(3) { height: 52%; animation-delay: 0.23s; }
.graph-scan span:nth-child(4) { height: 41%; animation-delay: 0.31s; }
.graph-scan span:nth-child(5) { height: 70%; animation-delay: 0.39s; }
.graph-scan span:nth-child(6) { height: 58%; animation-delay: 0.47s; }
.graph-scan span:nth-child(7) { height: 84%; animation-delay: 0.55s; }
.graph-scan span:nth-child(8) { height: 66%; animation-delay: 0.64s; }

@keyframes graphFloat {
  0% { transform: scaleY(0.7); opacity: 0.55; }
  100% { transform: scaleY(1); opacity: 1; }
}

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

.hidden {
  display: none !important;
}

textarea {
  width: 100%;
  min-height: 200px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(9, 16, 28, 0.76);
  color: var(--text);
  padding: 18px 16px;
  resize: vertical;
  font-size: 1.1rem;
  line-height: 1.6;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.01);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

textarea.is-speaking {
  border-color: rgba(140, 191, 255, 0.7);
  box-shadow: 0 0 0 1px rgba(141, 191, 255, 0.35), 0 0 18px rgba(103, 162, 255, 0.2);
  animation: textPulse 1.3s ease-in-out infinite alternate;
}

@keyframes textPulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.004); }
}

.live-transcript-wrap {
  margin: 12px 0 14px;
  border: 1px solid rgba(113, 166, 255, 0.2);
  border-radius: 12px;
  background: rgba(14, 29, 43, 0.72);
  overflow: hidden;
}

.live-transcript-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #82d7ff;
  box-shadow: 0 0 12px rgba(130, 215, 255, 0.9);
  animation: livePulse 1s ease-in-out infinite;
}

@keyframes livePulse {
  0%, 100% { transform: scale(0.8); opacity: 0.6; }
  50% { transform: scale(1.2); opacity: 1; }
}

.live-transcript {
  min-height: 62px;
  padding: 12px 14px 13px;
  color: #ecf9ff;
  font-size: 0.98rem;
  line-height: 1.5;
  background: linear-gradient(180deg, rgba(16, 30, 43, 0.9), rgba(9, 18, 28, 0.72));
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.live-transcript.is-live {
  animation: liveTextGlow 0.8s ease-in-out infinite alternate;
}

@keyframes liveTextGlow {
  from { text-shadow: 0 0 0 rgba(140, 191, 255, 0); }
  to { text-shadow: 0 0 10px rgba(140, 191, 255, 0.45); }
}

textarea::placeholder {
  color: #7b8ca7;
}

.input-actions {
  display: flex;
  gap: 12px;
  margin-top: 18px;
}

.voice-btn, .stop-btn, .submit-btn, .mini-btn, .action-btn {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.25s ease;
}

.voice-btn:hover, .stop-btn:hover, .submit-btn:hover, .mini-btn:hover, .action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(99, 143, 255, 0.18);
}

.voice-btn {
  flex: 1;
  background: linear-gradient(135deg, #d9ebff, #9ab9ff);
  color: #0b1730;
  box-shadow: inset 0 0 16px rgba(255,255,255,0.2);
}

.stop-btn {
  flex: 0.7;
  background: rgba(255,255,255,0.04);
  color: var(--text);
}

.upload-box {
  position: relative;
  margin-top: 14px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.02);
  color: var(--muted);
  overflow: hidden;
}

.upload-box input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-label {
  display: inline-block;
  width: 100%;
  cursor: pointer;
  font-weight: 600;
}

.desktop-tools {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid rgba(131, 178, 255, 0.18);
  border-radius: 12px;
  background: rgba(7, 17, 28, 0.6);
}

.tool-heading,
.tool-grid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tool-heading {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.tool-status {
  color: #85c8ff;
}

.tool-grid {
  margin-top: 10px;
}

.tool-button {
  flex: 1;
  min-height: 40px;
  border: 1px solid rgba(133, 176, 240, 0.28);
  border-radius: 8px;
  background: rgba(119, 169, 255, 0.1);
  color: #dbeeff;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
}

.tool-button:hover {
  border-color: rgba(151, 207, 255, 0.66);
  background: rgba(119, 169, 255, 0.2);
}

.file-tool {
  display: grid;
  place-items: center;
}

.file-tool input {
  display: none;
}

.gesture-preview,
.model-canvas {
  width: 100%;
  margin-top: 10px;
  border: 1px solid rgba(125, 192, 255, 0.2);
  border-radius: 8px;
  background: #07121e;
}

.gesture-preview {
  position: relative;
  overflow: hidden;
  min-height: 160px;
}

.gesture-preview video,
.model-canvas {
  display: block;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.gesture-guide {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 5px 7px;
  border-radius: 5px;
  background: rgba(4, 12, 20, 0.74);
  color: #b9defc;
  font-size: 10px;
}

.submit-btn {
  width: 100%;
  margin-top: 18px;
  background: linear-gradient(135deg, #7de0bd, #7ec7e5);
  color: #091521;
  border: none;
  min-height: 52px;
  font-size: 1.05rem;
  box-shadow: 0 14px 30px rgba(91, 191, 214, 0.22);
}

.result-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.context-pill {
  border-radius: 999px;
  padding: 8px 14px;
  background: rgba(110, 225, 164, 0.12);
  border: 1px solid rgba(124, 227, 170, 0.3);
  color: #dffbf0;
  font-size: 12px;
  font-weight: 700;
}

.analysis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.monitor-grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 10px;
  margin: 12px 0 14px;
}

.mini-panel {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}

.mini-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 10px;
}

.signal-bars {
  display: flex;
  align-items: end;
  gap: 6px;
  height: 62px;
  padding-top: 8px;
}

.signal-bars span {
  display: block;
  flex: 1;
  border-radius: 999px 999px 3px 3px;
  background: linear-gradient(180deg, rgba(174, 217, 255, 0.8), rgba(64, 130, 255, 0.35));
  animation: signalWave 1.4s ease-in-out infinite alternate;
}

.signal-bars span:nth-child(1) { height: 35%; animation-delay: 0.05s; }
.signal-bars span:nth-child(2) { height: 55%; animation-delay: 0.12s; }
.signal-bars span:nth-child(3) { height: 70%; animation-delay: 0.2s; }
.signal-bars span:nth-child(4) { height: 48%; animation-delay: 0.3s; }
.signal-bars span:nth-child(5) { height: 82%; animation-delay: 0.42s; }
.signal-bars span:nth-child(6) { height: 62%; animation-delay: 0.52s; }
.signal-bars span:nth-child(7) { height: 92%; animation-delay: 0.62s; }

@keyframes signalWave {
  0% { transform: scaleY(0.7); opacity: 0.5; }
  100% { transform: scaleY(1); opacity: 1; }
}

.metric-row {
  display: grid;
  grid-template-columns: 52px 1fr;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.metric-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
}

.metric-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #86d6ff, #77e0d0);
}

.metric-bar.risk i {
  background: linear-gradient(90deg, #f7c38a, #f0897a);
}

.metric-bar.speed i {
  background: linear-gradient(90deg, #bbebff, #8aa8ff);
}

.analysis-box {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  min-height: 110px;
}

.label-title {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 10px;
}

.analysis-text {
  color: var(--text);
  font-size: 1rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

.response-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.response-card {
  background: linear-gradient(180deg, rgba(18, 27, 40, 0.9), rgba(12, 21, 31, 0.92));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px 14px;
  min-height: 200px;
  box-shadow: inset 0 0 20px rgba(134, 176, 255, 0.04);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.response-card:hover {
  transform: translateY(-2px);
  border-color: rgba(150, 188, 255, 0.45);
}

.processing-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 18px;
  background: rgba(3, 6, 12, 0.4);
  backdrop-filter: blur(8px);
  z-index: 50;
  pointer-events: none;
}

.processing-ring {
  position: relative;
  width: 108px;
  height: 108px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(150, 210, 255, 0.15), rgba(98, 166, 255, 0.8), rgba(113, 239, 219, 0.15), rgba(150, 210, 255, 0.15));
  animation: spinRing 1.8s linear infinite;
  box-shadow: 0 0 24px rgba(122, 175, 255, 0.26);
}

.processing-ring::before {
  content: "";
  position: absolute;
  inset: 12px;
  background: rgba(9, 17, 27, 0.92);
  border-radius: 50%;
  border: 1px solid rgba(130, 172, 255, 0.22);
}

.processing-core {
  position: absolute;
  inset: 30px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(126, 196, 255, 0.9), rgba(81, 128, 255, 0.35) 55%, rgba(9, 18, 32, 0.6) 100%);
  box-shadow: 0 0 18px rgba(117, 187, 255, 0.44);
}

.processing-label {
  letter-spacing: 0.28em;
  font-size: 11px;
  color: #dbeaff;
  text-transform: uppercase;
}

@keyframes spinRing {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.08); }
  100% { transform: rotate(360deg) scale(1); }
}

.response-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-name {
  font-weight: 700;
  font-size: 1rem;
}

.good-name {
  color: #c9f4e0;
}

.bad-name {
  color: #ffd4d0;
}

.mini-btn {
  padding: 8px 12px;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-size: 12px;
}

.response-body {
  color: var(--text);
  line-height: 1.7;
  white-space: pre-wrap;
  min-height: 165px;
}

.bottom-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.action-btn {
  flex: 1;
  background: rgba(255,255,255,0.03);
  color: var(--text);
  border: 1px solid var(--border);
}

.meta-box {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}

.meta-header {
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.meta-box ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.8;
}

.rdf-box pre {
  margin: 8px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--soft);
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .response-grid,
  .analysis-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  body {
    display: block;
    padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
    overflow: auto;
  }

  .app-shell {
    min-height: 100vh;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .topbar {
    padding: 20px 22px;
  }

  .status-pill {
    padding: 9px 13px;
    font-size: 13px;
  }

  .assistant-stage {
    height: 148px;
    margin: 12px 12px 0;
  }

  .stage-hud {
    top: 17px;
    left: 16px;
  }

  .stage-readout {
    right: 14px;
    bottom: 13px;
  }

  .layout {
    padding: 12px;
    gap: 12px;
  }

  .mobile-view-tabs {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin: 10px 12px 0;
    padding: 5px;
    border: 1px solid rgba(126, 173, 242, 0.22);
    border-radius: 10px;
    background: rgba(8, 18, 30, 0.94);
    backdrop-filter: blur(14px);
  }

  .mobile-view-tab {
    min-height: 40px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
  }

  .mobile-view-tab.is-active {
    background: linear-gradient(135deg, rgba(118, 173, 255, 0.35), rgba(93, 216, 190, 0.22));
    box-shadow: inset 0 0 0 1px rgba(160, 209, 255, 0.25);
    color: #f0f8ff;
  }

  body[data-mobile-view="command"] .result-panel,
  body[data-mobile-view="command"] .history-panel,
  body[data-mobile-view="analysis"] .input-panel,
  body[data-mobile-view="analysis"] .history-panel,
  body[data-mobile-view="history"] .input-panel,
  body[data-mobile-view="history"] .result-panel {
    display: none;
  }

  .panel {
    padding: 16px;
    border-radius: 15px;
  }

  .panel h2 {
    font-size: 1.75rem;
  }

  textarea {
    min-height: 122px;
    font-size: 1rem;
  }

  .live-transcript-wrap {
    margin: 10px 0;
  }

  .live-transcript {
    min-height: 48px;
    padding: 9px 11px;
  }

  .wave-panel {
    margin-top: 8px;
  }

  .graph-scan {
    height: 40px;
  }

  .input-actions {
    margin-top: 12px;
  }

  .desktop-tools {
    display: block;
  }

  .result-panel {
    gap: 12px;
  }

  .response-card {
    min-height: 0;
  }

  .response-body {
    min-height: 0;
  }

  .rdf-box {
    display: none;
  }
}

/* --- attachment + conversation history --- */

.attachment-status {
  margin-top: 8px;
  font-size: 12px;
  color: rgba(198, 221, 255, 0.72);
  word-break: break-all;
}

.link-btn {
  margin-top: 6px;
  background: none;
  border: none;
  padding: 0;
  color: #7cc4ff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

.link-btn:hover {
  color: #a7dcff;
}

.link-btn.hidden {
  display: none;
}

.history-panel {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(167, 208, 255, 0.6);
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
}

.history-empty {
  font-size: 13px;
  color: rgba(198, 221, 255, 0.5);
  padding: 12px;
}

.history-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: rgba(11, 22, 36, 0.72);
}

.history-time {
  font-size: 11px;
  letter-spacing: 0.06em;
  color: rgba(167, 208, 255, 0.55);
}

.history-question {
  margin-top: 6px;
  font-weight: 700;
  color: #e8f3ff;
  font-size: 14px;
  white-space: pre-wrap;
}

.history-answer {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.55;
  color: rgba(206, 226, 255, 0.78);
  white-space: pre-wrap;
}

.model-canvas {
  touch-action: none;
  cursor: grab;
}

.model-canvas:active {
  cursor: grabbing;
}
