/* ═══════════════════════════════════════════════════════════
   Prompter — Apple-style dark interface
   ═══════════════════════════════════════════════════════════ */

:root {
  --bg: #0a0a0c;
  --bg-elevated: #141418;
  --bg-card: #1a1a1f;
  --bg-card-press: #232329;
  --separator: rgba(255, 255, 255, 0.08);
  --text: #f5f5f7;
  --text-secondary: rgba(235, 235, 245, 0.6);
  --text-tertiary: rgba(235, 235, 245, 0.32);
  --accent: #ff9f0a;
  --accent-press: #e08800;
  --danger: #ff453a;
  --chrome-bg: rgba(22, 22, 26, 0.72);
  --chrome-border: rgba(255, 255, 255, 0.1);
  --radius-card: 16px;
  --radius-pill: 999px;
  --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);
  color-scheme: dark;
}

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

html, body {
  height: 100%;
  overscroll-behavior: none;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
  overflow: hidden;
}

::selection { background: rgba(255, 159, 10, 0.35); }

/* ── Views ─────────────────────────────────────────────── */

.view {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  background: var(--bg);
}
.view.is-active { display: flex; }

/* ── Buttons ───────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: none;
  color: var(--text);
  font: 600 0.95rem/1 inherit;
  font-family: inherit;
  letter-spacing: -0.01em;
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 120ms ease-out, background-color 120ms ease-out, opacity 120ms ease-out;
}
.btn:active { transform: scale(0.96); }          /* feedback on press, instantly */

.btn--primary {
  background: var(--accent);
  color: #1a1002;
}
.btn--primary:active { background: var(--accent-press); }
.btn--pill { border-radius: var(--radius-pill); padding: 11px 18px; }
.btn--large { padding: 14px 24px; font-size: 1.05rem; border-radius: var(--radius-pill); }
.btn--ghost { color: var(--accent); }
.btn--ghost:active { opacity: 0.6; }
.btn--icon { padding: 10px; color: var(--text-secondary); }

.icon { width: 20px; height: 20px; flex: none; }

/* ── Top bar ───────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(14px + var(--sat)) calc(20px + var(--sar)) 14px calc(20px + var(--sal));
  flex: none;
}
.topbar--translucent {
  position: relative;
  z-index: 5;
  background: rgba(10, 10, 12, 0.78);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--separator);
}
.topbar__title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.022em;   /* negative tracking at display size */
  line-height: 1.1;
}
.topbar__meta {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  letter-spacing: 0.01em;
  flex: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Library ───────────────────────────────────────────── */

.library {
  flex: 1;
  overflow-y: auto;
  padding: 4px calc(20px + var(--sar)) calc(32px + var(--sab)) calc(20px + var(--sal));
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
  gap: 12px;
  align-content: start;
}

.scriptcard {
  background: var(--bg-card);
  border: 1px solid var(--separator);
  border-radius: var(--radius-card);
  padding: 16px 18px;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 140ms ease-out, background-color 140ms ease-out;
}
.scriptcard:active { transform: scale(0.98); background: var(--bg-card-press); }
.scriptcard__title {
  font-size: 1.06rem;
  font-weight: 650;
  letter-spacing: -0.014em;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.scriptcard__preview {
  font-size: 0.86rem;
  color: var(--text-secondary);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.scriptcard__meta {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  letter-spacing: 0.01em;
  margin-top: 2px;
}

/* ── Empty state ───────────────────────────────────────── */

.empty {
  position: absolute;
  inset: 0;
  pointer-events: none;   /* overlay must not block the topbar buttons */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 32px;
}
.empty[hidden] { display: none; }
.empty .btn { pointer-events: auto; }
.empty__glyph {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-bottom: 18px;
  align-items: center;
}
.empty__glyph span {
  display: block;
  height: 10px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.16);
}
.empty__glyph span:nth-child(1) { width: 92px; }
.empty__glyph span:nth-child(2) { width: 132px; }
.empty__glyph span:nth-child(3) { width: 112px; }
.empty__glyph span:nth-child(4) { width: 72px; }
.empty__glyph .empty__accent { background: var(--accent); }
.empty h2 { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.018em; }
.empty p { color: var(--text-secondary); max-width: 300px; font-size: 0.95rem; margin-bottom: 14px; }

/* ── Editor ────────────────────────────────────────────── */

.editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0 calc(20px + var(--sar)) 0 calc(20px + var(--sal));
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
}
.editor__title {
  border: 0;
  background: none;
  color: var(--text);
  font-family: inherit;
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  padding: 22px 0 10px;
  outline: none;
  width: 100%;
}
.editor__title::placeholder { color: var(--text-tertiary); }
.editor__text {
  flex: 1;
  border: 0;
  background: none;
  color: var(--text);
  font-family: inherit;
  font-size: 1.08rem;
  line-height: 1.65;
  resize: none;
  outline: none;
  width: 100%;
  padding-bottom: 24px;
}
.editor__text::placeholder { color: var(--text-tertiary); }

.editor__bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px calc(20px + var(--sar)) calc(10px + var(--sab)) calc(20px + var(--sal));
  background: rgba(10, 10, 12, 0.78);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid var(--separator);
}
.editor__stats {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  letter-spacing: 0.01em;
  text-align: center;
  white-space: nowrap;
}

