/* =========================================================================
   TalkToRoy — public styles
   Single stylesheet. No framework. Dark-first. iOS-inspired palette.
   ========================================================================= */

:root {
  /* Base surfaces */
  --bg:          #040506;
  --bg-elev:     #11151B;
  --bg-elev-2:   #1A2028;
  --border:      rgba(255,255,255,.10);

  /* Text */
  --fg:          #FFFFFF;   /* Pure white */
  --fg-muted:    rgba(255,255,255,.76);
  --fg-subtle:   rgba(255,255,255,.46);

  /* Brand */
  --accent:      #53A7FF;
  --accent-2:    #7FBCFF;
  --accent-ink:  #FFFFFF;   /* Text on accent */
  --success:     #32D74B;   /* Vivid Green */
  --danger:      #FF375F;   /* Bold Pink */
  --warning:     #FF9F0A;

  --focus:       #7FBCFF;

  /* Radii */
  --r-sm: 10px;
  --r:    14px;
  --r-lg: 20px;
  --r-pill: 999px;

  /* Shadows */
  --sh-1: 0 1px 0 rgba(255,255,255,.05) inset, 0 18px 44px rgba(0,0,0,.34);
  --sh-focus: 0 0 0 3px rgba(83, 167, 255, .24), 0 12px 28px rgba(18, 104, 189, .18);

  --f-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  --f-prompter: 'Source Sans 3', 'Inter', system-ui, sans-serif;

  --ease: cubic-bezier(.2,.8,.2,1);

  /* ── Z-index layers ── */
  --z-camera:    0;
  --z-script:    5;
  --z-hud:       15;
  --z-hud-top:   20;
  --z-countdown: 50;
  --z-setup:     10;
  --z-review:    30;
  --z-perm:      25;
  --z-modal:     200;
  --z-topbar:    20;

  /* ── Glass system ── */
  --glass-bg:       rgba(8, 12, 18, 0.58);
  --glass-bg-heavy: rgba(5, 8, 12, 0.82);
  --glass-border:   rgba(255, 255, 255, 0.11);
  --glass-blur:     blur(24px) saturate(175%);
  --glass-shadow:   0 28px 72px rgba(0,0,0,.36), 0 2px 10px rgba(0,0,0,.22);

  /* ── Spacing scale ── */
  --sp-xs: 6px;
  --sp-sm: 10px;
  --sp-md: 16px;
  --sp-lg: 24px;
  --sp-xl: 40px;

  /* ── Animation tokens ── */
  --dur-fast:   120ms;
  --dur-norm:   220ms;
  --dur-slow:   380ms;
  --ease-out:   cubic-bezier(.2,.8,.2,1);
  --ease-spring: cubic-bezier(.34,1.56,.64,1);

  /* ── Safe area shorthands ── */
  --sat: env(safe-area-inset-top,    0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left,   0px);
  --sar: env(safe-area-inset-right,  0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

/* Make [hidden] win over display:flex/grid on modals and other containers */
[hidden] { display: none !important; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--f-ui);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse 120% 80% at 58% -18%, rgba(83,167,255,.12), transparent),
    radial-gradient(ellipse 78% 56% at -12% 62%, rgba(255,91,120,.08), transparent),
    linear-gradient(180deg, rgba(255,255,255,.015), transparent 14%, transparent 78%, rgba(255,255,255,.012));
  position: relative;
}
body::before,
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}
body::before {
  background:
    radial-gradient(circle at 18% 12%, rgba(112, 191, 255, .10), transparent 26%),
    radial-gradient(circle at 82% 0%, rgba(94, 255, 192, .05), transparent 22%);
}
body::after {
  background: linear-gradient(180deg, rgba(255,255,255,.015), transparent 24%, transparent 76%, rgba(255,255,255,.012));
  opacity: .55;
}

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

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

h1, h2, h3, h4 { margin: 0 0 .5em; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
h1 { font-size: clamp(32px, 4.8vw, 56px); letter-spacing: -.025em; }
h2 { font-size: clamp(24px, 2.8vw, 36px); }
h3 { font-size: 20px; }
p  { margin: 0 0 1em; color: var(--fg-muted); }

/* -------------------- layout -------------------- */
.container { max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.narrow    { max-width: 720px; margin: 0 auto; padding: 0 24px; }

/* -------------------- top bar -------------------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(7, 10, 14, 0.68);
  backdrop-filter: saturate(185%) blur(26px);
  -webkit-backdrop-filter: saturate(185%) blur(26px);
  border-bottom: 1px solid rgba(255,255,255,.07);
  box-shadow: 0 1px 0 rgba(255,255,255,.03) inset;
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px; gap: 16px;
}
.logo {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 17px; letter-spacing: -.02em; color: var(--fg);
  flex-shrink: 0;
}
.logo:hover { text-decoration: none; opacity: .85; }
.logo-dot {
  width: 8px; height: 8px; background: var(--accent); border-radius: 50%;
  box-shadow: 0 0 10px rgba(10, 132, 255, .9), 0 0 20px rgba(10,132,255,.4);
  flex-shrink: 0;
}
.logo-img {
  width: 30px; height: 30px; border-radius: 8px;
  object-fit: cover; object-position: center;
  background: var(--bg-elev-2);
  box-shadow: 0 0 0 1px rgba(255,255,255,.1), 0 2px 8px rgba(0,0,0,.5);
  display: block;
}
.logo-img:not([src]), .logo-img[src=""] { display: none; }
.admin-sidebar .logo-img { width: 24px; height: 24px; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  color: rgba(255,255,255,.65); padding: 7px 13px; border-radius: var(--r-pill);
  font-weight: 500; font-size: 14px; letter-spacing: -.01em;
  transition: color var(--dur-fast), background var(--dur-fast);
}
.nav a:hover { color: var(--fg); background: rgba(255,255,255,.08); text-decoration: none; }
.nav a.primary {
  background: var(--accent); color: #fff; font-weight: 600;
  box-shadow: 0 2px 12px rgba(10,132,255,.4);
  transition: background var(--dur-fast), box-shadow var(--dur-fast), transform var(--dur-fast) var(--ease-spring);
}
.nav a.primary:hover {
  background: var(--accent-2); color: #fff;
  box-shadow: 0 4px 18px rgba(10,132,255,.55);
  transform: translateY(-1px);
}

/* Nav dropdown groups */
.nav-group { position: relative; }
.nav-group-btn {
  display: inline-flex; align-items: center; gap: 4px;
  color: rgba(255,255,255,.65); padding: 7px 13px; border-radius: var(--r-pill);
  font-weight: 500; font-size: 14px; cursor: pointer;
  background: none; border: 0; font-family: inherit; letter-spacing: -.01em;
  transition: color var(--dur-fast), background var(--dur-fast);
}
.nav-group-btn:hover { color: var(--fg); background: rgba(255,255,255,.08); }
.nav-group-btn svg { opacity: .5; transition: transform var(--dur-norm) var(--ease-out); }
.nav-group.open .nav-group-btn svg { transform: rotate(180deg); opacity: .8; }
.nav-dropdown {
  position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  min-width: 180px;
  background: rgba(28,28,30,.96);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0,0,0,.7), 0 1px 0 rgba(255,255,255,.05) inset;
  display: none; flex-direction: column; padding: 8px; z-index: 200;
  animation: dropdown-pop var(--dur-norm) var(--ease-spring);
}
@keyframes dropdown-pop {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px) scale(.97); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
@keyframes panel-up {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.nav-group.open .nav-dropdown { display: flex; }
.nav-dropdown a {
  color: rgba(255,255,255,.8); padding: 9px 13px; border-radius: 10px;
  font-weight: 500; font-size: 14px; white-space: nowrap;
  transition: color var(--dur-fast), background var(--dur-fast);
}
.nav-dropdown a:hover { color: var(--fg); background: rgba(255,255,255,.1); text-decoration: none; }

.nav-settings-btn {
  display: inline-flex;
  background: none; border: 0; color: rgba(255,255,255,.5); cursor: pointer;
  width: 36px; height: 36px; border-radius: var(--r-pill);
  align-items: center; justify-content: center;
  transition: color var(--dur-fast), background var(--dur-fast);
}
.nav-settings-btn:hover { color: var(--fg); background: rgba(255,255,255,.08); }

.nav-group[data-auth="required"] { display: flex; align-items: center; }

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column; justify-content: center; align-items: center; gap: 5px;
  width: 44px; height: 44px; padding: 8px; flex-shrink: 0;
  background: none; border: 0; color: var(--fg); cursor: pointer;
  border-radius: var(--r-pill); transition: background var(--dur-fast);
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.hamburger:hover { background: rgba(255,255,255,.08); }
.hamburger span {
  display: block; width: 20px; height: 1.5px;
  background: currentColor; border-radius: 2px;
  transition: transform .28s var(--ease-spring), opacity .2s;
}
.nav-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.55); backdrop-filter: blur(4px);
  z-index: 98;
}
body.nav-open .nav-overlay { display: block; }
html.nav-open, body.nav-open { overflow: hidden; }
.nav-drawer-close { display: none; }
a.nav-record {
  color: rgba(255,255,255,.65); font-weight: 500;
  background: transparent;
  transition: background var(--dur-fast), transform var(--dur-fast) var(--ease-spring);
}
a.nav-record svg { display: none; }
a.nav-record:hover {
  color: var(--fg); background: rgba(255,255,255,.08);
  text-decoration: none; transform: translateY(-1px);
}

/* -------------------- buttons -------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--r-pill); border: 1px solid rgba(255,255,255,.1);
  font: inherit; font-weight: 600; cursor: pointer;
  transition: background var(--dur-fast), box-shadow var(--dur-fast),
              transform var(--dur-fast) var(--ease-spring);
  min-height: 42px; font-size: 14px; letter-spacing: -.01em;
  background: rgba(255,255,255,.07); color: var(--fg);
  box-shadow: 0 1px 0 rgba(255,255,255,.04) inset;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover {
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.16);
  transform: translateY(-1px);
}
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(10,132,255,.5); }
.btn-primary {
  background: var(--accent); color: #fff; border-color: transparent;
  box-shadow: 0 4px 16px rgba(10,132,255,.38);
}
.btn-primary:hover {
  background: var(--accent-2); color: #fff;
  box-shadow: 0 6px 22px rgba(10,132,255,.55); transform: translateY(-1px);
}
.btn-primary:active { transform: scale(.97) translateY(0); }
.btn-ghost { background: transparent; border-color: rgba(255,255,255,.15); }
.btn-ghost:hover { background: rgba(255,255,255,.07); }
.btn-success {
  background: var(--success); color: #041b09; border-color: transparent;
  box-shadow: 0 4px 14px rgba(50,215,75,.38);
}
.btn-success:hover { box-shadow: 0 6px 20px rgba(50,215,75,.5); transform: translateY(-1px); }
.btn-danger {
  background: var(--danger); color: #fff; border-color: transparent;
  box-shadow: 0 4px 14px rgba(255,55,95,.35);
}
.btn-danger:hover { box-shadow: 0 6px 20px rgba(255,55,95,.5); transform: translateY(-1px); }
.btn-lg { padding: 14px 26px; min-height: 52px; font-size: 16px; }
.btn[disabled] { opacity: .4; cursor: not-allowed; transform: none !important; }

/* -------------------- form controls -------------------- */
.input, .textarea, .select {
  display: block; width: 100%;
  background: rgba(255,255,255,.05); color: var(--fg);
  border: 1px solid rgba(255,255,255,.09); border-radius: 16px;
  padding: 14px 16px; font: inherit; font-size: 15px;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast),
              background var(--dur-fast);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
}
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: rgba(127,188,255,.46);
  background: rgba(255,255,255,.08);
  box-shadow: var(--sh-focus);
}
.input::placeholder, .textarea::placeholder { color: rgba(255,255,255,.28); }
.textarea { min-height: 120px; resize: vertical; font-family: var(--f-ui); line-height: 1.55; }
.label { display: block; font-size: 13px; color: rgba(255,255,255,.55); margin-bottom: 8px; font-weight: 500; letter-spacing: .01em; }
.field + .field { margin-top: 18px; }
.field-error { color: var(--danger); font-size: 13px; margin-top: 6px; }

