/* Assaig · El ventall — one stylesheet for the whole app.
 *
 * Tokens follow Polaris naming (--p-*). Two surfaces: the "script paper"
 * (cream, ink, crimson) for reading and choosing, and the dark auditorium of
 * the rehearsal stage. Body text ≥ 17 px and 48 px touch targets: the actor
 * reads this on a phone, at arm's length, mid-rehearsal.
 */

:root {
  --p-color-bg: #f4ecdf;
  --p-color-bg-surface: #fffaf2;
  --p-color-bg-surface-secondary: #f8f0e3;
  --p-color-bg-surface-hover: #fbf3e6;
  --p-color-bg-surface-active: #f1e6d4;
  --p-color-bg-surface-mine: #fdf1e8;
  --p-color-bg-fill-brand: #9b1c2c;
  --p-color-bg-fill-brand-hover: #84131f;
  --p-color-bg-fill-brand-active: #6f0f19;
  --p-color-bg-fill-secondary: #fffaf2;
  --p-color-bg-fill-gold: #c8962e;
  --p-color-bg-fill-success: #2f7d5b;
  --p-color-bg-fill-warning: #d39a2a;
  --p-color-bg-fill-critical: #b42318;
  --p-color-bg-stage: #120c0d;
  --p-color-bg-stage-surface: rgba(26, 18, 19, 0.86);
  --p-color-bg-stage-surface-strong: rgba(18, 12, 13, 0.94);

  --p-color-text: #2a1d17;
  --p-color-text-secondary: #6b5a4e;
  --p-color-text-brand: #8c1626;
  --p-color-text-on-brand: #ffffff;
  --p-color-text-success: #1f6b4a;
  --p-color-text-warning: #8a5a00;
  --p-color-text-critical: #a3170f;
  --p-color-text-direction: #6b5a4e;
  --p-color-text-on-stage: #fbf3e6;
  --p-color-text-on-stage-secondary: #d8c8b4;

  --p-color-border: #e2d3bd;
  --p-color-border-secondary: #eee3d2;
  --p-color-border-strong: #c9b293;
  --p-color-border-focus: #1d4ed8;
  --p-color-border-mine: #9b1c2c;

  --p-space-050: 2px; --p-space-100: 4px; --p-space-150: 6px; --p-space-200: 8px;
  --p-space-300: 12px; --p-space-400: 16px; --p-space-500: 20px; --p-space-600: 24px;
  --p-space-800: 32px; --p-space-1000: 40px; --p-space-1200: 48px; --p-space-1600: 64px;

  --p-font-family-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --p-font-family-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --p-font-size-body-sm: 15px;
  --p-font-size-body-md: 17px;
  --p-font-size-body-lg: 19px;
  --p-font-size-heading-sm: 17px;
  --p-font-size-heading-md: 20px;
  --p-font-size-heading-lg: 24px;
  --p-font-size-heading-xl: 30px;
  --p-font-size-heading-2xl: 38px;
  --p-font-weight-regular: 400;
  --p-font-weight-medium: 500;
  --p-font-weight-semibold: 600;
  --p-font-weight-bold: 700;
  --p-font-line-height-body: 1.5;

  --p-border-radius-100: 4px; --p-border-radius-200: 8px; --p-border-radius-300: 12px;
  --p-border-radius-400: 16px; --p-border-radius-full: 9999px;
  --p-shadow-100: 0 1px 2px rgba(60, 30, 10, 0.08);
  --p-shadow-200: 0 2px 8px rgba(60, 30, 10, 0.10), 0 1px 2px rgba(60, 30, 10, 0.06);
  --p-shadow-400: 0 10px 30px rgba(30, 10, 5, 0.25);
  --p-shadow-600: 0 20px 60px rgba(0, 0, 0, 0.45);
  --p-motion-ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --p-motion-duration-150: 150ms;
  --p-motion-duration-200: 200ms;
  --p-motion-duration-300: 300ms;

  --script-scale: 1;
  color-scheme: light;
}

