/* 017–019 Voice: user speech, thinking, assistant speech.
   Pixel values from Figma UI/UX Library › Examples › voice / user-speech, voice / thinking, voice / assistant-speech. */
.vo-stage { box-sizing: border-box; display: flex; align-items: center; justify-content: center; height: 72px; }
.vo-stage > .vo-pill { flex: none; }
.vo-pill {
  --vo-fill: #fff;
  --vo-edge: rgb(29 29 31 / 9%);
  --vo-ink: #1d1d1f;
  --vo-shadow: 0 1px 2px rgb(18 24 38 / 5%), 0 6px 16px -4px rgb(18 24 38 / 10%), 0 14px 26px -10px rgb(18 24 38 / 8%);
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  box-sizing: border-box;
  height: 72px;
  padding: 0 28px 0 12px;
  border-radius: 36px;
  overflow: hidden;
  isolation: isolate;
  background: var(--vo-fill);
  box-shadow: inset 0 0 0 1px var(--vo-edge), var(--vo-shadow);
  color: var(--vo-ink);
  font-family: var(--font, "Halden"), "Halden", sans-serif;
  font-weight: 500;
  font-size: 24px;
  line-height: 32px;
}
:root[data-theme=dark] .vo-pill {
  --vo-fill: #232326;
  --vo-edge: rgb(255 255 255 / 10%);
  --vo-ink: #fff;
  --vo-shadow: 0 1px 2px rgb(0 0 0 / 20%);
}

/* ambient glow: an ellipse 41 px down, 18 px wider than the pill, blurred and clipped by it.
   Built from five overlapping slices of the same gradient so it can rise and fall like a voice level. */
.vo-glow {
  position: absolute;
  z-index: -1;
  left: -11px;
  right: -7px;
  top: 47px;
  height: 52px;
  filter: blur(20px);
  pointer-events: none;
  opacity: var(--vo-glow-o, .30);
  transition: opacity .6s ease;
}
.vo-pill[data-live] .vo-glow { will-change: transform; }
:root[data-theme=dark] .vo-glow { top: 41px; height: 56px; opacity: var(--vo-glow-o-dark, .45); }
.vo-glow i {
  position: absolute;
  bottom: 0;
  width: 32%;
  height: 100%;
  border-radius: 50%;
  background: var(--vo-glow);
  background-size: 312% 100%;
  transform-origin: 50% 100%;
}
.vo-glow i:nth-child(1) { left: -4%;  background-position: 0% 0; }
.vo-glow i:nth-child(2) { left: 18%;  background-position: 25% 0; }
.vo-glow i:nth-child(3) { left: 34%;  background-position: 50% 0; }
.vo-glow i:nth-child(4) { left: 50%;  background-position: 75% 0; }
.vo-glow i:nth-child(5) { left: 72%;  background-position: 100% 0; }
.vo-pill[data-kind=user] { --vo-glow-o: .26; --vo-glow-o-dark: .4; --vo-glow: linear-gradient(90deg, rgb(161 181 189 / 0), rgb(170 178 181 / .9) 25%, rgb(139 142 144) 60%, rgb(111 111 113 / .9) 85%, rgb(211 211 214 / 0)); }
.vo-pill[data-kind=reply] { --vo-glow: linear-gradient(90deg, rgb(100 210 255 / 0), rgb(100 210 255 / .9) 25%, rgb(10 132 255) 60%, rgb(94 92 230 / .9) 85%, rgb(94 92 230 / 0)); }
.vo-pill[data-kind=ask] { --vo-glow: linear-gradient(90deg, rgb(123 100 255 / 0), rgb(100 157 255 / .9) 25%, rgb(129 71 238) 60%, rgb(94 92 230 / .9) 85%, rgb(94 92 230 / 0)); }
.vo-pill[data-kind=thinking] .vo-glow { display: none; }
/* live: the speech engine (card.js) writes --g1…--g5 from the voice level and pitch of the words being spoken */
.vo-pill[data-live] .vo-glow i:nth-child(1) { transform: scaleY(var(--g1, 1)); }
.vo-pill[data-live] .vo-glow i:nth-child(2) { transform: scaleY(var(--g2, 1)); }
.vo-pill[data-live] .vo-glow i:nth-child(3) { transform: scaleY(var(--g3, 1)); }
.vo-pill[data-live] .vo-glow i:nth-child(4) { transform: scaleY(var(--g4, 1)); }
.vo-pill[data-live] .vo-glow i:nth-child(5) { transform: scaleY(var(--g5, 1)); }