/* -------------------- cards -------------------- */
.card {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 28px;
  padding: 28px;
  box-shadow: 0 2px 0 rgba(255,255,255,.04) inset, 0 30px 72px rgba(0,0,0,.34);
  backdrop-filter: blur(18px) saturate(170%);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
}

/* -------------------- hero -------------------- */
.hero {
  padding: 80px 0 40px; text-align: center;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(83,167,255,.16), transparent),
    linear-gradient(180deg, rgba(255,255,255,.015), transparent 70%);
}
.hero h1 { margin-bottom: 18px; }
.hero .lede {
  color: rgba(255,255,255,.6); font-size: 19px; max-width: 600px;
  margin: 0 auto 32px; line-height: 1.65;
}
.hero .cta-row { display: inline-flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* -------------------- teleprompter app -------------------- */
.prompter-shell { padding: 28px 0 80px; }

.prompter-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .92fr) minmax(320px, .76fr);
  gap: 12px;
  align-items: stretch;
  padding: 14px 16px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 24px; margin-bottom: 16px;
  box-shadow: 0 1px 0 rgba(255,255,255,.05) inset, 0 24px 56px rgba(0,0,0,.32);
  backdrop-filter: blur(18px) saturate(165%);
  -webkit-backdrop-filter: blur(18px) saturate(165%);
}
.toolbar-block {
  min-width: 0;
  display: flex;
  align-items: stretch;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 20px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
  align-self: stretch;
}
.toolbar-block-sliders {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  align-content: start;
}
.toolbar-block-toggles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 18px;
  align-content: start;
}
.toolbar-block-toggles > :nth-child(1) { grid-column: 1; grid-row: 1; }
.toolbar-block-toggles > :nth-child(2) { grid-column: 2; grid-row: 1; }
.toolbar-block-toggles > :nth-child(3) { grid-column: 1; grid-row: 2; }
.toolbar-block-toggles > :nth-child(4) { grid-column: 2; grid-row: 2; }
.toolbar-block-actions {
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}
.toolbar-play-row .btn,
.toolbar-action-utility .btn {
  min-width: 0;
}
.toolbar-action-utility {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.toolbar-action-utility .btn {
  min-height: 38px;
  padding: 8px 14px;
  font-size: 13px;
  white-space: nowrap;
}
.toolbar-play-row {
  display: grid;
}
.toolbar-play-row .btn-primary {
  min-height: 52px;
  box-shadow: 0 8px 20px rgba(10,132,255,.26);
}
.btn-quiet-action {
  color: rgba(255,255,255,.78);
  background: rgba(255,255,255,.025);
}
.toolbar-mobile-reset-slot {
  display: flex;
  grid-column: 1 / -1;
  margin-top: 2px;
}
.toolbar-mobile-reset-slot .btn {
  min-height: 36px;
  padding: 7px 14px;
  font-size: 12px;
  opacity: 0.8;
}
.toolbar-mobile-speakers-slot {
  display: flex;
  grid-column: 1 / -1;
  margin-top: 2px;
  align-self: end;
}
.toolbar-mobile-speakers-slot .btn {
  min-height: 38px;
  padding: 7px 14px;
  font-size: 12px;
  border-radius: 999px;
  width: auto;
  color: rgba(255,255,255,.78);
  background: rgba(255,255,255,.02);
  border-color: rgba(255,255,255,.08);
}
.toolbar-group {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.toolbar-group .label {
  margin: 0;
  white-space: nowrap;
  font-size: 12px;
}
.toolbar-group input[type="range"] {
  width: 100%;
  min-width: 0;
}

@media (min-width: 761px) {
  .prompter-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1.04fr) minmax(0, .88fr) minmax(320px, .72fr);
    gap: 14px;
  }
  .toolbar-block {
    padding: 15px 16px 10px;
    gap: 12px;
    height: auto;
    min-height: 0;
  }
  .toolbar-block-sliders,
  .toolbar-block-toggles {
    grid-template-rows: auto auto 1fr auto;
    align-content: stretch;
  }
  .toolbar-block-sliders {
    gap: 10px 18px;
  }
  .toolbar-mobile-reset-slot {
    grid-column: 1 / -1;
    grid-row: 4;
    align-self: end;
    margin-top: -16px;
  }
  .toolbar-block-toggles {
    gap: 10px 20px;
  }
  .toolbar-mobile-speakers-slot {
    grid-column: 1 / -1;
    grid-row: 4;
    align-self: end;
    margin-top: -16px;
  }
  .toolbar-group {
    gap: 12px;
  }
  .toolbar-group .label,
  .toolbar-block-toggles .toggle span:last-child {
    font-size: 12px;
    line-height: 1.2;
  }
  .toolbar-block-toggles .toggle {
    min-height: 24px;
    padding: 0;
    gap: 10px;
    font-size: 12px;
    color: rgba(255,255,255,.72);
  }
  .toolbar-block-toggles .toggle-switch {
    width: 34px;
    height: 19px;
  }
  .toolbar-block-toggles .toggle-switch::after {
    width: 13px;
    height: 13px;
  }
  .toolbar-block-toggles .toggle input:checked + .toggle-switch::after {
    transform: translateX(15px);
  }
  .toolbar-mobile-reset-slot .btn,
  .toolbar-mobile-speakers-slot .btn,
  .toolbar-action-utility .btn {
    min-height: 40px;
    padding: 8px 16px;
    font-size: 12px;
    border-radius: 999px;
  }
  .toolbar-mobile-speakers-slot .btn {
    opacity: 0.8;
    justify-self: start;
  }
  .toolbar-block-actions {
    justify-content: flex-start;
    gap: 6px;
  }
  .toolbar-action-utility {
    gap: 10px;
    align-items: start;
  }
  .toolbar-play-row {
    margin-top: 8px;
  }
  .toolbar-play-row .btn-primary {
    min-height: 46px;
    padding-top: 9px;
    padding-bottom: 9px;
  }
}

input[type="range"] {
  -webkit-appearance: none; appearance: none; background: transparent; height: 24px;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; background: var(--bg-elev-2); border-radius: 2px;
}
input[type="range"]::-moz-range-track {
  height: 4px; background: var(--bg-elev-2); border-radius: 2px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); margin-top: -7px; cursor: pointer;
  box-shadow: 0 0 0 2px rgba(10,132,255,.25);
}
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px; border: 0; border-radius: 50%; background: var(--accent); cursor: pointer;
}

