/* Whisper — Voice mode (v5-voice.js). RESTRAINT.md: neutral surface, one accent; the orb is the only colour.
   Layers: above modals/topbar (≤380), below toasts (950), palette (960), tooltips (1100) and the lock screen (1150). */

.vx-ov {
  --vx-size: min(280px, 70vw);
  position: fixed; inset: 0; z-index: 920;
  display: grid; grid-template-rows: auto 1fr auto;
  background: var(--bg); color: var(--text);
}
.vx-ov[hidden] { display: none; }
html.vx-on, html.vx-on body { overflow: hidden; }

.vx-head {
  display: flex; align-items: center; gap: 12px; min-width: 0;
  height: 56px; padding: 0 16px 0 24px; border-bottom: 1px solid var(--line); background: var(--surface);
}
.vx-title { margin: 0; font: var(--type-14); font-weight: 600; letter-spacing: 0; color: var(--text); }
.vx-where { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-12); color: var(--text-3); }
.vx-grow { flex: 1 1 auto; }
.vx-min { white-space: nowrap; }
.vx-min svg { flex: 0 0 auto; }

.vx-body {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  min-height: 0; overflow-y: auto; overflow-x: hidden; padding: clamp(24px, 14vh, 150px) 16px 32px;
}
.vx-stage { display: flex; flex-direction: column; align-items: center; text-align: center; max-width: 100%; }

.vx-orb {
  position: relative; display: block; width: var(--vx-size); height: var(--vx-size);
  padding: 0; margin: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.vx-orb[aria-disabled="true"] { cursor: default; }
.vx-orb:focus { outline: none; }
/* the visible sphere is 72% of the canvas: draw the focus ring just outside it */
.vx-orb:focus-visible { outline: 2px solid var(--accent); outline-offset: calc(var(--vx-size) * -0.115); }
.vx-canvas { display: block; width: 100%; height: 100%; }

.vx-state { margin-top: 4px; min-height: 28px; font: var(--type-20); letter-spacing: var(--track-heading); color: var(--text); }
.vx-state.vx-s-paused, .vx-state.vx-s-error { font: var(--type-16); font-weight: 600; letter-spacing: 0; max-width: 520px; }
.vx-hint { margin-top: 4px; min-height: 20px; max-width: 520px; font-size: var(--fs-13); line-height: var(--lh-13); color: var(--text-3); }
.vx-hint .btn { margin-left: 8px; vertical-align: middle; }
.vx-link { color: var(--accent); text-decoration: none; font-weight: 500; margin-left: 4px; }
.vx-link:hover { text-decoration: underline; }
.vx-link:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 4px; }

.vx-tx, .vx-ans {
  width: min(640px, 100%); margin-top: 24px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
}
.vx-tx[hidden], .vx-ans[hidden] { display: none; }
.vx-l { display: block; margin-bottom: 4px; font-size: var(--fs-12); color: var(--text-3); }
.vx-tx textarea {
  display: block; width: 100%; min-height: 44px; max-height: 160px; resize: none; box-sizing: border-box;
  padding: 6px 8px; margin: 0 -8px; width: calc(100% + 16px);
  border: 1px solid transparent; border-radius: 6px; background: transparent;
  font: var(--type-16); color: var(--text);
}
.vx-tx textarea:hover { border-color: var(--line); }
.vx-tx textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--signal-ring); }
.vx-tx-bar, .vx-ans-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.vx-tx-note, .vx-ans-meta { font-size: var(--fs-12); color: var(--text-3); font-variant-numeric: tabular-nums; }
.vx-ans-t { font: var(--type-14); color: var(--text); overflow-wrap: anywhere; white-space: pre-line; }

.vx-foot {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px 24px;
  padding: 12px 24px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface);
}
.vx-notes { flex: 1 1 320px; min-width: 0; font-size: var(--fs-12); line-height: var(--lh-12); color: var(--text-3); }
.vx-privacy { color: var(--text-2); }
.vx-opts { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 20px; }
.vx-opt { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-13); color: var(--text-2); }
.vx-opt .v2w-switch:focus-visible { outline: none; box-shadow: var(--ring); }

@media (max-width: 719px) {
  .vx-head { padding: 0 8px 0 16px; padding-top: env(safe-area-inset-top); height: calc(52px + env(safe-area-inset-top)); }
  .vx-where { display: none; }
  .vx-min span { display: none; }
  .vx-body { padding-top: 32px; }
  .vx-foot { padding-left: 16px; padding-right: 16px; gap: 10px; }
  .vx-opts { width: 100%; justify-content: space-between; }
}
@media (max-height: 560px) {
  .vx-ov { --vx-size: min(200px, 50vh); }
  .vx-body { padding-top: 12px; }
}

/* composer mic: compact live orb while the overlay is minimized; quiet when voice is unavailable */
#view-chat .w3-mic.vx-mic-off { color: var(--text-3); opacity: .72; }
#view-chat .w3-mic.vx-mic-off:hover { opacity: 1; }
#view-chat .w3-mic.vx-mic-live { padding: 0 6px; }
#view-chat .w3-mic.vx-mic-live .w3-bi, #view-chat .w3-mic.vx-mic-live .w3-mic-rec { display: none; }
#view-chat .w3-mic canvas.vx-mini { display: block; width: 24px; height: 24px; }

/* Admin › Voice — spoken answers */
.vx-adm { margin-top: 16px; }
.vx-adm-p { margin: 0 0 12px; color: var(--text-2); max-width: 720px; }
.vx-adm-t { margin: 0 0 8px; }
.vx-adm .v2p-voice-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; }

/* phone Home ask field: voice button */
.v2w-askm .v2w-askm-voice { flex: 0 0 auto; margin-right: -6px; color: var(--text-3); }
@media (max-width: 719px) { #v2w-home-voice { display: none; } }