@media (prefers-reduced-motion: reduce) {
  :root { --p-motion-duration-150: 0ms; --p-motion-duration-200: 0ms; --p-motion-duration-300: 0ms; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--p-color-bg);
  color: var(--p-color-text);
  font: var(--p-font-weight-regular) var(--p-font-size-body-md) / var(--p-font-line-height-body) var(--p-font-family-sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
body.on-stage { background: var(--p-color-bg-stage); overflow: hidden; }
h1, h2, h3 { font-family: var(--p-font-family-serif); line-height: 1.2; margin: 0; }
a { color: var(--p-color-text-brand); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--p-color-border-focus); outline-offset: 2px; border-radius: var(--p-border-radius-100); }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--p-space-200);
  min-height: 48px; padding: 0 var(--p-space-500);
  border-radius: var(--p-border-radius-300); border: 1px solid var(--p-color-border-strong);
  background: var(--p-color-bg-fill-secondary); color: var(--p-color-text);
  font-weight: var(--p-font-weight-semibold); cursor: pointer; text-decoration: none;
  transition: background var(--p-motion-duration-150) var(--p-motion-ease), transform var(--p-motion-duration-150);
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn:hover { background: var(--p-color-bg-surface-hover); }
.btn:active { transform: scale(0.98); background: var(--p-color-bg-surface-active); }
.btn[disabled] { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--p-color-bg-fill-brand); border-color: var(--p-color-bg-fill-brand); color: var(--p-color-text-on-brand); }
.btn-primary:hover { background: var(--p-color-bg-fill-brand-hover); }
.btn-primary:active { background: var(--p-color-bg-fill-brand-active); }
.btn-plain { background: transparent; border-color: transparent; color: var(--p-color-text-brand); padding: 0 var(--p-space-300); }
.btn-plain:hover { background: rgba(155, 28, 44, 0.06); }
.btn-lg { min-height: 56px; font-size: var(--p-font-size-body-lg); padding: 0 var(--p-space-600); }
.btn-block { width: 100%; }
.btn-icon { width: 48px; padding: 0; }
.btn .ico { font-size: 1.15em; line-height: 1; }

/* ------------------------------------------------------------------ page */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--p-space-200);
  padding: max(var(--p-space-200), env(safe-area-inset-top)) var(--p-space-300) var(--p-space-200);
  background: rgba(244, 236, 223, 0.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--p-color-border-secondary);
}
.topbar .title { flex: 1; min-width: 0; font-family: var(--p-font-family-serif); font-weight: var(--p-font-weight-bold); font-size: var(--p-font-size-heading-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .title small { display: block; font-family: var(--p-font-family-sans); font-weight: var(--p-font-weight-regular); font-size: 13px; color: var(--p-color-text-secondary); }
.page { max-width: 860px; margin: 0 auto; padding: var(--p-space-400) var(--p-space-400) calc(var(--p-space-1600) + env(safe-area-inset-bottom)); }

.hero {
  position: relative; overflow: hidden; border-radius: var(--p-border-radius-400);
  min-height: 200px; display: flex; align-items: flex-end; color: #fff;
  background: #3a1016 center / cover no-repeat; box-shadow: var(--p-shadow-200);
}
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20, 6, 8, 0) 20%, rgba(20, 6, 8, 0.82) 100%); }
.hero .hero-body { position: relative; z-index: 1; padding: var(--p-space-500); }
.hero h1 { font-size: var(--p-font-size-heading-2xl); letter-spacing: 0.01em; }
.hero p { margin: var(--p-space-100) 0 0; font-size: var(--p-font-size-body-lg); opacity: 0.95; }

.section-title { display: flex; align-items: baseline; gap: var(--p-space-300); margin: var(--p-space-800) 0 var(--p-space-300); }
.section-title h2 { font-size: var(--p-font-size-heading-lg); }
.section-title span { color: var(--p-color-text-secondary); font-size: var(--p-font-size-body-sm); }

.card {
  background: var(--p-color-bg-surface); border: 1px solid var(--p-color-border-secondary);
  border-radius: var(--p-border-radius-300); box-shadow: var(--p-shadow-100);
  padding: var(--p-space-400);
}
.card + .card { margin-top: var(--p-space-300); }
.card h3 { font-size: var(--p-font-size-heading-md); }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: var(--p-space-300); margin-bottom: var(--p-space-300); }
.muted { color: var(--p-color-text-secondary); }
.small { font-size: var(--p-font-size-body-sm); }

