:root {
  --bg: #09090b;
  --surface: #141418;
  --surface2: #1c1c22;
  --border: rgba(255,255,255,0.09);
  --text: #f4f4f6;
  --muted: #8e8e9a;
  --accent: #30d158;
  --accent-dim: rgba(48,209,88,0.14);
  --red: #ff453a;
  --font: "Outfit", system-ui, sans-serif;
  --mono: "JetBrains Mono", monospace;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
}
.hidden { display: none !important; }

/* Ritual */
.ritual-screen {
  min-height: 100dvh;
  padding: 1.25rem 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: radial-gradient(ellipse at 50% 0%, rgba(48,209,88,0.06), transparent 55%);
}
.ritual-top {
  width: 100%;
  max-width: 520px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.back-link { color: var(--muted); text-decoration: none; font-size: 0.9rem; }
.back-link:hover { color: var(--text); }
.ritual-badge {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--accent);
  padding: 0.25rem 0.6rem;
  border: 1px solid rgba(48,209,88,0.3);
  border-radius: 99px;
}
.ritual-hero { text-align: center; margin: 2rem 0 1.5rem; }
.ritual-hero h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.75rem, 5vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.ritual-lead { margin: 0; color: var(--muted); font-size: 0.95rem; }

.ritual-controls {
  display: flex;
  gap: 3rem;
  flex-wrap: wrap;
  justify-content: center;
}
.ritual-col { display: flex; flex-direction: column; align-items: center; gap: 0.65rem; }
.ritual-label {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  color: var(--muted);
}
.ritual-sub { font-size: 0.68rem; color: var(--muted); font-weight: 700; letter-spacing: 0.04em; }
.ritual-status { margin-top: 1.5rem; color: var(--muted); font-size: 0.88rem; text-align: center; }

