/* =============================================================================
   QwenPret — Design System
   Simultaneous interpretation for medical conferences.
   "Every word, in every language — live."

   Direction: Clinical Calm. Trustworthy, precise, calm, clinical-grade.
   Single stylesheet, no build step. Light default; dark via [data-theme]
   and prefers-color-scheme. Captions are the hero: near-black slab in BOTH
   themes for max AAA contrast regardless of hall lighting.

   Single optional webfont: Inter (loaded via <link> in HTML, display=swap),
   with a metrics-compatible system fallback so a font failure is invisible.
   CJK / Thai / Vietnamese / Arabic fall back to native platform faces; the
   caption block's lang/dir attributes drive correct shaping.

   SECTION INDEX
     1.  Tokens — non-color (type, space, radii, z, motion, breakpoints)
     2.  Tokens — color (light :root)
     3.  Tokens — color (dark: [data-theme="dark"] + prefers-color-scheme)
     4.  Reset & base elements
     5.  Typography helpers (eyebrow, headings, utility)
     6.  Accessibility (skip-link, focus, sr-only)
     7.  Layout (section, card, page widths, grids)
     8.  App shell (header, brand, footer, trust-note)
     9.  Buttons
     10. Theme toggle
     11. Language picker & chips
     12. Room code / join block / QR / share / copy
     13. Status: dots, pills, status-bar, speech & health dots
     14. Waveform / meter
     15. Mic control
     16. Listener ledger (speaker monitoring)
     17. Caption slab (THE HERO) + pairs + stepper + jump-to-live
     18. Audio enable
     19. Toasts & inline errors
     20. Screen transitions & motion
     21. RTL
     22. Reduced-motion overrides
   ============================================================================= */

/* =============================================================================
   1. TOKENS — non-color (theme-independent)
   ============================================================================= */
:root {
  /* Typography families */
  --font-ui:   'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'Roboto Mono', Menlo, monospace;

  /* Font sizes (rem @ 16px root) */
  --fs-caption-2xl: 2.5rem;    /* 40px — caption stepper "A+" max */
  --fs-caption-xl:  2rem;      /* 32px — caption stepper "A" default */
  --fs-caption-lg:  1.625rem;  /* 26px — caption stepper "A-" min */
  --fs-room-code:   2.75rem;   /* 44px — room code display, mono */
  --fs-display:     1.875rem;  /* 30px — landing/page H1 */
  --fs-h2:          1.25rem;   /* 20px */
  --fs-eyebrow:     0.8125rem; /* 13px — uppercase section labels */
  --fs-body:        1rem;      /* 16px — body + verbatim original in caption pair */
  --fs-label:       0.875rem;  /* 14px */
  --fs-micro:       0.75rem;   /* 12px — status, counts, footnote */

  /* Line heights */
  --lh-caption: 1.3;
  --lh-display: 1.2;
  --lh-h2:      1.3;
  --lh-body:    1.6;
  --lh-tight:   1;
  --lh-label:   1.45;

  /* Weights */
  --fw-regular: 400;
  --fw-medium:  500;
  --fw-semi:    600;
  --fw-bold:    700;

  /* Letter spacing */
  --ls-display: -0.02em;
  --ls-h2:      -0.01em;
  --ls-eyebrow:  0.08em;
  --ls-code:     0.1em;

  /* Spacing scale (4px grid) */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;

  /* Layout maxima */
  --measure-caption: 38em;
  --maxw-page:       1120px;
  --maxw-console:    1180px;

  /* Radii */
  --r-control: 8px;
  --r-panel:   12px;
  --r-slab:    14px;
  --r-pill:    999px;

  /* Z-index */
  --z-base:     0;
  --z-sticky:   10;
  --z-dropdown: 100;
  --z-toast:    200;

  /* Durations & easing */
  --ease:      cubic-bezier(.2,.6,.2,1);
  --dur-fast:  120ms;
  --dur-base:  180ms;
  --dur-view:  240ms;
  --dur-meter: 60ms;
  --breathe:   1800ms;

  /* Breakpoints (reference; used in @media literals below) */
  --bp-sm: 480px;
  --bp-md: 760px;
  --bp-lg: 900px;
  --bp-xl: 1120px;
}

/* =============================================================================
   2. TOKENS — color (LIGHT, default)
   ============================================================================= */
:root {
  --bg:            #F7F9FB;
  --surface:       #FFFFFF;
  --surface-alt:   #EEF2F6;
  --border:        #D6DEE6;
  --border-strong: #B7C3CF;
  --text:          #0E1A24;
  --muted:         #5A6B78;
  --accent:        #0B5FA5;
  --accent-weak:   #E2EDF7;
  --accent-alt:    #0E8A8A;
  --success:       #1A7F4B;
  --warn:          #B26A00;
  --danger:        #C0392B;
  --focus:         #0B5FA5;

  /* Accent-darkened states for filled controls */
  --accent-press:  #094E87;
  --on-accent:     #FFFFFF;

  /* Caption slab — highest-contrast surface, darker than chrome in BOTH themes */
  --caption-bg:       #0B0F16;
  --caption-text:     #FFFFFF;
  --caption-original: #C4CEDC;
  --caption-rule:     #2C82C9;

  /* Waveform */
  --wave-bar:      #0E8A8A;
  --wave-bar-hi:   #0B5FA5;
  --wave-baseline: #B7C3CF;

  /* Elevation */
  --shadow-float: 0 1px 2px rgba(14,26,36,.06), 0 6px 16px rgba(14,26,36,.08);
  --ring-live:    0 0 0 1px var(--accent);
}

