/* SMAU FILE
 * Path: css/smau-studio2-voice.css
 * Owns: Creator Studio 2.0 — the Voice & Conversation editor's visuals ONLY
 *       (js/creator/creator.voice.js). Generic Studio 2.0 primitives
 *       (.s2-screen, .s2-head, .s2-card, .s2-row, .s2-btn, .s2-field, …) are
 *       owned by css/smau-studio2.css; every rule here is scoped to a vo2-
 *       prefixed class so the two files never fight over the same name.
 * Invariants:
 *   - Class selectors only. Nothing here is anchored to an id, so no rule can
 *     quietly land on an element that no longer exists.
 *   - Phone width first (390px is the design floor); the wider layout is an
 *     enhancement in one min-width block at the bottom.
 *   - --s2-tap (44px) stays the floor for anything a thumb has to hit.
 * Depends: css/smau-studio2.css tokens on #studio-root — --s2-accent,
 *          --s2-accent-strong, --s2-accent-soft, --s2-ok, --s2-warn,
 *          --s2-danger, --s2-ink, --s2-muted, --s2-card, --s2-card-border,
 *          --s2-radius. Every use carries a fallback so this file never
 *          renders blank if a token is ever missing.
 */

.vo2-screen {
  --vo2-accent: var(--s2-accent, #8b7cf8);
  --vo2-accent-strong: var(--s2-accent-strong, #a297ff);
  --vo2-accent-soft: var(--s2-accent-soft, rgba(139, 124, 248, 0.16));
  --vo2-ok: var(--s2-ok, #3ecf8e);
  --vo2-warn: var(--s2-warn, #ffb454);
  --vo2-danger: var(--s2-danger, #ff5c5c);
  --vo2-ink: var(--s2-ink, rgba(238, 240, 248, 0.94));
  --vo2-muted: var(--s2-muted, rgba(238, 240, 248, 0.55));
  --vo2-card: var(--s2-card, rgba(255, 255, 255, 0.04));
  --vo2-card-border: var(--s2-card-border, rgba(255, 255, 255, 0.09));
  --vo2-radius: var(--s2-radius, 16px);
  --vo2-sheet-bg: rgba(28, 28, 42, 0.98);
  --vo2-tap: var(--s2-tap, 44px);
  position: relative;
}

@media (prefers-color-scheme: light) {
  .vo2-screen {
    --vo2-ink: var(--s2-ink, rgba(20, 20, 30, 0.92));
    --vo2-muted: var(--s2-muted, rgba(20, 20, 30, 0.55));
    --vo2-card: var(--s2-card, rgba(20, 20, 30, 0.035));
    --vo2-card-border: var(--s2-card-border, rgba(20, 20, 30, 0.12));
    --vo2-sheet-bg: rgba(252, 252, 255, 0.98);
  }
}

/* The explicit theme toggle wins over the OS media query in both directions:
   :root[data-theme] .vo2-screen out-specifies the bare class above. */
:root[data-theme="light"] .vo2-screen {
  --vo2-ink: var(--s2-ink, rgba(20, 20, 30, 0.92));
  --vo2-muted: var(--s2-muted, rgba(20, 20, 30, 0.55));
  --vo2-card: var(--s2-card, rgba(20, 20, 30, 0.035));
  --vo2-card-border: var(--s2-card-border, rgba(20, 20, 30, 0.12));
  --vo2-sheet-bg: rgba(252, 252, 255, 0.98);
}

:root[data-theme="dark"] .vo2-screen {
  --vo2-ink: var(--s2-ink, rgba(238, 240, 248, 0.94));
  --vo2-muted: var(--s2-muted, rgba(238, 240, 248, 0.55));
  --vo2-card: var(--s2-card, rgba(255, 255, 255, 0.04));
  --vo2-card-border: var(--s2-card-border, rgba(255, 255, 255, 0.09));
  --vo2-sheet-bg: rgba(28, 28, 42, 0.98);
}

.vo2-sub {
  margin: 2px 0 12px;
  font-weight: 600;
  color: var(--vo2-ink);
}

/* ── The current result, blueprint-05 style: what you have made so far ── */

.vo2-result {
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  border-color: var(--vo2-accent-soft);
}

.vo2-result-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--vo2-muted);
}

.vo2-result-body {
  font-size: 15px;
  font-weight: 700;
  color: var(--vo2-ink);
  word-break: break-word;
  padding-right: 90px;
}

.vo2-result .s2-chip {
  position: absolute;
  top: 14px;
  right: 14px;
}

.vo2-chip-on {
  color: var(--vo2-ok);
  border-color: rgba(62, 207, 142, 0.4);
  background: rgba(62, 207, 142, 0.12);
}

.vo2-chip-warn {
  color: var(--vo2-warn);
  border-color: rgba(255, 180, 84, 0.4);
  background: rgba(255, 180, 84, 0.12);
}

/* ── Cards ── */

.vo2-card {
  margin-bottom: 14px;
}

.vo2-help {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--vo2-muted);
}

/* An honest sentence about something that cannot happen. Deliberately loud
   enough to read as an answer, never as a disabled control. */
.vo2-notice {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 180, 84, 0.32);
  background: rgba(255, 180, 84, 0.09);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--vo2-ink);
}

