/* Radiant, quieter. A calm, conventional podcast app in system type with one cobalt accent; the ring identity lives
   only in the cover art and the icon. Highlighted rows are tinted, never marked with a side stripe. */
:root {
  color-scheme: light dark;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --fill: #eef1f5;
  --text: #111a2e;
  --muted: #4a5469;
  --faint: #606a80;         /* ≥4.5:1 on --bg, --surface, --fill and --accent-soft */
  --line: #dde2ea;
  --accent: #2c55c9;
  --accent-soft: #e8eefc;
  --on-accent: #ffffff;
  --danger: #c0364f;
  --danger-soft: #fbe6ea;
  --warn: #8a5a00;
  --ok: #2e7a4f;
  --bar: rgb(255 255 255 / .9);
  --sheet: var(--bg);
  --scrim: rgb(17 26 46 / .3);
  --shadow: 0 6px 20px rgb(17 26 46 / .1);
  --shadow-sheet: 0 -8px 32px rgb(0 0 0 / .22);
  --shadow-cover: 0 0 0 1px rgb(0 0 0 / .06), 0 2px 8px rgb(0 0 0 / .08);
  --shadow-control: 0 1px 2px rgb(0 0 0 / .08);   /* the selected half of a segmented switch */
  --shadow-knob: 0 1px 3px rgb(0 0 0 / .25);      /* the seek bar's thumb */
  --mask-solid: #000;                              /* mask gradients read only alpha; this is the opaque stop */
  --radius: 14px;
  --tabbar: 54px;
  --ease: cubic-bezier(.22, 1, .3, 1);  /* fast start, long settle (gym-booker) */
  --press-scale: .965;
  --press-bright: .95;
  /* Older names some screens still use. */
  --fg: var(--text);
  --err: var(--danger);
  --err-soft: var(--danger-soft);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d111b;
    --surface: #171d2a;
    --fill: #1f2737;
    --text: #f1f4fa;
    --muted: #b0b9cb;
    --faint: #8a95ab;
    --line: #273043;
    --accent: #8fa9ff;
    --accent-soft: #1e2a4a;
    --on-accent: #0d1530;
    --danger: #ff8ea6;
    --danger-soft: #3a1b26;
    --warn: #f0c060;
    --ok: #7fd3a1;
    --bar: rgb(23 29 42 / .9);
    --sheet: #131926;
    --scrim: rgb(0 0 0 / .55);
    --shadow: 0 6px 24px rgb(0 0 0 / .45);
    --press-bright: 1.15;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* App shell: scrolling main, mini-player, tab bar. Pinned to the screen rather than sized with vh units: on iOS
   dvh/lvh/innerHeight can be off by the status bar (iOS playbook). A fixed box with inset 0 is exactly what the
   browser shows, and the page itself can't scroll. */
.shell { position: fixed; inset: 0; display: flex; flex-direction: column; }
main { flex: 1; overflow-y: auto; overscroll-behavior: contain;
  padding: calc(env(safe-area-inset-top) + 8px) max(16px, env(safe-area-inset-right)) 24px max(16px, env(safe-area-inset-left)); }
.page { max-width: 680px; margin: 0 auto; }
.offline { max-width: 680px; margin: 0 auto 8px; background: var(--fill); color: var(--muted); border-radius: 10px;
  padding: 8px 12px; font-size: 14px; }

nav.tabs {
  flex: none; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); background: var(--bar);
  -webkit-backdrop-filter: blur(20px) saturate(1.4); backdrop-filter: blur(20px) saturate(1.4);
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
nav.tabs button {
  height: var(--tabbar); border: 0; background: none; color: var(--faint); font-size: 11px; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
}
nav.tabs button svg { width: 24px; height: 24px; }
nav.tabs button[aria-current="page"] { color: var(--accent); }

/* Type */
.largetitle { font-size: 34px; line-height: 1.1; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 8px 0 14px; }
h2 { font-size: 21px; margin: 4px 0 12px; letter-spacing: -.01em; }
h3 { font-size: 17px; margin: 18px 0 8px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 14px; }
/* Secondary text under a control or a heading (a key's status, spend, an estimate). Screens may size it differently. */
.sub { font-size: 14px; color: var(--muted); font-weight: 400; }
.strong { font-weight: 600; }
.tnum { font-variant-numeric: tabular-nums; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.center { display: grid; place-items: center; min-height: 50vh; text-align: center; }
code { font: 14px ui-monospace, "SF Mono", Menlo, monospace; background: var(--fill); padding: 1px 5px; border-radius: 6px; }

/* Surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.list, .group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list > * + *, .group > .group-row + .group-row { border-top: 1px solid var(--line); }
.item { padding: 12px 14px; display: flex; gap: 10px; align-items: center; }
.item .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-head { font-size: 13px; font-weight: 600; color: var(--muted); padding: 10px 14px 4px; }
.group-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; min-height: 52px; }
.group > .group-head + .group-row { border-top: 0; }
.group > p { padding: 0 14px 10px; margin: 0; }
.one-line { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.draft-row { padding-top: 10px; padding-bottom: 10px; }
.draft-row .grow > * + * { margin-top: 2px; }
.headactions { position: relative; gap: 0; }
.sheet-undo { position: sticky; bottom: 0; margin-top: 12px; }
.sheet-undo .undo { margin: 0 0 6px; }

/* Fields: a label above a filled input. 16px+ text, or iOS zooms on focus and never zooms back (playbook). */
label { display: block; font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 11px 12px;
  font-size: 17px; min-height: 46px;
}
select { -webkit-appearance: none; appearance: none; padding-right: 34px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a93a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 10px center / 18px; }
textarea { resize: vertical; line-height: 1.5; }
::placeholder { color: var(--faint); opacity: 1; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
input:disabled, textarea:disabled, select:disabled { opacity: .6; }
.fields { display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: 8px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 17px; color: var(--text); font-weight: 400; margin: 0; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }

/* Buttons. Every target is at least 44px. */
.btn {
  border: 0; background: var(--fill); border-radius: 12px; padding: 10px 16px; font-weight: 600; font-size: 16px;
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none; color: var(--text);
}
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.small { padding: 6px 14px; font-size: 15px; border-radius: 999px; }
.btn.wide { width: 100%; }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .45; cursor: default; }
.btn[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.iconbtn { width: 44px; height: 44px; flex: none; border: 0; background: none; border-radius: 999px; display: grid;
  place-items: center; color: var(--muted); padding: 0; }
.iconbtn:disabled { opacity: .4; }
.textbtn, .link { background: none; border: 0; color: var(--accent); font: inherit; font-weight: 600; min-height: 44px;
  padding: 0 4px; text-decoration: none; display: inline-flex; align-items: center; }
.textbtn:disabled, .link:disabled { color: var(--faint); }
.textbtn.danger { color: var(--danger); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0; }
/* The undo strip: over the mini-player and the tab bar after a removal that can come back, for 8 s. */
.undo { flex: none; display: flex; align-items: center; gap: 2px; margin: 0 8px 6px; padding: 2px 2px 2px 14px;
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow), 0 0 0 1px var(--line); font-size: 15px; }
.undo > span { flex: 1; min-width: 0; }
.undo.failed > span { color: var(--danger); }
/* A confirmation with nothing to take back ("Plays next."): the strip's look, without its buttons. */
.undo.toast { padding: 12px 14px; }


.badge, .tag { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--fill);
  color: var(--muted); white-space: nowrap; }
.badge.ok { color: var(--ok); }
.badge.err, .tag.err { color: var(--danger); }
.badge.warn, .tag.warn { color: var(--warn); }
.badge.accent, .tag.accent { background: var(--accent-soft); color: var(--accent); }
.error-box { background: var(--danger-soft); color: var(--text); border-radius: 12px; padding: 10px 12px; font-size: 15px; }

.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 1s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; border-top-color: var(--line); border-right-color: var(--accent); } }