/* =============================================================================
   3. TOKENS — color (DARK)
   Applied when explicit [data-theme="dark"] OR when no explicit theme is set
   and the OS prefers dark. Explicit [data-theme="light"] always wins.
   ============================================================================= */
[data-theme="dark"] {
  --bg:            #121315;
  --surface:       #191B1D;
  --surface-alt:   #212427;
  --border:        #303437;
  --border-strong: #43484C;
  --text:          #ECEEF0;
  --muted:         #9AA3A9;
  --accent:        #4FA3E3;
  --accent-weak:   #16314A;
  --accent-alt:    #3FB7B0;
  --success:       #3FC07E;
  --warn:          #E0A23A;
  --danger:        #E8736A;
  --focus:         #6BB7EF;

  --accent-press:  #6BB7EF;
  --on-accent:     #07090C;

  --caption-bg:       #07090C;
  --caption-text:     #F4F6F7;
  --caption-original: #AEB9C6;
  --caption-rule:     #4FA3E3;

  --wave-bar:      #3FB7B0;
  --wave-bar-hi:   #4FA3E3;
  --wave-baseline: #43484C;

  --shadow-float: 0 0 0 1px var(--border-strong);
  --ring-live:    0 0 0 1px var(--accent);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg:            #121315;
    --surface:       #191B1D;
    --surface-alt:   #212427;
    --border:        #303437;
    --border-strong: #43484C;
    --text:          #ECEEF0;
    --muted:         #9AA3A9;
    --accent:        #4FA3E3;
    --accent-weak:   #16314A;
    --accent-alt:    #3FB7B0;
    --success:       #3FC07E;
    --warn:          #E0A23A;
    --danger:        #E8736A;
    --focus:         #6BB7EF;

    --accent-press:  #6BB7EF;
    --on-accent:     #07090C;

    --caption-bg:       #07090C;
    --caption-text:     #F4F6F7;
    --caption-original: #AEB9C6;
    --caption-rule:     #4FA3E3;

    --wave-bar:      #3FB7B0;
    --wave-bar-hi:   #4FA3E3;
    --wave-baseline: #43484C;

    --shadow-float: 0 0 0 1px var(--border-strong);
    --ring-live:    0 0 0 1px var(--accent);
  }
}

/* =============================================================================
   4. RESET & BASE
   ============================================================================= */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: var(--fw-regular);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color var(--dur-base) var(--ease),
              color var(--dur-base) var(--ease);
}

img, canvas, svg { display: block; max-width: 100%; }

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

::selection {
  background: var(--accent-weak);
  color: var(--text);
}

[hidden] { display: none !important; }

/* =============================================================================
   5. TYPOGRAPHY HELPERS
   ============================================================================= */
h1, h2, h3, h4, p { margin: 0; }

.h1, h1 {
  font-size: clamp(1.5rem, 1.1rem + 1.8vw, var(--fs-display));
  line-height: var(--lh-display);
  font-weight: var(--fw-semi);
  letter-spacing: var(--ls-display);
}

.h2, h2 {
  font-size: var(--fs-h2);
  line-height: var(--lh-h2);
  font-weight: var(--fw-semi);
  letter-spacing: var(--ls-h2);
}

.eyebrow {
  display: inline-block;
  font-size: var(--fs-eyebrow);
  line-height: 1.4;
  font-weight: var(--fw-semi);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--muted);
}

.body  { font-size: var(--fs-body);  line-height: var(--lh-body); }
.label { font-size: var(--fs-label); line-height: var(--lh-label); font-weight: var(--fw-medium); }
.micro { font-size: var(--fs-micro); line-height: 1.4; font-weight: var(--fw-medium); }

.subhead,
.hint {
  color: var(--muted);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
}

.helper {
  color: var(--muted);
  font-size: var(--fs-micro);
  line-height: 1.4;
}

.text-muted { color: var(--muted); }
.mono { font-family: var(--font-mono); }

/* =============================================================================
   6. ACCESSIBILITY
   ============================================================================= */

/* Skip link — first focusable, visually hidden until focused. */
.skip-link {
  position: absolute;
  inset-inline-start: var(--s-3);
  inset-block-start: -200%;
  z-index: var(--z-toast);
  padding: var(--s-2) var(--s-4);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-control);
  font-size: var(--fs-label);
  font-weight: var(--fw-medium);
  box-shadow: var(--shadow-float);
}
.skip-link:focus {
  inset-block-start: var(--s-3);
  text-decoration: none;
}

/* Screen-reader-only utility */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Visible focus on every interactive element: 2px solid focus ring, 2px offset,
   instant (never animated). Never removed, only restyled. */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-control);
}
/* Slab-radius elements keep their corner radius on the ring. */
.caption-slab:focus-visible,
.caption-slab--mono:focus-visible { border-radius: var(--r-slab); }

/* =============================================================================
   7. LAYOUT
   ============================================================================= */
.page,
.app-main {
  width: 100%;
  max-width: var(--maxw-page);
  margin-inline: auto;
  padding-inline: var(--s-5);
}
.page--console,
.app-main--console { max-width: var(--maxw-console); }

.section {
  padding-block: var(--s-5);
}
@media (min-width: 760px) {
  .section { padding-block: var(--s-6); }
}

.stack    { display: flex; flex-direction: column; }
.stack > * + * { margin-block-start: var(--s-4); }
.stack-lg > * + * { margin-block-start: var(--s-6); }
.stack-sm > * + * { margin-block-start: var(--s-2); }