/* ── Prompter ──────────────────────────────────────────── */

.view--prompter { background: #000; }

.prompter {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: default;
}
.prompter__scroll {
  position: absolute;
  left: 0; right: 0; top: 0;
  will-change: transform;
}
.prompter__content {
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.015em;   /* large prompter text: tightened */
  line-height: 1.42;
  text-wrap: balance;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  padding-left: calc(var(--prompt-margin, 8%) + var(--sal));
  padding-right: calc(var(--prompt-margin, 8%) + var(--sar));
  font-size: var(--prompt-size, 64px);
  text-align: var(--prompt-align, center);
}

.prompter--mirror-h .prompter__scroll { transform-origin: center; }

.prompter__eyeline {
  position: absolute;
  left: 0;
  top: var(--eyeline-y, 33%);
  width: 4px;
  height: 44px;
  transform: translateY(-50%);
  background: var(--accent);
  border-radius: 0 3px 3px 0;
  opacity: 0.9;
  pointer-events: none;
}
.prompter__eyeline::after {
  content: "";
  position: absolute;
  right: auto;
  left: 0;
  top: 50%;
  width: 100vw;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 159, 10, 0.28), transparent 40%);
  pointer-events: none;
}
.prompter.eyeline-off .prompter__eyeline { display: none; }

.prompter__fadeTop, .prompter__fadeBottom {
  position: absolute;
  left: 0; right: 0;
  height: 12%;
  pointer-events: none;
  z-index: 2;
}
.prompter__fadeTop { top: 0; background: linear-gradient(#000, transparent); }
.prompter__fadeBottom { bottom: 0; background: linear-gradient(transparent, #000); }

/* ── Camera mode ───────────────────────────────────────── */

.prompter__camera {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;   /* preview mirror set per-camera in JS; recording is never mirrored */
}
.prompter__camscrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  z-index: 1;
}

/* Native (Capacitor) camera renders BEHIND the webview — go transparent so it shows through */
body.native-camera,
body.native-camera .view--prompter,
body.native-camera .prompter { background: transparent !important; }
body.native-camera #cameraFeed { display: none; }
.prompter--camera .prompter__scroll { z-index: 2; }
.prompter--camera .prompter__content { text-shadow: 0 2px 14px rgba(0, 0, 0, 0.85); }
.prompter--camera .prompter__fadeTop,
.prompter--camera .prompter__fadeBottom { display: none; }

.recbtn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.85);
  background: none;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  transition: transform 130ms ease-out;
}
.recbtn:active { transform: scale(0.92); }
.recbtn__core {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ff453a;
  transition: border-radius 220ms cubic-bezier(0.32, 0.72, 0, 1), width 220ms cubic-bezier(0.32, 0.72, 0, 1), height 220ms cubic-bezier(0.32, 0.72, 0, 1);
}
.recbtn.is-recording .recbtn__core {
  width: 22px;
  height: 22px;
  border-radius: 6px;      /* morphs into a stop square, iOS-style */
}

.recbadge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #ff453a;
}
.recbadge__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff453a;
  animation: recPulse 1.2s ease-in-out infinite;
}
@keyframes recPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