.toggle {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none;
  font-size: 14px; color: var(--fg-muted);
  min-height: 38px;
  padding: 0 2px;
}
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-switch {
  width: 36px; height: 20px; background: var(--bg-elev-2); border-radius: var(--r-pill);
  position: relative; transition: background .15s var(--ease);
  border: 1px solid var(--border);
}
.toggle-switch::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; background: var(--fg-muted); border-radius: 50%;
  transition: transform .15s var(--ease), background .15s var(--ease);
}
.toggle input:checked + .toggle-switch { background: var(--accent); border-color: transparent; }
.toggle input:checked + .toggle-switch::after { transform: translateX(16px); background: #fff; }

.prompter-stage {
  position: relative;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 22px;
  box-shadow: 0 1px 0 rgba(255,255,255,.05) inset, 0 16px 48px rgba(0,0,0,.5);
  overflow: hidden; min-height: 440px;
}
/* Editor = textarea + matching colour-overlay, stacked pixel-perfectly.
   The textarea's text is rendered transparent so only the overlay's coloured
   runs show through. The caret and selection highlight still work. */
.script-edit-wrap {
  position: relative;
  min-height: 440px;
  width: 100%;
}
.script-textarea,
.script-preview-overlay {
  font-family: var(--f-prompter);
  font-size: var(--prompter-font-size, 18px);
  line-height: var(--prompter-line-height, 1.6);
  padding: 24px var(--prompter-pad-x, 24px);
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-wrap: break-word;
  letter-spacing: 0;
  tab-size: 4;
  margin: 0;
  border: 0;
  box-sizing: border-box;
  transition: font-size .12s ease, line-height .12s ease, padding .12s ease;
}
.script-textarea {
  position: relative;           /* keeps the caret above the overlay */
  display: block;
  width: 100%;
  min-height: 440px;
  resize: none;
  background: transparent;
  /* invisible glyphs, visible caret + visible selection highlight */
  color: transparent;
  -webkit-text-fill-color: transparent;
  caret-color: var(--fg);
  outline: none;
  z-index: 2;
}
.script-textarea::selection { background: rgba(10,132,255,.30); }
.script-textarea::placeholder {
  color: var(--fg-subtle);
  -webkit-text-fill-color: var(--fg-subtle);
}
.script-preview-overlay {
  position: absolute;
  inset: 0;
  color: var(--fg);
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}
/* When playing, the editor is hidden; the scrolling viewport takes over. */
.prompter-stage.playing .script-edit-wrap { display: none; }

.prompter-viewport {
  display: none; position: relative; height: min(70vh, 520px); overflow: hidden;
  padding: 0; background: #000;
  touch-action: none;                /* let us own vertical drag gestures */
  cursor: grab;
  user-select: none;
}
.prompter-viewport.dragging { cursor: grabbing; }
.prompter-stage.playing .prompter-viewport { display: block; }
.prompter-content {
  font-family: var(--f-prompter); font-weight: 500; color: #fff;
  padding: 50% var(--prompter-pad-x, 8%) 60%; white-space: pre-wrap; word-wrap: break-word;
  will-change: transform;
  font-size: var(--prompter-font-size, 52px);
  line-height: var(--prompter-line-height, 1.35);
  transform-origin: center center;
}
/* Inline speaker tags — the [Name] marker itself is tinted a bit dimmer */
.prompter-content .speaker-tag,
.script-preview-overlay .speaker-tag {
  font-weight: 600;
  opacity: .65;
  margin-right: .25em;
}
/* NOTE: mirror/flip is now composed in JS via inline transform to avoid
   being overridden by the scrolling translateY(). CSS rules below kept as
   a safety net for non-playing (edit) mode. */
.prompter-stage:not(.playing).mirror-h .prompter-content { transform: scaleX(-1); }
.prompter-stage:not(.playing).mirror-v .prompter-content { transform: scaleY(-1); }
.prompter-stage:not(.playing).mirror-h.mirror-v .prompter-content { transform: scale(-1, -1); }

/* v7.4 — preview mirror / flip while editing. The whole editor wrap
   (textarea + coloured overlay) is transformed so the user can SEE what
   playback will look like before pressing Play. Typing still works (the
   textarea receives keystrokes normally, the caret simply appears on the
   mirrored side), so this acts as a preview toggle. */
.script-edit-wrap { transform-origin: center center; transition: transform .15s ease; }
.prompter-stage:not(.playing).mirror-h .script-edit-wrap { transform: scaleX(-1); }
.prompter-stage:not(.playing).mirror-v .script-edit-wrap { transform: scaleY(-1); }
.prompter-stage:not(.playing).mirror-h.mirror-v .script-edit-wrap { transform: scale(-1, -1); }

.cue-line {
  position: absolute; left: 0; right: 0; top: 45%;
  height: 2px; background: linear-gradient(90deg, transparent, var(--accent) 20%, var(--accent) 80%, transparent);
  pointer-events: none; opacity: .75;
}
.cue-line::before, .cue-line::after {
  content: ''; position: absolute; top: -6px; width: 0; height: 0;
  border: 7px solid transparent;
}
.cue-line::before { left: 0; border-left-color: var(--accent); border-right: 0; }
.cue-line::after  { right: 0; border-right-color: var(--accent); border-left: 0; }

.prompter-controls {
  display: flex; gap: 12px; align-items: center; justify-content: center;
  margin-top: 16px;
}

.shortcuts {
  display: flex; flex-wrap: wrap; gap: 18px; justify-content: center;
  margin-top: 14px; color: var(--fg-subtle); font-size: 13px;
}
.kbd {
  display: inline-block; padding: 1px 7px; background: var(--bg-elev-2); color: var(--fg);
  border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px;
  font-family: 'SFMono-Regular', ui-monospace, Consolas, monospace; font-size: 12px;
  margin: 0 2px;
}

/* fullscreen */
.prompter-stage:fullscreen { border-radius: 0; border: 0; }
.prompter-stage:fullscreen .prompter-viewport { height: 100vh; }
.prompter-stage:-webkit-full-screen { border-radius: 0; border: 0; }

/* Guarantee floating controls are visible and correctly dimmed inside native
   desktop fullscreen. Some browsers scope fixed-position descendants to the
   fullscreen element, so we re-assert the focus-mode rules here. */
.prompter-stage:fullscreen .floating-controls,
.prompter-stage:-webkit-full-screen .floating-controls { display: grid; opacity: 1; }
.prompter-stage:fullscreen .fc-speed-badge,
.prompter-stage:-webkit-full-screen .fc-speed-badge { display: inline-flex; opacity: 1; }
.prompter-stage:fullscreen .focus-exit,
.prompter-stage:-webkit-full-screen .focus-exit { display: inline-flex; opacity: 1; }

/* Idle dim inside fullscreen — same 30% as focus mode */
body.idle .prompter-stage:fullscreen .floating-controls,
body.idle .prompter-stage:-webkit-full-screen .floating-controls { opacity: 0.3; }
body.idle .prompter-stage:fullscreen .fc-speed-badge,
body.idle .prompter-stage:-webkit-full-screen .fc-speed-badge { opacity: 0.3; }
body.idle .prompter-stage:fullscreen .focus-exit,
body.idle .prompter-stage:-webkit-full-screen .focus-exit { opacity: 0.3; }

/* -------------------- FOCUS MODE (distraction-free playing) -------------------- */
/* When body.focus, hide chrome and promote the stage to full-bleed. */
body.focus .topbar,
body.focus .hero,
body.focus .features,
body.focus .site-footer,
body.focus .prompter-toolbar,
body.focus .prompter-controls,
body.focus .shortcuts { display: none !important; }

body.focus {
  background: #000;
  overflow: hidden;
}
body.focus main { padding: 0; }
body.focus .prompter-shell { padding: 0; }
body.focus .prompter-shell.container { max-width: 100%; padding: 0; }
body.focus .prompter-stage {
  border-radius: 0; border: 0; min-height: 100vh;
  background: #000;
}
body.focus .prompter-viewport { height: 100vh; }
/* Prevent double-tap zoom while the prompter is playing */
body.focus .prompter-stage,
body.focus .prompter-viewport { touch-action: manipulation; }

/* =========================================================================
   Focus-mode playback UI — pill bar + progress bar + speed badge
   ========================================================================= */

/* Thin orange progress bar, fixed to the bottom, above the pill */
.fc-progress-track {
  position: fixed; left: 0; right: 0; bottom: 0;
  height: 3px;
  background: rgba(255,255,255,.08);
  z-index: 88;
  display: none;
}
body.focus .fc-progress-track { display: block; }
.fc-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #FF9F0A 0%, #FF6B00 100%);
  box-shadow: 0 0 16px rgba(255,122,0,.55);
  transition: width .12s linear;
}

/* Speed percentage pill ("152% ✎") floating above the control bar */
.fc-speed-badge {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  display: none; align-items: center; gap: 6px;
  padding: 6px 14px;
  background: rgba(28,28,30,.9);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  font-size: 13px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  cursor: pointer;
  z-index: 91;
  opacity: 0;
  transition: opacity .25s var(--ease), background .15s var(--ease);
}
body.focus .fc-speed-badge { display: inline-flex; opacity: 1; }
body.focus.idle .fc-speed-badge { opacity: 0.3; }
.fc-speed-badge:hover { background: var(--bg-elev-2); }
.fc-speed-badge svg { opacity: .55; }

/* Main pill bar */
.floating-controls {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  display: none;
  grid-template-columns: minmax(180px, 220px) auto auto;
  gap: 10px;
  align-items: center;
  background: rgba(14,16,20,.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 26px;
  box-shadow: 0 12px 36px rgba(0,0,0,.6);
  z-index: 90;
  opacity: 0;
  transition: opacity .25s var(--ease);
  max-width: calc(100vw - 24px);
}
body.focus .floating-controls { display: grid; opacity: 1; }
body.focus.idle .floating-controls { opacity: 0.3; }

.fc-zone {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 56px;
  padding: 0 10px;
  border-radius: 18px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
}
.fc-zone-speed {
  justify-content: flex-start;
  gap: 10px;
  padding: 0 14px;
}

.fc-divider { display: none; }

.fc-btn {
  background: transparent; color: var(--fg);
  border: 0; cursor: pointer;
  width: 44px; height: 44px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s var(--ease), transform .08s var(--ease);
  padding: 0;
}
.fc-btn:hover { background: rgba(255,255,255,.08); }
.fc-btn:active { transform: scale(.94); }
.fc-btn.primary {
  background: var(--fg); color: #000; width: 48px; height: 48px;
  box-shadow: 0 4px 14px rgba(255,255,255,.15);
}
.fc-btn.primary:hover { background: #f0f0f0; }
.fc-btn.fc-btn-stop { color: var(--danger); }
.fc-btn.fc-btn-stop:hover { background: rgba(255,55,95,.15); }
.fc-btn.fc-btn-aa { position: relative; }
.fc-aa {
  font-weight: 700; font-size: 16px; line-height: 1; color: var(--fg);
  display: inline-flex; align-items: baseline; gap: 1px;
}
.fc-aa span { font-size: 11px; }

/* Walker / runner glyphs */
.fc-mini {
  background: transparent; color: var(--fg-muted);
  border: 0; cursor: pointer;
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  transition: color .15s var(--ease), background .15s var(--ease);
  flex: none;
  padding: 0;
}
.fc-mini:hover { color: var(--fg); background: rgba(255,255,255,.06); }

/* Custom speed slider on the pill */
.fc-speed-slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 24px; background: transparent;
}
.fc-speed-slider::-webkit-slider-runnable-track {
  height: 4px; background: rgba(255,255,255,.18); border-radius: 2px;
}
.fc-speed-slider::-moz-range-track {
  height: 4px; background: rgba(255,255,255,.18); border-radius: 2px;
}
.fc-speed-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; margin-top: -6px; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.5);
}
.fc-speed-slider::-moz-range-thumb {
  width: 16px; height: 16px; border: 0; border-radius: 50%; background: #fff;
  cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.5);
}

/* Slide-up settings panel */
.fc-panel {
  position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%);
  width: min(420px, calc(100vw - 24px));
  background: rgba(28,28,30,.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.7);
  padding: 18px 20px;
  z-index: 92;
  animation: fc-panel-in .22s var(--ease);
}
@keyframes fc-panel-in { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translate(-50%, 0); } }
.fc-panel-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px;
}
.fc-panel-head h3 { font-size: 15px; margin: 0; }
.fc-panel-close {
  background: transparent; color: var(--fg-muted); border: 0; cursor: pointer;
  width: 30px; height: 30px; border-radius: 50%; font-size: 16px;
}
.fc-panel-close:hover { background: rgba(255,255,255,.08); color: var(--fg); }
.fc-panel-row { margin-bottom: 14px; display: flex; flex-direction: column; gap: 8px; }
.fc-panel-row .toggle + .toggle { margin-top: 4px; }
.fc-panel-row input[type="range"] { width: 100%; }

/* Exit focus button, top-right */
.focus-exit {
  position: fixed; top: 14px; right: 14px;
  display: none;
  background: rgba(28,28,30,.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--fg); border: 1px solid var(--border);
  width: 42px; height: 42px; border-radius: 50%;
  font-size: 18px; cursor: pointer;
  z-index: 91;
  align-items: center; justify-content: center;
  transition: opacity .25s var(--ease), background .15s var(--ease);
}
body.focus .focus-exit { display: inline-flex; opacity: 1; }
body.focus.idle .focus-exit { opacity: 0.3; }
.focus-exit:hover { background: var(--bg-elev-2); }