.row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
}
.row--between { justify-content: space-between; }
.row--end { justify-content: flex-end; }

/* Cards / sections */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-panel);
  padding: var(--s-5);
}
@media (min-width: 760px) {
  .card { padding: var(--s-6); }
}

.card--step {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.card__num {
  font-family: var(--font-mono);
  font-size: var(--fs-h2);
  font-weight: var(--fw-bold);
  color: var(--accent);
  letter-spacing: var(--ls-code);
}

/* Hero action row */
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
}

/* Landing flow grid */
.flow-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-4);
}
@media (max-width: 760px) {
  .flow-grid { grid-template-columns: 1fr; }
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { width: 100%; }
}

/* Console regions */
.console-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-5);
}
@media (max-width: 900px) {
  .console-grid { grid-template-columns: 1fr; }
}

/* =============================================================================
   8. APP SHELL
   ============================================================================= */
.app-header {
  position: sticky;
  inset-block-start: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-3) var(--s-5);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(8px);
  backdrop-filter: saturate(1.4) blur(8px);
  border-block-end: 1px solid var(--border);
}
.app-header__group {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

/* Minimal header (audience listen view) */
.app-header--minimal {
  padding-block: var(--s-2);
}

/* Brand lockup */
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--text);
  text-decoration: none;
  font-weight: var(--fw-semi);
}
.brand:hover { text-decoration: none; }
.brand__glyph {
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--accent);
}
.brand__glyph svg,
.brand__glyph path,
.brand__glyph rect { fill: currentColor; }
.brand__name {
  font-size: var(--fs-h2);
  font-weight: var(--fw-semi);
  letter-spacing: var(--ls-h2);
  color: var(--text);
}
.brand__suffix {
  color: var(--muted);
  font-weight: var(--fw-regular);
}

/* Footer */
.app-footer {
  margin-block-start: var(--s-7);
  border-block-start: 1px solid var(--border);
  padding: var(--s-5);
}
.app-footer__row {
  width: 100%;
  max-width: var(--maxw-page);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  flex-wrap: wrap;
}

/* Trust / privacy note */
.trust-note {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--muted);
  font-size: var(--fs-micro);
  line-height: 1.4;
}
.trust-note__glyph {
  flex: none;
  width: 14px;
  height: 14px;
  color: var(--muted);
}
.trust-note--pinned {
  position: sticky;
  inset-block-end: 0;
  background: var(--bg);
  padding: var(--s-3) var(--s-5);
  border-block-start: 1px solid var(--border);
  justify-content: center;
  text-align: center;
}

/* =============================================================================
   9. BUTTONS
   ============================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 44px;
  padding: 0 var(--s-4);
  border: 1px solid transparent;
  border-radius: var(--r-control);
  background: transparent;
  color: var(--text);
  font-size: var(--fs-label);
  font-weight: var(--fw-semi);
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  text-decoration: none;
  transition: background-color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn[disabled],
.btn:disabled {
  opacity: .5;
  pointer-events: none;
  cursor: not-allowed;
}
.btn.is-loading { pointer-events: none; opacity: .8; }

/* Variants */
.btn--primary {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}
.btn--primary:hover { background: var(--accent-press); border-color: var(--accent-press); }

.btn--secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn--secondary:hover { border-color: var(--border-strong); }

.btn--ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
}
.btn--ghost:hover { color: var(--text); background: var(--surface-alt); }

.btn--danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}
.btn--danger:hover { background: var(--danger); color: var(--on-accent); }

/* Sizes */
.btn--lg {
  min-height: 52px;
  padding: 0 var(--s-5);
  font-size: var(--fs-body);
}
.btn--sm {
  min-height: 36px;
  padding: 0 var(--s-3);
  font-size: var(--fs-micro);
}

/* =============================================================================
   10. THEME TOGGLE
   ============================================================================= */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-control);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              background-color var(--dur-fast) var(--ease);
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.theme-toggle__icon { width: 20px; height: 20px; }
.theme-toggle__icon path,
.theme-toggle__icon circle,
.theme-toggle__icon line { stroke: currentColor; fill: none; }

/* Show only the appropriate glyph for the resolved theme. */
.theme-toggle .theme-toggle__icon--moon { display: none; }
.theme-toggle .theme-toggle__icon--sun  { display: block; }
[data-theme="dark"] .theme-toggle .theme-toggle__icon--moon { display: block; }
[data-theme="dark"] .theme-toggle .theme-toggle__icon--sun  { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) .theme-toggle .theme-toggle__icon--moon { display: block; }
  :root:not([data-theme="light"]):not([data-theme="dark"]) .theme-toggle .theme-toggle__icon--sun  { display: none; }
}

/* =============================================================================
   11. LANGUAGE PICKER & CHIPS
   ============================================================================= */
.lang-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: var(--s-3);
}

.lang-picker__count {
  color: var(--muted);
  font-size: var(--fs-label);
  font-weight: var(--fw-medium);
}

/* Audience single-select: one large tap target per row on phones. */
.lang-picker--single {
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
}
@media (max-width: 480px) {
  .lang-picker--single { grid-template-columns: 1fr; }
}

/* Chip atom — works as <button>, <label>, or <a> */
.lang-chip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-1) var(--s-2);
  min-height: 48px;
  padding: var(--s-2) var(--s-3);
  border: 1px solid var(--border);
  border-radius: var(--r-control);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-align: start;
  transition: border-color var(--dur-fast) var(--ease),
              background-color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
}
.lang-chip:hover { border-color: var(--border-strong); background: var(--surface-alt); }