.voicebadge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.01em;
  max-width: 260px;
}
.voicebadge #voiceHeard { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.voicebadge__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: recPulse 1.4s ease-in-out infinite;
}

/* Word spans — invisible until voice tracking highlights the current line */
.prompter__content .w { transition: color 220ms ease; }
.prompter--voice .prompter__content .w.spoken { color: var(--text-tertiary); }
.prompter--voice .prompter__content .w.current { color: var(--accent); }

.take__meta { font-size: 0.85rem; font-weight: 600; color: var(--text-tertiary); margin-left: 6px; }
.take__preview {
  width: 100%;
  max-height: 300px;
  border-radius: 14px;
  background: #000;
  margin-bottom: 14px;
}
.take__actions { display: flex; flex-direction: column; gap: 6px; }

@media (prefers-reduced-motion: reduce) {
  .recbadge__dot { animation: none; }
}

/* ── Floating chrome (translucent, content scrolls under) ─ */

.prompter__chrome {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--chrome-bg);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--chrome-border);
  border-radius: 22px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  transition: opacity 260ms ease, transform 320ms cubic-bezier(0.32, 0.72, 0, 1);
}
.prompter__chrome--top {
  top: calc(14px + var(--sat));
  width: min(560px, calc(100% - 28px));
}
.prompter__chrome--bottom {
  bottom: calc(16px + var(--sab));
  padding: 10px 14px;
}
.chrome-hidden.prompter__chrome--top { opacity: 0; transform: translateX(-50%) translateY(-12px); pointer-events: none; }
.chrome-hidden.prompter__chrome--bottom { opacity: 0; transform: translateX(-50%) translateY(12px); pointer-events: none; }

.btn--chrome {
  padding: 9px;
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}
.btn--chrome:active { background: rgba(255, 255, 255, 0.16); transform: scale(0.92); }

.prompter__progresswrap {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}
.prompter__progress {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  background: var(--accent);
}
.prompter__time {
  font-size: 0.8rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  min-width: 40px;
  text-align: center;
}

.speedgroup {
  display: flex;
  align-items: center;
  gap: 8px;
}
.speedgroup__value {
  font-size: 0.82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  min-width: 42px;
  text-align: center;
  letter-spacing: 0.01em;
}

.playbtn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  color: #1a1002;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 130ms ease-out, background-color 130ms ease-out;
}
.playbtn:active { transform: scale(0.92); background: var(--accent-press); }
.playbtn svg { width: 26px; height: 26px; grid-area: 1 / 1; transition: opacity 140ms ease, transform 140ms ease; }
.playbtn__pause { opacity: 0; transform: scale(0.7); }
.is-playing .playbtn__pause { opacity: 1; transform: scale(1); }
.is-playing .playbtn__play { opacity: 0; transform: scale(0.7); }

/* ── Countdown ─────────────────────────────────────────── */

.countdown {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.72);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.countdown[hidden] { display: none; }
.countdown span {
  font-size: clamp(6rem, 24vw, 12rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.countdown span.tick {
  animation: countTick 950ms ease-out;
}
@keyframes countTick {
  0% { opacity: 0; transform: scale(1.28); }
  18% { opacity: 1; transform: scale(1); }
  85% { opacity: 1; }
  100% { opacity: 0.2; transform: scale(0.92); }
}

/* ── Settings sheet ────────────────────────────────────── */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 260ms ease;
}
.scrim.visible { opacity: 1; }
.scrim[hidden] { display: none; }

.sheet {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: 0;
  width: min(520px, 100%);
  transform: translateX(-50%) translateY(100%);
  background: rgba(24, 24, 29, 0.9);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid var(--chrome-border);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  padding: 0 22px calc(22px + var(--sab));
  will-change: transform;
  touch-action: none;
}
.sheet[hidden] { display: none; }

.sheet__grabberzone {
  padding: 10px 0 6px;
  display: flex;
  justify-content: center;
  cursor: grab;
  touch-action: none;
}
.sheet__grabber {
  width: 40px;
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.24);
}
.sheet__title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.016em;
  padding: 4px 0 14px;
}
.sheet__body {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: min(58vh, 480px);
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding-bottom: 4px;
}