/* save modal / tiny toast */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: rgba(28,28,30,.96);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  color: var(--fg); border: 1px solid rgba(255,255,255,.12);
  padding: 12px 20px; border-radius: var(--r-pill);
  box-shadow: 0 8px 32px rgba(0,0,0,.6);
  z-index: 100; font-size: 14px; font-weight: 500;
  animation: toast-in .22s var(--ease-spring);
  white-space: nowrap;
}
.toast.error { border-color: rgba(255,55,95,.4); background: rgba(40,10,18,.96); }
.toast.success { border-color: rgba(50,215,75,.35); background: rgba(8,32,14,.96); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

.modal-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  align-items: center; justify-content: center;
  z-index: 80; padding: 20px;
}
.modal-backdrop:not([hidden]) { display: flex; animation: fade-in var(--dur-norm) var(--ease-out) both; }
.modal {
  background: rgba(28,28,30,.96);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 24px; padding: 28px;
  max-width: 480px; width: 100%;
  box-shadow: 0 2px 0 rgba(255,255,255,.06) inset, 0 32px 80px rgba(0,0,0,.7);
  animation: panel-up var(--dur-slow) var(--ease-spring) both;
}
.modal h3 { margin-top: 0; letter-spacing: -.02em; }

/* File upload helper — visually hidden input */
.file-hidden { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* -------------------- feature row -------------------- */
.features {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
  margin: 56px 0 28px;
}
.feature {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 22px; padding: 26px 24px;
  transition: border-color var(--dur-norm), transform var(--dur-norm) var(--ease-spring),
              box-shadow var(--dur-norm);
  box-shadow: 0 1px 0 rgba(255,255,255,.04) inset;
}
.feature:hover {
  border-color: rgba(255,255,255,.15); transform: translateY(-3px);
  box-shadow: 0 1px 0 rgba(255,255,255,.06) inset, 0 16px 36px rgba(0,0,0,.45);
}
.feature .icon {
  width: 40px; height: 40px; border-radius: 12px;
  background: rgba(10,132,255,.2); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; margin-bottom: 14px;
  box-shadow: 0 0 16px rgba(10,132,255,.2);
}
.feature h3 { font-size: 16px; margin-bottom: 6px; letter-spacing: -.01em; }
.feature p { font-size: 14px; margin: 0; color: rgba(255,255,255,.5); line-height: 1.6; }

/* -------------------- auth pages -------------------- */
.auth-wrap {
  min-height: calc(100vh - 60px); display: flex; align-items: center; justify-content: center;
  padding: 40px 20px;
  background: radial-gradient(ellipse 70% 60% at 50% 0%, rgba(10,132,255,.08), transparent);
}
.auth-card {
  width: 100%; max-width: 420px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 28px; padding: 36px 32px;
  box-shadow: 0 2px 0 rgba(255,255,255,.05) inset, 0 32px 80px rgba(0,0,0,.6);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
}
.auth-card h1 { font-size: 26px; text-align: center; margin-bottom: 28px; letter-spacing: -.03em; }
.auth-card .muted-center { text-align: center; color: rgba(255,255,255,.4); font-size: 14px; margin-top: 20px; }

/* -------------------- my-scripts (gallery + list) -------------------- */
.scripts-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin: 28px 0 18px; flex-wrap: wrap;
}
.scripts-head h1 { font-size: 28px; margin: 0; }
.scripts-search {
  position: relative; flex: 1; min-width: 200px; max-width: 420px;
}
.scripts-search input {
  width: 100%; padding: 10px 14px 10px 38px;
  background: var(--bg-elev); color: var(--fg); border: 1px solid var(--border);
  border-radius: var(--r); font: inherit; font-size: 14px;
}
.scripts-search input:focus { outline: none; border-color: var(--accent); box-shadow: var(--sh-focus); }
.scripts-search::before {
  content: ''; position: absolute; left: 12px; top: 50%; width: 16px; height: 16px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23D4D4D4'><path d='M15.5 14h-.79l-.28-.27a6.51 6.51 0 0 0 1.48-5.34C15.22 5.1 12.47 2.5 9.1 2.5S3 5.1 3 8.5 5.75 14.5 9.1 14.5c1.61 0 3.1-.58 4.24-1.57l.27.28v.79l5 5L20 17.5l-4.5-3.5zm-6.4 0a4.5 4.5 0 1 1 0-9 4.5 4.5 0 0 1 0 9z'/></svg>") no-repeat center/contain;
  transform: translateY(-50%);
}
.scripts-view-toggle {
  display: inline-flex; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden;
  background: var(--bg-elev);
}
.scripts-view-toggle button {
  background: transparent; color: var(--fg-muted); border: 0;
  padding: 8px 14px; cursor: pointer; font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
}
.scripts-view-toggle button.active { background: var(--bg-elev-2); color: var(--fg); }
.scripts-view-toggle button + button { border-left: 1px solid var(--border); }
.scripts-view-toggle svg { width: 16px; height: 16px; }

/* GALLERY view */
.scripts-gallery {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}
.tile {
  display: flex; flex-direction: column; gap: 10px;
  position: relative; cursor: pointer; min-width: 0;
}
.tile-card {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(44,44,46,.9) 0%, rgba(28,28,30,.95) 100%);
  padding: 18px 16px;
  overflow: hidden;
  color: rgba(255,255,255,.8);
  box-shadow: 0 1px 0 rgba(255,255,255,.06) inset, 0 12px 32px rgba(0,0,0,.55);
  transition: transform var(--dur-norm) var(--ease-spring),
              box-shadow var(--dur-norm) var(--ease-out);
  border: 1px solid rgba(255,255,255,.09);
}
.tile:hover .tile-card {
  transform: translateY(-5px) scale(1.01);
  box-shadow: 0 1px 0 rgba(255,255,255,.08) inset, 0 24px 48px rgba(0,0,0,.7);
  border-color: rgba(255,255,255,.15);
}
.tile-card .tile-preview {
  font-family: var(--f-prompter); font-size: 11px; line-height: 1.5;
  color: rgba(255,255,255,.45);
  white-space: pre-wrap; word-break: break-word;
  overflow: hidden;
  mask-image: linear-gradient(180deg, rgba(255,255,255,.9) 0%, rgba(255,255,255,.7) 60%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, rgba(255,255,255,.9) 0%, rgba(255,255,255,.7) 60%, transparent 100%);
  height: 100%;
}
.tile-meta-overlay {
  position: absolute; left: 12px; bottom: 10px; right: 12px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 10px; color: rgba(255,255,255,.3);
  font-weight: 600; letter-spacing: .03em;
}
.tile-title {
  font-size: 14px; font-weight: 600; color: var(--fg); letter-spacing: -.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tile-title-add { color: rgba(255,255,255,.92); }
.tile-sub { font-size: 11px; color: rgba(255,255,255,.35); }
.tile-menu {
  position: absolute; top: 8px; right: 8px;
  width: 30px; height: 30px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.5); color: rgba(255,255,255,.7); border: 0; cursor: pointer;
  opacity: 0; transition: opacity var(--dur-fast), background var(--dur-fast);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.tile:hover .tile-menu { opacity: 1; }
.tile-menu:hover { background: rgba(0,0,0,.8); color: #fff; }
.tile-menu-pop {
  position: absolute; top: 40px; right: 8px;
  background: rgba(28,28,30,.96);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,.1); border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0,0,0,.7);
  min-width: 160px; padding: 8px; z-index: 10;
  animation: dropdown-pop var(--dur-norm) var(--ease-spring);
}
.tile-menu-pop button {
  display: block; width: 100%; text-align: left;
  background: transparent; color: rgba(255,255,255,.85); border: 0; cursor: pointer;
  padding: 9px 13px; border-radius: 10px; font-size: 14px;
  transition: background var(--dur-fast);
}
.tile-menu-pop button:hover { background: rgba(255,255,255,.1); }
.tile-menu-pop button.danger { color: var(--danger); }

/* Add-new tile */
.tile-add .tile-card {
  background: linear-gradient(145deg, rgba(20,34,54,.92) 0%, rgba(13,20,31,.96) 100%);
  border: 1px solid rgba(111,178,255,.22);
  box-shadow: 0 1px 0 rgba(255,255,255,.05) inset, 0 12px 32px rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.9);
  transition: border-color var(--dur-norm), color var(--dur-norm),
              transform var(--dur-norm) var(--ease-spring);
}
.tile-add:hover .tile-card {
  border-color: rgba(111,178,255,.5); color: #fff;
  transform: translateY(-4px);
  box-shadow: 0 1px 0 rgba(255,255,255,.06) inset, 0 24px 48px rgba(7,48,92,.22);
}
.tile-add .tile-plus {
  font-size: 52px; font-weight: 200; line-height: 1;
}
.tile-add-copy {
  position: absolute;
  left: 16px; right: 16px; bottom: 16px;
  display: flex; flex-direction: column; gap: 3px;
  color: rgba(255,255,255,.92);
}
.tile-add-copy strong {
  font-size: 15px; letter-spacing: -.02em;
}
.tile-add-copy span {
  font-size: 12px; color: rgba(255,255,255,.56);
}

/* LIST view */
.scripts-list {
  display: flex; flex-direction: column; gap: 8px;
}
.list-row {
  display: grid; grid-template-columns: 1fr auto auto;
  gap: 14px; align-items: center;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 18px; padding: 16px 18px;
  transition: border-color var(--dur-fast), background var(--dur-fast),
              transform var(--dur-fast) var(--ease-spring);
}
.list-row:hover {
  border-color: rgba(10,132,255,.4); background: rgba(10,132,255,.04);
  transform: translateX(3px);
}
.list-row h3 {
  font-size: 15px; margin: 0 0 6px; letter-spacing: -.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.list-row .preview {
  color: rgba(255,255,255,.42); font-size: 13px; margin: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.45;
}
.list-row .meta { color: rgba(255,255,255,.3); font-size: 12px; white-space: nowrap; }
.list-row .actions { display: flex; gap: 6px; }
.list-row-main {
  min-width: 0;
}
.list-row-add {
  border-style: solid;
  border-color: rgba(111,178,255,.22);
  background: linear-gradient(145deg, rgba(20,34,54,.9), rgba(13,20,31,.95));
}
.list-row-icon {
  width: 36px; height: 36px;
  border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(111,178,255,.14);
  color: #9dccff;
  font-size: 28px; line-height: 1;
  flex: none;
}
.list-row-add .list-row-main {
  display: flex;
  align-items: center;
  gap: 12px;
}
.list-row-add .btn {
  pointer-events: none;
}

/* -------------------- speaker swatches -------------------- */
.speaker-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--r);
  padding: 8px 10px;
}
.speaker-name {
  flex: 1; min-width: 0;
  background: transparent; border: 0; color: var(--fg);
  font: inherit; font-size: 14px; padding: 4px 0; outline: none;
  overflow: hidden; text-overflow: ellipsis;
}
.speaker-name:focus { outline: none; }
.speaker-swatches { display: flex; gap: 4px; flex-wrap: nowrap; }
.speaker-swatch {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid transparent; cursor: pointer;
  padding: 0; background-clip: padding-box;
  transition: transform .12s var(--ease), border-color .12s var(--ease);
}
.speaker-swatch:hover { transform: scale(1.1); }
.speaker-swatch.selected { border-color: var(--fg); }
.speaker-remove {
  background: transparent; border: 0; color: var(--fg-subtle); cursor: pointer;
  width: 26px; height: 26px; border-radius: 50%; font-size: 14px;
}
.speaker-remove:hover { color: var(--danger); background: rgba(255,55,95,.1); }

