/* ==========================================================================
   INNO BRAIN — the voice stage
   A HUD that reacts to your actual voice: the ring is driven by microphone
   amplitude through the Web Audio analyser, never by a canned animation.
   ========================================================================== */

.voice-stage {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 28px 24px 34px;
  /* A solid ground, not a scrim: talking to it is a takeover, and readability
     must not depend on backdrop-filter, which several browsers quietly skip. */
  background-color: #0b0b0b;
  background-image:
    radial-gradient(ellipse 70% 55% at 50% 45%, rgba(244, 81, 30, .13), transparent 70%),
    radial-gradient(ellipse 130% 95% at 50% 50%, rgba(32, 32, 32, .65), transparent 78%);
  animation: stage-in 300ms var(--ease);
}
.voice-stage[hidden] { display: none; }

@keyframes stage-in {
  from { opacity: 0; transform: scale(1.02); }
  to   { opacity: 1; transform: none; }
}

.voice-stage.is-closing { animation: stage-out 220ms var(--ease) forwards; }
@keyframes stage-out { to { opacity: 0; transform: scale(1.015); } }

/* The same technical grid as the dashboard, pulled tighter. */
.voice-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .02) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 50%, transparent 20%, #000 90%);
}

/* --- head ----------------------------------------------------------------- */

.voice-head {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 2;
}