.cover { width: 96px; height: 96px; border-radius: 12px; object-fit: cover; flex: none; display: block;
  box-shadow: var(--shadow-cover); }

/* Login */
.login { max-width: 420px; padding-top: 12vh; }
.login-mark { border-radius: 16px; display: block; margin-bottom: 18px; }
.login .largetitle { margin-bottom: 14px; }

/* Bottom sheets. lvh, not vh/dvh: the short units stop a sheet short of the bottom in standalone (iOS playbook). */
.scrim {
  position: fixed; inset: 0; z-index: 30; background: var(--scrim);
  -webkit-backdrop-filter: blur(8px) saturate(.85); backdrop-filter: blur(8px) saturate(.85);
  opacity: 0; transition: opacity .26s ease;
}
.scrim[data-open] { opacity: 1; }
.sheet {
  position: fixed; z-index: 30; left: 50%; bottom: 0; width: min(100%, 560px);
  transform: translate(-50%, 110%); transition: transform .4s var(--ease);
  max-height: 90vh; max-height: 90lvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--sheet); border-radius: 18px 18px 0 0; box-shadow: var(--shadow-sheet);
  padding: 0 max(16px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.sheet[data-open] { transform: translate(-50%, 0); }
.sheet-head { position: sticky; top: 0; z-index: 1; background: var(--sheet); display: flex; align-items: center; gap: 8px; padding: 14px 0 10px; }
.sheet-head h2 { margin: 0; font-size: 19px; }
.sheet-head .btn { background: none; color: var(--accent); padding-right: 0; }
.sheet textarea.notes { min-height: 96px; }
.sheet-quote { font-size: 17px; line-height: 1.45; margin: 0; }
.section { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 18px; }

/* ---------- Mini-player: sits on the tab bar, opens Now Playing ---------- */
.mini { flex: none; position: relative; overflow: hidden; display: flex; align-items: center; gap: 2px;
  margin: 0 max(8px, env(safe-area-inset-right)) 6px max(8px, env(safe-area-inset-left)); padding: 6px 4px 6px 6px;
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow), 0 0 0 1px var(--line); }
.mini-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 0;
  text-align: left; min-height: 44px; }