.empty {
  text-align: center; padding: 80px 20px; color: var(--fg-muted);
  border: 1px dashed var(--border); border-radius: var(--r-lg);
}

/* -------------------- footer -------------------- */
.site-footer {
  border-top: 1px solid rgba(255,255,255,.06);
  margin-top: 80px; padding: 32px 0;
  color: rgba(255,255,255,.3); font-size: 13px;
}
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.footer-inner a { color: rgba(255,255,255,.4); margin-left: 16px; transition: color var(--dur-fast); }
.footer-inner a:hover { color: rgba(255,255,255,.75); text-decoration: none; }

/* -------------------- mobile -------------------- */
@media (max-width: 760px) {
  .topbar {
    top: 0;
    z-index: 120;
    background: #07090d;
    border-bottom: 1px solid rgba(255,255,255,.07);
    box-shadow: 0 1px 0 rgba(255,255,255,.03) inset;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .topbar-inner {
    position: relative;
    height: 52px;
    gap: 12px;
    padding-top: max(0px, env(safe-area-inset-top, 0px));
  }
  .logo {
    gap: 10px;
    font-size: 17px;
    font-weight: 700;
    color: #f5f5f7;
    transition: opacity var(--dur-fast);
  }
  .logo-img {
    width: 26px;
    height: 26px;
    border-radius: 50%;
  }
  .hamburger {
    display: inline-flex;
    width: 40px;
    height: 40px;
    margin-left: auto;
    color: #f5f5f7;
    border-radius: 50%;
    position: relative;
    z-index: 201;
  }
  .hamburger:hover { background: rgba(255,255,255,.08); }
  .hamburger span {
    width: 18px;
    height: 1.6px;
    background: currentColor;
    border-radius: 99px;
  }
  body.nav-open .hamburger span:nth-child(1) {
    transform: translateY(6.6px) rotate(45deg);
  }
  body.nav-open .hamburger span:nth-child(2) {
    opacity: 0;
  }
  body.nav-open .hamburger span:nth-child(3) {
    transform: translateY(-6.6px) rotate(-45deg);
  }

  .nav-overlay {
    display: none !important;
  }
  .nav-drawer-close { display: none !important; }

  .nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding:
      calc(env(safe-area-inset-top, 0px) + 74px)
      24px
      calc(env(safe-area-inset-bottom, 0px) + 28px);
    background: #07090d;
    border: 0;
    transform: none;
    opacity: 1;
    visibility: hidden;
    transition: visibility 0s linear 120ms;
    z-index: 200;
    overflow-y: auto;
    box-shadow: none;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    pointer-events: none;
  }
  body.nav-open .nav {
    visibility: visible;
    transition: none;
    pointer-events: auto;
  }
  body.nav-open .topbar {
    background: #07090d;
    border-bottom-color: rgba(255,255,255,.07);
    box-shadow: 0 1px 0 rgba(255,255,255,.03) inset;
  }
  body.nav-open main,
  body.nav-open .site-footer {
    pointer-events: none;
  }
  body.nav-open .logo { opacity: 1; }

  .nav > a,
  .nav-group-btn {
    width: 100%;
    min-height: 58px;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    color: #f5f5f7;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -.02em;
    text-shadow: none;
    filter: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
  }
  .nav > a:hover,
  .nav-group-btn:hover {
    background: transparent;
    border-color: transparent;
    transform: none;
    color: #fff;
  }
  .nav > a::after {
    content: '';
  }
  .nav > a.primary {
    color: #f5f5f7;
    background: transparent;
    border-color: transparent;
    box-shadow: none;
  }
  .nav > a.primary::after {
    content: '';
  }
  .nav > a.nav-record {
    color: #f5f5f7;
    background: transparent;
  }

  .nav-group {
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid rgba(255,255,255,.08);
  }
  .nav > a {
    border-bottom: 1px solid rgba(255,255,255,.08);
  }
  .nav-group-btn svg {
    width: 15px;
    height: 15px;
    color: rgba(255,255,255,.62);
    opacity: 1;
    transition: transform 180ms ease;
  }
  .nav-group.open .nav-group-btn svg {
    transform: rotate(180deg);
  }
  .nav-dropdown {
    position: static;
    top: auto;
    left: auto;
    transform: none;
    display: none;
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 2px 0 14px 0;
    margin: 0;
    min-width: 0;
    width: 100%;
    border-left: 1px solid rgba(255,255,255,.08);
    margin-left: 8px;
    animation: none;
  }
  .nav-group.open .nav-dropdown {
    display: flex !important;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    opacity: 1;
  }
  .nav-dropdown a {
    display: block;
    width: 100%;
    min-height: 42px;
    padding: 8px 0 8px 22px;
    border-radius: 0;
    background: transparent;
    color: rgba(255,255,255,.72);
    font-size: 16px;
    font-weight: 500;
    line-height: 1.35;
    text-align: left;
    filter: none;
  }
  .nav-dropdown a::after {
    content: '';
  }
  .nav-dropdown a:hover {
    background: transparent;
    color: #fff;
  }

  .user-badge {
    align-self: flex-start;
    max-width: 100%;
    width: fit-content;
    margin: 10px 0 18px;
    padding: 8px 14px;
    border-top: 0;
    color: rgba(245,245,247,.94);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: none;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.25;
    background: rgba(59, 224, 168, 0.12);
    border-radius: 999px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
    border: 1px solid rgba(59, 224, 168, 0.25);
    min-height: auto;
    display: inline-flex;
    align-items: center;
  }
  .user-badge:empty { display: none; }
  .nav-settings-btn,
  #logoutLink[data-auth="required"] {
    width: 100%;
    min-height: 50px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #f5f5f7;
    font-size: 16px;
    font-weight: 500;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  #logoutLink[data-auth="required"]::after {
    content: '';
  }

  .features { grid-template-columns: 1fr; }
  .scripts-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .tile { gap: 8px; }
  .tile-card {
    aspect-ratio: 0.82;
    padding: 14px 12px;
    border-radius: 18px;
  }
  .tile-card .tile-preview {
    font-size: 10px;
    line-height: 1.42;
  }
  .tile-meta-overlay {
    left: 10px; right: 10px; bottom: 10px;
    font-size: 9px;
  }
  .tile-title {
    font-size: 13px;
  }
  .tile-sub {
    font-size: 10px;
  }
  .tile-add .tile-plus {
    font-size: 44px;
  }
  .tile-add-copy {
    left: 12px; right: 12px; bottom: 12px;
  }
  .tile-add-copy strong { font-size: 13px; }
  .tile-add-copy span { font-size: 11px; }
  .scripts-list {
    gap: 10px;
  }
  .list-row {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px;
  }
  .list-row .meta {
    order: 2;
    white-space: normal;
  }
  .list-row .actions {
    order: 3;
    width: 100%;
  }
  .list-row .actions .btn {
    flex: 1;
    min-height: 44px;
  }
  .prompter-toolbar { gap: 10px; padding: 10px; }
  .toolbar-group input[type="range"] { width: 90px; }
  .hero { padding: 40px 0 20px; }
  .script-textarea { font-size: 16px; padding: 16px; }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ============================================================
   v7 — Projects + Folders + Invite
   ============================================================ */
.crumbs {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--fg-muted);
  margin: 12px 0 18px;
}
.crumbs a { color: var(--fg-muted); }
.crumbs a:hover { color: var(--accent); }
.crumbs span { color: var(--fg-subtle); }

/* Projects grid on /projects.html */
.projects-grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.project-card {
  display: flex; flex-direction: column;
  padding: 22px; border-radius: 20px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  color: var(--fg); text-decoration: none;
  transition: transform var(--dur-norm) var(--ease-spring),
              border-color var(--dur-norm), box-shadow var(--dur-norm);
  min-height: 160px;
  box-shadow: 0 1px 0 rgba(255,255,255,.04) inset;
}
.project-card:hover {
  transform: translateY(-4px);
  border-color: rgba(10,132,255,.4);
  background: rgba(10,132,255,.04);
  box-shadow: 0 1px 0 rgba(255,255,255,.06) inset, 0 16px 40px rgba(0,0,0,.5);
  text-decoration: none;
}
.project-role {
  display: inline-block; align-self: flex-start;
  font-size: 11px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(10, 132, 255, 0.12);
  padding: 3px 8px; border-radius: 999px;
  margin-bottom: 10px;
}
.project-name {
  font-size: 18px; font-weight: 700; margin: 0 0 6px;
  color: var(--fg);
}
.project-desc {
  color: var(--fg-muted); font-size: 14px; line-height: 1.5;
  flex: 1; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.project-meta {
  display: flex; gap: 8px; align-items: center;
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px; color: var(--fg-muted);
}

/* Single project page */
.project-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 18px 0 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.project-head h1 { margin: 0 0 4px; font-size: 28px; line-height: 1.15; }
.project-head .subtle { color: var(--fg-muted); margin: 0; font-size: 14px; }
.project-head-actions {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}

.project-layout {
  display: grid; gap: 24px;
  grid-template-columns: 260px 1fr;
  align-items: flex-start;
}
.folders-pane {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px;
  position: sticky; top: 78px;
}
.folders-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
}
.folders-head h3 { font-size: 13px; color: var(--fg-subtle); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; margin: 0; }
.folders-head .btn { padding: 4px 10px; font-size: 16px; line-height: 1; }
.folder-list { list-style: none; padding: 0; margin: 0; }
.folder-item {
  display: flex; align-items: center;
  border-radius: var(--r-sm);
}
.folder-item.active { background: rgba(10,132,255,0.12); }
.folder-item.active .folder-name { color: var(--fg); }
.folder-btn {
  flex: 1;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; background: transparent; border: 0; color: var(--fg-muted);
  text-align: left; cursor: pointer; font-size: 14px; border-radius: var(--r-sm);
  min-width: 0;
}
.folder-btn:hover { color: var(--fg); background: var(--bg-elev-2); }
.folder-ico { flex: none; }
.folder-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-count { color: var(--fg-subtle); font-size: 12px; }
.folder-menu {
  background: transparent; border: 0; color: var(--fg-muted);
  padding: 6px 8px; cursor: pointer; border-radius: var(--r-sm);
  font-size: 16px;
}
.folder-menu:hover { background: var(--bg-elev-2); color: var(--fg); }

.scripts-pane { min-width: 0; }

.row-sub {
  display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px;
}
.row-chip {
  display: inline-block; font-size: 11px;
  background: var(--bg-elev-2); color: var(--fg-muted);
  padding: 2px 8px; border-radius: 999px;
}
.folder-picker {
  padding: 6px 10px; font-size: 13px; max-width: 160px;
}