.vo2-status {
  margin-top: 8px;
  min-height: 18px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--vo2-muted);
}

.vo2-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.vo2-btn-row .s2-btn {
  min-height: var(--vo2-tap);
}

/* ── Providers ── */

.vo2-providers {
  margin-top: 10px;
}

.vo2-provider {
  align-items: center;
  gap: 10px;
}

.vo2-provider[data-state="on"] {
  border-color: var(--vo2-accent);
  background: var(--vo2-accent-soft);
}

.vo2-provider .s2-btn {
  flex: 0 0 auto;
  min-height: var(--vo2-tap);
}

.vo2-providers + .s2-field {
  margin-top: 14px;
}

.vo2-voice-row,
.vo2-link-row {
  margin-top: 12px;
  width: 100%;
  min-height: var(--vo2-tap);
  text-align: left;
}

/* ── The collapsed profile sentence — the exact words the runtime sends ── */

.vo2-sentence,
.vo2-gloss {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed var(--vo2-card-border);
  background: rgba(128, 128, 160, 0.07);
}

.vo2-sentence-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--vo2-muted);
}

.vo2-sentence-body,
.vo2-gloss-body {
  font-size: 13px;
  line-height: 1.5;
  color: var(--vo2-ink);
  word-break: break-word;
}

.vo2-preview .s2-btn--primary {
  flex: 1 1 auto;
}

.vo2-stop {
  flex: 0 0 auto;
}

/* ── Lines ── */

.vo2-lines,
.vo2-memos {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

.vo2-line,
.vo2-memo {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--vo2-card-border);
  background: rgba(128, 128, 160, 0.05);
}

.vo2-line-head,
.vo2-memo-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.vo2-line-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
}

.vo2-line-actions .s2-btn {
  min-height: var(--vo2-tap);
  padding: 0 12px;
}

.vo2-kind[data-kind="greeting"] {
  color: var(--vo2-accent-strong);
  border-color: var(--vo2-accent);
  background: var(--vo2-accent-soft);
}

.vo2-kind[data-kind="promise"] {
  color: var(--vo2-warn);
  border-color: rgba(255, 180, 84, 0.4);
  background: rgba(255, 180, 84, 0.12);
}

.vo2-kind[data-kind="filled"] {
  color: var(--vo2-ok);
  border-color: rgba(62, 207, 142, 0.4);
  background: rgba(62, 207, 142, 0.12);
}

.vo2-line .s2-select {
  margin-bottom: 8px;
}

.vo2-line-text {
  min-height: 58px;
}

/* A promised memo reads as owed, not as broken. */
.vo2-memo[data-state="promised"] {
  border-style: dashed;
  border-color: rgba(255, 180, 84, 0.35);
}

/* ── Read-only mechanical truth (pacing) ── */

.vo2-truth {
  margin-top: 14px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--vo2-card-border);
  background: rgba(128, 128, 160, 0.05);
}

.vo2-truth-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--vo2-ink);
  margin-bottom: 6px;
}

.vo2-truth p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--vo2-muted);
}

.vo2-push {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--vo2-card-border);
}

/* ── The picker sheet (blueprint 06) ── */

.vo2-sheet-scrim {
  position: fixed;
  inset: 0;
  background: rgba(6, 6, 12, 0.55);
  z-index: 40;
}

.vo2-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 41;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 78vh;
  padding: 10px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  border-radius: 20px 20px 0 0;
  border: 1px solid var(--vo2-card-border);
  border-bottom: 0;
  background: var(--vo2-sheet-bg);
  box-shadow: 0 -18px 48px rgba(0, 0, 0, 0.45);
}

.vo2-sheet-grab {
  width: 46px;
  height: 4px;
  margin: 2px auto 4px;
  border-radius: 999px;
  background: var(--vo2-muted);
  opacity: 0.5;
}

.vo2-sheet-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.vo2-sheet-title {
  flex: 1 1 auto;
  font-size: 17px;
  font-weight: 800;
  color: var(--vo2-ink);
}

.vo2-sheet-list {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.vo2-sheet-row {
  width: 100%;
  min-height: var(--vo2-tap);
  text-align: left;
}

/* ── Wider than a phone: the form breathes, nothing reflows structurally ── */

@media (min-width: 720px) {
  .vo2-screen {
    max-width: 720px;
  }

  .vo2-sheet {
    left: 50%;
    right: auto;
    width: min(560px, 92vw);
    transform: translateX(-50%);
    border-radius: 20px;
    bottom: 5vh;
    border-bottom: 1px solid var(--vo2-card-border);
  }

  .vo2-line-head,
  .vo2-memo-head {
    flex-wrap: nowrap;
  }
}