.mini-meta { min-width: 0; display: grid; }
.mini-title { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-status { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mini .iconbtn { color: var(--text); }
.mini-hair { position: absolute; left: 14px; right: 14px; bottom: 0; height: 2px; border-radius: 999px; background: var(--fill); overflow: hidden; }
.mini-hair i { position: absolute; inset: 0; background: var(--accent); transform-origin: left; }
.mini-hair i.r { background: color-mix(in srgb, var(--accent) 30%, var(--fill)); }

/* ---------- Now Playing: a full-height layer over the tabs ----------
   Portalled into <body> like the sheets and on their z-index: whichever opened last (appended last) is on top. */
.np { position: fixed; inset: 0; z-index: 30; background: var(--bg); display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
  transform: translateY(100%); transition: transform .42s var(--ease); }
.np.open { transform: none; }
.np-head { flex: none; position: relative; display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 0; }
.np-head .menu { right: 8px; }
.menu button:disabled { opacity: 1; color: var(--faint); }
.np-kind { font-size: 15px; font-weight: 600; color: var(--muted); }
.np-ep { flex: none; display: flex; gap: 14px; align-items: center; padding: 6px 20px 12px; max-width: 680px; width: 100%; margin: 0 auto; }
.np-ep h2 { margin: 0; font-size: 21px; line-height: 1.2; }
.np-sub { color: var(--muted); font-size: 15px; margin-top: 3px; }
.np-status { flex: none; margin: 0 auto 8px; max-width: 640px; width: calc(100% - 40px); background: var(--fill);
  color: var(--muted); font-size: 14px; padding: 7px 12px; border-radius: 10px; font-variant-numeric: tabular-nums; }
.np-lines { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px 12px 24px; position: relative;
  -webkit-mask-image: linear-gradient(transparent 0, var(--mask-solid) 16px, var(--mask-solid) calc(100% - 28px), transparent);
  mask-image: linear-gradient(transparent 0, var(--mask-solid) 16px, var(--mask-solid) calc(100% - 28px), transparent); }
.np-lines > * { max-width: 660px; margin-left: auto; margin-right: auto; }
.ln { display: flex; align-items: flex-start; border-radius: 14px; transition: background-color .3s ease; }
.ln-body { flex: 1; min-width: 0; border: 0; background: none; text-align: left; padding: 10px 4px 10px 12px; display: grid; gap: 2px; }
.ln-who { font-size: 13px; font-weight: 700; color: var(--faint); display: flex; justify-content: space-between; gap: 8px; }
.ln-time { font-weight: 600; font-variant-numeric: tabular-nums; }
.ln-text { font-size: 17px; line-height: 1.42; color: var(--faint); transition: color .3s ease; }
.ln-cue { color: var(--faint); font-style: italic; }
.ln-err { font-size: 14px; color: var(--danger); }
.ln-more { color: var(--faint); margin-top: 6px; }
.ln-src { min-width: 44px; min-height: 44px; margin-top: 2px; color: var(--muted); font-size: 13px; font-weight: 600;
  font-variant-numeric: tabular-nums; background: none; border: 0; }
.src { display: flex; gap: 12px; align-items: baseline; }
.src-sub { font-size: 12px; font-weight: 700; color: var(--faint); }
.src-title { font-size: 16px; color: var(--text); }
.src-sum { font-size: 14px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; }
.ln.now { background: var(--accent-soft); }
.ln.now .ln-who { color: var(--accent); }
.ln.now .ln-text { color: var(--text); font-weight: 600; }
.ln.past .ln-text { color: var(--muted); }
.ln.past .ln-who { color: var(--muted); }
/* Not rendered yet: faint at full strength (at least 4.5:1, never an opacity), set in italic. */
.ln.pending .ln-text { font-style: italic; }
.ln.rendering .ln-who::after { content: "rendering"; font-weight: 600; color: var(--faint); }
.ln.failed .ln-text { color: var(--danger); }
.ln.stopped .ln-text { font-style: italic; }
.ln-err.muted { color: var(--muted); }
.np-stop { align-self: center; flex: none; margin: 0 auto 8px; }
.np-pause { text-align: center; font-size: 13px; color: var(--faint); padding: 2px; }
.np-follow { position: absolute; right: max(18px, env(safe-area-inset-right)); bottom: calc(196px + env(safe-area-inset-bottom));
  z-index: 2; border: 1px solid var(--line); background: var(--surface); color: var(--accent); border-radius: 999px;
  min-height: 40px; padding: 0 14px; font-weight: 600; font-size: 14px; box-shadow: var(--shadow); }
.np-transport { flex: none; padding: 6px max(22px, env(safe-area-inset-right)) calc(14px + env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left));
  background: var(--bg); width: 100%; max-width: 640px; margin: 0 auto; }

.seek-hit { position: relative; height: 32px; display: flex; align-items: center; touch-action: none; cursor: pointer; border-radius: 6px; }
.seek-track { position: relative; width: 100%; height: 5px; border-radius: 999px; background: var(--fill); overflow: hidden;
  transition: transform .2s var(--ease); }
.seek-track.active { transform: scaleY(1.6); }
.seek-ready, .seek-played { position: absolute; inset: 0; transform-origin: left; }
.seek-ready { background: color-mix(in srgb, var(--accent) 24%, var(--fill)); }
.seek-played { background: var(--text); }
.seek-thumb { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%;
  background: var(--text); box-shadow: var(--shadow-knob); pointer-events: none; }
.seek-tip { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); white-space: nowrap; background: var(--text);
  color: var(--bg); font-size: 13px; font-weight: 600; padding: 3px 8px; border-radius: 10px; font-variant-numeric: tabular-nums; }