/* Hide the native checkbox/radio; chip carries the visual state. */
.lang-chip input[type="checkbox"],
.lang-chip input[type="radio"] {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}

.lang-chip__name {
  font-size: var(--fs-label);
  font-weight: var(--fw-semi);
  line-height: 1.2;
}
.lang-chip__code {
  margin-inline-start: auto;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: var(--fw-medium);
  letter-spacing: .04em;
  color: var(--muted);
  background: var(--surface-alt);
  padding: 2px var(--s-2);
  border-radius: var(--r-control);
}
.lang-chip__en {
  flex-basis: 100%;
  font-size: var(--fs-micro);
  color: var(--muted);
}
.lang-chip__check {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--accent);
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease);
}

/* Selected state — via .is-selected, aria-pressed, or :checked input */
.lang-chip.is-selected,
.lang-chip[aria-pressed="true"],
.lang-chip:has(input:checked) {
  background: var(--accent-weak);
  border-color: var(--accent);
}
.lang-chip.is-selected .lang-chip__check,
.lang-chip[aria-pressed="true"] .lang-chip__check,
.lang-chip:has(input:checked) .lang-chip__check { opacity: 1; }

.lang-chip.is-selected .lang-chip__code,
.lang-chip[aria-pressed="true"] .lang-chip__code,
.lang-chip:has(input:checked) .lang-chip__code {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

/* Audience single-select chips are taller (≥56px) per tap-target spec. */
.lang-picker--single .lang-chip { min-height: 56px; }

/* RTL chip mirrors internal alignment. */
.lang-chip[dir="rtl"] { text-align: end; }

/* =============================================================================
   12. ROOM CODE / JOIN BLOCK / QR / SHARE / COPY
   ============================================================================= */
.room-code {
  font-family: var(--font-mono);
  font-size: var(--fs-room-code);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-code);
  line-height: var(--lh-tight);
  color: var(--text);
  user-select: all;
  -webkit-user-select: all;
}

.room-code--input {
  display: block;
  width: 100%;
  text-align: center;
  text-transform: uppercase;
  padding: var(--s-3) var(--s-4);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-control);
  caret-color: var(--accent);
}
.room-code--input::placeholder {
  color: var(--muted);
  letter-spacing: var(--ls-code);
}
.room-code--input:hover { border-color: var(--accent); }

/* Muted mono room label (pick-language screen) */
.room-code-label {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: var(--ls-code);
  color: var(--muted);
  text-transform: uppercase;
}

/* Join block grouping code + QR + share URL */
.join-block {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--s-5);
  align-items: center;
}
@media (max-width: 480px) {
  .join-block { grid-template-columns: 1fr; }
}
.join-block__qr {
  flex: none;
  width: 132px;
  height: 132px;
  padding: var(--s-2);
  background: #FFFFFF;             /* QR must stay high-contrast in both themes */
  border: 1px solid var(--border);
  border-radius: var(--r-panel);
}
.join-block__qr img,
.join-block__qr canvas {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}
.join-block__main {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  min-width: 0;
}

.share-row {
  display: flex;
  gap: var(--s-2);
  align-items: stretch;
}
.share-url {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  padding: 0 var(--s-3);
  min-height: 44px;
  background: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-control);
  text-overflow: ellipsis;
}

.copy-btn { flex: none; }
.copy-btn.is-copied {
  color: var(--success);
  border-color: var(--success);
}

/* =============================================================================
   13. STATUS — dots, pills, status-bar, speech & health dots
   ============================================================================= */

/* Generic round indicator. NEVER the sole signal — always paired with text. */
.status-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--muted);
  transition: background-color var(--dur-base) var(--ease);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 32px;
  padding: var(--s-1) var(--s-3);
  border-radius: var(--r-pill);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  font-size: var(--fs-micro);
  font-weight: var(--fw-semi);
  color: var(--text);
  white-space: nowrap;
}
.status-pill__label { line-height: 1; }

/* State mapping — color crossfades, never blinks. */
.status-pill[data-state="connecting"]   .status-dot { background: var(--muted); }
.status-pill[data-state="live"]          .status-dot { background: var(--success); }
.status-pill[data-state="reconnecting"]  .status-dot { background: var(--warn); }
.status-pill[data-state="ended"]         .status-dot { background: var(--danger); }

.status-pill[data-state="live"] {
  border-color: color-mix(in srgb, var(--success) 50%, var(--border));
}
.status-pill[data-state="reconnecting"] {
  border-color: color-mix(in srgb, var(--warn) 50%, var(--border));
}
.status-pill[data-state="ended"] {
  border-color: color-mix(in srgb, var(--danger) 50%, var(--border));
}

/* Speech-activity dot — breathes only while audio flows (.is-speaking). */
.speech-dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: var(--r-pill);
  background: var(--muted);
  transition: background-color var(--dur-base) var(--ease);
}
.speech-dot.is-speaking {
  background: var(--accent-alt);
  animation: qp-breathe var(--breathe) var(--ease) infinite;
}
@keyframes qp-breathe {
  0%, 100% { opacity: 1; }
  50%      { opacity: .55; }
}

.status-speaking {
  font-size: var(--fs-micro);
  font-weight: var(--fw-medium);
  color: var(--muted);
}
.status-speaking.is-speaking { color: var(--text); }