/* orb halo: the orb acts as a coloured light source casting a clean luminous bloom onto the pill behind it (pure hue in light mode so no dark-rim grey mud appears) */
.vo-halo { position: absolute; z-index: -1; left: -14px; top: -14px; width: 100px; height: 100px; border-radius: 50%; opacity: .52; filter: blur(18px); pointer-events: none; background: radial-gradient(circle at 46% 52%, rgba(64, 206, 255, .72) 0%, rgba(10, 132, 255, .42) 38%, rgba(94, 92, 230, .16) 62%, transparent 78%); }
.vo-pill[data-live] .vo-halo { will-change: transform, opacity; }
.vo-pill[data-kind=ask] .vo-halo { background: radial-gradient(circle at 46% 52%, rgba(158, 124, 255, .72) 0%, rgba(129, 71, 238, .42) 38%, rgba(196, 132, 252, .16) 62%, transparent 78%); }
.vo-halo img { width: 100%; height: 100%; display: none; border-radius: 50%; }
:root[data-theme=dark] .vo-halo { opacity: .28; background: none; z-index: -2; }
:root[data-theme=dark] .vo-halo img { display: block; }
.vo-pill[data-live] .vo-halo { opacity: calc(.48 + var(--lv, 0) * .32); transform: scale(calc(.96 + var(--lv, 0) * .16)); }
:root[data-theme=dark] .vo-pill[data-live] .vo-halo { opacity: calc(.22 + var(--lv, 0) * .16); transform: none; }
.vo-pill[data-live] .vo-halo img { transform: rotate(calc(var(--rot, 0) * 1deg)); }