.seek-times { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 600;
  color: var(--muted); font-variant-numeric: tabular-nums; margin-top: -4px; }
.seek-total { border: 0; background: none; color: inherit; font: inherit; min-height: 44px; padding: 0 0 0 16px; margin: -6px 0; }

.keys { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.keys button { border: 0; background: none; color: var(--text); padding: 0; display: grid; place-items: center; }
.keys button:disabled { opacity: .35; cursor: default; }
.key-speed { min-width: 54px; height: 44px; border-radius: 999px; font-weight: 700; font-size: 15px; background: var(--fill) !important;
  font-variant-numeric: tabular-nums; }
.key-skip { width: 60px; height: 60px; border-radius: 999px; }
.key-play { width: 72px; height: 72px; border-radius: 50%; background: var(--text) !important; color: var(--bg) !important; }
.key-play.waiting { animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .65; } }
.key-queue { position: relative; min-width: 54px; height: 44px; border-radius: 999px; background: var(--fill) !important; }
.pagehead .upnext { position: relative; color: var(--text); }
.pagehead .upnext .count { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; border-radius: 999px;
  padding: 0 5px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; line-height: 18px; }
.key-queue .count { position: absolute; top: 2px; right: 6px; min-width: 18px; height: 18px; border-radius: 999px; padding: 0 5px;
  background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; line-height: 18px; }