/* scene cards (home) */
.scene-card { display: grid; grid-template-columns: auto 1fr; gap: var(--p-space-300) var(--p-space-400); cursor: pointer; transition: box-shadow var(--p-motion-duration-200), transform var(--p-motion-duration-200); }
.scene-card:hover { box-shadow: var(--p-shadow-200); }
.scene-card:active { transform: scale(0.995); }
.scene-num {
  width: 56px; height: 56px; border-radius: var(--p-border-radius-300);
  display: grid; place-items: center; text-align: center; line-height: 1;
  background: var(--p-color-bg-fill-brand); color: #fff; font-family: var(--p-font-family-serif);
}
.scene-num b { display: block; font-size: 22px; }
.scene-num small { font-size: 11px; opacity: 0.85; letter-spacing: 0.06em; }
.scene-card h3 { margin-bottom: var(--p-space-100); }
.scene-card p { margin: 0; color: var(--p-color-text-secondary); font-size: var(--p-font-size-body-sm); }
.scene-foot { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: var(--p-space-200) var(--p-space-300); }
.faces { display: flex; }
.faces .face { margin-left: -8px; }
.faces .face:first-child { margin-left: 0; }

.face {
  width: 36px; height: 36px; border-radius: var(--p-border-radius-full); flex: none;
  background: var(--face-color, #999) center / cover no-repeat; border: 2px solid var(--p-color-bg-surface);
  display: grid; place-items: center; color: #fff; font-weight: var(--p-font-weight-bold); font-size: 14px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}
.face.lg { width: 56px; height: 56px; font-size: 20px; }

.badge {
  display: inline-flex; align-items: center; gap: var(--p-space-100); min-height: 26px;
  padding: 0 var(--p-space-200); border-radius: var(--p-border-radius-full);
  background: var(--p-color-bg-surface-secondary); border: 1px solid var(--p-color-border-secondary);
  font-size: 14px; font-weight: var(--p-font-weight-medium); color: var(--p-color-text-secondary); white-space: nowrap;
}
.badge.success { background: #e3f3eb; border-color: #bfe3d0; color: var(--p-color-text-success); }
.badge.warning { background: #fbf0d9; border-color: #f1d9a6; color: var(--p-color-text-warning); }
.badge.critical { background: #fbe4e1; border-color: #f3c3bd; color: var(--p-color-text-critical); }
.badge.brand { background: #f8e3e5; border-color: #efc2c7; color: var(--p-color-text-brand); }

.meter { flex: 1; min-width: 80px; height: 8px; border-radius: 99px; background: var(--p-color-border-secondary); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--p-color-bg-fill-success); border-radius: inherit; }

.banner {
  display: flex; gap: var(--p-space-300); align-items: flex-start;
  padding: var(--p-space-300) var(--p-space-400); border-radius: var(--p-border-radius-300);
  background: #fbf0d9; border: 1px solid #f1d9a6; color: #5c3d00; margin: var(--p-space-300) 0;
}
.banner.critical { background: #fbe4e1; border-color: #f3c3bd; color: #6b120b; }
.banner.info { background: #e8eefb; border-color: #c7d4f3; color: #1d2f5e; }

/* ------------------------------------------------------------------ scene page */
.scene-head { display: grid; gap: var(--p-space-300); }
.scene-head h1 { font-size: var(--p-font-size-heading-xl); }
.cast-row { display: flex; flex-wrap: wrap; gap: var(--p-space-200); }
.cast-chip { display: inline-flex; align-items: center; gap: var(--p-space-200); padding: var(--p-space-100) var(--p-space-300) var(--p-space-100) var(--p-space-100); border-radius: var(--p-border-radius-full); background: var(--p-color-bg-surface); border: 1px solid var(--p-color-border-secondary); font-size: var(--p-font-size-body-sm); }
.cast-chip .face { width: 30px; height: 30px; border-width: 0; font-size: 12px; }
.cast-chip.me { border-color: var(--p-color-border-mine); background: var(--p-color-bg-surface-mine); font-weight: var(--p-font-weight-semibold); }
.actions { display: grid; grid-template-columns: 1fr; gap: var(--p-space-200); }
@media (min-width: 600px) { .actions { grid-template-columns: 2fr 1fr 1fr; } }

.toolbar { display: flex; flex-wrap: wrap; gap: var(--p-space-200); align-items: center; margin: var(--p-space-600) 0 var(--p-space-300); }
.toolbar .spacer { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--p-color-border-strong); border-radius: var(--p-border-radius-300); overflow: hidden; background: var(--p-color-bg-surface); }
.seg button { min-height: 44px; min-width: 44px; padding: 0 var(--p-space-300); border: 0; background: transparent; cursor: pointer; font-weight: var(--p-font-weight-medium); }
.seg button + button { border-left: 1px solid var(--p-color-border); }
.seg button[aria-pressed="true"] { background: var(--p-color-bg-fill-brand); color: #fff; }

.script { font-family: var(--p-font-family-serif); font-size: calc(var(--p-font-size-body-lg) * var(--script-scale)); line-height: 1.55; }
.script .dir { color: var(--p-color-text-direction); font-style: italic; margin: var(--p-space-400) var(--p-space-200); font-size: 0.92em; }
.script .line { position: relative; padding: var(--p-space-300) var(--p-space-300) var(--p-space-300) var(--p-space-400); border-radius: var(--p-border-radius-200); margin: var(--p-space-100) 0; border-left: 4px solid transparent; }
.script .line:hover { background: var(--p-color-bg-surface-hover); }
.script .line.mine { background: var(--p-color-bg-surface-mine); border-left-color: var(--p-color-border-mine); }
.script .line.mine.hidden-text .say { color: transparent; background: repeating-linear-gradient(90deg, #e9d7c6 0 0.9em, transparent 0.9em 1.15em); border-radius: 3px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.script .line.mine.hidden-text.revealed .say { color: inherit; background: none; }
.script .who { font-family: var(--p-font-family-sans); font-weight: var(--p-font-weight-bold); font-size: 0.78em; letter-spacing: 0.06em; text-transform: uppercase; color: var(--who-color, var(--p-color-text)); }
.script .note { font-family: var(--p-font-family-sans); font-style: italic; color: var(--p-color-text-direction); font-size: 0.78em; }
.script .act { font-style: italic; color: var(--p-color-text-direction); }
.script .line-tools { display: flex; flex-wrap: wrap; gap: var(--p-space-100); margin-top: var(--p-space-200); font-family: var(--p-font-family-sans); }
.script .line-tools .btn { min-height: 40px; font-size: 14px; padding: 0 var(--p-space-300); border-radius: var(--p-border-radius-200); }
.script .line.playing { background: #fff3d6; }

/* ------------------------------------------------------------------ settings */
.form { display: grid; gap: var(--p-space-500); }
.field { display: grid; gap: var(--p-space-150); }
.field > label, .field > .label { font-weight: var(--p-font-weight-semibold); }
.field .help { color: var(--p-color-text-secondary); font-size: var(--p-font-size-body-sm); }
.field select, .field input[type="text"], .field input[type="password"] {
  min-height: 48px; padding: 0 var(--p-space-300); border-radius: var(--p-border-radius-200);
  border: 1px solid var(--p-color-border-strong); background: #fff; width: 100%;
}
.field input[type="range"] { width: 100%; min-height: 36px; accent-color: var(--p-color-bg-fill-brand); }
.range-row { display: flex; align-items: center; gap: var(--p-space-300); }
.range-row output { min-width: 4.5em; text-align: right; font-variant-numeric: tabular-nums; font-weight: var(--p-font-weight-semibold); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: var(--p-space-400); min-height: 48px; cursor: pointer; }
.switch input { appearance: none; -webkit-appearance: none; width: 52px; height: 32px; border-radius: 99px; background: #cdbfae; position: relative; flex: none; cursor: pointer; transition: background var(--p-motion-duration-200); }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: var(--p-shadow-100); transition: transform var(--p-motion-duration-200) var(--p-motion-ease); }
.switch input:checked { background: var(--p-color-bg-fill-brand); }
.switch input:checked::after { transform: translateX(20px); }
.choices { display: grid; gap: var(--p-space-200); }
.choice { display: flex; gap: var(--p-space-300); align-items: flex-start; padding: var(--p-space-300); border: 1px solid var(--p-color-border); border-radius: var(--p-border-radius-200); cursor: pointer; background: #fff; }
.choice input { margin-top: 4px; width: 20px; height: 20px; accent-color: var(--p-color-bg-fill-brand); flex: none; }
.choice b { display: block; }
.choice span { color: var(--p-color-text-secondary); font-size: var(--p-font-size-body-sm); }
.choice:has(input:checked) { border-color: var(--p-color-border-mine); background: var(--p-color-bg-surface-mine); }

/* ------------------------------------------------------------------ login */
.login-page { min-height: 100dvh; display: grid; place-items: center; padding: var(--p-space-400); background: #2a0d12 url(../img/poster-1280.webp) center / cover no-repeat; position: relative; }
.login-page::before { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(25, 6, 9, 0.35), rgba(25, 6, 9, 0.85)); }
.login-card { position: relative; z-index: 1; width: min(420px, 100%); background: rgba(255, 250, 242, 0.97); border-radius: var(--p-border-radius-400); box-shadow: var(--p-shadow-600); padding: var(--p-space-600); display: grid; gap: var(--p-space-400); }
.login-card h1 { font-size: var(--p-font-size-heading-2xl); text-align: center; color: var(--p-color-text-brand); }
.login-card .sub { text-align: center; margin: calc(-1 * var(--p-space-300)) 0 0; color: var(--p-color-text-secondary); }

/* ------------------------------------------------------------------ stage */
.stage-root { position: fixed; inset: 0; background: var(--p-color-bg-stage); color: var(--p-color-text-on-stage); }
.stage-root canvas.three { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage-backdrop-2d { position: absolute; inset: 0; background: #120c0d center 30% / cover no-repeat; }
.stage-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; align-items: center; gap: var(--p-space-200);
  padding: max(var(--p-space-200), env(safe-area-inset-top)) var(--p-space-300) var(--p-space-200);
  background: linear-gradient(180deg, rgba(12, 6, 7, 0.75), rgba(12, 6, 7, 0));
}
.stage-top .title { flex: 1; min-width: 0; font-family: var(--p-font-family-serif); font-size: 17px; font-weight: var(--p-font-weight-bold); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-top .title small { display: block; font-family: var(--p-font-family-sans); font-weight: var(--p-font-weight-regular); font-size: 13px; color: var(--p-color-text-on-stage-secondary); }
.btn-stage { background: rgba(30, 20, 21, 0.7); border-color: rgba(255, 255, 255, 0.18); color: var(--p-color-text-on-stage); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.btn-stage:hover { background: rgba(50, 34, 36, 0.85); }
.btn-stage:active { background: rgba(70, 48, 50, 0.9); }
.progress-line { position: absolute; left: 0; right: 0; top: 0; height: 3px; background: rgba(255, 255, 255, 0.12); z-index: 6; }
.progress-line > i { display: block; height: 100%; width: 0; background: var(--p-color-bg-fill-gold); transition: width var(--p-motion-duration-300); }

.stage-bottom { position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; padding: var(--p-space-300) var(--p-space-300) max(var(--p-space-300), env(safe-area-inset-bottom)); display: grid; gap: var(--p-space-200); pointer-events: none; }
.stage-bottom > * { pointer-events: auto; }
.subtitle {
  max-width: 780px; width: 100%; margin: 0 auto;
  background: var(--p-color-bg-stage-surface); border: 1px solid rgba(255, 255, 255, 0.10); border-radius: var(--p-border-radius-400);
  padding: var(--p-space-300) var(--p-space-400); box-shadow: var(--p-shadow-400); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  font-family: var(--p-font-family-serif); font-size: calc(19px * var(--script-scale)); line-height: 1.45;
  transition: opacity var(--p-motion-duration-200), transform var(--p-motion-duration-200);
}
.subtitle[hidden] { display: none; }
.subtitle .who { display: flex; align-items: center; gap: var(--p-space-200); font-family: var(--p-font-family-sans); font-weight: var(--p-font-weight-bold); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--who-color, #fff); margin-bottom: var(--p-space-100); }
.subtitle .who .note { text-transform: none; letter-spacing: 0; font-weight: var(--p-font-weight-regular); font-style: italic; color: var(--p-color-text-on-stage-secondary); }
.subtitle .act { font-style: italic; color: var(--p-color-text-on-stage-secondary); font-size: 0.9em; }
.subtitle .w { transition: color var(--p-motion-duration-150); }
.subtitle .w.hit { color: #9be3bd; }
.subtitle .w.miss { color: #ffb4a8; text-decoration: underline wavy rgba(255, 140, 120, 0.8); text-underline-offset: 4px; }
.subtitle.dir-only { font-style: italic; color: var(--p-color-text-on-stage-secondary); font-size: calc(17px * var(--script-scale)); }

.myturn { border: 2px solid var(--p-color-bg-fill-gold); box-shadow: 0 0 0 4px rgba(200, 150, 46, 0.18), var(--p-shadow-400); }
.myturn .who { color: #f5cf7a; }
.hint-text { color: #f5e6c8; }
.hint-text .rest { color: rgba(245, 230, 200, 0.28); }
.hint-text .initial { letter-spacing: 0.05em; }
.turn-bar { display: flex; align-items: center; gap: var(--p-space-200); max-width: 780px; width: 100%; margin: 0 auto; }
.turn-bar .grow { flex: 1; }
.mic {
  position: relative; width: 56px; height: 56px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-size: 24px; background: rgba(30, 20, 21, 0.75); border: 2px solid rgba(255, 255, 255, 0.25);
}
.mic::before { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 3px solid var(--p-color-bg-fill-gold); opacity: calc(0.15 + var(--level, 0) * 0.85); transform: scale(calc(1 + var(--level, 0) * 0.25)); transition: transform 80ms linear, opacity 80ms linear; }
.mic.listening { border-color: var(--p-color-bg-fill-gold); }
.mic.thinking::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 3px solid transparent; border-top-color: #fff; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.status-pill { display: inline-flex; align-items: center; gap: var(--p-space-150); min-height: 32px; padding: 0 var(--p-space-300); border-radius: 99px; background: rgba(30, 20, 21, 0.75); border: 1px solid rgba(255, 255, 255, 0.15); font-size: 14px; color: var(--p-color-text-on-stage-secondary); }
.feedback { max-width: 780px; width: 100%; margin: 0 auto; display: flex; flex-wrap: wrap; gap: var(--p-space-200); align-items: center; }
.feedback .badge { background: rgba(30, 20, 21, 0.85); border-color: rgba(255, 255, 255, 0.18); color: #fff; font-size: 15px; min-height: 32px; }
.feedback .badge.success { color: #9be3bd; border-color: rgba(155, 227, 189, 0.5); }
.feedback .badge.warning { color: #f5cf7a; border-color: rgba(245, 207, 122, 0.5); }
.feedback .badge.critical { color: #ffb4a8; border-color: rgba(255, 180, 168, 0.5); }

/* overlays on the stage: the start card, settings sheet, results */
.sheet-back { position: absolute; inset: 0; z-index: 20; background: rgba(10, 4, 5, 0.6); display: grid; align-items: end; justify-items: center; animation: fade var(--p-motion-duration-200); }
@media (min-width: 700px) { .sheet-back { align-items: center; } }
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: min(560px, 100%); max-height: min(88dvh, 860px); overflow: auto; overscroll-behavior: contain;
  background: var(--p-color-bg-surface); color: var(--p-color-text);
  border-radius: var(--p-border-radius-400) var(--p-border-radius-400) 0 0; box-shadow: var(--p-shadow-600);
  padding: var(--p-space-500) var(--p-space-500) max(var(--p-space-500), env(safe-area-inset-bottom));
  animation: rise var(--p-motion-duration-300) var(--p-motion-ease);
}
@media (min-width: 700px) { .sheet { border-radius: var(--p-border-radius-400); } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }
.sheet h2 { font-size: var(--p-font-size-heading-lg); margin-bottom: var(--p-space-200); }
.sheet .sheet-actions { display: grid; gap: var(--p-space-200); margin-top: var(--p-space-500); }
.score-big { font-family: var(--p-font-family-serif); font-size: 64px; font-weight: var(--p-font-weight-bold); line-height: 1; color: var(--p-color-text-brand); }
.result-line { display: grid; grid-template-columns: auto 1fr; gap: var(--p-space-200) var(--p-space-300); padding: var(--p-space-300) 0; border-top: 1px solid var(--p-color-border-secondary); font-family: var(--p-font-family-serif); }
.result-line > .badge { align-self: start; }
.result-line .diff .miss { color: var(--p-color-text-critical); text-decoration: underline wavy; text-underline-offset: 3px; }
.result-line .heard { grid-column: 2; font-family: var(--p-font-family-sans); font-size: var(--p-font-size-body-sm); color: var(--p-color-text-secondary); }
.toast { position: absolute; left: 50%; top: calc(64px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 30; background: rgba(20, 12, 13, 0.92); color: #fff; padding: var(--p-space-200) var(--p-space-400); border-radius: 99px; font-size: 15px; box-shadow: var(--p-shadow-400); animation: fade var(--p-motion-duration-200); max-width: calc(100% - 32px); text-align: center; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; z-index: 4; color: var(--p-color-text-on-stage-secondary); font-family: var(--p-font-family-serif); font-size: 20px; }
.empty { text-align: center; padding: var(--p-space-1000) var(--p-space-400); color: var(--p-color-text-secondary); }
.turn-bar .btn { white-space: nowrap; padding: 0 var(--p-space-400); }
@media (max-width: 420px) {
  .turn-bar { gap: var(--p-space-150); }
  .turn-bar .status-pill { padding: 0 var(--p-space-200); font-size: 13px; }
  .turn-bar .btn { padding: 0 var(--p-space-300); }
}
