/* Voice v1 (#138, ADR 051): the mic in the Talk composer, the one-line voice bar above the field and
   the speaker beside each reply's time. Tokens only; 44 px targets; no motion under reduced motion.
   #177: while listening, the composer is the recording bar (✕, the sound, the time, Stop, Send) with the
   words above it; controls are drawn 32 px and tapped 44 px (a hit box around each). */
.mic-button{position:relative;width:44px;height:44px;min-width:44px;margin-bottom:2px;padding:0;border-radius:50%;border:1px solid var(--stroke);color:var(--text-2)}
.mic-button .mic-stop{display:none}
/* Listening: the mic becomes the stop square it is (tap to stop); blocked: crossed, like the line above. */
.mic-button[data-state=listening] .mic-on{display:none}
.mic-button[data-state=listening] .mic-stop{display:block;width:18px;height:18px;fill:currentColor}
.mic-button[data-state=blocked]{color:var(--warning);border-color:rgba(246,174,94,.6)}
.mic-button[data-state=blocked] .mic-on{display:none}
.mic-button[data-state=blocked] .mic-off{display:block}
.mic-button .icon{width:22px;height:22px}
.mic-button .mic-off{display:none}
.mic-button[data-state=off]{color:var(--text-3)}
.mic-button[data-state=off] .mic-on{display:none}
.mic-button[data-state=off] .mic-off{display:block}
.mic-button[data-state=listening]{color:var(--cyan);background:rgba(102,226,240,.14);border:1.5px solid var(--cyan);box-shadow:var(--glow-active)}
/* Writing (ADR 058): the recording is with Ari, which is turning it into words. */
.mic-button[data-state=writing]{color:var(--cyan);border:1.5px dashed var(--cyan)}
.voice-bar[data-state=writing] .voice-dot{background:var(--cyan);animation:voice-dot .8s ease-in-out infinite alternate}
/* One outline is the composer's: the line is a tint, coloured by its state. */
.voice-bar{display:flex;align-items:center;gap:4px;margin:0 0 8px;padding:0 2px 0 12px;min-height:44px;border:0;border-radius:var(--r-chip);background:var(--glass-soft);color:var(--text);font-size:14px}
.voice-bar[hidden]{display:none}
.voice-bar[data-state=error]{background:rgba(246,174,94,.13)}
/* A kept recording's ✕ (#676) leads the line, as in the recording bar: no inset before it, so "Computer asleep" fits at 360 px. */
.voice-bar[data-state=error]:has(>#voice-cancel:not([hidden])){padding-left:0}
.voice-state{display:flex;align-items:center;gap:8px;flex:1 1 auto;min-width:0}
#voice-state-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.voice-dot{width:10px;height:10px;flex-shrink:0;border-radius:50%;background:var(--text-3)}
.voice-bar[data-state=error] .voice-dot{background:var(--warning)}
@keyframes voice-dot{from{opacity:.55}to{opacity:1}}
.voice-hint{display:none;width:20px;height:20px;color:var(--text-2)}
.voice-bar[data-state=off] .voice-dot{display:none}
/* No speech recognition here, or the microphone refused: a crossed mic instead of the dot (#157). */
.voice-bar[data-reason=denied] .voice-dot,.voice-bar[data-reason=iphone] .voice-dot{display:none}
.voice-bar[data-state=off] .voice-hint-off,.voice-bar[data-reason=denied] .voice-hint-off,.voice-bar[data-reason=iphone] .voice-hint-off{display:block}
/* "Try again" shows its own arrow, so it is not mistaken for "Didn't hear". */
.voice-bar[data-state=error][data-reason=retry] .voice-dot{display:none}
.voice-bar[data-state=error][data-reason=retry] .voice-hint-retry{display:block;color:var(--warning)}
/* ⓘ: the shared sheet (#145) behind a 44 px button in the line. */
.voice-bar .info-btn{width:44px;height:44px;min-width:44px;margin:0;display:inline-grid;place-items:center;border-radius:50%}
.voice-bar .info-btn[hidden]{display:none}
/* Computer asleep (#157): the moon instead of the dot, and Send again as the one action. */
.voice-bar[data-reason=asleep] .voice-dot{display:none}
.voice-bar[data-reason=asleep] .voice-hint-asleep{display:block;color:var(--text-2)}
.voice-bar[data-state=error][data-reason=asleep]{background:var(--glass-raised)}
/* A note, not an error: "Max 5 min" after a recording stopped at the limit. */
.voice-bar[data-state=error][data-reason=limit]{background:var(--glass-raised)}
.voice-bar[data-reason=limit] .voice-dot{background:var(--text-3)}
.voice-bar[data-reason=cancelled] .voice-dot,.voice-bar[data-reason=busy] .voice-dot{background:var(--text-3)}
.voice-again{background:var(--violet);border-color:var(--violet);color:var(--on-accent);white-space:nowrap}
.voice-again[hidden]{display:none}
.voice-chip{min-width:44px;min-height:36px;margin:4px 0;padding:0 10px;border:1px solid var(--stroke);border-radius:var(--r-chip);font-size:13px;font-weight:650;letter-spacing:.04em;color:var(--text)}
.voice-toggle{border-radius:50%;color:var(--text-2)}
.voice-toggle[aria-pressed=true]{color:var(--on-accent);background:var(--violet)}
.voice-chip[hidden],.voice-toggle[hidden]{display:none}


/* #177 The recording bar, on the #178 tokens (app.css :root; compact.css): each control is a --hit box
   (44 px to tap) drawn smaller inside a transparent ring (border + background-clip): ✕, the language and
   Stop at --control-sm (28 px), Send at --control (36 px). While listening the composer's row (attach,
   field, mic, Send) steps aside; the bar is one --hit row, so the composer stays about 46 px tall. */
.composer.voice-recording .composer-row,.composer.voice-recording .composer-hint{display:none}
.voice-bar[data-state=starting],.voice-bar[data-state=listening],.voice-bar[data-state=stopping],.voice-bar[data-state=writing]{
  gap:2px;margin:0;padding:0;min-height:var(--hit);background-color:transparent}
.voice-ctl,#voice-lang{box-sizing:border-box;position:relative;display:inline-grid;place-items:center;flex-shrink:0;
  width:var(--hit);height:var(--hit);min-width:var(--hit);min-height:var(--hit);margin:0;padding:0;
  border:var(--ring,var(--hit-ring-sm)) solid transparent;background-clip:padding-box;border-radius:50%;background-color:var(--glass-soft);color:var(--text-2)}
