/* .voice scoped styles (FM-249 Voice, polish 1): the site's Voice world, cyan on near-black navy with the violet #6d4aff
   only while recording. Colours come from app.css :root only. No external fonts or URLs. */
/* HUD surfaces use the shared palette; no assets or invented telemetry. */
.voice {
  background-color: var(--voice-bg);
  background-image: linear-gradient(var(--haze-voice) 1px, transparent 1px), linear-gradient(90deg, var(--haze-voice) 1px, transparent 1px);
  background-size: 24px 24px;
  padding: 1rem;
}
.voice-hud {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "ring" "recorder" "words" "captures" "coder" "time";
  gap: 1rem;
  align-items: start;
}
.voice-hud > * { min-width: 0; }
.voice .voice-panel {
  margin: 0;
  padding: 1rem;
  border: 1px solid var(--voice);
  border-radius: 0;
  background: var(--voice-bg);
  box-shadow: inset 0 0 24px var(--haze-voice);
  overflow-wrap: anywhere;
}
.voice .voice-panel > h2 {
  margin: -1rem -1rem 1rem;
  padding: .55rem 1rem;
  border-bottom: 1px solid var(--glow-voice);
  background: var(--haze-voice);
  color: var(--text);
  font: 600 .75rem/1.5 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.voice-recorder { grid-area: recorder; text-align: center; }
.voice-words { grid-area: words; }
.voice-captures { grid-area: captures; }
.voice-coder { grid-area: coder; }
.voice-time { grid-area: time; }
.voice-clock { margin: .5rem 0; font: 600 2.5rem/1.3 var(--mono); letter-spacing: .08em; }
.voice-date { color: var(--voice); font: .8rem/1.6 var(--mono); }
.voice-ring-area { grid-area: ring; text-align: center; padding-block: 1rem; }
.voice-ring {
  --ring: var(--voice);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1;
  margin: auto;
  border: 1px solid var(--ring);
  border-radius: 50%;
  box-shadow: 0 0 32px var(--haze-voice), inset 0 0 32px var(--haze-voice);
}
.voice-ring::before, .voice-ring::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.voice-ring::before {
  inset: 8px;
  background: repeating-conic-gradient(var(--ring) 0deg 1deg, transparent 1deg 6deg);
  mask-image: radial-gradient(circle, transparent 65%, var(--white) 66% 69%, transparent 70%);
}
.voice-ring::after { inset: 24px; border: 1px solid var(--ring); box-shadow: 0 0 0 6px var(--haze-voice); }
.voice-ring:has(.is-recording) { --ring: var(--voice-record); }
.voice-brand { position: absolute; bottom: 18%; width: 55%; color: var(--text); }
.voice-brand span { display: block; font: 700 1.5rem/1.3 var(--mono); letter-spacing: .2em; }
.voice-brand small {
  display: block;
  max-width: 21ch;
  margin: .3rem auto 0;
  color: var(--muted);
  font: .75rem/1.4 var(--mono);
  letter-spacing: normal;
  text-align: center;
}
.voice .voice-record {
  position: absolute;
  top: 50%;
  left: 20%;
  transform: translateY(-50%);
  z-index: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 60%;
  min-height: 52px;
  margin: 0;
  border: 1px solid var(--voice);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 1.125rem;
  font-weight: 600;
}
.voice-record::before { content: ""; width: .6em; height: .6em; margin-right: .5em; border-radius: 50%; background: var(--voice); }
.voice .voice-record.is-recording { background: var(--voice-record); border-color: var(--voice-record); color: var(--on-accent); box-shadow: 0 0 24px var(--glow-record); }
.voice-record.is-recording::before { background: var(--on-accent); }
.voice-hud-state { min-height: 1.6em; margin: 1rem 0 0; color: var(--voice); font-weight: 600; overflow-wrap: anywhere; }
.voice-state { min-height: 1.6em; margin: 0; font-weight: 600; }
.voice :is(button, a, input, select, textarea):focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
.voice [hidden] { display: none; }
.voice-privacy, .voice-unavailable { max-width: 36rem; margin: 8px auto 0; color: var(--muted); font-size: .9375rem; }
/* FM-443 slice 4: the default-microphone line and its help, muted like the privacy lines. */
.voice-mic, .voice-mic-help { max-width: 36rem; margin: 8px auto 0; color: var(--muted); font-size: .9375rem; }
.voice-mic-help summary { color: var(--accent); cursor: pointer; }
.voice-mic-help p { margin: 6px 0 0; text-align: left; }
.voice-label, .voice-status {
  font: 600 .75rem/1.4 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.voice .voice-label { margin-top: 0; color: var(--voice); }
.voice-panes { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.voice .voice-pane { margin: 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
.voice-pane textarea { min-height: 180px; }
.voice-hint, .voice-redo { grid-column: 1 / -1; }
.voice .voice-hint { margin: 0; color: var(--muted); font-size: .9375rem; }
.voice-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; }
.voice-actions button, .voice-recovery button, .voice-redo button { margin: 0 8px 8px 0; }
.voice-recovery, .voice-result { margin: 8px 0; }
.voice-result:not(:empty) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  padding: 1rem 1.25rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--voice);
  border-radius: .75rem;
  background: var(--panel-2);
}
.voice-result > span:first-child { flex: 1 1 100%; font-weight: 600; }
.voice-result.is-error { border-left-color: var(--amber); font-weight: 600; }
.voice-review { display: inline-flex; flex-wrap: wrap; gap: 8px; }
.voice-review button { margin: 4px 0; }
.voice-skip-line { flex: 1 1 100%; color: var(--muted); font-size: .875rem; }
.voice-captures ul { list-style: none; margin: 0; padding: 0; }
.voice-captures li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 4px 0;
  border-top: 1px solid var(--line);
}
.voice-status { padding: 2px 8px; border: 1px solid currentColor; border-radius: 999px; color: var(--muted); }
.voice-status.is-approved { color: var(--theatre); }
.voice-status.is-pending { color: var(--voice); }
@media (min-width: 720px) {
  .voice-panes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1200px) {
  .voice { width: min(1440px, calc(100vw - 4rem)); position: relative; left: 50%; transform: translateX(-50%); }
  .voice-hud {
    grid-template-columns: minmax(0, .75fr) minmax(0, 1fr) minmax(0, 1.25fr);
    grid-template-areas: "time ring words" "captures recorder words" ". recorder coder";
  }
  .voice-panes { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: no-preference) {
  .voice-ring::before { animation: voice-orbit 80s linear infinite; }
  @keyframes voice-orbit { to { transform: rotate(360deg); } }
}
.voice-coder label { display: block; }
.voice-word { display: flex; flex-wrap: wrap; gap: .5rem; margin-block: .5rem; }
.voice-word input { max-width: 15rem; }

/* FM-306 slice 2: PROPOSED confirmation, extending the STAGING HUD. */
.voice .voice-confirm { margin-top: 1rem; text-align: left; }
.voice-confirm-preview { white-space: pre-wrap; color: var(--muted); }
.voice-confirm-outcome { color: var(--text); }
.voice-confirm[data-state='failed'] { border-color: var(--amber); }
.voice-confirm .voice-actions { gap: .5rem; }

/* The persistent live line announces card text without a second visible sentence. */
.voice-state.has-proposal {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* STAGING FM-360: separate the brand and Record on the smallest rings. */
@media (max-width: 360px) {
  .voice .voice-record { top: 38%; }
  .voice-brand { bottom: 17%; width: 64%; }
}

/* FM-371: the simple Voice view gives the ring and words room to breathe. */
.voice.voice-simple { max-width: 960px; width: 100%; left: auto; transform: none; margin-inline: auto; }
.voice-simple .voice-hud { grid-template-columns: minmax(0, 1fr); grid-template-areas: "ring" "words" "recorder" "captures"; }
.voice-simple .voice-panes { grid-template-columns: minmax(0, 1fr); }
.voice-simple .voice-ring { max-width: 360px; }
@media (min-width: 900px) {
  .voice-simple .voice-hud { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "ring words" "recorder words" "captures captures"; }
}

/* FM-383 slice 1: PROPOSED simple-mode type and ring that grows with its text. */
.voice-simple .voice-ring {
  padding: 3rem 12%;
  gap: max(8px, .75rem);
}
.voice-simple .voice-record {
  position: static;
  transform: none;
  order: -1;
  width: auto;
  min-width: 60%;
  max-width: 100%;
  flex-shrink: 0;
  overflow-wrap: anywhere;
}
.voice-simple .voice-brand {
  position: static;
  width: 100%;
  overflow-wrap: anywhere;
}
.voice-simple .voice-brand small { font-size: .875rem; }
.voice-simple :is(.voice-panel > h2, .voice-label, .voice-status) {
  font-family: var(--sans);
  font-size: .875rem;
  letter-spacing: normal;
  text-transform: none;
}
.voice-simple .voice-label, .voice-simple .voice-panel > h2 { font-size: 1rem; }

/* FM-383 fix r1: keep whole words; reclaim panel padding only for a narrow, large-text ring. */
.voice-simple .voice-record,
.voice-simple .voice-brand small {
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
  white-space: normal;
}
.voice-simple .voice-ring-area { container-type: inline-size; }
@container (max-width: 8rem) {
  .voice-simple .voice-ring {
    width: calc(100% + 2rem);
    min-width: min-content;
    margin-inline: -1rem;
    padding-inline: 0;
  }
  .voice-simple .voice-record { min-width: max-content; }
}

/* FM-384: whole words in simple Voice cards when the text outgrows phone space. */
.voice-simple { container: voice-cards / inline-size; }
@container voice-cards (max-width: 8rem) {
  .voice-simple .voice-hud { --voice-card-inset: clamp(8px, 4cqi, 1rem); }
  .voice-simple .voice-panel { padding-inline: var(--voice-card-inset); }
  .voice-simple .voice-result:not(:empty) { padding-inline: var(--voice-card-inset); }
  .voice-simple .voice-panel > h2 {
    margin-inline: calc(-1 * var(--voice-card-inset));
    padding-inline: var(--voice-card-inset);
  }
  .voice-simple .voice-panes,
  .voice-simple .voice-actions,
  .voice-simple .voice-review { gap: clamp(8px, 4cqi, 1rem); }
  .voice-simple .voice-panel,
  .voice-simple .voice-panel :is(h2, p, li, label, button, a) {
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
  }
}

/* FM-443: local read-aloud controls, with native keyboard behavior and no motion. */
.voice-speech { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-block: 1rem; }
.voice-speech .voice-hint { flex-basis: 100%; }
.voice .voice-read-switch { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; }
.voice .voice-play, .voice .voice-stop-speech { min-height: 44px; min-width: 44px; }