.ignition-box { position: relative; width: 92px; height: 156px; }
.ignition-slot {
  position: absolute;
  inset: 8px;
  background: #1a1a1e;
  border-radius: 10px;
  border: 1px solid #000;
  overflow: hidden;
}
.ignition-lever {
  position: absolute;
  left: 5px; right: 5px;
  height: 38px;
  border-radius: 7px;
  background: linear-gradient(180deg, #5a5a62, #1a1a1e);
  border: 1px solid rgba(255,255,255,0.12);
  bottom: 4px;
  cursor: grab;
  touch-action: none;
}
.ignition-lever.on { background: linear-gradient(180deg, var(--accent), #1a6b32); }
.ignition-cover {
  position: absolute;
  inset: 0;
  border-radius: 16px 16px 10px 10px;
  background: linear-gradient(180deg, #ff5a52, #8b0000);
  border: 1.5px solid rgba(255,255,255,0.2);
  box-shadow: 0 14px 28px rgba(0,0,0,0.45);
  transform-origin: top center;
  transition: transform 0.35s ease;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 10px;
}
.ignition-cover.open { transform: rotateX(-112deg); pointer-events: none; }
.cover-hint { font-size: 0.52rem; font-weight: 800; opacity: 0.85; }

.engine-btn {
  width: 116px; height: 116px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.18);
  background: radial-gradient(circle at 35% 28%, #4a4a52, #0e0e12);
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.1em;
  position: relative;
  cursor: pointer;
}
.engine-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.engine-btn:not(:disabled):active { transform: scale(0.94); }
.engine-btn.active {
  box-shadow: 0 0 48px rgba(48,209,88,0.45);
  border-color: var(--accent);
}
.engine-ring {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  border: 2px dashed rgba(255,255,255,0.12);
}

.btn-quick-start {
  margin-top: 1.25rem;
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.7rem 1.4rem;
  border-radius: 99px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.btn-quick-start:hover { color: var(--accent); border-color: rgba(48,209,88,0.4); }

.btn-pwa-install {
  display: block;
  margin: 0.75rem auto 0;
  background: rgba(48, 209, 88, 0.1);
  border: 1px solid rgba(48, 209, 88, 0.35);
  color: var(--accent);
  padding: 0.65rem 1.2rem;
  border-radius: 99px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
}
.btn-pwa-install:hover { background: rgba(48, 209, 88, 0.16); }
.btn-pwa-install[hidden] { display: none !important; }

/* Chat */
.chat-screen {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  position: relative;
  --pipeline-bar-h: auto;
}

/* Pipeline bar — full width top */
.pipeline-bar {
  flex-shrink: 0;
  width: 100%;
  border-bottom: 1px solid var(--border);
  background: rgba(9,9,11,0.97);
  backdrop-filter: blur(14px);
  z-index: 35;
  overflow: hidden;
}
.pipeline-bar-body {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 5mm 5mm 5mm 1rem;
  box-sizing: border-box;
  --pipeline-row-h: auto;
}
.pipeline-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.28rem;
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.1rem 0;
}
.pipeline-row {
  display: flex;
  align-items: baseline;
  gap: 0.85rem;
  min-width: 0;
}
.pipeline-status-row {
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.2rem;
  padding-top: 0.28rem;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.pipeline-io-row {
  flex-direction: column;
  align-items: stretch;
  gap: 0.15rem;
  overflow: visible;
}
.pipeline-io-label {
  display: flex;
  align-items: baseline;
  gap: 0.85rem;
  min-width: 0;
}
.tech-key {
  font-family: var(--mono);
  font-size: clamp(0.78rem, 1.9vw, 0.95rem);
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--muted);
  flex-shrink: 0;
  min-width: 5.75rem;
}
.tech-val-lg {
  font-family: var(--mono);
  font-size: clamp(0.78rem, 1.9vw, 0.95rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.tech-val-lg.phase-recording { color: #ff9f0a; }
.tech-val-lg.phase-speaking { color: #64d2ff; }
.tech-val-lg.phase-thinking { color: #bf5af2; }
.tech-val-lg.phase-error { color: var(--red); }
.tech-val-lg.is-error { color: var(--red); }
#tech-cam.cam-on { color: #64d2ff; }
.tech-vu {
  position: relative;
  height: 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.1);
  overflow: visible;
  margin-left: 5.75rem;
  max-width: 18rem;
}
.tech-vu-wrap {
  flex: 1;
  min-width: 0;
  margin-left: 5.75rem;
  max-width: 18rem;
  position: relative;
  z-index: 2;
}
.tech-vu-wrap > .tech-vu {
  margin-left: 0;
  max-width: none;
}
.tech-vu-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  pointer-events: none;
  opacity: 0.22;
  z-index: 0;
}
.tech-vu-zone.ambient {
  left: 0;
  background: linear-gradient(90deg, transparent, rgba(255,200,60,0.35));
}
.tech-vu-zone.voice {
  right: 0;
  background: linear-gradient(270deg, transparent, rgba(48,209,88,0.4));
}
.tech-vu-mark {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  transform: translateX(-1px);
  pointer-events: none;
  z-index: 2;
}
.tech-vu-mark.ambient { background: #ffc83d; box-shadow: 0 0 6px rgba(255,200,60,0.7); }
.tech-vu-mark.voice-min { background: #5ac8fa; box-shadow: 0 0 5px rgba(90,200,250,0.6); }
.tech-vu-mark.voice-max { background: #30d158; box-shadow: 0 0 6px rgba(48,209,88,0.7); }
.pipeline-simple .stt1-panel {
  display: none !important;
}
.pipeline-simple #selective-listening-block {
  display: none !important;
}
.tech-vu-sliders {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  margin-top: 0.45rem;
  width: 100%;
}
.vu-threshold-ctrl {
  display: grid;
  grid-template-columns: 1.35rem 1fr 2rem;
  align-items: center;
  gap: 0.3rem;
  width: 100%;
  font-size: 0.66rem;
  color: var(--muted);
  cursor: pointer;
  touch-action: manipulation;
}
.vu-th-key {
  font-weight: 700;
  flex-shrink: 0;
  text-align: right;
}
.vu-threshold-ctrl:nth-child(1) .vu-th-key { color: #ffc83d; }
.vu-threshold-ctrl:nth-child(2) .vu-th-key { color: #5ac8fa; }
.vu-threshold-ctrl:nth-child(3) .vu-th-key { color: #30d158; }
.vu-threshold-ctrl input[type="range"] {
  width: 100%;
  min-width: 0;
  height: 1rem;
  margin: 0;
  cursor: pointer;
}
.vu-threshold-ctrl:nth-child(1) input[type="range"] { accent-color: #ffc83d; }
.vu-threshold-ctrl:nth-child(2) input[type="range"] { accent-color: #5ac8fa; }
.vu-threshold-ctrl:nth-child(3) input[type="range"] { accent-color: #30d158; }
.vu-th-val {
  width: 2rem;
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.tech-vu-bar {
  position: relative;
  z-index: 1;
  height: 100%;
  width: 0%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), #5ef58a);
  transition: width 0.05s linear;
}
.tech-vu-bar.out {
  background: linear-gradient(90deg, #3b82f6, #64d2ff);
}
.pipeline-right {
  display: flex;
  align-items: center;
  gap: 5mm;
  flex: 0 1 auto;
  min-width: 0;
  max-width: min(52vw, 22rem);
  height: var(--pipeline-row-h, auto);
  overflow: hidden;
}
.pipeline-actions {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.35rem;
  flex: 0 0 auto;
  flex-shrink: 0;
}
.status-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  flex-shrink: 0;
  margin-top: 0;
}
.pipeline-hint {
  display: block;
  padding: 0 1rem 0.4rem;
  font-size: 0.72rem !important;
  color: var(--accent) !important;
}
.icon-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 11px;
  width: 44px; height: 44px;
  cursor: pointer;
  font-size: 1.05rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.icon-btn.danger { color: var(--red); }

/* Camera 16:9 — înălțime = coloana stângă; video absolut ca să nu umfle bara */
.pipeline-cam {
  position: relative;
  flex: 0 1 auto;
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  width: auto;
  max-width: calc(100% - 3.25rem - 5mm);
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid rgba(59,130,246,0.35);
  background: #000;
  contain: layout size style;
}
.pipeline-cam.cam-live {
  border-color: rgba(59,130,246,0.75);
  box-shadow: 0 0 0 1px rgba(59,130,246,0.25), 0 4px 18px rgba(0,0,0,0.45);
}
.camera-preview {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  background: #000;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.pipeline-cam.cam-live .camera-preview { opacity: 1; }
.camera-aperture-cap {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 45%, #1a1a20 0%, #050508 70%);
  transition: opacity 0.3s ease, transform 0.35s ease;
}
.pipeline-cam.cam-live .camera-aperture-cap {
  opacity: 0;
  pointer-events: none;
  transform: scale(1.08);
}
.aperture-lens {
  width: 72%;
  aspect-ratio: 1;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.6));
}
.aperture-svg {
  display: block;
  width: 100%;
  height: 100%;
}
.camera-badge {
  position: absolute;
  top: 5px;
  left: 6px;
  z-index: 3;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #fff;
  background: rgba(220,38,38,0.9);
  padding: 2px 5px;
  border-radius: 4px;
}
.camera-badge.hidden { display: none; }

.history-panel {
  position: fixed;
  top: 9.5rem;
  left: 0; bottom: 0;
  width: min(300px, 88vw);
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 30;
  overflow: hidden;
  box-shadow: 8px 0 32px rgba(0,0,0,0.35);
  display: flex;
  flex-direction: column;
}
.history-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}
.text-btn { background: none; border: none; color: var(--accent); cursor: pointer; font-weight: 600; }
.danger-text-btn {
  background: none;
  border: none;
  color: var(--red);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.82rem;
  width: 100%;
  padding: 0.85rem 1rem;
  text-align: left;
}
.danger-text-btn:hover { background: rgba(255,69,58,0.08); }
.danger-text-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.history-foot {
  margin-top: auto;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
#history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  overflow-y: auto;
}
#history-list li button {
  width: 100%;
  text-align: left;
  padding: 0.9rem 1rem;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  font-size: 0.84rem;
}
#history-list li button.active { background: var(--accent-dim); }
#history-list li small { display: block; color: var(--muted); font-size: 0.68rem; margin-top: 0.15rem; }

.chat-split {
  flex: 1;
  display: flex;
  flex-direction: row;
  min-height: 0;
  overflow: hidden;
}
.chat-split:not(.selective-on) .stt1-panel {
  display: none;
}
.chat-split.selective-on .chat-main {
  border-left: 1px solid var(--border);
}
.stt1-panel {
  flex: 0 0 42%;
  max-width: 520px;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: linear-gradient(180deg, rgba(8, 24, 16, 0.95), rgba(6, 18, 12, 0.98));
  border-right: 1px solid rgba(72, 199, 142, 0.15);
}
.stt1-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid rgba(72, 199, 142, 0.2);
  flex-shrink: 0;
}
.stt1-panel-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(96, 220, 150, 0.95);
  font-family: "JetBrains Mono", monospace;
}
.stt1-panel-timer {
  font-size: 0.72rem;
  color: rgba(160, 230, 180, 0.75);
  font-family: "JetBrains Mono", monospace;
}
.stt1-live {
  flex: 1 1 50%;
  min-height: 0;
  overflow-y: auto;
  padding: 0.75rem;
  -webkit-overflow-scrolling: touch;
}
.stt1-live-hint {
  margin: 0;
  font-size: 0.82rem;
  color: rgba(140, 200, 160, 0.55);
  font-style: italic;
}
.stt1-live-text {
  margin: 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8rem;
  line-height: 1.55;
  color: #c8f5dc;
  white-space: pre-wrap;
  word-break: break-word;
}
.stt1-live-text.interim {
  opacity: 0.88;
  border-left: 2px solid rgba(72, 199, 142, 0.5);
  padding-left: 0.55rem;
}
.stt1-live-status {
  margin: 0.4rem 0 0;
  font-size: 0.68rem;
  color: rgba(96, 200, 140, 0.65);
  font-family: "JetBrains Mono", monospace;
}
.stt1-archive-head {
  flex-shrink: 0;
  padding: 0.4rem 0.75rem;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(120, 190, 255, 0.7);
  border-top: 1px solid rgba(72, 152, 255, 0.2);
  background: rgba(8, 20, 36, 0.35);
}
.stt1-archive {
  flex: 0 1 38%;
  min-height: 80px;
  max-height: 42%;
  overflow-y: auto;
  padding: 0.5rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  -webkit-overflow-scrolling: touch;
}
.stt1-archive-block {
  padding: 0.5rem 0.6rem;
  border-radius: 10px;
  background: linear-gradient(135deg, #0f2238, #0c1a2e);
  border: 1px solid rgba(72, 152, 255, 0.28);
  font-size: 0.78rem;
  line-height: 1.45;
  color: #d0e8ff;
}
.stt1-archive-block time {
  display: block;
  font-size: 0.62rem;
  color: rgba(120, 190, 255, 0.75);
  margin-bottom: 0.25rem;
  font-family: "JetBrains Mono", monospace;
}
.stt1-archive-block p {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-style: italic;
}
.messages,
.chat-main {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  -webkit-overflow-scrolling: touch;
  min-width: 0;
  min-height: 0;
}

.welcome-card {
  margin: auto;
  max-width: 400px;
  text-align: center;
  padding: 2rem 1.5rem;
}
.welcome-card h3 { margin: 0 0 0.5rem; font-size: 1.25rem; }
.welcome-card p { margin: 0 0 1.25rem; color: var(--muted); font-size: 0.92rem; line-height: 1.5; }
.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}
.welcome-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; }
.chip {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.45rem 0.85rem;
  border-radius: 99px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.chip:hover { border-color: rgba(48,209,88,0.4); background: var(--accent-dim); }

.bubble {
  max-width: 85%;
  padding: 0.7rem 0.95rem;
  border-radius: 18px;
  line-height: 1.5;
  font-size: 0.94rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.bubble.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #1a4d2e, #143d24);
  border: 1px solid rgba(48,209,88,0.25);
  border-bottom-right-radius: 6px;
}
.bubble.user.ambient {
  opacity: 0.55;
  font-size: 0.86rem;
  font-style: italic;
  background: linear-gradient(135deg, #122a1c, #0f2218);
}
.bubble.ai {
  align-self: flex-start;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-bottom-left-radius: 6px;
}
.bubble.ai.context-reaction {
  background: linear-gradient(135deg, #0f2847, #0c2238);
  border: 1px solid rgba(72, 152, 255, 0.42);
  border-bottom-left-radius: 6px;
  color: #d4e8ff;
  box-shadow: 0 0 0 1px rgba(48, 120, 220, 0.08);
}
.bubble.ai.context-reaction::before {
  content: "◈ fundal · ";
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: rgba(120, 190, 255, 0.85);
  display: block;
  margin-bottom: 0.25rem;
}
.bubble.context {
  align-self: flex-start;
  max-width: 92%;
  padding: 0.55rem 0.85rem;
  background: linear-gradient(135deg, #143528, #0d281c);
  border: 1px dashed rgba(72, 199, 142, 0.45);
  border-bottom-left-radius: 6px;
  color: #b8f0cc;
  font-size: 0.86rem;
  line-height: 1.45;
  opacity: 0.92;
}
.bubble.context .context-capture-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(96, 220, 150, 0.9);
  margin-bottom: 0.35rem;
}
.bubble.context .context-capture-text {
  font-style: italic;
  white-space: pre-wrap;
  word-break: break-word;
  color: #d0f5dc;
}
.bubble.system {
  align-self: center;
  font-size: 0.78rem;
  color: var(--muted);
  background: transparent;
  border: none;
  padding: 0.25rem;
}
.bubble-image {
  display: block;
  max-width: min(220px, 70vw);
  max-height: 180px;
  object-fit: cover;
  border-radius: 10px;
  margin-top: 0.35rem;
  border: 1px solid var(--border);
}
.bubble.user .bubble-image { margin-left: 0; }

.composer {
  display: flex;
  gap: 0.5rem;
  padding: 0.7rem 0.85rem;
  padding-bottom: max(0.7rem, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--surface);
  align-items: flex-end;
}
.composer textarea {
  width: 100%;
  resize: none;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  padding: 0.7rem 0.9rem;
  font-family: inherit;
  font-size: 1rem;
  max-height: 120px;
  line-height: 1.4;
}
.composer textarea:focus { outline: none; border-color: rgba(48,209,88,0.45); }
.mic-btn, .send-btn, .cam-btn, .attach-btn {
  flex-shrink: 0;
  width: 46px; height: 46px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.attach-btn.has-image {
  border-color: rgba(48,209,88,0.55);
  color: var(--accent);
  box-shadow: 0 0 0 2px rgba(48,209,88,0.2);
}
.image-attach-preview {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0.85rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid rgba(48,209,88,0.35);
  border-radius: 12px;
  background: rgba(48,209,88,0.08);
}
.image-attach-preview.hidden { display: none; }
.image-attach-preview img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.image-attach-label {
  flex: 1;
  min-width: 0;
  font-size: 0.82rem;
  color: var(--muted);
}
.image-attach-clear {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}
.cam-btn.active {
  background: #2563eb;
  border-color: #3b82f6;
  color: #fff;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.35);
}
.vision-tag { opacity: 0.85; margin-right: 0.15rem; }
.chat-screen.has-pipeline-bar .mic-status { display: none; }

.mic-btn.listening {
  background: var(--red);
  border-color: var(--red);
  animation: pulse-mic 1.2s ease-in-out infinite;
}
@keyframes pulse-mic { 50% { box-shadow: 0 0 0 8px rgba(255,69,58,0.2); } }
.send-btn { background: var(--accent); color: #041208; border-color: var(--accent); }
.send-btn:disabled, .mic-btn:disabled, .cam-btn:disabled, .attach-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.vision-tag.upload { opacity: 0.9; }
.composer-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.2rem; }

.mic-status { margin: 0; font-size: 0.74rem; color: var(--accent); min-height: 1em; }
.mic-status.error { color: var(--red); }

/* Settings */
.settings-dialog {
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  width: min(440px, 94vw);
  max-height: 90dvh;
  padding: 0;
}
.settings-dialog::backdrop { background: rgba(0,0,0,0.7); }
.settings-dialog header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--border);
}
.settings-dialog h2 { margin: 0; font-size: 1.05rem; }

.settings-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.65rem 1rem 0;
  border-bottom: 1px solid var(--border);
}
.tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--muted);
  padding: 0.55rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.settings-body { padding: 1rem 1.15rem; overflow-y: auto; max-height: 52dvh; }
.tab-panel { display: none; flex-direction: column; gap: 0.7rem; }
.tab-panel.active { display: flex; }
.panel-hint { margin: 0; font-size: 0.78rem; color: var(--muted); line-height: 1.4; }
.settings-body label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.settings-field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.85rem; }
.settings-label-row,
.settings-check-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
}
.settings-label-text {
  flex: 1;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}
.settings-sublabel {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: -0.1rem;
}
.settings-check-row {
  cursor: pointer;
  user-select: none;
  color: var(--text) !important;
}
.settings-check-row input[type="checkbox"] {
  flex-shrink: 0;
  margin: 0;
}
.settings-info-btn {
  flex-shrink: 0;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
}
.settings-info-btn:hover {
  background: rgba(59,130,246,0.18);
  border-color: rgba(59,130,246,0.45);
}
.settings-info-inline {
  width: 1.25rem;
  height: 1.25rem;
  font-size: 0.68rem;
  vertical-align: middle;
  margin-left: 0.2rem;
}
.settings-info-dialog {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0;
  max-width: min(92vw, 26rem);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 16px 48px rgba(0,0,0,0.55);
}
.settings-info-dialog::backdrop { background: rgba(0,0,0,0.55); }
.settings-info-dialog header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}
.settings-info-dialog h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}
.settings-info-body {
  padding: 1rem 1.05rem 1.1rem;
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  max-height: min(60dvh, 22rem);
  overflow-y: auto;
}
.settings-body input, .settings-body textarea, .settings-body select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 0.55rem 0.7rem;
  font-family: inherit;
  font-size: 0.92rem;
}
.settings-body fieldset {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.65rem;
  margin: 0;
}
.engine-pick { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.85rem; }
.settings-body > .settings-label-row { margin-bottom: 0.25rem; }
.engine-opt {
  flex: 1;
  min-width: 80px;
  flex-direction: row !important;
  align-items: center;
  cursor: pointer;
}
.engine-opt input { display: none; }
.engine-opt span {
  display: block;
  width: 100%;
  text-align: center;
  padding: 0.5rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.85rem;
}
.engine-opt input:checked + span {
  background: var(--accent-dim);
  border-color: rgba(48,209,88,0.45);
  color: var(--accent);
}
.check { flex-direction: row !important; align-items: center; gap: 0.5rem; color: var(--text) !important; }
.range-label { font-size: 0.78rem; color: var(--accent); }
.settings-dialog footer { padding: 0.85rem 1.15rem 1rem; border-top: 1px solid var(--border); }
.btn-primary {
  width: 100%;
  padding: 0.75rem;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #041208;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
}

@media (max-width: 720px) {
  .pipeline-bar-body {
    flex-direction: column;
    padding: 5mm 5mm 5mm 0.65rem;
    align-items: stretch;
  }
  .pipeline-left { gap: 0.28rem; }
  .pipeline-right {
    align-self: stretch;
    width: 100%;
    max-width: none;
    height: auto !important;
    justify-content: flex-end;
    gap: 5mm;
  }
  .pipeline-cam {
    flex: 0 1 auto;
    height: auto;
    width: clamp(8rem, 42vw, 12rem);
    max-width: calc(100% - 3.25rem - 5mm);
    aspect-ratio: 16 / 9;
    max-height: none;
  }
  .icon-btn { width: 40px; height: 40px; }
  .tech-vu { max-width: 100%; margin-left: 5.75rem; }
  .history-panel { top: 15rem; }
  .chat-split.selective-on {
    flex-direction: column;
  }
  .chat-split.selective-on .stt1-panel {
    flex: 0 0 auto;
    max-width: none;
    width: 100%;
    max-height: 38vh;
    border-right: none;
    border-bottom: 1px solid rgba(72, 199, 142, 0.2);
  }
  .chat-split.selective-on .chat-main {
    border-left: none;
  }
  .stt1-archive { max-height: 28vh; }
}

@media (max-width: 480px) {
  .ritual-controls { gap: 2rem; }
  .bubble { max-width: 92%; }
  .tech-key { min-width: 4.5rem; }
  .tech-vu { margin-left: 4.5rem; }
}