/* Per-channel health dot (reused inside listener rows) */
.health-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--success);
}
.health-dot[data-state="live"]          { background: var(--success); }
.health-dot[data-state="idle"]          { background: var(--muted); }
.health-dot[data-state="reconnecting"]  { background: var(--warn); }
.health-dot[data-state="ended"]         { background: var(--danger); }

/* The calm status triad container */
.status-bar {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  flex-wrap: wrap;
  padding: var(--s-3) var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-panel);
}
.status-bar__context {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--fs-micro);
  color: var(--muted);
}
.status-bar__tag {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: .04em;
  color: var(--text);
}

/* Sticky variant used atop the audience listen view */
.status-bar--sticky {
  position: sticky;
  inset-block-start: 0;
  z-index: var(--z-sticky);
  border-radius: 0;
  border-inline: none;
  border-block-start: none;
}

/* =============================================================================
   14. WAVEFORM / METER
   ============================================================================= */
.waveform {
  position: relative;
  width: 100%;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--r-panel);
  overflow: hidden;
}
.waveform canvas { width: 100%; height: 100%; display: block; }

/* Speaker console centerpiece — tall */
.waveform--hero { height: 120px; }

/* Audience slim strip confirming audio is flowing */
.waveform--baseline {
  height: 28px;
  border-radius: var(--r-control);
}

/* When live, a single functional ring. */
.waveform.is-live { box-shadow: var(--ring-live); }

/* Silent baseline line (drawn behind both canvas and bar fallback). */
.waveform::after {
  content: "";
  position: absolute;
  inset-block-start: 50%;
  inset-inline: var(--s-2);
  height: 1px;
  background: var(--wave-baseline);
  opacity: .6;
  pointer-events: none;
}

/* Fallback bar meter (no-canvas path / #meterBar width animation).
   Width is data-driven by JS; rises in --dur-meter, calm fall via JS. */
.waveform__bar {
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 0;
  background: linear-gradient(90deg, var(--wave-bar), var(--wave-bar-hi));
  transition: width var(--dur-meter) linear;
}
/* If a canvas is present, hide the bar fallback and baseline rule. */
.waveform:has(canvas) .waveform__bar { display: none; }
.waveform:has(canvas)::after { display: none; }

/* Clip marker (peak ≈ max) on the hero waveform */
.meter-clip {
  position: absolute;
  inset-block-start: var(--s-2);
  inset-inline-end: var(--s-2);
  display: none;
  align-items: center;
  gap: 4px;
  padding: 2px var(--s-2);
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--wave-bar-hi) 22%, transparent);
  color: var(--wave-bar-hi);
  font-size: var(--fs-micro);
  font-weight: var(--fw-semi);
  letter-spacing: .04em;
}
.meter-clip.is-clipping { display: inline-flex; }

/* =============================================================================
   15. MIC CONTROL — and screen-audio control. Two source buttons live side by
        side on wide screens, stack on narrow. Either source can be toggled
        independently while the other stays live; the mix is broadcast.
   ============================================================================= */
.source-controls {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
@media (min-width: 560px) {
  .source-controls {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: stretch;
  }
}
.source-controls > .btn {
  flex: 1 1 0;
  min-width: 0;
}
.source-hint {
  margin-top: var(--s-1);
}
.source-hint em {
  font-style: normal;
  font-weight: var(--fw-semi);
}

.mic-btn, .screen-btn { width: 100%; }
@media (min-width: 480px) {
  .mic-btn, .screen-btn { width: auto; min-width: 220px; }
}
/* Icon inside source buttons — vertically center with label. */
.mic-btn, .screen-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
}
.btn__icon { flex: 0 0 auto; }

/* Live state: JS swaps to danger styling; aria-pressed reflects per-source
   state. Both buttons share the same live affordance. */
.mic-btn[aria-pressed="true"],
.screen-btn[aria-pressed="true"] {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}
.mic-btn[aria-pressed="true"]:hover,
.screen-btn[aria-pressed="true"]:hover {
  background: var(--danger);
  color: var(--on-accent);
}

/* =============================================================================
   16. LISTENER LEDGER (speaker monitoring)
   ============================================================================= */
.listener-ledger {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--r-panel);
  background: var(--surface);
  overflow: hidden;
}
.listener-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-block-end: 1px solid var(--border);
}
.listener-row:last-child { border-block-end: none; }

.listener-row__name {
  font-size: var(--fs-label);
  font-weight: var(--fw-medium);
  color: var(--text);
}
.listener-row__code {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: .04em;
  color: var(--muted);
}
.listener-row__count {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-variant-numeric: tabular-nums;
  text-align: end;
  color: var(--text);
}
.listener-row--idle .listener-row__name,
.listener-row--idle .listener-row__count { color: var(--muted); }

/* =============================================================================
   17. CAPTION SLAB — THE HERO
   The one plane that does NOT invert: near-black in BOTH themes for max AAA.
   ============================================================================= */
.caption-slab {
  position: relative;
  background: var(--caption-bg);
  color: var(--caption-text);
  border-radius: var(--r-slab);
  padding: var(--s-5);
  overflow-y: auto;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}
@media (min-width: 760px) {
  .caption-slab { padding: var(--s-6); }
}

/* The listen screen fills the viewport so the caption slab can be a bounded,
   internally-scrolling container. Without this the slab grows with content and
   the PAGE scrolls instead, which silently defeats auto-scroll. */
#listen {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