.setting { display: flex; flex-direction: column; gap: 8px; }
.setting--row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.setting__labelrow {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.setting label, .setting__name {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.008em;
}
.setting__name small {
  display: block;
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--text-tertiary);
  letter-spacing: 0.01em;
}
.setting output {
  font-size: 0.85rem;
  font-weight: 650;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 28px;
  background: none;
  touch-action: pan-x;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.16);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  margin-top: -10.5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}
input[type="range"]::-moz-range-track {
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.16);
}
input[type="range"]::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

.segmented {
  display: flex;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.segmented button {
  border: 0;
  background: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
}
.segmented button[aria-checked="true"] {
  background: rgba(255, 255, 255, 0.16);
  color: var(--text);
}

.mirrorbtns { display: flex; gap: 8px; }
.togglechip {
  border: 1px solid var(--separator);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease, transform 120ms ease-out;
}
.togglechip:active { transform: scale(0.95); }
.togglechip[aria-pressed="true"] {
  background: rgba(255, 159, 10, 0.18);
  border-color: rgba(255, 159, 10, 0.55);
  color: var(--accent);
}

/* ── Auth gate ─────────────────────────────────────────── */

.view--auth {
  align-items: center;
  justify-content: center;
  padding: 24px calc(24px + var(--sal)) calc(24px + var(--sab)) calc(24px + var(--sar));
  overflow-y: auto;
  position: relative;
}
.auth__glow {
  position: absolute;
  top: -8%;
  left: 50%;
  width: min(620px, 130vw);
  aspect-ratio: 1;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(255, 159, 10, 0.16), rgba(255, 159, 10, 0.04) 55%, transparent 72%);
  pointer-events: none;
  z-index: 0;
}
.auth {
  position: relative;
  z-index: 1;
  width: min(380px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: authIn 500ms cubic-bezier(0.32, 0.72, 0, 1);
}
@keyframes authIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
.auth__brandrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 26px;
}
.auth__mark { display: inline-flex; }
.auth__mark svg { width: 26px; height: 26px; }
.auth__wordmark {
  font-weight: 750;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}