#voice-lang[hidden],.voice-tools .voice-toggle[hidden]{display:none}
#voice-lang{width:auto;border-width:var(--hit-ring-sm) 2px;padding:0 8px;border-radius:var(--r-chip);font-size:12px;color:var(--text)}
.voice-ctl .icon{width:16px;height:16px}
.voice-ctl[hidden]{display:none}
/* Stop: a --control-sm disc tinted from --text (seen in light and dark; --glass-strong is #181's opaque
   surface, white in light) with a 10 px square in --text. */
.voice-stop{background-color:color-mix(in srgb,var(--text) 13%,transparent);color:var(--text)}
.voice-stop .icon{width:24px;height:24px;fill:currentColor;stroke:none}
.voice-send{--ring:var(--hit-ring);background-color:var(--violet);color:var(--on-accent)}
.voice-send .icon{width:18px;height:18px}
.voice-send[aria-pressed=true]{box-shadow:inset 0 0 0 2px var(--on-accent)}
.voice-cancel{background-color:transparent}
/* ✕ over words asks: "Discard?", a rose Discard and a quiet Keep in the sound's place; Stop and Send wait. */
/* Discard? sits in from the left like the ✕ row, and Keep keeps 8 px off the right edge (re-review nits). */
.voice-bar[data-confirm]{padding:0 8px 0 14px}
.voice-bar[data-confirm] #voice-state-text{font-weight:650}
.voice-bar[data-confirm] .voice-dot{background:var(--rose)}
.voice-discard,.voice-keep{box-sizing:border-box;flex-shrink:0;height:var(--hit);min-height:var(--hit);margin:0;padding:0 14px;
  border:solid transparent;border-width:var(--hit-ring-sm) 2px;background-clip:padding-box;border-radius:var(--r-chip);font-size:14px;font-weight:650}
.voice-discard{background-color:var(--rose);color:var(--on-accent)}
.voice-keep{background-color:transparent;color:var(--text);box-shadow:inset 0 0 0 1px var(--stroke)}
.voice-discard[hidden],.voice-keep[hidden]{display:none}
/* While recording: the sound and the time; "Listening" stays for screen readers only. */
.voice-bar[data-state=listening]:not([data-confirm]) .voice-dot,.voice-bar[data-state=stopping]:not([data-confirm]) .voice-dot{display:none}
.voice-bar[data-state=listening]:not([data-confirm]) #voice-state-text,.voice-bar[data-state=stopping]:not([data-confirm]) #voice-state-text{
  position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