/* Audience hero: fills remaining height, newest line anchored at the bottom,
   scrolls internally (overflow-y:auto comes from .caption-slab). min-height:0
   lets the flex child shrink so the overflow actually engages. */
.caption-slab--hero {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

/* Inner column capped to a comfortable measure, centered. */
.caption-stream {
  width: 100%;
  max-width: var(--measure-caption);
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
}

/* One utterance block — grouped so SR reads as one unit. */
.caption-pair {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  opacity: 1;
  animation: qp-caption-in var(--dur-base) var(--ease) both;
}
@keyframes qp-caption-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.caption-pair__tag {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: .06em;
  color: var(--caption-original);
  opacity: .8;
}

/* Verbatim source — authoritative but visibly secondary; ABOVE the rule. */
.caption-original {
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: var(--fw-regular);
  color: var(--caption-original);
  overflow-wrap: anywhere;
}

/* The 1px accent rule joining original + translation. */
.caption-pair__rule {
  height: 1px;
  border: none;
  margin: 0;
  background: var(--caption-rule);
  opacity: .75;
}

/* The hero translation — reader-selected caption size; BELOW the rule. */
.caption-translation {
  color: var(--caption-text);
  font-weight: var(--fw-semi);
  line-height: var(--lh-caption);
  /* Default = "A" (xl / 32px). Overridden by [data-caption-size] below. */
  font-size: var(--fs-caption-xl);
  overflow-wrap: anywhere;
}

/* Caption size scale — JS sets html[data-caption-size="lg|xl|2xl"]. */
[data-caption-size="lg"]  .caption-translation { font-size: var(--fs-caption-lg);  font-weight: var(--fw-medium); }
[data-caption-size="xl"]  .caption-translation { font-size: var(--fs-caption-xl);  font-weight: var(--fw-semi); }
[data-caption-size="2xl"] .caption-translation { font-size: var(--fs-caption-2xl); font-weight: var(--fw-semi); }

/* Current vs prior emphasis (prior stays readable for review). */
.caption-pair.is-prior .caption-translation { color: var(--caption-original); }
.caption-pair.is-prior .caption-original    { opacity: .8; }

/* In-progress (streaming) caption: text grows in place until the turn finalizes.
   A soft caret on the live line signals "still being interpreted". */
.caption-pair.is-interim .caption-translation::after {
  content: '';
  display: inline-block;
  inline-size: .5ch;
  block-size: 1em;
  margin-inline-start: 3px;
  vertical-align: -.12em;
  border-radius: 1px;
  background: var(--accent);
  animation: qp-caret 1.05s steps(1, end) infinite;
}
@keyframes qp-caret { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .caption-pair.is-interim .caption-translation::after { animation: none; opacity: .5; }
}

/* Session title (speaker-set), shown to listeners on the pick + listen screens. */
.session-title {
  font-size: var(--fs-h2);
  font-weight: var(--fw-semi);
  letter-spacing: var(--ls-h2);
  color: var(--text);
  margin: 0;
}
.status-bar__title {
  font-weight: var(--fw-semi);
  color: var(--text);
  max-inline-size: 34ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* RTL target (Arabic): right-align translation; original keeps its own dir. */
.caption-translation[dir="rtl"] { text-align: right; }

/* Speaker self-monitor variant: single-language source log, one line per
   utterance, no translation pairing. Same near-black styling. */
.caption-slab--mono {
  position: relative;
  background: var(--caption-bg);
  color: var(--caption-text);
  border-radius: var(--r-slab);
  padding: var(--s-5);
  max-height: 240px;
  overflow-y: auto;
  scroll-behavior: smooth;
}
.caption-slab--mono .caption-line {
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--caption-text);
  padding-block: var(--s-1);
  border-block-end: 1px solid color-mix(in srgb, var(--caption-original) 18%, transparent);
}
.caption-slab--mono .caption-line:last-child { border-block-end: none; }

/* Jump-to-live affordance — appears when reader scrolls up from newest line. */
.jump-to-live {
  position: sticky;
  inset-block-end: var(--s-3);
  margin-inline: auto;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 40px;
  padding: 0 var(--s-4);
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  font-size: var(--fs-micro);
  font-weight: var(--fw-semi);
  cursor: pointer;
  box-shadow: var(--shadow-float);
  transition: opacity var(--dur-base) var(--ease),
              transform var(--dur-base) var(--ease);
}
.jump-to-live[hidden] { display: none; }

/* Font-size stepper (A− / A / A+) */
.caption-stepper {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: var(--r-control);
  overflow: hidden;
  background: var(--surface);
}
.caption-stepper button {
  min-width: 40px;
  min-height: 40px;
  padding: 0 var(--s-2);
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: var(--fw-semi);
  cursor: pointer;
  border-inline-end: 1px solid var(--border);
  transition: background-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease);
}
.caption-stepper button:last-child { border-inline-end: none; }
.caption-stepper button:hover { color: var(--text); background: var(--surface-alt); }
.caption-stepper button[aria-pressed="true"] {
  color: var(--accent);
  background: var(--accent-weak);
}
.caption-stepper button:nth-child(1) { font-size: var(--fs-micro); }
.caption-stepper button:nth-child(2) { font-size: var(--fs-label); }
.caption-stepper button:nth-child(3) { font-size: var(--fs-body); }

/* =============================================================================
   18. AUDIO ENABLE
   ============================================================================= */
.audio-enable {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 48px;
  padding: 0 var(--s-4);
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--on-accent);
  border: 1px solid var(--accent);
  font-size: var(--fs-label);
  font-weight: var(--fw-semi);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease);
}
.audio-enable:hover { background: var(--accent-press); border-color: var(--accent-press); }
.audio-enable__glyph { font-size: 1.1em; line-height: 1; }