/* ---------- orb ---------- */
/* clip-path keeps a true circle even while the inner layers move (border-radius + transformed children leaves corners) */
.vo-orb { position: relative; flex: none; width: 48px; height: 48px; border-radius: 50%; overflow: hidden; isolation: isolate; }
.vo-orb > img { clip-path: circle(24px at 50% 50%); }
/* subtle tinted contact shadow beneath the blue/violet orbs to ground them physically on the light pill */
.vo-pill[data-kind=reply] .vo-orb { box-shadow: 0 3px 7px -2px rgba(10, 44, 118, .20), 0 1px 2px rgba(10, 30, 82, .10); }
.vo-pill[data-kind=ask] .vo-orb { box-shadow: 0 3px 7px -2px rgba(56, 24, 122, .20), 0 1px 2px rgba(42, 18, 92, .10); }
:root[data-theme=dark] .vo-pill[data-kind=reply] .vo-orb, :root[data-theme=dark] .vo-pill[data-kind=ask] .vo-orb { box-shadow: 0 2px 6px -1px rgba(0, 0, 0, .22); }
/* 3D optical glass shell: Fresnel specular crescent at top + internal chromatic bounce at bottom rim */
.vo-orb.is-fluid::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  z-index: 4;
  background:
    radial-gradient(62% 38% at 36% 18%, rgba(255, 255, 255, .52) 0%, rgba(255, 255, 255, .14) 48%, transparent 78%),
    radial-gradient(75% 42% at 58% 92%, rgba(120, 224, 255, .32) 0%, transparent 72%);
  box-shadow:
    inset 0 1px 1.5px rgba(255, 255, 255, .62),
    inset 0 -2px 5px rgba(86, 204, 255, .36),
    inset 0 0 0 0.75px rgba(255, 255, 255, .22);
}
.vo-pill[data-kind=ask] .vo-orb.is-fluid::after {
  background:
    radial-gradient(62% 38% at 36% 18%, rgba(255, 255, 255, .54) 0%, rgba(255, 255, 255, .14) 48%, transparent 78%),
    radial-gradient(75% 42% at 56% 92%, rgba(206, 168, 255, .36) 0%, transparent 72%);
  box-shadow:
    inset 0 1px 1.5px rgba(255, 255, 255, .64),
    inset 0 -2px 5px rgba(190, 148, 255, .40),
    inset 0 0 0 0.75px rgba(255, 255, 255, .24);
}
/* Front luminous core filament reacting directly to voice level (--lv): horizontal cyan wave for reply, calm breathing aurora for ask */
.vo-orb .vo-core {
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 3;
  mix-blend-mode: screen;
  filter: blur(3.5px);
  opacity: .34;
  background: radial-gradient(85% 42% at 50% 56%, rgba(152, 238, 255, .95) 0%, rgba(36, 156, 255, .45) 52%, transparent 78%);
  transition: opacity .12s ease-out;
}
.vo-pill[data-kind=ask] .vo-orb .vo-core {
  filter: blur(4.5px);
  opacity: .38;
  background: radial-gradient(70% 62% at 48% 52%, rgba(232, 214, 255, .92) 0%, rgba(154, 114, 255, .48) 54%, transparent 78%);
}
.vo-pill[data-kind=reply][data-live] .vo-orb .vo-core {
  opacity: calc(.28 + var(--lv, 0) * .68);
  transform: scale(calc(.88 + var(--lv, 0) * .32), calc(.78 + var(--lv, 0) * .42)) rotate(calc(var(--rot, 0) * .35deg));
}
.vo-pill[data-kind=ask][data-live] .vo-orb .vo-core {
  opacity: calc(.32 + var(--lv, 0) * .55);
  transform: scale(calc(.92 + var(--lv, 0) * .26)) rotate(calc(var(--rot, 0) * -.25deg));
}
.vo-orb img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* the moving layers sit inside the sphere, faded out before its rim, so the original edge stays crisp */
.vo-orb .vo-flow { position: absolute; inset: 0; -webkit-mask-image: radial-gradient(circle, #000 52%, transparent 70%); mask-image: radial-gradient(circle, #000 52%, transparent 70%); pointer-events: none; }
.vo-orb .vo-flow img { opacity: 0; mix-blend-mode: screen; }
.vo-pill[data-live] .vo-orb.is-fluid { transform: scale(calc(1 + var(--lv, 0) * .05)); }
.vo-pill[data-live] .vo-orb.is-fluid .vo-flow img { opacity: calc(.15 + var(--lv, 0) * .55); transform: rotate(calc(var(--rot, 0) * 1deg)) scale(calc(1.15 + var(--lv, 0) * .15)); }
.vo-pill[data-live] .vo-orb.is-fluid .vo-flow img + img { opacity: calc(.1 + var(--lv, 0) * .45); transform: rotate(calc(var(--rot, 0) * -1.4deg)) scale(calc(1.2 + var(--lv, 0) * .12)); }
/* light-mode Assistant speech: more expressive rhythmic pulse and luminous fluid wave tied to speech syllables */
:root:not([data-theme=dark]) .vo-pill[data-kind=reply][data-live] .vo-orb.is-fluid { transform: scale(calc(1 + var(--lv, 0) * .095)); }
:root:not([data-theme=dark]) .vo-pill[data-kind=reply][data-live] .vo-orb.is-fluid .vo-flow img { opacity: calc(.22 + var(--lv, 0) * .72); transform: rotate(calc(var(--rot, 0) * 1.15deg)) scale(calc(1.14 + var(--lv, 0) * .26)); filter: brightness(calc(1 + var(--lv, 0) * .22)); }
:root:not([data-theme=dark]) .vo-pill[data-kind=reply][data-live] .vo-orb.is-fluid .vo-flow img + img { opacity: calc(.16 + var(--lv, 0) * .62); transform: rotate(calc(var(--rot, 0) * -1.65deg)) scale(calc(1.22 + var(--lv, 0) * .22)); }
@keyframes vo-swirl { from { transform: rotate(0) scale(1.15); } 50% { transform: rotate(180deg) scale(1.3); } to { transform: rotate(360deg) scale(1.15); } }
@keyframes vo-pulse { from { opacity: .15; } to { opacity: .6; } }

/* thinking: the grain drifts irregularly inside the sphere instead of spinning — three layers at different depths */
.vo-orb.is-thinking .vo-flow { -webkit-mask-image: radial-gradient(circle, #000 58%, transparent 72%); mask-image: radial-gradient(circle, #000 58%, transparent 72%); }
.vo-orb.is-thinking .vo-flow img { mix-blend-mode: normal; opacity: .55; }
.vo-pill[data-live] .vo-orb.is-thinking .vo-flow img:nth-child(1) { animation: vo-grain-a 4.6s ease-in-out infinite alternate; }
.vo-pill[data-live] .vo-orb.is-thinking .vo-flow img:nth-child(2) { animation: vo-grain-b 3.4s ease-in-out infinite alternate; }
.vo-pill[data-live] .vo-orb.is-thinking .vo-flow img:nth-child(3) { animation: vo-grain-c 5.6s ease-in-out infinite alternate; }
.vo-pill[data-live] .vo-orb.is-thinking > img { animation: vo-grain-base 3s ease-in-out infinite alternate; }
@keyframes vo-grain-a { 0% { transform: translate(-7px, 4px) scale(1.5); opacity: .25; } 30% { transform: translate(6px, -6px) scale(1.75); opacity: .95; } 65% { transform: translate(-4px, -7px) scale(1.6); opacity: .4; } 100% { transform: translate(7px, 6px) scale(1.85); opacity: .9; } }
@keyframes vo-grain-b { 0% { transform: translate(6px, -5px) scale(2) rotate(40deg); opacity: .85; } 40% { transform: translate(-7px, 6px) scale(1.8) rotate(58deg); opacity: .2; } 100% { transform: translate(4px, 8px) scale(2.2) rotate(30deg); opacity: .8; } }
@keyframes vo-grain-c { 0% { transform: translate(0, 7px) scale(1.3) rotate(-25deg); opacity: .2; } 50% { transform: translate(-8px, -4px) scale(1.45) rotate(-12deg); opacity: .75; } 100% { transform: translate(7px, -6px) scale(1.35) rotate(-34deg); opacity: .3; } }
@keyframes vo-grain-base { from { opacity: .9; } to { opacity: .45; } }
/* Figma: thinking art at exposure −1 in light, +0.54 in dark */
.vo-orb.is-thinking img { filter: brightness(.5); }
:root[data-theme=dark] .vo-orb.is-thinking img { filter: brightness(1.45); }

/* ---------- words ---------- */
/* extra bleed padding (cancelled by negative margin) lets the incoming word blur fade softly without a hard vertical clip */
.vo-text { position: relative; display: block; flex: none; height: 32px; box-sizing: content-box; padding: 14px 18px 14px 10px; margin: -14px -18px -14px -10px; overflow: hidden; white-space: nowrap; }
.vo-line { position: relative; display: inline-block; white-space: nowrap; }
.vo-pill[data-live] .vo-line { will-change: transform, filter; }
.vo-pill[data-kind=user] .vo-line { opacity: .7; }
.vo-line b { font-weight: inherit; display: inline-block; animation: vo-word .9s cubic-bezier(.25, .6, .2, 1) both; }
/* each word arrives with a short motion blur instead of popping in */
/* words condense in place: no horizontal hop, just opacity and a blur that settles */
@keyframes vo-word { from { opacity: 0; filter: blur(10px); } 40% { opacity: .7; } to { opacity: 1; filter: blur(0); } }
/* thinking hand-over: the outgoing line is a ghost on top; incoming words rise 6 px out of a blur */
.vo-ghost { position: absolute; left: 10px; top: 14px; pointer-events: none; }
.vo-line b.vo-still { animation: none; }
/* the first word of a new line arrives with the fold, quick and soft */
.vo-line b.vo-first { animation: vo-first .4s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes vo-first { from { opacity: .45; filter: blur(5px); } to { opacity: 1; filter: blur(0); } }
/* written in: a wider, softer-edged light mask sweeps left to right across the incoming status */
.vo-line.vo-write { -webkit-mask-image: linear-gradient(90deg, #000 28%, transparent 72%); mask-image: linear-gradient(90deg, #000 28%, transparent 72%); -webkit-mask-size: 280% 100%; mask-size: 280% 100%; -webkit-mask-position: 0 0; mask-position: 0 0; }
/* scrolling: the 448 px window fades 10% at both edges, as in the Figma mask */
.vo-text.is-scroll { -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); }
.vo-pill[data-kind=thinking] .vo-line {
  color: transparent;
  background: linear-gradient(90deg, #2e9bea, rgb(31 143 232 / .9) 25%, #007aff 60%, rgb(88 86 214 / .9) 78%, #af52de) 0 0 / 100% 100%;
  -webkit-background-clip: text;
  background-clip: text;
}
:root[data-theme=dark] .vo-pill[data-kind=thinking] .vo-line { background-image: linear-gradient(90deg, #c2edff, rgb(100 210 255 / .9) 25%, #50a7ff 60%, rgb(107 105 255 / .9) 78%, #c35ce6); }
.vo-pill[data-kind=thinking][data-live] .vo-line {
  /* each status line has its own palette (card.js sets --vo-tg / --vo-tg-hi per phrase) */
  background-image:
    linear-gradient(100deg, transparent 38%, var(--vo-tg-hi, rgb(0 60 255 / .35)) 48%, transparent 58%),
    var(--vo-tg, linear-gradient(90deg, #2e9bea, #00b7ff 18%, #007aff 34%, #6e5bff 52%, #af52de 68%, #ff5fa2 84%, #2e9bea));
  background-size: 250% 100%, 300% 100%;
  animation: vo-shimmer 2.6s cubic-bezier(.45, 0, .25, 1) infinite;
}
@keyframes vo-shimmer { from { background-position: 130% 0, 0 0; } to { background-position: -130% 0, -150% 0; } }

/* while the sheet closes, freeze the loops and drop the costly backdrop so the morph stays smooth */
.sheet2[data-closing] .vo-pill, .sheet2[data-closing] .vo-pill * { animation-play-state: paused !important; }
.sheet2[data-closing] .vo-pill { -webkit-backdrop-filter: none; backdrop-filter: none; }

@media (prefers-reduced-motion: reduce) {
  .vo-pill *, .vo-pill { animation: none !important; transition: none !important; }
}
.vo-before { display: block; border: 0; pointer-events: none; background: transparent; color-scheme: light; height: 72px; }