.voice-bar[data-state=starting] .voice-dot{background-color:var(--cyan)}
.voice-wave{display:flex;align-items:center;justify-content:flex-end;gap:2px;flex:1 1 auto;min-width:0;height:24px;overflow:hidden}
.voice-wave[hidden]{display:none}
.voice-wave i{flex:0 0 3px;height:calc(3px + var(--h,0) * 21px);border-radius:2px;background-color:var(--cyan);transition:height .12s linear}
.voice-time{flex-shrink:0;font-size:13px;font-variant-numeric:tabular-nums;color:var(--text-2);white-space:nowrap}
.voice-time:empty{display:none}
/* The last 15 s of a recording: a quiet ring around the drawn Stop empties (--left: 1 to 0). */
.voice-stop[data-ending]::after{content:"";position:absolute;inset:-4px;border-radius:50%;pointer-events:none;
  background:conic-gradient(var(--warning) calc(var(--left,1)*1turn),transparent 0);
  -webkit-mask:radial-gradient(farthest-side,transparent calc(100% - 3px),#000 calc(100% - 2px));mask:radial-gradient(farthest-side,transparent calc(100% - 3px),#000 calc(100% - 2px))}
/* The words as they are said (only once there are words): what is agreed, then the tail, lighter;
   Auto-send and read-aloud beside them. */
.voice-live{display:flex;align-items:flex-end;gap:2px;padding:0 0 0 12px;border-bottom:1px solid var(--stroke-soft,var(--stroke))}
.voice-live[hidden]{display:none}
.voice-live-text{flex:1 1 auto;min-width:0;max-height:6em;margin:0;padding:8px 0;overflow-y:auto;font-size:16px;line-height:20px;color:var(--text);white-space:pre-wrap;overflow-wrap:anywhere}
.voice-tail{color:var(--text-3)}
.voice-tools{display:flex;align-items:center;flex-shrink:0}
.voice-tools .voice-toggle{box-sizing:border-box;width:var(--hit);height:var(--hit);min-width:var(--hit);min-height:var(--hit);margin:0;padding:0;
  border:var(--hit-ring-sm) solid transparent;background-clip:padding-box;border-radius:50%;background-color:transparent;display:inline-grid;place-items:center}
.voice-tools .icon{width:16px;height:16px}
.voice-tools .voice-toggle[aria-pressed=true]{background-color:var(--violet);color:var(--on-accent)}
/* ↑ Auto: a word chip, outlined when off and filled when on (aria-pressed). */
.voice-tools .voice-auto{box-sizing:border-box;display:inline-flex;align-items:center;gap:4px;height:var(--hit);min-height:var(--hit);min-width:0;margin:0;padding:0 10px 0 8px;
  border:solid transparent;border-width:var(--hit-ring-sm) 2px;background-clip:padding-box;border-radius:var(--r-chip);background-color:transparent;
  box-shadow:inset 0 0 0 1px var(--stroke);font-size:13px;font-weight:650;letter-spacing:.02em;color:var(--text)}
.voice-tools .voice-auto .icon{width:14px;height:14px}
.voice-tools .voice-auto[aria-pressed=true]{background-color:var(--violet);color:var(--on-accent);box-shadow:none}
/* The reply's speaker (in the row under the reply with its time, #215; app.css .reply-meta): a --hit
   box drawn --control-sm, taking no more than the row's own height. */
.speak-button{box-sizing:border-box;display:inline-grid;place-items:center;vertical-align:middle;width:var(--hit);height:var(--hit);min-width:var(--hit);min-height:var(--hit);
  margin:-12px -10px -12px -4px;padding:0;border:var(--hit-ring-sm) solid transparent;background-clip:padding-box;border-radius:50%;background-color:transparent;color:var(--text-3)}
.speak-button:hover{color:var(--text);filter:none}
.speak-button .icon{width:16px;height:16px}
.speak-button .speak-off{display:none;fill:currentColor;stroke:none}
.speak-button[aria-pressed=true]{color:var(--on-accent);background-color:var(--violet)}
.speak-button[aria-pressed=true] .speak-on{display:none}
.speak-button[aria-pressed=true] .speak-off{display:block}
/* The reply being read is marked, so reading is seen from afar. */
.message.reading>.markdown{box-shadow:0 0 0 2px var(--violet)}
/* While Ari writes down a recording, Send waits (the words are not in the box yet). */
.composer.voice-writing button[type=submit]{opacity:.45;pointer-events:none}
@media (prefers-reduced-motion:reduce){
  /* A steady ring instead of one that empties; bars that jump instead of glide. */
  .voice-stop[data-ending]::after{background:var(--warning)}
  .voice-wave i{transition:none}
  .voice-bar[data-state=writing] .voice-dot{animation:none}
}
/* A phone while Ari replies: attach, field, mic, Stop and Send share 343 px, so Stop is its square
   alone (its word stays its accessible name) and the field keeps room to type. */
@media (max-width:480px){
  .composer.replying .stop-button{width:48px;min-width:48px;padding:0;border-radius:50%}
  .composer.replying #stop-reply-text{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
}