/* Enabled state: recede to a quiet secondary pill. */
.audio-enable[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.audio-enable[aria-pressed="true"]:hover { border-color: var(--border-strong); }

/* Optional future volume control */
.volume-control {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
}

/* =============================================================================
   19. TOASTS & INLINE ERRORS
   ============================================================================= */
.toast {
  position: fixed;
  inset-block-end: var(--s-6);
  inset-inline: 0;
  margin-inline: auto;
  width: max-content;
  max-width: calc(100% - var(--s-6));
  z-index: var(--z-toast);
  padding: var(--s-3) var(--s-5);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-pill);
  font-size: var(--fs-label);
  font-weight: var(--fw-medium);
  box-shadow: var(--shadow-float);
  animation: qp-toast-in var(--dur-base) var(--ease) both;
}
.toast[hidden] { display: none; }
@keyframes qp-toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.inline-error {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  color: var(--danger);
  font-size: var(--fs-label);
  line-height: var(--lh-label);
}
.inline-error[hidden] { display: none; }
.inline-error__glyph {
  flex: none;
  width: 16px;
  height: 16px;
  margin-block-start: 2px;
  color: var(--danger);
}

/* Generic status / setup text line */
.status {
  font-size: var(--fs-micro);
  color: var(--muted);
}

/* =============================================================================
   20. SCREEN TRANSITIONS & MOTION
   ============================================================================= */
/* Screen roots fade in when revealed (setup→live, join→pick→listen). */
.screen {
  animation: qp-screen-in var(--dur-view) var(--ease) both;
}
@keyframes qp-screen-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* =============================================================================
   21. RTL
   Page chrome stays LTR; only language-specific content flips.
   ============================================================================= */
[dir="rtl"] .caption-translation { text-align: right; }
[dir="rtl"] .lang-chip { text-align: right; }

/* =============================================================================
   22. REDUCED MOTION
   Zero non-essential motion; preserve all information without movement.
   ============================================================================= */
@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-fast: 0ms;
    --dur-base: 0ms;
    --dur-view: 0ms;
    --breathe:  0ms;
  }

  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  /* Caption stream + self-monitor stop smooth-scrolling. */
  .caption-slab,
  .caption-slab--mono { scroll-behavior: auto; }

  /* Speech dot: static filled (speaking) vs hollow ring (silent), no breathe. */
  .speech-dot { animation: none; }
  .speech-dot.is-speaking { background: var(--accent-alt); }
  .speech-dot:not(.is-speaking) {
    background: transparent;
    box-shadow: inset 0 0 0 2px var(--muted);
  }

  /* Waveform fall transition removed — JS drives value-only stepped meter. */
  .waveform__bar { transition: none; }

  /* Caption arrival becomes an instant opacity swap. */
  .caption-pair { animation: none; }

  /* Glossary dropzone: no drag-hover lift. */
  .dropzone { transition: none; }
}

/* =============================================================================
   23. NATIVE SELECT  (source-language picker)
   A calm, design-system-native <select> reusing control tokens. Used for the
   presenter's single-select "Language you are speaking".
   ============================================================================= */
.field-select {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 0 calc(var(--s-7) - var(--s-2)) 0 var(--s-3);
  background-color: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-control);
  font-size: var(--fs-label);
  font-weight: var(--fw-medium);
  line-height: 1.2;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  /* Chevron drawn as an inline SVG so it tracks the text color in both themes. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%235A6B78' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--s-3) center;
  background-size: 16px 16px;
  transition: border-color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
}
[dir="rtl"] .field-select,
.field-select[dir="rtl"] {
  padding: 0 var(--s-3) 0 calc(var(--s-7) - var(--s-2));
  background-position: left var(--s-3) center;
}
.field-select:hover { border-color: var(--accent); }
[data-theme="dark"] .field-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%239AA3A9' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) .field-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%239AA3A9' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  }
}
.field-select option { color: var(--text); background: var(--surface); }

/* =============================================================================
   24. TOGGLE SWITCH  (on/off binary, e.g. "Use default glossary")
   Built on a real checkbox for native a11y; the track/knob are decorative.
   ============================================================================= */