.voice-tag {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.voice-tag b {
  color: var(--accent);
  font-weight: 700;
  letter-spacing: .18em;
}

.voice-seal {
  padding: 2px 9px;
  border-radius: 99px;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .16em;
}

.voice-close {
  margin-left: auto;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(32, 32, 32, .7);
  color: var(--ink-2);
  transition: color var(--quick), border-color var(--quick), background var(--quick);
}
.voice-close:hover { color: var(--ink); border-color: var(--accent); background: var(--panel-2); }
.voice-close svg { width: 16px; height: 16px; }

/* --- the ring ------------------------------------------------------------- */

.voice-core {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  min-height: 0;
}

.voice-ring {
  position: relative;
  width: min(390px, 74vmin);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.voice-ring canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Decorative rings sit in CSS so the canvas only draws what reacts. */
.voice-ring .halo {
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  border: 1px solid rgba(244, 81, 30, .13);
}
.voice-ring .halo.two   { inset: 15%; border-color: rgba(244, 81, 30, .09); }
.voice-ring .halo.three { inset: 26%; border-style: dashed; border-color: rgba(255, 255, 255, .05); }

/* Corner brackets, the HUD tell. */
.voice-ring .bracket {
  position: absolute;
  width: 26px; height: 26px;
  border: 2px solid var(--accent);
  opacity: .5;
}
.voice-ring .bracket.tl { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.voice-ring .bracket.tr { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.voice-ring .bracket.bl { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.voice-ring .bracket.br { bottom: 0; right: 0; border-left: 0; border-top: 0; }

.voice-ring .readout {
  position: relative;
  z-index: 2;
  text-align: center;
  pointer-events: none;
}
.voice-state {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--accent);
  text-shadow: 0 0 18px var(--accent-glow);
}
.voice-state.muted { color: var(--ink-3); text-shadow: none; }
.voice-level {
  margin-top: 7px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .12em;
  color: var(--ink-4);
}

/* The mic button doubles as the core when idle. */
.voice-hit {
  position: absolute;
  inset: 32%;
  border-radius: 50%;
  border: 0;
  background: transparent;
  cursor: pointer;
}

/* --- transcript and foot -------------------------------------------------- */

.voice-foot {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.voice-heard {
  min-height: 52px;
  max-width: 640px;
  font-size: 17px;
  line-height: 1.45;
  color: var(--ink);
  transition: color var(--quick);
}
.voice-heard .interim { color: var(--ink-3); }
.voice-heard:empty::before {
  content: attr(data-placeholder);
  color: var(--ink-4);
  font-size: 15px;
}

.voice-said {
  max-width: 640px;
  padding: 13px 18px;
  border-radius: 14px;
  border: 1px solid var(--accent-line);
  background: rgba(244, 81, 30, .07);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink);
  white-space: pre-wrap;
  animation: rise 360ms var(--ease);
}
.voice-said[hidden] { display: none; }

.voice-did { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.voice-did .chip {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
  font-size: 10.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.voice-hint {
  font-size: 11.5px;
  letter-spacing: .06em;
  color: var(--ink-4);
}
.voice-hint .kbd { margin: 0 2px; }

.voice-warn {
  max-width: 560px;
  padding: 13px 16px;
  border-radius: 12px;
  border: 1px solid rgba(245, 181, 68, .3);
  background: rgba(245, 181, 68, .08);
  color: #f3d9a6;
  font-size: 13px;
  line-height: 1.55;
}
.voice-warn[hidden] { display: none; }
.voice-warn .row { justify-content: center; margin-top: 10px; }

@media (max-width: 620px) {
  .voice-stage { padding: 20px 16px 26px; }
  .voice-heard { font-size: 15px; }
  .voice-ring .bracket { width: 18px; height: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .voice-stage, .voice-said { animation: none; }
}

/* ==========================================================================
   Ambient standby — what the dashboard becomes when left alone
   ========================================================================== */

.ambient {
  position: fixed;
  inset: 0;
  z-index: 85;                     /* under the voice stage, over everything else */
  display: grid;
  place-items: center;
  cursor: pointer;
  background-color: #0a0a0a;
  background-image:
    radial-gradient(ellipse 60% 50% at 50% 50%, rgba(244, 81, 30, .10), transparent 72%);
  animation: amb-in 700ms var(--ease);
}
.ambient.is-leaving { animation: amb-out 240ms var(--ease) forwards; }

@keyframes amb-in  { from { opacity: 0; } to { opacity: 1; } }
@keyframes amb-out { to { opacity: 0; } }

.ambient::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .016) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .016) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 75% 65% at 50% 50%, transparent 25%, #000 92%);
}

/* A slow wander, so a screen left on all night is not branded with the clock. */
.amb-drift {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 34px;
  animation: amb-drift 240s linear infinite;
}

@keyframes amb-drift {
  0%   { transform: translate(-14px, -10px); }
  25%  { transform: translate(12px, -14px); }
  50%  { transform: translate(15px, 12px); }
  75%  { transform: translate(-10px, 14px); }
  100% { transform: translate(-14px, -10px); }
}

.amb-tag {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 10.5px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink-4);
}
.amb-tag b { color: var(--accent); font-weight: 700; letter-spacing: .2em; }
.amb-standby {
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--ink-3);
}

.amb-body {
  display: flex;
  align-items: center;
  gap: 52px;
  flex-wrap: wrap;
  justify-content: center;
}

.amb-ring {
  position: relative;
  width: min(260px, 46vmin);
  aspect-ratio: 1;
  flex: none;
}
.amb-ring canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.amb-ring .halo {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  border: 1px solid rgba(244, 81, 30, .10);
}
.amb-ring .halo.two { inset: 20%; border-style: dashed; border-color: rgba(255, 255, 255, .04); }

.amb-read { min-width: 0; }

.amb-time {
  font-size: clamp(56px, 9vw, 104px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.amb-date {
  margin-top: 8px;
  font-size: 12.5px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.amb-next {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 26px;
  padding-left: 14px;
  border-left: 2px solid var(--accent);
}
.amb-label {
  font-size: 10px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--accent);
}
.amb-next-title { font-size: 19px; font-weight: 600; color: var(--ink); }
.amb-next-when  { font-size: 12.5px; color: var(--ink-3); }

.amb-stats {
  margin-top: 20px;
  font-size: 13px;
  color: var(--ink-3);
}
.amb-stats b { color: var(--ink-2); font-weight: 650; }
.amb-stats i { margin: 0 9px; color: var(--ink-4); font-style: normal; }

.amb-foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* The live level bar: proof that the wake watcher is listening, and that it is
   the only thing happening. */
.amb-meter {
  width: 120px;
  height: 2px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}
.amb-meter span {
  display: block;
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 90ms linear;
}

.amb-listen {
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-4);
}

@media (max-width: 760px) {
  .amb-body { flex-direction: column; gap: 28px; }
  .amb-read { text-align: center; }
  .amb-next { border-left: 0; border-top: 2px solid var(--accent); padding: 12px 0 0; align-items: center; }
  .amb-drift { gap: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .amb-drift { animation: none; }
}