/* Modals */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.65);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--r-lg);
  max-width: 520px; width: 100%;
  max-height: 90vh; overflow: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-close {
  background: transparent; border: 0; color: var(--fg-muted);
  font-size: 18px; cursor: pointer; padding: 4px 10px;
  border-radius: var(--r-sm);
}
.modal-close:hover { background: var(--bg-elev-2); color: var(--fg); }
.modal-body { padding: 20px; }

.member-list { list-style: none; padding: 0; margin: 0; }
.member-row {
  display: grid; grid-template-columns: 40px 1fr auto;
  gap: 12px; align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.member-row:last-child { border-bottom: 0; }
.member-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
}
.member-name { font-weight: 600; color: var(--fg); font-size: 14px; }
.member-email { font-size: 12px; color: var(--fg-muted); }
.member-date { font-size: 12px; color: var(--fg-subtle); }
.member-badge {
  font-size: 10px; background: rgba(10,132,255,0.18); color: var(--accent);
  padding: 1px 6px; border-radius: 999px; font-weight: 700;
  letter-spacing: .05em; margin-left: 6px;
}

/* Join page */
.join-card {
  text-align: center; padding: 32px 28px;
}
.join-card h1 { font-size: 26px; margin: 0; }
.join-card .subtle { color: var(--fg-muted); }
.join-ico {
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(10,132,255,0.12); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; margin: 0 auto 12px;
}

/* Invite banner on login/signup */
.invite-banner {
  background: rgba(10,132,255,0.12);
  border: 1px solid rgba(10,132,255,0.3);
  color: var(--fg);
  padding: 10px 14px; border-radius: var(--r-sm);
  margin-bottom: 18px; font-size: 14px;
}

/* Admin projects table */
.admin-projects-table {
  width: 100%; border-collapse: collapse;
  font-size: 14px;
}
.admin-projects-table th {
  text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border);
  color: var(--fg-subtle); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
}
.admin-projects-table td {
  padding: 12px; border-bottom: 1px solid var(--border); color: var(--fg);
  vertical-align: middle;
}
.admin-projects-table .invite-cell {
  display: flex; gap: 6px; align-items: center;
  max-width: 280px;
}
.admin-projects-table .invite-cell input {
  flex: 1; min-width: 0; font-size: 12px; padding: 6px 8px;
}

/* Save-to-project picker inside the Save modal */
.save-target {
  display: grid; gap: 10px; margin-top: 10px;
  grid-template-columns: 1fr 1fr;
}
.save-target .field { margin: 0; }
@media (max-width: 520px) { .save-target { grid-template-columns: 1fr; } }

@media (max-width: 760px) {
  .project-layout { grid-template-columns: 1fr; }
  .folders-pane { position: static; }
  .project-head { flex-direction: column; align-items: stretch; }
  .project-head-actions { justify-content: flex-start; }
}

/* Project speakers modal */
.speakers-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.speaker-row-p {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.speaker-name-p {
  font-weight: 600; font-size: 15px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.speaker-add-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.speaker-add-row .speaker-swatches { flex: 0 0 auto; }
.speaker-add-row .input { min-width: 140px; }

/* ---- v7.2 additions: user badge, countdown overlay, fullscreen toggle --- */

/* Small pill in the top nav showing the signed-in user's name. Hidden when
   the element is empty (auth loading / logged-out) so it doesn't leave an
   empty gap in the nav. */
.user-badge {
  display: inline-flex; align-items: center;
  max-width: 180px;
  padding: 4px 10px;
  margin: 0 2px;
  border-radius: 999px;
  background: rgba(59, 224, 168, 0.12);
  color: var(--fg);
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border: 1px solid rgba(59, 224, 168, 0.25);
}
.user-badge:empty { display: none; }
@media (max-width: 640px) {
  .topbar .user-badge { max-width: 110px; font-size: 12px; padding: 3px 8px; }
  .nav .user-badge {
    max-width: 100%;
    font-size: 13px;
    padding: 8px 14px;
  }
}

/* Countdown overlay — covers the viewport with a huge number + "Action!" */
.prompter-stage { position: relative; }
.countdown-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(4px);
  z-index: 30;
  cursor: pointer;
  user-select: none;
}
.countdown-overlay[hidden] { display: none; }
.countdown-num {
  font-size: clamp(120px, 28vw, 360px);
  font-weight: 800;
  line-height: 1;
  color: #3BE0A8;
  text-shadow: 0 4px 60px rgba(59, 224, 168, 0.45);
  animation: countdown-pop 900ms ease-out forwards;
}
.countdown-num.action {
  color: #FF9F0A;
  font-size: clamp(80px, 18vw, 220px);
  text-shadow: 0 4px 80px rgba(255, 159, 10, 0.55);
  letter-spacing: 2px;
}
.countdown-hint {
  color: rgba(255, 255, 255, 0.55);
  font-size: 14px; letter-spacing: 1px; text-transform: uppercase;
}
@keyframes countdown-pop {
  0%   { transform: scale(0.6); opacity: 0; }
  25%  { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1);   opacity: 1; }
}
/* Hide the overlay's cursor-hint caption when in native fullscreen on desktop
   so nothing distracts the reader. */
.prompter-stage:fullscreen .countdown-hint { display: none; }

/* ============================================================
   v7.3 — Mobile-friendly floating controls + speed icon
   ============================================================ */

/* Walk/run icon span — changes SVG with speed zone. Decorative; flush-left in speed zone. */
.fc-speed-icon {
  color: rgba(255,255,255,.55);
  flex: none;
  margin-right: 2px;
  display: inline-flex;
  align-items: center;
}
.fc-speed-icon svg { transition: opacity .2s; }

/* Mobile redesign of the floating pill. The pill used to be a single crowded
   row with 9+ hit-targets; on phones that left each button ~32–38 px wide
   (below Apple's 44 pt guideline) and pushed the speed slider into a tiny
   sliver. The new layout stacks the speed slider on its own row above the
   buttons so the slider gets real travel distance and every button reaches a
   comfortable 48 px. */
@media (max-width: 760px) {
  .prompter-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    padding: 12px;
  }
  .toolbar-block {
    padding: 12px;
    border-radius: 18px;
  }
  .toolbar-block-sliders {
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
  }
  .toolbar-block-toggles {
    grid-template-columns: 1fr 1fr;
    gap: 4px 14px;
    padding: 0;
    border: 0;
    background: transparent;
  }
  .toolbar-block-actions {
    gap: 12px;
  }
  .toolbar-play-row .btn-primary {
    width: 100%;
    min-height: 52px;
  }
  .toolbar-action-utility {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }
  .toolbar-action-utility .btn {
    min-height: 44px;
    font-size: 13px;
    padding: 10px 8px;
  }
  .toolbar-mobile-reset-slot {
    margin-top: 2px;
  }
  .toolbar-mobile-reset-slot .btn,
  .toolbar-mobile-speakers-slot .btn {
    min-height: 40px;
    font-size: 13px;
    padding: 8px 14px;
    border-radius: 999px;
  }
  .toolbar-mobile-reset-slot .btn {
    opacity: 0.82;
  }
  .toolbar-mobile-speakers-slot .btn {
    opacity: 0.8;
    background: rgba(255,255,255,.02);
    border-color: rgba(255,255,255,.08);
  }
  .toolbar-block-toggles .toggle {
    min-height: 42px;
  }
  .toolbar-block-toggles .toggle span:last-child {
    line-height: 1.25;
  }
  .floating-controls {
    grid-template-columns: 1fr;
    bottom: max(14px, env(safe-area-inset-bottom, 14px));
    padding: 12px;
    gap: 8px;
    width: calc(100vw - 16px);
    max-width: 520px;
    border-radius: 24px;
  }
  .floating-controls .fc-zone-speed {
    width: 100%;
    gap: 10px;
    padding: 0 12px;
  }
  .floating-controls .fc-speed-slider { height: 32px; }
  .floating-controls .fc-speed-slider::-webkit-slider-runnable-track { height: 6px; }
  .floating-controls .fc-speed-slider::-moz-range-track { height: 6px; }
  .floating-controls .fc-speed-slider::-webkit-slider-thumb {
    width: 22px; height: 22px; margin-top: -8px;
  }
  .floating-controls .fc-speed-slider::-moz-range-thumb {
    width: 22px; height: 22px;
  }
  .floating-controls .fc-zone {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }
  .floating-controls .fc-btn { width: 48px; height: 48px; }
  .floating-controls .fc-btn.primary {
    width: 56px; height: 56px;
    box-shadow: 0 6px 18px rgba(255,255,255,.18);
  }
  .floating-controls .fc-btn svg { width: 24px; height: 24px; }
  .floating-controls .fc-btn.primary svg { width: 26px; height: 26px; }
  .floating-controls .fc-aa { font-size: 18px; }
  .floating-controls .fc-aa span { font-size: 12px; }
  .fc-panel { bottom: 128px; }
  .fc-speed-badge { bottom: 150px; font-size: 14px; padding: 6px 12px; }
  .focus-exit { top: max(12px, env(safe-area-inset-top, 12px)); right: 12px; }
}

/* Extra-narrow phones: drop one decorative button so the row fits without wrapping */
@media (max-width: 380px) {
  .toolbar-block-sliders {
    grid-template-columns: 1fr;
  }
  .toolbar-primary-actions {
    grid-template-columns: 1fr 1fr;
  }
  .floating-controls .fc-btn { width: 44px; height: 44px; }
  .floating-controls .fc-btn.primary { width: 52px; height: 52px; }
  .floating-controls .fc-zone { gap: 4px; }
}

/* ============================================================
   Record Your Video page  (record.html)
   ============================================================ */

.record-page {
  position: relative;
  height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 10%, rgba(74, 144, 226, .18), transparent 32%),
    radial-gradient(circle at 18% 100%, rgba(255, 74, 105, .16), transparent 30%),
    #020304;
}
.record-page::before,
.record-page::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}
.record-page::before {
  background:
    radial-gradient(circle at 50% 18%, transparent 0%, transparent 16%, rgba(0,0,0,.12) 38%, rgba(0,0,0,.48) 100%),
    linear-gradient(180deg, rgba(1,3,7,.1) 0%, rgba(1,3,7,.3) 48%, rgba(1,3,7,.7) 100%);
}
.record-page::after {
  background: linear-gradient(180deg, rgba(255,255,255,.04), transparent 18%, transparent 82%, rgba(255,255,255,.03));
  mix-blend-mode: screen;
  opacity: .55;
}

.rec-camera {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1) scale(1.03);
  transform-origin: center center;
  z-index: var(--z-camera);
  background: #050608;
  filter: saturate(1.08) contrast(1.03) brightness(.95);
  transition: filter var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
}
.record-page[data-state="setup"] .rec-camera {
  filter: saturate(1) contrast(1.02) brightness(.84);
}
.record-page[data-state="countdown"] .rec-camera {
  filter: saturate(1.12) contrast(1.05) brightness(.96);
}
.record-page[data-state="recording"] .rec-camera {
  filter: saturate(1.16) contrast(1.08) brightness(.98);
}
.record-page[data-state="review"] .rec-camera {
  filter: saturate(.78) contrast(1.02) brightness(.42) blur(12px);
  transform: scaleX(-1) scale(1.08);
}