.switch {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.switch__input {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}
.switch__track {
  position: relative;
  flex: none;
  width: 40px;
  height: 24px;
  border-radius: var(--r-pill);
  background: var(--surface-alt);
  border: 1px solid var(--border-strong);
  transition: background-color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease);
}
.switch__track::after {
  content: "";
  position: absolute;
  inset-block-start: 2px;
  inset-inline-start: 2px;
  width: 18px;
  height: 18px;
  border-radius: var(--r-pill);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(14,26,36,.18);
  transition: transform var(--dur-fast) var(--ease),
              background-color var(--dur-fast) var(--ease);
}
.switch__input:checked + .switch__track {
  background: var(--accent);
  border-color: var(--accent);
}
.switch__input:checked + .switch__track::after {
  transform: translateX(16px);
  background: var(--on-accent);
}
.switch__input:focus-visible + .switch__track {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.switch__input:disabled + .switch__track { opacity: .5; }
.switch:has(.switch__input:disabled) { cursor: not-allowed; opacity: .7; }
.switch__label { font-size: var(--fs-label); font-weight: var(--fw-medium); color: var(--text); }
[dir="rtl"] .switch__input:checked + .switch__track::after { transform: translateX(-16px); }

/* =============================================================================
   25. GLOSSARY PANEL  (presenter setup) — default summary, import, preview
   ============================================================================= */

/* A bordered sub-panel grouping a related set of controls inside a card. */
.subpanel {
  border: 1px solid var(--border);
  border-radius: var(--r-panel);
  background: var(--surface-alt);
  padding: var(--s-4);
}
.subpanel > * + * { margin-block-start: var(--s-3); }

/* Default-glossary summary line: count + on/off toggle. */
.glossary-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  flex-wrap: wrap;
}
.glossary-summary__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.glossary-summary__count {
  font-size: var(--fs-label);
  font-weight: var(--fw-semi);
  color: var(--text);
}
.glossary-summary__count .num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* File drop / upload zone. */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-5) var(--s-4);
  text-align: center;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-panel);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease),
              background-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease);
}
.dropzone:hover,
.dropzone:focus-within { border-color: var(--accent); color: var(--text); }
.dropzone.is-dragover {
  border-color: var(--accent);
  border-style: solid;
  background: var(--accent-weak);
  color: var(--text);
}
.dropzone__glyph {
  width: 28px;
  height: 28px;
  color: var(--muted);
}
.dropzone__glyph path { stroke: currentColor; fill: none; }
.dropzone:hover .dropzone__glyph,
.dropzone.is-dragover .dropzone__glyph { color: var(--accent); }
.dropzone__primary { font-size: var(--fs-label); font-weight: var(--fw-semi); color: var(--text); }
.dropzone__hint { font-size: var(--fs-micro); color: var(--muted); }
.dropzone__file {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}
.dropzone.is-busy { pointer-events: none; opacity: .7; }

/* Parse-result readout (count, languages, method). */
.parse-result {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--r-panel);
  background: var(--surface);
}
.parse-result[hidden] { display: none; }
.parse-result__head {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
}
.parse-result__count {
  font-size: var(--fs-label);
  font-weight: var(--fw-semi);
  color: var(--text);
}
.parse-result__count .num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

/* Small chips listing detected languages / a method tag. */
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  align-items: center;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  padding: 2px var(--s-2);
  border-radius: var(--r-pill);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: var(--fw-medium);
  letter-spacing: .04em;
  color: var(--muted);
}
.tag--method {
  font-family: var(--font-ui);
  letter-spacing: 0;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}
.tag--llm {
  color: var(--accent-alt);
  background: color-mix(in srgb, var(--accent-alt) 12%, transparent);
  border-color: color-mix(in srgb, var(--accent-alt) 40%, var(--border));
}

/* Preview terms — a compact 2-column source→target sample list. */
.term-preview {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
}
.term-preview__row {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  font-size: var(--fs-micro);
  line-height: 1.5;
  padding-block: 2px;
  border-block-end: 1px solid var(--border);
}
.term-preview__row:last-child { border-block-end: none; }
.term-preview__src { color: var(--text); font-weight: var(--fw-medium); }
.term-preview__arrow { color: var(--muted); flex: none; }
.term-preview__tgt { color: var(--muted); }

/* Warnings list inside a parse result — informational, not an error. */
.notice-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  margin: 0;
  padding: 0;
  list-style: none;
}
.notice-list__item {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  font-size: var(--fs-micro);
  line-height: 1.45;
  color: var(--warn);
}
.notice-list__glyph {
  flex: none;
  width: 14px;
  height: 14px;
  margin-block-start: 2px;
  color: var(--warn);
}
.notice-list__glyph path,
.notice-list__glyph line,
.notice-list__glyph circle { stroke: currentColor; fill: none; }

/* AI-extraction option row (disabled when no extractor is configured). */
.ai-option {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
}
.ai-option__body { display: flex; flex-direction: column; gap: 2px; }
.ai-option.is-unavailable { opacity: .65; }
.ai-option input[type="checkbox"] {
  margin-block-start: 3px;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  flex: none;
}

/* Format documentation block (CSV/MD shape). */
.format-doc {
  font-size: var(--fs-micro);
  line-height: 1.55;
  color: var(--muted);
}
.format-doc code {
  font-family: var(--font-mono);
  font-size: .95em;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text);
}

/* =============================================================================
   26. SESSION META CHIPS  (live dashboard: source + glossary status)
   Reuses .status-pill geometry; quieter, informational chips.
   ============================================================================= */
.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 32px;
  padding: var(--s-1) var(--s-3);
  border-radius: var(--r-pill);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  font-size: var(--fs-micro);
  font-weight: var(--fw-medium);
  color: var(--text);
  white-space: nowrap;
}
.meta-chip__label { color: var(--muted); }
.meta-chip__value { font-weight: var(--fw-semi); }
.meta-chip__value .num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.meta-chip--glossary[data-on="true"] {
  border-color: color-mix(in srgb, var(--accent-alt) 45%, var(--border));
}
.meta-chip--glossary[data-on="true"] .meta-chip__value { color: var(--accent-alt); }

/* =============================================================================
   27. PASSTHROUGH HINT  (audience pick-language: marks the speaker's language)
   ============================================================================= */
.lang-chip__hint {
  flex-basis: 100%;
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  margin-block-start: 2px;
  font-size: var(--fs-micro);
  font-weight: var(--fw-medium);
  color: var(--accent-alt);
}
.lang-chip__hint svg { width: 12px; height: 12px; }
.lang-chip__hint svg :is(path, rect, line) { stroke: currentColor; fill: none; }