.auth__hero {
  font-size: clamp(1.9rem, 8vw, 2.5rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 30px;
}
.auth__hero span {
  background: linear-gradient(92deg, var(--accent) 10%, #ffd60a 90%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Clear Create-account / Sign-in switch */
.authtabs {
  display: flex;
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--separator);
  border-radius: 14px;
  padding: 4px;
  gap: 4px;
  margin-bottom: 18px;
}
.authtab {
  flex: 1;
  border: 0;
  background: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  padding: 11px 8px;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 200ms cubic-bezier(0.32, 0.72, 0, 1), color 200ms ease, transform 120ms ease-out;
}
.authtab:active { transform: scale(0.97); }
.authtab.is-active {
  background: var(--accent);
  color: #1a1002;
  box-shadow: 0 2px 10px rgba(255, 159, 10, 0.3);
}
.auth__form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.auth__form .textfield {
  padding: 15px 16px;
  font-size: 1.02rem;
  border-radius: 13px;
}
.auth__form .btn--large { margin-top: 4px; padding: 16px; font-size: 1.05rem; }
.auth__note {
  color: var(--text-tertiary);
  font-size: 0.85rem;
  margin-top: 18px;
  letter-spacing: 0.01em;
}

@media (prefers-reduced-motion: reduce) {
  .auth { animation: none; }
}

/* ── Plan chooser ──────────────────────────────────────── */

.view--plan {
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}
.planpick {
  width: min(400px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.planpick__cards {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 26px 0 14px;
}
.plancard {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  text-align: left;
  background: var(--bg-card);
  border: 1.5px solid var(--separator);
  border-radius: 18px;
  padding: 20px 22px;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  transition: transform 130ms ease-out, border-color 140ms ease, background-color 140ms ease;
}
.plancard:active { transform: scale(0.97); }
.plancard--featured {
  border-color: rgba(255, 159, 10, 0.6);
  background: rgba(255, 159, 10, 0.09);
}
.plancard__flag {
  position: absolute;
  top: -10px;
  right: 18px;
  background: var(--accent);
  color: #1a1002;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 3px 10px;
  border-radius: 999px;
}
.plancard__name { font-size: 0.9rem; font-weight: 650; color: var(--text-secondary); }
.plancard__price { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.025em; }
.plancard__price small { font-size: 0.95rem; font-weight: 600; color: var(--text-secondary); letter-spacing: 0; }
.plancard__note { font-size: 0.8rem; color: var(--text-tertiary); }
.planpick .btn--ghost { margin-top: 6px; }
.planpick .sheet__fineprint { margin-top: 16px; }

/* ── Account & Paywall ─────────────────────────────────── */

.topbar__spacer { flex: 1; }

.sheet--auto .sheet__body { max-height: min(70vh, 560px); }

.sheet__blurb {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 16px;
}
.sheet__fineprint {
  color: var(--text-tertiary);
  font-size: 0.78rem;
  text-align: center;
  margin-top: 12px;
  letter-spacing: 0.01em;
}

.authform { display: flex; flex-direction: column; gap: 10px; }
.textfield {
  border: 1px solid var(--separator);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  padding: 13px 16px;
  border-radius: 12px;
  outline: none;
  width: 100%;
  transition: border-color 140ms ease;
}
.textfield:focus { border-color: rgba(255, 159, 10, 0.6); }
.textfield::placeholder { color: var(--text-tertiary); }

.btn--block { width: 100%; justify-content: center; }
.btn--muted { color: var(--text-tertiary); }

.accountrow {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--separator);
  margin-bottom: 2px;
}
.accountrow__label { color: var(--text-secondary); font-size: 0.9rem; }
.accountrow__value {
  font-weight: 650;
  font-size: 0.92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#accountSignedIn .btn--block { margin-top: 12px; }

.probadge {
  display: inline-block;
  background: var(--accent);
  color: #1a1002;
  font-size: 0.72em;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 2px 9px;
  border-radius: 999px;
  vertical-align: 2px;
}

.profeatures {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}
.profeatures li {
  position: relative;
  padding-left: 28px;
  color: var(--text-secondary);
  font-size: 0.94rem;
  line-height: 1.45;
}
.profeatures li strong { color: var(--text); font-weight: 650; }
.profeatures li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 159, 10, 0.18);
  border: 1.5px solid var(--accent);
}
.profeatures li::after {
  content: "";
  position: absolute;
  left: 4.5px;
  top: 7.5px;
  width: 7px;
  height: 4px;
  border-left: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
}

.pricebtns { display: flex; gap: 10px; }
.pricebtn {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 18px 10px 14px;
  border-radius: 16px;
  border: 1.5px solid var(--separator);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  transition: transform 120ms ease-out, border-color 140ms ease, background-color 140ms ease;
}
.pricebtn:active { transform: scale(0.96); }
.pricebtn--featured {
  border-color: rgba(255, 159, 10, 0.65);
  background: rgba(255, 159, 10, 0.1);
}
.pricebtn__badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #1a1002;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.pricebtn__price {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.025em;
}
.pricebtn__term { font-size: 0.8rem; color: var(--text-secondary); font-weight: 550; }

/* ── Toast ─────────────────────────────────────────────── */

.toast {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: calc(28px + var(--sab));
  transform: translateX(-50%);
  background: var(--chrome-bg);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--chrome-border);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 11px 18px;
  border-radius: var(--radius-pill);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.5);
  animation: toastIn 260ms cubic-bezier(0.32, 0.72, 0, 1);
}
.toast[hidden] { display: none; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Accessibility preferences ─────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .chrome-hidden.prompter__chrome--top,
  .chrome-hidden.prompter__chrome--bottom { transform: translateX(-50%); }
}

@media (prefers-reduced-transparency: reduce) {
  .topbar--translucent, .editor__bar { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .prompter__chrome, .sheet, .toast { background: #17171b; -webkit-backdrop-filter: none; backdrop-filter: none; }
}

@media (prefers-contrast: more) {
  :root { --separator: rgba(255, 255, 255, 0.25); --chrome-border: rgba(255, 255, 255, 0.35); }
}

/* Desktop niceties */
@media (hover: hover) {
  .btn:hover { background-color: rgba(255, 255, 255, 0.06); }
  .btn--primary:hover { background: #ffab2e; }
  .btn--chrome:hover { background: rgba(255, 255, 255, 0.14); }
  .playbtn:hover { background: #ffab2e; }
  .scriptcard:hover { background: var(--bg-card-press); }
  .segmented button:hover { color: var(--text); }
}