.rec-topbar,
.rec-script-viewport,
.rec-setup-panel,
.rec-review-panel,
.rec-recording-hud,
.rec-countdown,
.rec-permission-wall {
  transition:
    opacity var(--dur-norm) var(--ease-out),
    transform var(--dur-norm) var(--ease-out),
    filter var(--dur-norm) var(--ease-out);
}

.rec-topbar {
  position: fixed;
  top: calc(var(--sat) + 14px);
  left: 50%;
  width: min(1100px, calc(100vw - 24px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: var(--z-topbar);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -10px);
}
.rec-topbar.is-active {
  opacity: 1;
  transform: translate(-50%, 0);
}
.rec-topbar > * { pointer-events: auto; }
.rec-back-btn,
.rec-page-title,
.rec-topbar > span:last-child {
  min-height: 48px;
  backdrop-filter: blur(24px) saturate(170%);
  -webkit-backdrop-filter: blur(24px) saturate(170%);
  border: 1px solid rgba(255,255,255,.11);
  background: rgba(10, 12, 16, .48);
  box-shadow: 0 18px 44px rgba(0,0,0,.32);
}
.rec-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  border-radius: 999px;
  color: rgba(255,255,255,.95);
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
  transition:
    transform var(--dur-fast) var(--ease-spring),
    background var(--dur-fast),
    border-color var(--dur-fast),
    box-shadow var(--dur-fast);
}
.rec-back-btn:hover {
  background: rgba(18, 23, 31, .68);
  border-color: rgba(255,255,255,.16);
  transform: translateY(-1px);
}
.rec-page-title,
.rec-topbar > span:last-child {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
}
.rec-page-title {
  padding: 0 18px;
  color: rgba(255,255,255,.88);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.rec-topbar > span:last-child {
  width: 90px;
}

.rec-script-viewport {
  position: fixed;
  z-index: var(--z-script);
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
}
.rec-script-viewport.is-active {
  opacity: 1;
}
.rec-script-viewport::after {
  content: 'Hold';
  position: absolute;
  right: 18px;
  bottom: 18px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(5,7,11,.72);
  border: 1px solid rgba(255,255,255,.14);
  color: rgba(255,255,255,.76);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity var(--dur-fast), transform var(--dur-fast);
}
.record-page.is-scroll-held .rec-script-viewport::after {
  opacity: 1;
  transform: translateY(0);
}
.rec-script-top-fade,
.rec-script-bottom-fade,
.rec-cue-line {
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
}
.rec-script-top-fade {
  top: 0;
  height: 30%;
  z-index: 3;
  background: linear-gradient(180deg, rgba(2,4,8,.88) 0%, rgba(2,4,8,.5) 52%, transparent 100%);
}
.rec-script-bottom-fade {
  bottom: 0;
  height: 36%;
  z-index: 3;
  background: linear-gradient(0deg, rgba(2,4,8,.88) 0%, rgba(2,4,8,.46) 48%, transparent 100%);
}
.rec-cue-line {
  top: 42%;
  left: 7%;
  right: 7%;
  height: 2px;
  z-index: 4;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.16) 14%, rgba(255,255,255,.45) 50%, rgba(255,255,255,.16) 86%, transparent);
  box-shadow: 0 0 18px rgba(255,255,255,.12);
}
.rec-script-content {
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  padding: 0 8%;
  z-index: 2;
  will-change: transform;
  font-size: var(--rec-font-size, 52px);
  line-height: var(--rec-line-height, 1.34);
}
.rec-script-content .ln {
  display: block;
  font-family: var(--f-prompter);
  font-weight: 700;
  font-size: 1em;
  line-height: inherit;
  color: #fff;
  text-shadow: 0 14px 36px rgba(0,0,0,.9), 0 2px 10px rgba(0,0,0,.82);
}
.rec-script-content .speaker-tag {
  opacity: .58;
  font-size: .72em;
  font-weight: 700;
  letter-spacing: .03em;
}

.rec-recording-hud {
  position: fixed;
  inset: 0;
  z-index: var(--z-hud);
  display: flex;
  flex-direction: column;
  pointer-events: none;
  opacity: 0;
}
.rec-recording-hud.is-active {
  opacity: 1;
}
.rec-recording-hud > * { pointer-events: auto; }

.rec-hud-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: calc(var(--z-hud-top) + 2);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: calc(var(--sat) + 18px) 18px 0;
  pointer-events: none;
}
.rec-indicator,
.rec-hud-pause {
  pointer-events: auto;
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  background: rgba(7, 10, 14, .58);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 18px 44px rgba(0,0,0,.34);
}
.rec-indicator {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 18px;
  border-radius: 999px;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.rec-indicator.is-paused {
  color: rgba(255,213,79,.96);
}
.rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff453a;
  flex-shrink: 0;
  box-shadow: 0 0 0 6px rgba(255,69,58,.13);
  animation: rec-pulse 1.2s ease-in-out infinite;
}
@keyframes rec-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .28; transform: scale(.76); }
}
.rec-hud-pause {
  position: fixed;
  top: calc(var(--sat) + 18px);
  right: 18px;
  min-height: 50px;
  padding: 0 18px;
  border-radius: 999px;
  color: rgba(255,255,255,.94);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    transform var(--dur-fast) var(--ease-spring),
    background var(--dur-fast),
    border-color var(--dur-fast),
    color var(--dur-fast);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.rec-hud-pause:hover {
  transform: translateY(-1px);
  background: rgba(14, 19, 27, .76);
}
.rec-hud-pause.paused {
  color: #ffd659;
  background: rgba(61, 47, 8, .62);
  border-color: rgba(255,214,89,.26);
}
.rec-hud-pause svg { flex-shrink: 0; }

.rec-hud-middle {
  flex: 1;
  pointer-events: none;
}

.rec-hud-bottom {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: calc(var(--z-hud-top) + 1);
  width: min(540px, calc(100vw - 24px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 58px 0 calc(var(--sab) + 16px);
  transform: translateX(-50%);
}
.rec-hud-bottom::before {
  content: '';
  position: absolute;
  inset: auto -18px 0;
  height: 160px;
  border-radius: 36px 36px 0 0;
  background: linear-gradient(0deg, rgba(2,4,8,.86) 0%, rgba(2,4,8,.46) 44%, transparent 100%);
  z-index: -1;
  pointer-events: none;
}
.rec-speed-btn,
.rec-stop-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid rgba(255,255,255,.12);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow: 0 18px 40px rgba(0,0,0,.34);
  transition:
    transform var(--dur-fast) var(--ease-spring),
    background var(--dur-fast),
    border-color var(--dur-fast),
    box-shadow var(--dur-fast),
    color var(--dur-fast);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.rec-speed-btn {
  min-height: 54px;
  border-radius: 18px;
  background: rgba(8, 11, 15, .34);
  padding: 12px 14px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.rec-speed-btn:hover {
  transform: translateY(-1px);
  background: rgba(18, 23, 31, .72);
  border-color: rgba(255,255,255,.18);
}
.rec-speed-btn:active,
.rec-stop-btn:active {
  transform: scale(.97);
}
.rec-speed-btn span:last-child {
  white-space: nowrap;
}
.rec-stop-btn {
  flex-direction: column;
  width: 84px;
  height: 84px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(35, 10, 13, .68), rgba(20, 6, 9, .82));
  border-color: rgba(255,255,255,.18);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .2em;
  text-transform: uppercase;
}
.rec-stop-btn:hover {
  color: #fff;
  background: linear-gradient(180deg, rgba(117, 26, 33, .84), rgba(92, 12, 18, .92));
  border-color: rgba(255,109,109,.4);
  box-shadow: 0 22px 48px rgba(128, 17, 29, .42);
}
.rec-stop-icon {
  width: 24px;
  height: 24px;
  background: #fff;
  border-radius: 7px;
  flex-shrink: 0;
}

.rec-countdown {
  position: fixed;
  inset: 0;
  z-index: var(--z-countdown);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  pointer-events: none;
  opacity: 0;
}
.rec-countdown.is-active {
  opacity: 1;
}
.rec-countdown-num {
  font-size: clamp(120px, 28vw, 360px);
  font-weight: 800;
  color: #3BE0A8;
  line-height: 1;
  text-shadow: 0 4px 60px rgba(59, 224, 168, 0.45);
  animation: countdown-pop 900ms ease-out forwards;
}
.rec-countdown-num.action {
  color: #FF9F0A;
  font-size: clamp(80px, 18vw, 220px);
  text-shadow: 0 4px 80px rgba(255, 159, 10, 0.55);
  letter-spacing: 2px;
}
.rec-countdown-hint {
  color: rgba(255, 255, 255, 0.58);
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.rec-setup-panel {
  position: fixed;
  left: 50%;
  bottom: max(12px, calc(var(--sab) + 8px));
  width: min(760px, calc(100vw - 28px));
  z-index: var(--z-setup);
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100dvh - var(--sat) - var(--sab) - 134px);
  overflow: hidden;
  opacity: 0;
  transform: translate(-50%, 26px);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 30px;
  background:
    linear-gradient(180deg, rgba(18,24,32,.46), rgba(8,11,16,.58)),
    rgba(7, 10, 14, .34);
  backdrop-filter: blur(18px) saturate(165%);
  -webkit-backdrop-filter: blur(18px) saturate(165%);
  box-shadow: 0 32px 72px rgba(0,0,0,.4);
}
.rec-setup-panel.is-active {
  opacity: 1;
  transform: translate(-50%, 0);
}
.rec-setup-script-area {
  border-radius: 24px;
  padding: 14px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  background: rgba(8, 12, 18, .34);
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.rec-setup-script-area:focus-within {
  background: rgba(12, 17, 24, .44);
  border-color: rgba(125, 188, 255, .28);
}
.rec-setup-script-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.rec-setup-script-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(255,255,255,.42);
}
.rec-load-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(61, 136, 255, .12);
  border: 1px solid rgba(110, 174, 255, .24);
  color: #9acbff;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .04em;
  cursor: pointer;
  transition:
    transform var(--dur-fast) var(--ease-spring),
    background var(--dur-fast),
    border-color var(--dur-fast);
}
.rec-load-btn:hover {
  transform: translateY(-1px);
  background: rgba(61, 136, 255, .26);
  border-color: rgba(110, 174, 255, .34);
}
.rec-script-textarea {
  position: relative;
  background: transparent;
  border: 0;
  outline: none;
  resize: none;
  color: transparent;
  -webkit-text-fill-color: transparent;
  caret-color: #fff;
  font-family: var(--f-prompter);
  font-size: var(--rec-font-size, 52px);
  line-height: var(--rec-line-height, 1.34);
  min-height: clamp(112px, 17vh, 156px);
  max-height: clamp(112px, 17vh, 156px);
  overflow-y: auto;
  z-index: 2;
}
.rec-script-textarea::placeholder {
  color: rgba(255,255,255,.24);
  -webkit-text-fill-color: rgba(255,255,255,.24);
}
.rec-script-textarea::selection {
  background: rgba(10,132,255,.28);
}
.rec-script-editor {
  position: relative;
  min-height: clamp(112px, 17vh, 156px);
  max-height: clamp(112px, 17vh, 156px);
}
.rec-script-textarea,
.rec-script-overlay {
  width: 100%;
  padding: 0;
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-wrap: break-word;
  letter-spacing: 0;
  box-sizing: border-box;
}
.rec-script-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
  color: #fff;
  font-family: var(--f-prompter);
  font-size: var(--rec-font-size, 52px);
  line-height: var(--rec-line-height, 1.34);
}
.rec-script-overlay .ln {
  display: block;
}
.rec-script-overlay .speaker-tag {
  opacity: .68;
  font-size: .72em;
  font-weight: 700;
}
.rec-settings-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
  align-items: end;
}
.rec-setting {
  min-width: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.rec-setting label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(255,255,255,.48);
}
.rec-setting-value {
  font-size: 13px;
  font-weight: 700;
  color: rgba(255,255,255,.86);
}
.rec-setting input[type="range"] {
  width: 100%;
  cursor: pointer;
  margin: 0;
}
.rec-options-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  gap: 12px;
  align-items: center;
}
.rec-option-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 0 2px 0 0;
  color: rgba(255,255,255,.82);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  user-select: none;
  transition:
    color var(--dur-fast);
}
.rec-option-toggle-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.rec-option-toggle-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}
.rec-option-toggle-sub {
  color: rgba(255,255,255,.42);
  font-size: 11px;
}
.rec-option-switch {
  position: relative;
  width: 52px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 999px;
  background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.12);
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.rec-option-switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,.28);
  transition: transform var(--dur-fast) var(--ease-spring);
}
.rec-option-toggle.active {
  color: #dfffe9;
}
.rec-option-toggle.active .rec-option-switch {
  background: rgba(60, 191, 114, .78);
  border-color: rgba(98, 255, 164, .34);
}
.rec-option-toggle.active .rec-option-switch-knob {
  transform: translateX(20px);
}
.rec-start-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 54px;
  width: 100%;
  max-width: none;
  align-self: stretch;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff584d 0%, #ff2d55 48%, #ff3b30 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .02em;
  cursor: pointer;
  box-shadow: 0 24px 44px rgba(255,59,72,.36), 0 10px 18px rgba(0,0,0,.18);
  transition:
    transform var(--dur-fast) var(--ease-spring),
    box-shadow var(--dur-fast),
    filter var(--dur-fast);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.rec-start-btn:hover {
  transform: translateY(-1px);
  filter: saturate(1.05);
  box-shadow: 0 28px 56px rgba(255,59,72,.44), 0 12px 24px rgba(0,0,0,.22);
}
.rec-start-btn:active {
  transform: scale(.98);
}
.rec-start-btn .rec-dot-big {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 6px rgba(255,255,255,.12);
  flex-shrink: 0;
}