/* ---------- Compose ---------- */
.compose { display: flex; flex-direction: column; gap: 10px; }
.compose[hidden] { display: none; }
.titlefield { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px 4px; }
.titlefield .lab { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); margin: 0; }
.titlefield .lab label { font: inherit; color: inherit; margin: 0; }
.titlefield input { border: 0; padding: 2px 0 8px; min-height: 0; font-size: 19px; font-weight: 600; background: none; border-radius: 0; }
.titlefield input:focus { outline: 0; }
.titlefield:focus-within, .scriptfield:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.scriptfield { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.scriptfield textarea { border: 0; background: none; min-height: 44vh; resize: none; overflow: hidden; padding: 12px 14px;
  font: 17px/1.55 -apple-system, BlinkMacSystemFont, system-ui, sans-serif; border-radius: var(--radius); }
.scriptfield textarea:focus { outline: 0; }
/* Script highlighting: a styled copy of the text sits behind a textarea whose own text is transparent, so names,
   cues and lines with warnings read like the script they are while editing stays a plain textarea. */
.scriptfield { position: relative; }
.scriptfield .hl, .scriptfield textarea { font: 17px/1.55 -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  padding: 12px 14px; white-space: pre-wrap; overflow-wrap: break-word; letter-spacing: 0; }
.scriptfield .hl { position: absolute; inset: 0; pointer-events: none; color: var(--text); border: 0; margin: 0; overflow: hidden; }
.scriptfield textarea.styled { position: relative; color: transparent; caret-color: var(--text); background: none; }
.scriptfield textarea.styled::selection { color: transparent; background: color-mix(in srgb, var(--accent) 28%, transparent); }
.hl .nm { color: var(--accent); }  /* colour only: a heavier weight would shift the caret off the text */
.hl .cue { color: var(--muted); }
.hl .warnline { text-decoration: underline wavy var(--warn); text-underline-offset: 4px; text-decoration-thickness: 1.5px; }
.hl .errline { text-decoration: underline wavy var(--danger); text-underline-offset: 4px; text-decoration-thickness: 1.5px; }
/* Ask AI: a fill tint (never cobalt) on the range being rewritten, with a small spinner at its end. The tint layer sits
   under the highlight copy so the text stays readable, and the spinner takes no width so the caret stays aligned. */
.scriptfield .asking-layer { color: transparent; }
.asking-layer mark { background: var(--fill); color: transparent; border-radius: 6px; }
.spin-anchor { display: inline-block; width: 0; position: relative; }
.spinner.small { position: absolute; left: 4px; top: 0.35em; width: 12px; height: 12px; border-width: 2px; }
.askpill { position: absolute; z-index: 2; min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.askquote { margin: 0; padding-left: 12px; border-left: 3px solid var(--line); color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; }
.restore { font-size: 15px; color: var(--muted); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
/* Lines under the script scroll into view below the page top; the bottom margin clearing the action bar is set as they
   appear (compose.tsx reveal), since the bar's height changes when it wraps. */
.compose .reveal { scroll-margin-top: 12px; }
.convert-hint { display: flex; align-items: center; gap: 10px; background: var(--accent-soft); border-radius: 12px; padding: 8px 8px 8px 14px; font-size: 15px; }

/* The action bar rides at the bottom of the scroll area, so Render is always under the thumb however long the script. */
.actionbar { position: sticky; bottom: 0; z-index: 3; margin-top: 4px; display: flex; align-items: center; gap: 10px;
  background: var(--surface); border-radius: 18px; padding: 8px;
  /* The last shadow is a band of page colour below the bar, so script text never shows between it and the tabs. */
  box-shadow: var(--shadow), 0 0 0 1px var(--line), 0 30px 0 16px var(--bg); }
.castbtn { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 12px 0 10px; border-radius: 12px;
  background: var(--fill); border: 0; text-align: left; min-width: 0; }
.faces { display: flex; flex: none; }
.faces i { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--fill); margin-left: -8px; display: grid;
  place-items: center; font: 700 11px/1 -apple-system, system-ui, sans-serif; font-style: normal; color: #fff; }
.faces i:first-child { margin-left: 0; }
.castbtn .l1 { display: block; font-size: 14px; font-weight: 700; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; }
.castbtn .l2 { display: block; font-size: 13px; color: var(--muted); line-height: 1.15; }
.stat { flex: 1; min-width: 0; font-size: 14px; color: var(--muted); line-height: 1.25; font-variant-numeric: tabular-nums; }
.stat button { border: 0; background: none; padding: 0; font: inherit; font-weight: 700; position: relative; text-decoration: underline;
  text-underline-offset: 3px; text-decoration-thickness: 1px; text-align: left; }
.actionbar .go { margin-left: auto; }
/* A script over 30 minutes: the note where Change it would be, on a row of its own above the bar's. */
.actionbar.long { flex-wrap: wrap; row-gap: 8px; }
.actionbar .longnote { order: -2; flex-basis: 100%; padding: 2px 6px 0; }
.menu .menu-note { padding: 10px 16px; border-top: 1px solid var(--line); }
/* A phone-width bar leaves the status a sliver between Cast, Change it and Render. As on the iPhone's two-row bar,
   the status goes on top at full width, with Cast, Change it and the primary under it. */
@media (max-width: 560px) {
  .actionbar { flex-wrap: wrap; row-gap: 8px; }
  .actionbar .stat { order: -1; flex-basis: 100%; padding: 2px 6px 0; }
}
/* Narrower still, the Cast button shows the faces alone (its label still names the cast), so the row stays one row. */
@media (max-width: 360px) { .castbtn > span:not(.faces) { display: none; } }
.stat button::after { content: ""; position: absolute; inset: -12px -8px; }  /* 44px target */
.stat .w { color: var(--warn); }
.stat .e { color: var(--danger); }
.go { min-height: 48px; padding: 0 16px; border-radius: 12px; font-size: 17px; font-weight: 700; flex: none; }
/* Change it: secondary, ink label, 44px target; the label folds to the wand on a narrow bar. */
.changeit { min-height: 44px; padding: 0 12px; border-radius: 12px; display: inline-flex; align-items: center; gap: 6px;
  color: var(--text); font-weight: 600; flex: none; }
/* Folded with the bar's two rows (below), so Cast, Change it and the primary always share the second row. */
@media (max-width: 560px) { .changeit .lbl { display: none; } .changeit { min-width: 44px; justify-content: center; } }
.words-row { display: flex; gap: 8px; align-items: flex-start; }
.words-row textarea { flex: 1; min-width: 0; }
.stack.tight { gap: 6px; }
.error-text { color: var(--danger); }
.issue { padding: 10px 14px; border: 0; background: none; text-align: left; width: 100%; display: grid; gap: 2px; }
.issue + .issue { border-top: 1px solid var(--line); }
.issue .where { font-size: 13px; font-weight: 700; display: flex; gap: 8px; }
.issue.error .where { color: var(--danger); }
.issue.warning .where { color: var(--warn); }
.issue .quote { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.custom-length { flex-basis: 100%; display: flex; align-items: center; gap: 10px; color: var(--muted); }
.custom-length input { width: 96px; }
.chip { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); font-size: 15px; font-weight: 600; position: relative; }
.chip::after { content: ""; position: absolute; inset: -4px 0; }  /* 44px target */
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.castrow { display: grid; grid-template-columns: 1fr auto; gap: 6px 8px; padding: 12px 14px; align-items: center; }
.castrow + .castrow { border-top: 1px solid var(--line); }
.castrow .who { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.castrow .pickers { grid-column: 1 / -1; display: grid; grid-template-columns: 1.25fr 1fr; gap: 8px; }
.castrow select { font-size: 16px; }

/* ---------- Library ---------- */
.showblock { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.showblock .name { font-size: 19px; font-weight: 700; line-height: 1.2; }
.showblock .sub { font-size: 14px; color: var(--muted); }
.pills { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.pill { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 0; background: var(--fill); color: var(--text);
  font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; position: relative; }
.pill::after { content: ""; position: absolute; inset: -4px 0; }
.search { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.searchbox { flex: 1; position: relative; }
.searchbox svg { position: absolute; left: 11px; top: 50%; margin-top: -9px; color: var(--faint); pointer-events: none; }
.searchbox input { background: var(--fill); border-color: transparent; padding-left: 36px; min-height: 42px; }
.search select { width: auto; background-color: var(--fill); border-color: transparent; min-height: 42px; font-size: 16px; }
.eps { margin: 6px -16px 0; border-top: 1px solid var(--line); }
.ep { display: flex; gap: 6px; align-items: center; padding: 12px 6px 12px 20px; border-bottom: 1px solid var(--line); }
.ep-open { flex: 1; min-width: 0; border: 0; background: none; padding: 0; text-align: left; display: flex; gap: 12px; align-items: center; }
.ep-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.ep-date { font-size: 13px; color: var(--muted); font-weight: 600; }
.ep-title { font-size: 17px; font-weight: 600; line-height: 1.25; }
.ep-meta { font-size: 14px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 2px; font-variant-numeric: tabular-nums; }
.ep-play { width: 44px; height: 44px; border: 0; background: none; display: grid; place-items: center; padding: 0; color: var(--accent); flex: none; }
.ep-play span { width: 36px; height: 36px; border-radius: 999px; box-shadow: inset 0 0 0 1.5px var(--line); display: grid; place-items: center; }
.ep-play[aria-pressed="true"] span { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.minibar { width: 40px; height: 4px; border-radius: 999px; background: var(--fill); position: relative; overflow: hidden; }
.minibar i { position: absolute; inset: 0; background: var(--accent); transform-origin: left; }
.trashhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.empty { text-align: center; padding: 32px 12px; color: var(--muted); }

/* ---------- Voices ---------- */
.voice { display: flex; align-items: center; gap: 12px; padding: 10px 6px 10px 14px; }
.voice + .voice { border-top: 1px solid var(--line); }
.avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff;
  font: 700 15px/1 -apple-system, system-ui, sans-serif; }
.voice-open { flex: 1; min-width: 0; border: 0; background: none; padding: 0; text-align: left; display: grid; gap: 1px; min-height: 44px; }
.voice-name { font-weight: 600; display: flex; gap: 6px; align-items: center; }
.voice-desc { font-size: 14px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.listen { position: relative; width: 44px; height: 44px; border: 0; background: none; padding: 0; color: var(--accent); flex: none; display: grid; place-items: center; }
.listen span { width: 36px; height: 36px; border-radius: 999px; background: var(--accent-soft); display: grid; place-items: center; }
.menu { position: absolute; right: 0; top: 48px; z-index: 5; background: var(--surface); border-radius: 14px; min-width: 220px;
  box-shadow: var(--shadow), 0 0 0 1px var(--line); overflow: hidden; }
.menu-dismiss { position: fixed; inset: 0; z-index: 4; border: 0; background: none; cursor: default; }
.menu button { display: grid; width: 100%; text-align: left; border: 0; background: none; padding: 10px 16px; min-height: 52px; gap: 1px; }
.menu button + button { border-top: 1px solid var(--line); }
.menu .sub { font-size: 13px; color: var(--muted); font-weight: 400; }
.scores { display: grid; gap: 4px; }
.qr { background: #fff; border-radius: var(--radius); padding: 14px; width: min(100%, 280px); margin: 0 auto; }
.qr svg { display: block; width: 100%; height: auto; }
.invite-text { overflow-wrap: anywhere; }

/* Motion (after gym-booker): nothing cuts. Content eases in, state colours cross-fade, presses show. */
.fade-in, .error-box { animation: fade-in .24s ease both; }
@keyframes fade-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
nav.tabs button { transition: color .24s ease; }
.btn, .chip, .pill, .iconbtn, .keys button { transition: background-color .2s ease, color .2s ease, opacity .2s ease, transform 90ms ease, filter 90ms ease; }
.seek-ready, .mini-hair i.r { transition: transform .3s var(--ease); }
.badge, .tag { animation: fade-in .2s ease both; }
/* Pressed: set by installPress() for at least 120ms; :active is the fallback. Rows tint rather than shrink. */
.is-pressed:is(.btn, .chip, .pill, .iconbtn, .keys button, .ep-play, .listen), :is(.btn, .chip, .pill):active {
  transform: scale(var(--press-scale)); filter: brightness(var(--press-bright)); }
.btn.wide.is-pressed { transform: none; }
.key-play.is-pressed { transform: scale(.94); }
nav.tabs button.is-pressed { transform: scale(.92); filter: none; }
:is(.ep-open, .voice-open, .mini-open, .ln-body, .castbtn, .issue) { transition: opacity .12s ease; }
:is(.ep-open, .voice-open, .mini-open, .ln-body, .castbtn, .issue).is-pressed { opacity: .6; }
.ln-body:disabled { cursor: default; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important;
  }
  .is-pressed, :is(.btn, .chip):active { transform: none !important; }
}

.seg { display: flex; background: var(--fill); border-radius: 12px; padding: 2px; margin: 4px 0 12px; }
.seg button { flex: 1; min-height: 44px; border: 0; background: none; border-radius: 10px; font-weight: 600; color: var(--muted); }
.seg button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-control); }
.requestfield { position: relative; }
/* "Brief ready · Review": the kept plan, one tap away. */
.brief-ready { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 14px; border-radius: 12px;
  background: var(--accent-soft); }
.requestfield textarea { width: 100%; min-height: 120px; padding-right: 56px; }
.requestfield .mic { position: absolute; right: 6px; bottom: 6px; width: 44px; height: 44px; color: var(--accent); }
.requestfield .mic.on { color: var(--danger); }
/* The brief's pinned foot: Change it (field, mic, button), its summary, the estimate, Edit and Go. The last shadow is a
   band of sheet colour over the sheet's bottom padding, so brief fields never show below it. */
.brief-foot { position: sticky; bottom: 0; z-index: 2; background: var(--sheet); padding: 10px 0 2px;
  border-top: 1px solid var(--line); box-shadow: 0 40px 0 20px var(--sheet); }
.stack .brief-foot > * + * { margin-top: 8px; }
.stack .brief-foot > [role="status"]:empty { margin-top: 0; }
/* While Change it is being typed in, the foot drops back into the flow: in iOS standalone the keyboard does not shrink
   the layout viewport, so a pinned foot would sit behind it with Edit and Go. */
.brief-foot:focus-within { position: static; box-shadow: none; }
.change-row { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.change-row .requestfield { flex: 1 1 220px; min-width: 0; }
.change-row > .btn { flex: 0 0 auto; min-height: 52px; }
.requestfield.change textarea { min-height: 52px; max-height: 22vh; max-height: 22lvh; resize: none; }
/* Change it: a field the last answer moved gets a soft accent wash for about two seconds. */
.brief .field { border-radius: 10px; transition: background .3s var(--ease); }
.brief .field input { transition: background .3s var(--ease); }
.brief .changed, .brief .changed input { background: var(--accent-soft); transition: background .3s var(--ease); }
.meter { display: flex; align-items: center; gap: 8px; }
.meter i { display: block; height: 6px; border-radius: 999px; background: var(--accent); flex: 0 0 auto; max-width: 70%; }
.steps { list-style: none; padding: 0; margin: 8px 0; }
.steps li { padding: 4px 0 4px 26px; position: relative; color: var(--faint); }
.steps li.done, .steps li.now { color: var(--text); }
.steps li::before { content: "○"; position: absolute; left: 0; color: var(--faint); }
.steps li.done::before { content: "✓"; color: var(--accent); }
.steps li.now::before { content: "◌"; color: var(--accent); }
.progress .cost { font-size: 13px; color: var(--faint); }
.sources-box summary { min-height: 44px; display: flex; align-items: center; font-weight: 600; }

.writer-key { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.writer-key input { flex: 1 1 180px; width: auto; min-width: 0; }
.writer-key button { flex: 0 0 auto; }
.ai-panel .ai-task { display: grid; gap: 6px; margin: 12px 0; }
.ai-panel select { min-height: 44px; }
.ai-key { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; display: grid; gap: 8px; }
.ai-key-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; font-weight: 600; }
.steps li.failed, .steps li.failed::before { color: var(--danger); }
.steps li.failed::before { content: "!"; }

.compose-panel { display: flex; flex-direction: column; gap: 10px; }

/* Episodes from Reddit: section dividers in Now Playing, the new-version notice, the Redo sheet, and Compose's
   Sections list. */
.np-section { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 10px 0 0 12px; }
.np-section-title { margin: 0; font-size: 13px; font-weight: 600; color: var(--muted); flex: 0 1 auto; min-width: 0; }
.np-section-rule { flex: 1 1 16px; min-width: 16px; height: 1px; background: var(--line); }
.np-section .iconbtn { color: var(--faint); }
.np-notice { flex: none; display: flex; align-items: center; gap: 8px; margin: 0 auto 8px; max-width: 640px;
  width: calc(100% - 40px); background: var(--accent-soft); border-radius: 12px; padding: 4px 4px 4px 14px; font-size: 15px; }
.np-box { flex: none; margin: 0 auto 8px; max-width: 640px; width: calc(100% - 40px); }
.redo-failure { margin-bottom: 8px; }
.redo-section, .redo-preview, .redo-step { margin: 0; }
.redo-preview { font-weight: 600; }
.redo-step { display: flex; align-items: center; gap: 8px; }
.redo .sub { font-size: 14px; color: var(--muted); }
.redo .seg { margin: 0; }
.section-menu .group-row { width: 100%; border: 0; background: none; text-align: left; color: var(--text); }
.section-menu .group-row + .group-row { border-top: 1px solid var(--line); }
.section-menu .group-row:disabled { color: var(--faint); cursor: default; }
.section-menu > p { padding: 0 14px 12px; }
.sections .section-row { gap: 4px; flex-wrap: wrap; }
.sections .section-row .grow { flex-basis: 160px; }
.sections > .error-box { margin: 10px; }

/* Swipes reveal the action before release; vertical movement still scrolls the list. */
.ep, .up-row { position: relative; }
.ep { overflow: hidden; }
.ep-open { position: relative; z-index: 1; background: var(--bg); }
.swipe-feedback { flex: none; color: var(--accent); background: var(--accent-soft); border-radius: 6px;
  padding: 7px 9px; font-size: 13px; font-weight: 700; pointer-events: none; }
.ep > .swipe-feedback { position: absolute; right: 94px; }
.ep > .swipe-feedback.leading { left: 12px; right: auto; }