.rec-review-panel {
  position: fixed;
  inset: 0;
  z-index: var(--z-review);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding:
    calc(var(--sat) + 86px)
    24px
    max(24px, calc(var(--sab) + 18px));
  opacity: 0;
  pointer-events: none;
}
.rec-review-panel.is-active {
  opacity: 1;
}
.rec-review-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(2,4,8,.28), rgba(2,4,8,.52) 45%, rgba(2,4,8,.76));
  pointer-events: none;
}
.rec-review-video,
.rec-review-actions {
  position: relative;
  pointer-events: auto;
}
.rec-review-video {
  width: min(720px, 100%);
  max-height: min(68vh, 780px);
  object-fit: contain;
  transform: scaleX(-1);
  border-radius: 32px;
  background: rgba(5, 7, 11, .68);
  border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 36px 84px rgba(0,0,0,.42);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
}
.rec-review-actions {
  width: min(360px, 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  border-radius: 30px;
  background: rgba(7, 10, 14, .72);
  border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 32px 72px rgba(0,0,0,.38);
  backdrop-filter: blur(28px) saturate(170%);
  -webkit-backdrop-filter: blur(28px) saturate(170%);
}
.rec-review-title {
  margin: 0 0 4px;
  color: rgba(255,255,255,.86);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
  text-align: center;
}
.rec-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  border-radius: 20px;
  padding: 0 20px;
  font-size: 16px;
  font-weight: 750;
  cursor: pointer;
  transition:
    transform var(--dur-fast) var(--ease-spring),
    background var(--dur-fast),
    border-color var(--dur-fast),
    box-shadow var(--dur-fast),
    color var(--dur-fast);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.rec-action-save {
  border: 0;
  color: #06140b;
  background: linear-gradient(135deg, #77f59b 0%, #38d86b 100%);
  box-shadow: 0 20px 44px rgba(56,216,107,.28);
}
.rec-action-save:hover {
  transform: translateY(-1px);
  box-shadow: 0 24px 52px rgba(56,216,107,.34);
}
.rec-action-again {
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: #fff;
}
.rec-action-again:hover {
  transform: translateY(-1px);
  background: rgba(255,255,255,.1);
}
.rec-action-discard {
  min-height: 48px;
  border: 0;
  background: transparent;
  color: rgba(255,255,255,.54);
  font-size: 14px;
}
.rec-action-discard:hover {
  color: rgba(255,255,255,.8);
}

.rec-permission-wall {
  position: fixed;
  inset: 0;
  z-index: var(--z-perm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 28px;
  text-align: center;
  background: rgba(2,4,8,.62);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
}
.rec-permission-wall p {
  margin: 0;
  max-width: 340px;
  color: rgba(255,255,255,.74);
  font-size: 16px;
  line-height: 1.72;
}
.rec-permission-wall .rec-start-btn {
  width: auto;
  min-width: 220px;
  max-width: 280px;
  align-self: center;
}

@media (min-width: 760px) {
  .rec-script-viewport {
    top: calc(var(--sat) + 28px);
    left: 50%;
    width: min(640px, 76vw);
    height: min(34vh, 320px);
    transform: translateX(-50%);
    border-radius: 30px;
    background: rgba(8, 11, 15, .46);
    border: 1px solid rgba(255,255,255,.11);
    box-shadow: 0 30px 72px rgba(0,0,0,.35);
    backdrop-filter: blur(28px) saturate(175%);
    -webkit-backdrop-filter: blur(28px) saturate(175%);
  }
  .rec-script-top-fade { height: 22%; }
  .rec-script-bottom-fade { height: 28%; }
  .rec-cue-line { top: 43%; }
}

@media (max-width: 959px) {
  .rec-review-panel {
    flex-direction: column;
    justify-content: flex-end;
  }
  .rec-review-video {
    width: min(100%, 680px);
    max-height: min(46vh, 420px);
  }
  .rec-review-actions {
    width: min(100%, 680px);
  }
}

@media (max-width: 759px) {
  .rec-topbar {
    width: calc(100vw - 20px);
    top: calc(var(--sat) + 10px);
  }
  .rec-topbar > span:last-child {
    display: none;
  }
  .rec-page-title {
    padding: 0 14px;
  }
  .rec-script-viewport {
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: none;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .rec-script-top-fade {
    height: 54%;
    background: linear-gradient(180deg, rgba(2,4,8,.86) 0%, rgba(2,4,8,.58) 38%, transparent 100%);
  }
  .rec-script-bottom-fade {
    height: 30%;
  }
  .rec-cue-line {
    top: 36%;
    left: 6%;
    right: 6%;
  }
  .rec-script-content {
    padding: 0 7%;
  }
  .rec-setup-panel {
    width: calc(100vw - 18px);
    bottom: max(6px, calc(var(--sab) + 4px));
    padding: 14px;
    border-radius: 24px;
    gap: 10px;
    max-height: calc(100dvh - var(--sat) - var(--sab) - 126px);
  }
  .rec-settings-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .rec-hud-top {
    padding: calc(var(--sat) + 14px) 12px 0;
    justify-content: flex-start;
  }
  .rec-indicator {
    min-height: 46px;
    padding: 0 16px;
  }
  .rec-hud-pause {
    top: calc(var(--sat) + 14px);
    right: 12px;
    min-height: 46px;
    padding: 0 14px;
  }
  .rec-hud-bottom {
    width: calc(100vw - 18px);
    gap: 8px;
    padding: 48px 0 calc(var(--sab) + 10px);
  }
  .rec-speed-btn {
    min-height: 50px;
    padding: 12px 10px;
    border-radius: 16px;
  }
  .rec-stop-btn {
    width: 76px;
    height: 76px;
    border-radius: 22px;
  }
}

@media (max-width: 520px) {
  .rec-back-btn {
    padding: 0 14px;
    min-height: 44px;
  }
  .rec-page-title {
    min-height: 44px;
    font-size: 12px;
    letter-spacing: .16em;
  }
  .rec-hud-pause {
    padding: 0 12px;
    font-size: 11px;
    letter-spacing: .12em;
  }
  .rec-hud-bottom {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .rec-speed-btn {
    flex-direction: column;
    gap: 6px;
    font-size: 11px;
  }
  .rec-stop-btn {
    justify-self: center;
  }
  .rec-script-textarea {
    min-height: 112px;
    max-height: 112px;
  }
  .rec-options-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .rec-start-btn {
    min-height: 50px;
    font-size: 15px;
  }
  .rec-option-toggle {
    min-height: 44px;
  }
  .rec-countdown-num {
    font-size: clamp(96px, 26vw, 180px);
  }
  .rec-countdown-num.action {
    font-size: clamp(56px, 16vw, 100px);
  }
  .rec-review-panel {
    padding:
      calc(var(--sat) + 68px)
      10px
      max(12px, calc(var(--sab) + 10px));
    gap: 12px;
  }
  .rec-review-video {
    border-radius: 24px;
  }
  .rec-review-actions {
    padding: 18px;
    border-radius: 24px;
  }
}

body.is-iphone .rec-script-top-fade {
  height: 56%;
}
body.is-iphone .rec-script-bottom-fade {
  height: 28%;
}
body.is-iphone .rec-cue-line {
  top: 35%;
}
body.is-iphone .rec-script-content {
  padding: 0 7%;
}
body.is-iphone .rec-setup-panel {
  max-height: calc(100dvh - var(--sat) - var(--sab) - 124px);
}

body.is-ipad .rec-script-viewport,
body.is-desktop .rec-script-viewport {
  top: calc(var(--sat) + 22px);
}

body.is-ipad .rec-hud-top,
body.is-ipad .rec-hud-bottom {
  pointer-events: auto;
}
