/*
 * Opitan: "stage directions".
 * Narration is a performance and the audio tags are the director's notes, so emotion is the only colour on the page:
 * mood chips in the hero, the transcript margin and the player's mood ribbon. One warm accent, the marigold lamp,
 * marks what is live or actionable. Everything else is ink on dusk-coloured paper (night in dark mode).
 */

:root {
  color-scheme: light dark;

  /* Dusk (light) */
  --bg: #f4eff3;
  --bg-raised: #fcfafc;
  --bg-sunk: #ebe4ea;
  --fill: #ebe4ea;
  --hover: rgb(34 27 58 / 0.06);
  --ink: #221b3a;
  --ink-2: #4b4463;
  --ink-3: #625b7a;
  --line: #e0d7df;
  --line-strong: #c7bdc9;
  --lamp: #e8962a;
  --lamp-ink: #8a5000;
  --lamp-wash: rgb(232 150 42 / 0.13);
  --on-lamp: #221b3a;
  --focus: #5847d6;
  --ok: #22704c;
  --danger: #b03a2e;
  --on-danger: #ffffff;
  --danger-wash: rgb(176 58 46 / 0.07);
  --mood-joy: #e8962a;
  --mood-tender: #d4607a;
  --mood-grave: #4b6fc2;
  --mood-tension: #8053cc;
  --mood-neutral: #9a93ae;
  --brand-tile: #241d45;
  --brand-wave: #f1ecf8;
  --veil: rgb(252 250 252 / 0.6);
  --veil-strong: rgb(252 250 252 / 0.82);
  --dock-bg: rgb(252 250 252 / 0.9);
  --dock-shadow: 0 -1px 0 var(--line), 0 -14px 34px rgb(34 27 58 / 0.07);
  --lamp-glow: rgb(232 150 42 / 0.32);
  --scrim: rgb(34 27 58 / 0.34);
  --pop-shadow: 0 1px 2px rgb(34 27 58 / 0.06), 0 22px 54px -14px rgb(34 27 58 / 0.26);
  --card-shadow: 0 26px 60px -40px rgb(34 27 58 / 0.4);

  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Schibsted Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --gutter: 16px;
  --dock-h: 0px;
  --r-s: 10px;
  --r-m: 14px;
  --r-l: 22px;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Night */
    --bg: #16132b;
    --bg-raised: #1f1b3a;
    --bg-sunk: #100e22;
    --fill: #2b2651;
    --hover: rgb(241 237 248 / 0.07);
    --ink: #f1edf8;
    --ink-2: #c6bfda;
    --ink-3: #9d95b8;
    --line: #2f2a4f;
    --line-strong: #463f6b;
    --lamp: #f4ac45;
    --lamp-ink: #f6b75c;
    --lamp-wash: rgb(244 172 69 / 0.12);
    --on-lamp: #1a1530;
    --focus: #b5a8ff;
    --ok: #74d4a6;
    --danger: #ff8f80;
    --on-danger: #1a1530;
    --danger-wash: rgb(255 143 128 / 0.08);
    --mood-joy: #f4ac45;
    --mood-tender: #f08aa1;
    --mood-grave: #7d9cf0;
    --mood-tension: #b08cf5;
    --mood-neutral: #8c85a8;
    --brand-tile: #2c2656;
    --brand-wave: #f1edf8;
    --veil: rgb(31 27 58 / 0.55);
    --veil-strong: rgb(31 27 58 / 0.8);
    --dock-bg: rgb(31 27 58 / 0.9);
    --dock-shadow: 0 -1px 0 var(--line), 0 -14px 34px rgb(0 0 0 / 0.35);
    --lamp-glow: rgb(244 172 69 / 0.28);
    --scrim: rgb(6 5 18 / 0.62);
    --pop-shadow: 0 0 0 1px rgb(255 255 255 / 0.03), 0 26px 64px -12px rgb(0 0 0 / 0.65);
    --card-shadow: 0 26px 60px -36px rgb(0 0 0 / 0.7);
  }
}

@media (min-width: 720px) {
  :root {
    --gutter: 28px;
  }
}

/* ───────────── Base ───────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 24px;
  scroll-padding-bottom: calc(var(--dock-h) + 24px);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body.has-dock {
  padding-bottom: calc(var(--dock-h) + 12px);
}

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

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

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

::selection {
  background: rgb(232 150 42 / 0.3);
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 12px;
  top: -80px;
  z-index: 100;
  padding: 12px 16px;
  border-radius: var(--r-s);
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
}

.skip:focus {
  top: 12px;
}

.muted {
  color: var(--ink-3);
}

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

.icon-sm {
  width: 16px;
  height: 16px;
}

.spinner {
  display: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ───────────── Masthead & page ───────────── */

.masthead {
  max-width: 1200px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) var(--gutter) 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding-right: 6px;
  border-radius: var(--r-s);
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  width: 30px;
  height: 30px;
}

.mark-tile {
  fill: var(--brand-tile);
}

.mark-lamp {
  fill: var(--lamp);
}

.mark-wave {
  fill: none;
  stroke: var(--brand-wave);
  stroke-width: 4.6;
  stroke-linecap: round;
}

.mark-wave-far {
  opacity: 0.55;
}

.brand-name {
  font: 600 1.375rem/1 var(--serif);
  font-variation-settings: "opsz" 36;
  letter-spacing: -0.01em;
}

main {
  display: block;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--gutter) 72px;
  outline: none;
}

.booting {
  min-height: 60vh;
}

/* The shape of a heading and a card while a screen loads; it fades in only when the wait is long enough to notice. */
.boot {
  display: grid;
  gap: 14px;
  max-width: 640px;
  padding: clamp(28px, 6vw, 72px) 0 0;
  animation: boot-in 0.4s ease 0.3s both;
}

.boot-line,
.boot-text,
.boot-card {
  display: block;
  border-radius: 12px;
  background: var(--bg-sunk);
}

.boot-line {
  width: min(560px, 92%);
  height: clamp(2.4rem, 1.5rem + 3vw, 3.6rem);
}

.boot-line.is-short {
  width: min(380px, 64%);
}

.boot-text {
  width: min(420px, 80%);
  height: 1.1rem;
  margin-top: 10px;
  border-radius: 8px;
}

.boot-card {
  width: 100%;
  height: 132px;
  margin-top: 22px;
  border-radius: var(--r-l);
}

@media (prefers-reduced-motion: no-preference) {
  .boot > * {
    animation: boot-pulse 1.6s ease-in-out 0.7s infinite alternate;
  }
}

@keyframes boot-in {
  from {
    opacity: 0;
  }
}

@keyframes boot-pulse {
  to {
    opacity: 0.55;
  }
}

.notice-view {
  max-width: 560px;
  padding: 12vh 0 0;
  display: grid;
  gap: 14px;
  justify-items: start;
}

.notice-title {
  margin: 0;
  font: 500 clamp(1.9rem, 1.4rem + 2vw, 2.6rem)/1.1 var(--serif);
  letter-spacing: -0.015em;
  /* "Can't reach Opitan / right now", not "…right / now", on phones. */
  text-wrap: pretty;
  outline: none;
}

.notice-text {
  margin: 0 0 8px;
  font-size: 1.0625rem;
  color: var(--ink-2);
  /* An email address in it ("We sent a new link to …") wraps rather than running off a phone's screen. */
  overflow-wrap: anywhere;
}

/* ───────────── Buttons & fields ───────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border: 1.5px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: 600 1rem/1 var(--sans);
  text-decoration: none;
  white-space: nowrap;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    transform 0.1s ease;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  cursor: progress;
  opacity: 0.7;
}

.btn.is-busy .spinner {
  display: inline-block;
}

.btn.is-busy > .icon {
  display: none;
}

.btn-primary {
  background: var(--lamp);
  color: var(--on-lamp);
}

.btn-primary:hover:not(:disabled) {
  background: color-mix(in oklab, var(--lamp) 86%, var(--ink));
}

.btn-quiet {
  border-color: var(--line-strong);
}

.btn-quiet:hover {
  background: var(--hover);
}

.btn-danger {
  background: var(--danger);
  color: var(--on-danger);
}

.btn-danger:hover:not(:disabled) {
  background: color-mix(in oklab, var(--danger) 88%, var(--ink));
}

.btn-danger-quiet {
  color: var(--danger);
}

.btn-sm {
  min-height: 40px;
  padding: 0 16px;
  font-size: 0.9375rem;
}

.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 2px;
  border: 0;
  background: none;
  color: var(--ink);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
  text-decoration-color: color-mix(in oklab, var(--ink) 30%, transparent);
}

.btn-link:hover {
  text-decoration-color: currentColor;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.field-label {
  display: block;
  margin: 0 0 8px;
  font: 600 0.9375rem/1.3 var(--sans);
}

.optional {
  font-weight: 400;
  color: var(--ink-3);
}

.field-input {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 13px 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-m);
  background: var(--bg-raised);
  font-size: 1rem;
  line-height: 1.4;
}

.field-input:hover {
  border-color: color-mix(in oklab, var(--line-strong) 60%, var(--ink));
}

.field-input:focus-visible {
  outline-offset: 1px;
  border-color: var(--ink);
}

.field-input[aria-invalid="true"] {
  border-color: var(--danger);
}

.field-hint {
  margin: 6px 0 0;
  font-size: 0.8125rem;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.field-error,
.form-error {
  margin: 8px 0 0;
  color: var(--danger);
  font-size: 0.9375rem;
  font-weight: 500;
}

.field-error:empty,
.form-error:empty {
  display: none;
}

/*
 * Text from articles and the server can hold a "word" wider than a phone: a German compound, a bare link, a long host
 * name standing in for a title. It breaks wherever it must instead of pushing the page sideways.
 */
.story-title,
.story-byline,
.source-site,
.fid-name,
.fid-fact,
.fid-literal,
.chapter-title,
.script-heading,
.line-text,
.failed-message,
.stage-message,
.shelf-title,
.status-error,
.meta-site,
.field-error,
.form-error,
.toast {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* ───────────── Emotion chips ───────────── */

.chip {
  --mood: var(--mood-neutral);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 8px;
  border: 1px solid color-mix(in oklab, var(--mood) 34%, transparent);
  border-radius: 999px;
  background: color-mix(in oklab, var(--mood) 11%, var(--bg-raised));
  color: var(--ink-2);
  font: 500 0.75rem/1.15 var(--sans);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.chip::before {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--mood);
}

.chip[data-mood="joy"] {
  --mood: var(--mood-joy);
}

.chip[data-mood="tender"] {
  --mood: var(--mood-tender);
}

.chip[data-mood="grave"] {
  --mood: var(--mood-grave);
}

.chip[data-mood="tension"] {
  --mood: var(--mood-tension);
}

.chip-inline {
  margin: 0 1px;
  padding: 2px 8px 2px 6px;
  font-size: 0.6875rem;
  vertical-align: 0.18em;
}

.chip-inline::before {
  width: 6px;
  height: 6px;
}

/* ───────────── Home: hero ───────────── */

.hero {
  padding: clamp(28px, 6vw, 76px) 0 clamp(28px, 4vw, 48px);
}

.hero-title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.65rem, 1.35rem + 5.6vw, 5.75rem);
  font-variation-settings: "opsz" 72;
  line-height: 1.02;
  letter-spacing: -0.03em;
  outline: none;
}

.hero-line {
  display: block;
  text-wrap: balance;
}

.hero-chip {
  position: relative;
  top: -0.32em;
  margin-right: 0.4em;
  font-size: clamp(0.72rem, 0.6rem + 0.4vw, 0.9rem);
  letter-spacing: 0.01em;
  vertical-align: top;
  transform: translateY(0.95em);
}

.hero-line + .hero-line {
  padding-left: clamp(0px, 3.5vw, 64px);
}

.hero-lede {
  max-width: 36ch;
  margin: clamp(16px, 2vw, 24px) 0 0;
  color: var(--ink-2);
  font: 400 clamp(1.0625rem, 0.98rem + 0.45vw, 1.3rem)/1.5 var(--serif);
  font-variation-settings: "opsz" 20;
}

@media (prefers-reduced-motion: no-preference) {
  .hero.is-intro .hero-line {
    animation: line-in 0.75s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }

  .hero.is-intro .hero-line + .hero-line {
    animation-delay: 0.35s;
  }

  .hero.is-intro .hero-chip::before {
    animation: lamp-on 1.4s ease-out both;
  }

  .hero.is-intro .hero-line + .hero-line .hero-chip::before {
    animation-delay: 0.35s;
  }
}

@keyframes line-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

@keyframes lamp-on {
  0% {
    box-shadow: 0 0 0 0 var(--mood);
  }
  100% {
    box-shadow: 0 0 0 9px transparent;
  }
}

/* ───────────── Home: composer ───────────── */

.home-grid {
  display: grid;
  gap: 56px;
}

@media (min-width: 1060px) {
  .home-grid {
    grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
    gap: 72px;
    align-items: start;
  }
}

.composer {
  display: grid;
  gap: 24px;
  min-width: 0;
}

.link-field {
  display: flex;
  align-items: center;
  min-height: 62px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-m);
  background: var(--bg-raised);
  transition: border-color 0.15s ease;
}

.link-field:hover {
  border-color: color-mix(in oklab, var(--line-strong) 60%, var(--ink));
}

.link-field:focus-within {
  border-color: var(--ink);
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.link-field:has([aria-invalid="true"]) {
  border-color: var(--danger);
}

.link-icon {
  margin-left: 16px;
  color: var(--ink-3);
}

.link-input {
  flex: 1;
  min-width: 0;
  min-height: 58px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  font-size: 1.0625rem;
}

.link-input:focus-visible {
  outline: none;
}

.link-input::placeholder {
  color: var(--ink-3);
  opacity: 0.8;
}

.paste-btn {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  min-height: 46px;
  margin: 6px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--r-s);
  background: var(--fill);
  font-weight: 600;
  font-size: 0.9375rem;
}

.paste-btn:hover {
  background: color-mix(in oklab, var(--fill) 84%, var(--ink));
}

.paste-btn .icon {
  width: 18px;
  height: 18px;
}

.composer-text {
  display: grid;
  gap: 0;
}

.composer-text .field-input + .field-label {
  margin-top: 18px;
}

.text-input {
  min-height: 220px;
  resize: vertical;
}

.text-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
}

.make-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  margin-top: -6px;
}

.btn-make {
  min-height: 58px;
  padding: 0 30px;
  font-size: 1.0625rem;
  box-shadow: 0 10px 26px -12px var(--lamp-glow);
}

@media (max-width: 519px) {
  .btn-make {
    flex: 1 1 100%;
  }
}

.source-switch .icon {
  width: 18px;
  height: 18px;
}

.group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.group-title {
  margin: 0 0 10px;
  padding: 0;
  font: 600 0.9375rem/1.3 var(--sans);
}

.group-row {
  display: grid;
  gap: 24px;
}


/* Narrators */

.voice-list {
  display: grid;
  gap: 8px;
}

@media (min-width: 560px) {
  .voice-list {
    grid-template-columns: 1fr 1fr;
  }
}

/* Phones: a swipeable row with the next narrator peeking in, instead of six stacked cards. */
@media (max-width: 559px) {
  .voice-list {
    grid-auto-columns: minmax(240px, 82%);
    grid-auto-flow: column;
    margin: 0 calc(var(--gutter) * -1);
    padding: 4px var(--gutter) 12px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-padding-inline: var(--gutter);
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  .voice-list::-webkit-scrollbar {
    display: none;
  }

  .voice {
    scroll-snap-align: start;
  }
}

.voice {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border: 1.5px solid var(--line);
  border-radius: var(--r-m);
  background: var(--bg-raised);
  transition: border-color 0.15s ease;
}

.voice:hover {
  border-color: var(--line-strong);
}

.voice:has(.voice-input:checked) {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 0.5px var(--ink);
}

.voice:has(.voice-input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.voice-input,
.seg-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.voice-label {
  position: relative;
  display: grid;
  align-content: center;
  gap: 2px;
  min-height: 70px;
  padding: 12px 6px 12px 46px;
  cursor: pointer;
}

.voice-label::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 50%;
  width: 20px;
  height: 20px;
  margin-top: -10px;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  background: var(--bg-raised);
}

.voice-input:checked + .voice-label::before {
  border-color: var(--ink);
  background: radial-gradient(circle, var(--lamp) 0 5px, var(--bg-raised) 5.5px);
}

.voice-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  font: 600 1.125rem/1.2 var(--serif);
  font-variation-settings: "opsz" 24;
}

.badge {
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--lamp-wash);
  color: var(--lamp-ink);
  font: 600 0.6875rem/1.2 var(--sans);
  letter-spacing: 0.02em;
}

.voice-meta {
  color: var(--ink-3);
  font-size: 0.8125rem;
}

.voice-desc {
  color: var(--ink-2);
  font-size: 0.875rem;
  line-height: 1.35;
}

.sample {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-right: 12px;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
}

.sample:hover {
  border-color: var(--ink);
}

.sample > * {
  grid-area: 1 / 1;
}

.sample .icon {
  width: 18px;
  height: 18px;
}

.sample .i-play {
  margin-left: 2px;
}

.sample .i-stop {
  display: none;
}

.sample[data-state="loading"] .i-play {
  display: none;
}

.sample[data-state="loading"] .spinner {
  display: block;
}

.sample[data-state="playing"] {
  border-color: var(--lamp);
  background: var(--lamp);
  color: var(--on-lamp);
}

.sample[data-state="playing"] .i-play {
  display: none;
}

.sample[data-state="playing"] .i-stop {
  display: block;
}

.sample[data-state="error"] {
  border-color: var(--danger);
  color: var(--danger);
}

/* Style & intensity */

.seg {
  display: grid;
  gap: 8px;
}

.seg-style {
  grid-template-columns: 1fr 1fr;
}

.seg-intensity {
  grid-template-columns: repeat(3, 1fr);
}

.seg-item {
  position: relative;
  min-width: 0;
}

.seg-label {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  height: 100%;
  min-height: 58px;
  padding: 11px 13px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-s);
  background: var(--bg-raised);
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.seg-label:hover {
  border-color: var(--line-strong);
}

.seg-input:checked + .seg-label {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 0.5px var(--ink);
}

.seg-input:focus-visible + .seg-label {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.seg-name {
  font-weight: 600;
  font-size: 0.9375rem;
}

.seg-hint {
  color: var(--ink-3);
  font-size: 0.8125rem;
  line-height: 1.3;
}

.seg-intensity .seg-label {
  align-items: center;
  text-align: center;
  padding: 10px 6px;
}

/* At the narrowest phones "Expressive" is a hair wider than a third of the row: the tiles give up their side padding. */
@media (max-width: 340px) {
  .seg-intensity .seg-label {
    padding-inline: 2px;
    letter-spacing: -0.01em;
  }
}

.wave {
  width: 28px;
  height: 16px;
  color: var(--ink-3);
}

.seg-input:checked + .seg-label .wave {
  color: var(--lamp-ink);
}

/* ───────────── Home: library ───────────── */

.library {
  min-width: 0;
}

.library-title {
  margin: 0 0 14px;
  font: 500 1.75rem/1.15 var(--serif);
  font-variation-settings: "opsz" 40;
  letter-spacing: -0.012em;
}

.shelf {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.shelf-link {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin: 0 -10px;
  padding: 10px;
  border-radius: 18px;
  text-decoration: none;
}

.shelf-link:hover {
  background: var(--hover);
}

.cover {
  display: block;
  overflow: hidden;
  background: var(--bg-sunk);
}

.cover img,
.cover .art {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.shelf-cover {
  width: 68px;
  height: 68px;
  border-radius: 13px;
}

.shelf-text {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding-top: 1px;
}

.shelf-title {
  display: -webkit-box;
  overflow: hidden;
  font: 500 1.1875rem/1.25 var(--serif);
  font-variation-settings: "opsz" 24;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.shelf-item.is-queued .shelf-title,
.shelf-item.is-extracting .shelf-title {
  color: var(--ink-2);
}

.shelf-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 14px;
  color: var(--ink-3);
  font-size: 0.8125rem;
}

.meta-site {
  color: var(--ink-2);
  font-weight: 600;
}

.meta-duration {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.meta-icon {
  width: 12px;
  height: 12px;
}

.eq {
  display: none;
  align-items: flex-end;
  gap: 2px;
  height: 11px;
}

.eq i {
  width: 3px;
  height: 100%;
  border-radius: 1px;
  background: currentColor;
  transform-origin: bottom;
}

.eq i:nth-child(2) {
  transform: scaleY(0.55);
}

.eq i:nth-child(3) {
  transform: scaleY(0.8);
}

.shelf-item.is-playing .meta-duration {
  color: var(--lamp-ink);
  font-weight: 600;
}

.shelf-item.is-playing .meta-icon {
  display: none;
}

.shelf-item.is-playing .eq {
  display: inline-flex;
}

.now-playing {
  display: none;
}

.shelf-item.is-playing .now-playing {
  display: inline;
}

@media (prefers-reduced-motion: no-preference) {
  .shelf-item.is-playing .eq i {
    animation: eq 0.9s ease-in-out infinite alternate;
  }

  .shelf-item.is-playing .eq i:nth-child(2) {
    animation-delay: -0.3s;
  }

  .shelf-item.is-playing .eq i:nth-child(3) {
    animation-delay: -0.6s;
  }
}

@keyframes eq {
  from {
    transform: scaleY(0.25);
  }
  to {
    transform: scaleY(1);
  }
}

.shelf-status {
  display: grid;
  gap: 6px;
  font-size: 0.8125rem;
}

.status-label {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 7px;
  padding: 3px 10px 3px 9px;
  border-radius: 999px;
  background: var(--lamp-wash);
  color: var(--lamp-ink);
  font-size: 0.75rem;
  font-weight: 600;
}

.shelf-status.is-active .status-label::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lamp);
}

@media (prefers-reduced-motion: no-preference) {
  .shelf-status.is-active .status-label::before {
    animation: live 1.8s ease-in-out infinite;
  }
}

@keyframes live {
  50% {
    opacity: 0.35;
  }
}

.status-pct {
  color: var(--ink-3);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.mini-meter {
  display: block;
  max-width: 240px;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--bg-sunk);
}

.mini-meter-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--lamp);
  transition: width 0.6s ease;
}

.shelf-status.is-failed .status-label {
  background: var(--danger-wash);
  color: var(--danger);
}

.status-error {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink-2);
  line-height: 1.4;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.shelf-empty {
  padding: 22px 22px 24px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-l);
}

.shelf-empty-title {
  margin: 0 0 4px;
  font: 500 1.25rem/1.3 var(--serif);
}

.shelf-empty-text {
  margin: 0;
  color: var(--ink-2);
  max-width: 40ch;
}

/* ───────────── Story: header ───────────── */

.crumb {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  margin: 12px 0 6px -8px;
  padding: 0 12px 0 4px;
  border-radius: 999px;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
}

.crumb:hover {
  background: var(--hover);
  color: var(--ink);
}

.story-head {
  display: grid;
  /* One column no wider than the screen, however long the title's longest word. */
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
  margin: 6px 0 36px;
}

.story-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--r-l);
}

.story-cover.is-loading {
  background: var(--bg-sunk);
}

@media (min-width: 860px) {
  .story-head {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 380px);
    gap: 48px;
    /* Top-aligned so opening the fidelity details doesn't slide the cover around. */
    align-items: start;
  }

  .story-cover {
    order: 2;
    aspect-ratio: 4 / 3;
  }
}

.story-title {
  margin: 0;
  font: 450 clamp(2.05rem, 1.35rem + 2.9vw, 3.6rem)/1.05 var(--serif);
  font-variation-settings: "opsz" 64;
  letter-spacing: -0.024em;
  text-wrap: balance;
  outline: none;
}

.story-title.is-placeholder {
  color: var(--ink-3);
}

.story-byline {
  margin: 14px 0 0;
  color: var(--ink-2);
  font: italic 400 1.125rem/1.4 var(--serif);
}

.story-source {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 18px;
  margin: 6px 0 0;
  color: var(--ink-3);
  font-size: 0.9375rem;
}

.source-site {
  color: var(--ink-2);
  font-weight: 600;
}

.source-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 44px;
  color: var(--ink);
  font-weight: 600;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
  text-decoration-color: color-mix(in oklab, var(--ink) 30%, transparent);
}

.listen {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-top: 22px;
}

.btn-listen {
  min-height: 58px;
  padding: 0 28px 0 22px;
  font-size: 1.0625rem;
  box-shadow: 0 10px 26px -12px var(--lamp-glow);
}

.btn-listen .icon {
  width: 22px;
  height: 22px;
}

.btn-listen .i-pause,
.btn-listen.is-playing .i-play {
  display: none;
}

.btn-listen.is-playing .i-pause {
  display: block;
}

.listen-duration {
  color: var(--ink-3);
  font-weight: 600;
}

/* Fidelity */

.fidelity-wrap {
  margin-top: 18px;
}

.fidelity {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px 0 9px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--bg-raised);
  font-weight: 600;
  font-size: 0.9375rem;
}

.fidelity:hover {
  border-color: var(--line-strong);
}

.fidelity-icon {
  width: 24px;
  height: 24px;
}

.fidelity.is-complete .fidelity-icon {
  color: var(--ok);
}

.fidelity.is-partial .fidelity-icon {
  color: var(--lamp-ink);
}

.chev {
  color: var(--ink-3);
  transition: transform 0.2s ease;
}

.fidelity[aria-expanded="true"] .chev {
  transform: rotate(180deg);
}

.fidelity-panel {
  max-width: 600px;
  margin-top: 12px;
  padding: 18px 20px 6px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-m);
  background: var(--bg-raised);
}

.fid-intro {
  margin: 0 0 12px;
  color: var(--ink-2);
  font-size: 0.9375rem;
}

.fid-sections {
  margin: 0;
  padding: 0;
  list-style: none;
}

.fid-section {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.fid-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
  margin: 0;
}

.fid-name {
  font: 500 1.0625rem/1.3 var(--serif);
}

.fid-count {
  color: var(--lamp-ink);
  font-weight: 600;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.fid-count.is-complete {
  color: var(--ok);
}

.fid-rounds {
  margin: 2px 0 0;
  color: var(--ink-3);
  font-size: 0.8125rem;
}

.fid-issues {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.fid-issue {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  font-size: 0.9375rem;
}

.fid-status {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--lamp-wash);
  color: var(--lamp-ink);
  font-weight: 600;
  font-size: 0.75rem;
}

.fid-note {
  display: block;
  margin-top: 2px;
  color: var(--ink-3);
  font-size: 0.8125rem;
}

.fid-literal {
  margin: 8px 0 0;
  color: var(--ink-2);
  font-size: 0.8125rem;
}

/* ───────────── Story: making it ───────────── */

.story-loading {
  margin: 0;
}

.progress-panel {
  max-width: 720px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 0 0 30px;
  padding: 0;
  list-style: none;
}

.step {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 9px;
  color: var(--ink-3);
  font-size: 0.8125rem;
  text-align: center;
}

.step::before {
  content: "";
  position: absolute;
  top: 10px;
  right: calc(50% + 14px);
  left: calc(-50% + 14px);
  height: 2px;
  border-radius: 2px;
  background: var(--line-strong);
}

.step:first-child::before {
  display: none;
}

.step.is-done::before,
.step.is-current::before {
  background: var(--ink);
}

.step-dot {
  position: relative;
  width: 22px;
  height: 22px;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  background: var(--bg);
}

.step.is-done .step-dot {
  border-color: var(--ink);
  background: var(--ink);
}

.step.is-done .step-dot::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 3px;
  width: 5px;
  height: 9px;
  border: solid var(--bg);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.step.is-current .step-dot {
  border-color: var(--lamp);
  background: var(--lamp);
  box-shadow: 0 0 0 6px var(--lamp-wash);
}

.step.is-current .step-label {
  color: var(--ink);
  font-weight: 600;
}

.step.is-done .step-label {
  color: var(--ink-2);
}

@media (prefers-reduced-motion: no-preference) {
  .step.is-current .step-dot {
    animation: on-air 2.2s ease-in-out infinite;
  }
}

@keyframes on-air {
  50% {
    box-shadow: 0 0 0 11px transparent;
  }
}

@media (max-width: 400px) {
  .step {
    font-size: 0.6875rem;
  }
}

.stage {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.stage-message {
  margin: 0;
  font: italic 400 clamp(1.4rem, 1.15rem + 1vw, 1.85rem)/1.25 var(--serif);
  font-variation-settings: "opsz" 36;
}

.stage-pct {
  flex: none;
  color: var(--ink-2);
  font: 600 1.0625rem/1 var(--sans);
  font-variant-numeric: tabular-nums;
}

.meter {
  height: 6px;
  margin: 16px 0 14px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--bg-sunk);
}

.meter-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--lamp);
  transition: width 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.stage-note {
  max-width: 52ch;
  margin: 0;
  color: var(--ink-3);
  font-size: 0.9375rem;
}

.stage-offline {
  margin: 0 0 10px;
  color: var(--danger);
  font-weight: 600;
}

.log-title {
  margin: 40px 0 12px;
  font: 600 0.9375rem/1.3 var(--sans);
}

.log {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
  border-left: 2px solid var(--line-strong);
}

.log-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 12px;
  padding: 7px 0 7px 16px;
  font-size: 0.9375rem;
  line-height: 1.45;
}

.log-item:first-child {
  color: var(--ink);
}

.log-item:not(:first-child) .log-msg {
  color: var(--ink-2);
}

.log-time {
  flex: none;
  min-width: 4.6em;
  color: var(--ink-3);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.log-icon {
  align-self: center;
}

.log-item.is-warn .log-icon,
.log-item.is-warn .log-msg {
  color: var(--lamp-ink);
}

.log-item.is-error .log-icon,
.log-item.is-error .log-msg {
  color: var(--danger);
}

.log-msg {
  flex: 1 1 14em;
  min-width: 0;
  overflow-wrap: anywhere;
}

.log-item.is-empty {
  color: var(--ink-3);
}

/* Failed */

.failed-panel {
  max-width: 720px;
}

.failed-panel > .row {
  margin-bottom: 4px;
}

.failed-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  font: 500 clamp(1.45rem, 1.2rem + 1vw, 1.85rem)/1.2 var(--serif);
}

.failed-icon {
  width: 28px;
  height: 28px;
  color: var(--danger);
}

.failed-message {
  max-width: 60ch;
  margin: 0 0 20px;
  padding: 14px 16px;
  border-left: 3px solid var(--danger);
  border-radius: 0 var(--r-s) var(--r-s) 0;
  background: var(--danger-wash);
  font-size: 1.0625rem;
  line-height: 1.5;
}

/* ───────────── Story: ready ───────────── */

.resume {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  max-width: 760px;
  margin: -12px 0 28px;
  padding: 10px 12px 10px 18px;
  border-radius: var(--r-m);
  background: var(--lamp-wash);
}

.resume-text {
  margin: 0;
  font-weight: 600;
}

.story-columns {
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.story-rail {
  display: contents;
}

.chapters {
  order: -1;
}

@media (min-width: 1060px) {
  .story-columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 72px;
    align-items: start;
  }

  .story-rail {
    position: sticky;
    top: 24px;
    display: grid;
    gap: 30px;
    max-height: calc(100vh - var(--dock-h) - 48px);
    overflow: auto;
  }
}

.rail-title {
  margin: 0 0 8px;
  font: 600 0.9375rem/1.3 var(--sans);
}

.chapter-list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chapter {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: baseline;
  width: 100%;
  min-height: 46px;
  padding: 11px 12px;
  border: 0;
  border-radius: var(--r-m);
  background: transparent;
  text-align: left;
}

.chapter:hover {
  background: var(--hover);
}

.chapter-num {
  color: var(--ink-3);
  font: 600 0.8125rem/1 var(--sans);
  font-variant-numeric: tabular-nums;
}

.chapter-title {
  font: 500 1.0625rem/1.3 var(--serif);
}

.chapter-time {
  color: var(--ink-3);
  font-size: 0.8125rem;
}

.chapter.is-current {
  background: var(--lamp-wash);
}

.chapter.is-current .chapter-num {
  color: var(--lamp-ink);
}

.details {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 18px;
  margin: 0;
  font-size: 0.875rem;
}

.details:empty {
  display: none;
}

.details dt {
  color: var(--ink-3);
}

.details dd {
  margin: 0;
  color: var(--ink-2);
  font-weight: 500;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.delete {
  display: contents;
}

.confirm {
  display: grid;
  gap: 12px;
  width: 100%;
  padding: 16px;
  border-radius: var(--r-m);
  background: var(--danger-wash);
  border: 1.5px solid color-mix(in oklab, var(--danger) 30%, transparent);
}

.confirm-text {
  margin: 0;
  font-weight: 600;
}

/* Transcript: a performance script, directions in the margin */

.transcript {
  min-width: 0;
  max-width: 780px;
}

.transcript-title {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.script-section + .script-section {
  margin-top: 44px;
}

.script-heading {
  margin: 0 0 14px;
  font: 500 1.6rem/1.2 var(--serif);
  font-variation-settings: "opsz" 40;
  letter-spacing: -0.012em;
}

.line {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  padding: 10px 0;
}

.line-cue {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.stamp {
  min-height: 30px;
  padding: 4px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-3);
  font: 500 0.8125rem/1 var(--sans);
  font-variant-numeric: tabular-nums;
}

.stamp:hover {
  background: var(--hover);
  color: var(--ink);
}

.line-text {
  max-width: 36em;
  margin: 0;
  padding: 2px 0 2px 16px;
  border-left: 3px solid transparent;
  color: var(--ink);
  font: 400 1.1875rem/1.65 var(--serif);
  font-variation-settings: "opsz" 18;
  transition:
    color 0.35s ease,
    border-color 0.35s ease;
}

.line.is-seekable .line-text {
  cursor: pointer;
}

.transcript[data-playing] .line:not(.is-current) .line-text {
  color: var(--ink-2);
}

.line.is-current .line-text {
  border-left-color: var(--lamp);
  color: var(--ink);
}

.line.is-current .stamp {
  color: var(--lamp-ink);
  font-weight: 600;
}

@media (min-width: 760px) {
  .line {
    grid-template-columns: 132px minmax(0, 1fr);
    gap: 0 20px;
  }

  .line-cue {
    flex-direction: column;
    align-items: flex-end;
    align-content: flex-end;
    gap: 6px;
    padding-top: 5px;
  }

  .script-heading {
    margin-left: calc(132px + 20px + 19px);
  }
}

/* ───────────── Player dock ───────────── */

.dock {
  position: fixed;
  z-index: 30;
  right: 0;
  bottom: 0;
  left: 0;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--dock-bg);
  box-shadow: var(--dock-shadow);
  -webkit-backdrop-filter: saturate(1.3) blur(16px);
  backdrop-filter: saturate(1.3) blur(16px);
}

.dock-inner {
  display: grid;
  align-items: center;
  gap: 6px 14px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px var(--gutter) 12px;
}

.dock-thin {
  --played: 0%;
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  display: none;
  height: 3px;
  background: linear-gradient(90deg, var(--lamp) var(--played), transparent var(--played));
}

.dock-story {
  grid-area: story;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 44px;
  border-radius: var(--r-s);
  text-decoration: none;
}

.dock-art {
  flex: none;
}

.dock-cover {
  width: 44px;
  height: 44px;
  border-radius: 10px;
}

.dock-text {
  display: grid;
  min-width: 0;
}

.dock-title {
  overflow: hidden;
  font: 500 1rem/1.25 var(--serif);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dock-sub {
  overflow: hidden;
  color: var(--ink-3);
  font-size: 0.8125rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dock-controls {
  grid-area: controls;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
}

.icon-btn:hover {
  background: var(--hover);
}

.icon-btn .icon {
  width: 28px;
  height: 28px;
}

.play {
  position: relative;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 50%;
  background: var(--lamp);
  color: var(--on-lamp);
  box-shadow: 0 8px 20px -8px var(--lamp-glow);
}

.play:hover {
  background: color-mix(in oklab, var(--lamp) 88%, var(--ink));
}

.play > * {
  grid-area: 1 / 1;
}

.play .icon {
  width: 26px;
  height: 26px;
}

.play .i-play {
  margin-left: 3px;
}

.play .i-pause,
.play.is-playing .i-play {
  display: none;
}

.play.is-playing .i-pause {
  display: block;
}

.play .spinner {
  width: calc(100% + 8px);
  height: calc(100% + 8px);
  border-width: 2px;
  border-color: var(--lamp);
  border-right-color: transparent;
}

.play.is-waiting .spinner {
  display: block;
}

.dock-timeline {
  grid-area: timeline;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.time {
  min-width: 2.8em;
  color: var(--ink-2);
  font: 500 0.8125rem/1 var(--sans);
  font-variant-numeric: tabular-nums;
}

.time-total {
  text-align: right;
}

.dock-extra {
  grid-area: extra;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
}

.dock-chapter {
  max-width: 220px;
  overflow: hidden;
  color: var(--ink-3);
  font-size: 0.8125rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.speed {
  min-width: 56px;
  min-height: 40px;
  padding: 0 10px;
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  font: 600 0.875rem/1 var(--sans);
  font-variant-numeric: tabular-nums;
}

.speed:hover {
  border-color: var(--ink);
}

.dock-error {
  max-width: 1200px;
  margin: -4px auto 0;
  padding: 0 var(--gutter) 10px;
  color: var(--danger);
  font-size: 0.875rem;
  font-weight: 500;
}

.dock-error .btn-link {
  min-height: 32px;
  color: inherit;
}

/* Full: on the page of the story that is loaded */

.dock[data-mode="full"] .dock-inner {
  grid-template-columns: 1fr auto 1fr;
  grid-template-areas:
    "timeline timeline timeline"
    ". controls extra";
}

.dock[data-mode="full"] .dock-story {
  display: none;
}

@media (max-width: 599px) {
  .dock[data-mode="full"] .dock-chapter {
    display: none;
  }
}

@media (min-width: 760px) {
  .dock[data-mode="full"] .dock-inner {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "controls timeline extra";
    gap: 10px 28px;
    padding-top: 12px;
    padding-bottom: 12px;
  }
}

/* Compact: everywhere else, so listening carries on while browsing */

.dock[data-mode="compact"] .dock-inner {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "story controls";
  padding-top: 9px;
  padding-bottom: 9px;
}

.dock[data-mode="compact"] .dock-thin {
  display: block;
}

.dock[data-mode="compact"] .dock-skip,
.dock[data-mode="compact"] .dock-timeline,
.dock[data-mode="compact"] .dock-extra {
  display: none;
}

.dock[data-mode="compact"] .play {
  width: 46px;
  height: 46px;
  box-shadow: none;
}

.dock[data-mode="compact"] .play .icon {
  width: 22px;
  height: 22px;
}

/* Scrubber: the played part shows the narration's mood ribbon */

.scrub {
  --played: 0%;
  --buffered: 0%;
  position: relative;
  height: 34px;
  min-width: 0;
}

.scrub-track {
  position: absolute;
  top: 50%;
  right: 0;
  left: 0;
  height: 6px;
  margin-top: -3px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--bg-sunk);
}

.scrub-ribbon {
  position: absolute;
  inset: 0;
  background: var(--lamp);
}

.scrub-veil {
  position: absolute;
  top: 0;
  bottom: 0;
}

.scrub-veil.is-buffered {
  left: var(--played);
  width: max(0%, calc(var(--buffered) - var(--played)));
  background: var(--veil);
}

.scrub-veil.is-rest {
  left: max(var(--played), var(--buffered));
  right: 0;
  background: var(--veil-strong);
}

.scrub-ticks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.tick {
  position: absolute;
  top: 50%;
  width: 3px;
  height: 14px;
  margin: -7px 0 0 -1.5px;
  border-radius: 2px;
  background: var(--ink-3);
  box-shadow: 0 0 0 2px var(--dock-bg);
}

.scrub-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.scrub-input:focus-visible {
  outline: none;
}

.scrub:has(.scrub-input:focus-visible) .scrub-track {
  outline: 3px solid var(--focus);
  outline-offset: 5px;
}

.scrub-input::-webkit-slider-runnable-track {
  height: 34px;
  background: transparent;
}

.scrub-input::-webkit-slider-thumb {
  box-sizing: border-box;
  width: 20px;
  height: 20px;
  margin-top: 7px;
  border: 3px solid var(--bg-raised);
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 1px 6px rgb(0 0 0 / 0.25);
  -webkit-appearance: none;
  appearance: none;
}

.scrub-input::-moz-range-track {
  height: 34px;
  background: transparent;
}

.scrub-input::-moz-range-thumb {
  box-sizing: border-box;
  width: 20px;
  height: 20px;
  border: 3px solid var(--bg-raised);
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 1px 6px rgb(0 0 0 / 0.25);
}

/* ───────────── Passcode ───────────── */

.gate {
  display: grid;
  gap: 10px;
  max-width: 440px;
  padding-top: 12vh;
}

.gate-title {
  margin: 0;
  font: 500 clamp(2rem, 1.6rem + 1.6vw, 2.6rem)/1.1 var(--serif);
  letter-spacing: -0.016em;
  outline: none;
}

.gate-lede {
  margin: 0 0 14px;
  color: var(--ink-2);
  font-size: 1.0625rem;
}

.gate-form {
  display: grid;
  gap: 0;
}

.gate-form .btn {
  justify-self: start;
  margin-top: 18px;
  min-width: 140px;
}

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

.toast {
  position: fixed;
  z-index: 40;
  left: 50%;
  bottom: calc(var(--dock-h) + 18px + env(safe-area-inset-bottom));
  /* Centred with left: 50%, so without an explicit width it would shrink into half the screen. */
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 12px 20px;
  border-radius: var(--r-l);
  text-align: center;
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  font-size: 0.9375rem;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.toast.is-shown {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast:empty {
  display: none;
}

/* ───────────── Buttons: ink ───────────── */

/* The quiet partner of the lamp button: forms' own actions (sign in, copy), so the lamp stays the one call to act. */
.btn-ink {
  background: var(--ink);
  color: var(--bg-raised);
}

.btn-ink:hover:not(:disabled) {
  background: color-mix(in oklab, var(--ink) 84%, var(--bg));
}

.btn-block {
  width: 100%;
}

/* ───────────── Masthead: minutes and the account menu ───────────── */

.masthead-end {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

@media (min-width: 960px) {
  /* The front door's own "Request an invite" is in view there. */
  .masthead-join {
    display: none;
  }
}

.minutes-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px 0 12px;
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  color: var(--ink);
  font: 600 0.875rem/1 var(--sans);
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease;
}

.minutes-chip:hover {
  border-color: color-mix(in oklab, var(--line-strong) 50%, var(--ink));
  background: var(--hover);
}

.minutes-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lamp);
}

.minutes-chip[data-tone="low"] {
  border-color: color-mix(in oklab, var(--lamp) 50%, transparent);
  background: var(--lamp-wash);
  color: var(--lamp-ink);
}

.minutes-chip[data-tone="empty"] {
  border-color: color-mix(in oklab, var(--danger) 45%, transparent);
  color: var(--danger);
}

.minutes-chip[data-tone="empty"] .minutes-dot {
  background: var(--danger);
}

.account {
  position: relative;
}

.avatar-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
}

.avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--brand-tile);
  color: var(--brand-wave);
  font: 600 0.875rem/1 var(--sans);
  letter-spacing: 0.03em;
  box-shadow:
    0 0 0 2px var(--bg),
    0 0 0 3.5px var(--line-strong);
  transition: box-shadow 0.15s ease;
}

.avatar-btn:hover .avatar,
.avatar-btn[aria-expanded="true"] .avatar {
  box-shadow:
    0 0 0 2px var(--bg),
    0 0 0 4px var(--lamp);
}

.menu {
  position: absolute;
  z-index: 50;
  top: calc(100% + 8px);
  right: 0;
  width: min(288px, calc(100vw - 2 * var(--gutter)));
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  background: var(--bg-raised);
  box-shadow: var(--pop-shadow);
}

.menu-head {
  margin: 0 0 6px;
  padding: 12px 12px 12px;
  border-bottom: 1px solid var(--line);
}

.menu-name {
  margin: 0;
  font: 500 1.125rem/1.25 var(--serif);
  overflow-wrap: anywhere;
}

.menu-email {
  margin: 2px 0 0;
  color: var(--ink-3);
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
}

.menu-plan {
  display: inline-block;
  margin: 10px 0 0;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--lamp-wash);
  color: var(--lamp-ink);
  font: 600 0.75rem/1.2 var(--sans);
}

.menu-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-s);
  background: transparent;
  color: var(--ink);
  font: 500 0.9375rem/1.2 var(--sans);
  text-align: left;
  text-decoration: none;
}

.menu-item:hover {
  background: var(--hover);
}

.menu-item:focus-visible {
  outline-offset: -2px;
}

/* The page you're on: the lamp marks it, as it marks the playing line. */
.menu-item[aria-current="page"] {
  font-weight: 600;
}

.menu-item[aria-current="page"]::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-left: auto;
  border-radius: 50%;
  background: var(--lamp);
}

.menu-foot {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.menu-signout {
  color: var(--ink-2);
}

@media (prefers-reduced-motion: no-preference) {
  .menu:not([hidden]) {
    animation: pop-in 0.16s cubic-bezier(0.2, 0.7, 0.2, 1);
    transform-origin: top right;
  }
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
}

/* ───────────── The front door (signed out) ───────────── */

.door {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "hero"
    "card"
    "more";
  gap: 36px;
  padding: clamp(16px, 5vw, 56px) 0 24px;
}

.door-hero {
  grid-area: hero;
  padding: 0;
}

/* Named areas only inside the door's grid: elsewhere (setup, reset) an unknown area name would add columns. */
.door > .door-card {
  grid-area: card;
}

.door-card {
  min-width: 0;
  padding: clamp(20px, 3vw, 30px);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  background: var(--bg-raised);
  box-shadow: var(--card-shadow);
}

.door-more {
  grid-area: more;
  min-width: 0;
}

.door-title {
  font-size: clamp(2.65rem, 1.35rem + 5.6vw, 4.25rem);
}

.door-promise {
  max-width: 28ch;
  margin: clamp(14px, 2vw, 22px) 0 0;
  color: var(--ink-2);
  font: italic 400 clamp(1.2rem, 1.05rem + 0.6vw, 1.5rem)/1.4 var(--serif);
  font-variation-settings: "opsz" 24;
}

@media (min-width: 960px) {
  .door {
    grid-template-columns: minmax(0, 1fr) minmax(340px, 400px);
    /* A tall card (the invite form) grows the second row, so the steps stay right under the title. */
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "hero card"
      "more card";
    column-gap: clamp(48px, 6vw, 96px);
    row-gap: 44px;
    align-items: start;
  }

  .door-title {
    font-size: clamp(3.1rem, 0.4rem + 4.6vw, 4.25rem);
  }

  .door-card {
    margin-top: 12px;
  }
}

/* How it works, set as a performed script: each step with its direction in the margin. */
.door-steps {
  display: grid;
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.door-step {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.door-cue {
  display: flex;
  align-items: flex-start;
}

.door-line {
  max-width: 34em;
  margin: 0;
  padding: 2px 0 2px 16px;
  border-left: 3px solid var(--line-strong);
  color: var(--ink);
  font: 400 1.25rem/1.4 var(--serif);
  font-variation-settings: "opsz" 24;
  /* No word alone on a step's last line ("…and performs / it.") at phone widths. */
  text-wrap: pretty;
}

.door-more-text {
  display: block;
  margin-top: 6px;
  color: var(--ink-2);
  font: 400 0.9375rem/1.5 var(--sans);
}

@media (min-width: 600px) {
  .door-step {
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 0 18px;
  }

  .door-cue {
    justify-content: flex-end;
    padding-top: 4px;
  }
}

.door-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-top: 34px;
}

.btn-cta {
  min-height: 56px;
  padding: 0 28px;
  font-size: 1.0625rem;
  box-shadow: 0 10px 26px -12px var(--lamp-glow);
}

.door-trust {
  margin: 0;
  color: var(--ink-3);
  font-size: 0.9375rem;
}

@media (min-width: 600px) {
  .door-cta {
    padding-left: calc(104px + 18px);
  }
}

/* One performance on arrival: the title's lines, then a playhead passing down the script once. */
@media (prefers-reduced-motion: no-preference) {
  .door.is-intro .door-line {
    animation: cue-pass 1.2s ease both;
  }

  .door.is-intro .door-step .chip::before {
    animation: lamp-on 1.4s ease-out both;
  }

  .door.is-intro .door-step:nth-child(1) .door-line,
  .door.is-intro .door-step:nth-child(1) .chip::before {
    animation-delay: 0.9s;
  }

  .door.is-intro .door-step:nth-child(2) .door-line,
  .door.is-intro .door-step:nth-child(2) .chip::before {
    animation-delay: 1.5s;
  }

  .door.is-intro .door-step:nth-child(3) .door-line,
  .door.is-intro .door-step:nth-child(3) .chip::before {
    animation-delay: 2.1s;
  }
}

@keyframes cue-pass {
  0%,
  100% {
    border-left-color: var(--line-strong);
  }
  22%,
  62% {
    border-left-color: var(--lamp);
  }
}

/* Sign-in, setup, invite and reset forms */

.auth-form {
  display: grid;
  gap: 16px;
}

.auth-title {
  margin: 0 0 2px;
  font: 500 1.625rem/1.15 var(--serif);
  font-variation-settings: "opsz" 36;
  letter-spacing: -0.01em;
}

.auth-field .field-label {
  margin-bottom: 7px;
}

.auth-field .field-error,
.auth-field .field-hint {
  margin-top: 6px;
}

.auth-field .field-hint {
  font-variant-numeric: normal;
}

.auth-field .field-input[readonly] {
  background: var(--bg-sunk);
  color: var(--ink-2);
}

.auth-form .form-error {
  margin: 0;
}

.auth-form .btn-block {
  margin-top: 4px;
}

.handle-preview {
  color: var(--ink-2);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.auth-help {
  display: grid;
  gap: 8px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 0.875rem;
  line-height: 1.45;
}

.auth-help p {
  margin: 0;
}

.auth-help strong {
  color: var(--ink);
  font-weight: 600;
}

.auth-help-link {
  color: var(--ink);
  font-weight: 600;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in oklab, var(--ink) 35%, transparent);
}

.auth-help-link:hover {
  text-decoration-color: currentColor;
}

.auth-fine {
  margin: 16px 0 0;
  color: var(--ink-3);
  font-size: 0.8125rem;
}

.auth-solo {
  display: grid;
  gap: 12px;
  max-width: 470px;
  padding: clamp(20px, 8vh, 88px) 0 24px;
}

.auth-solo-title {
  margin: 0;
  font: 500 clamp(2.1rem, 1.6rem + 1.8vw, 2.9rem)/1.06 var(--serif);
  font-variation-settings: "opsz" 60;
  letter-spacing: -0.02em;
  outline: none;
}

.auth-solo-lede {
  max-width: 40ch;
  margin: 0 0 14px;
  color: var(--ink-2);
  font-size: 1.0625rem;
}

/* Password with Show/Hide: one bordered field, like the link field */

.pw-field {
  display: flex;
  align-items: center;
  min-height: 52px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-m);
  background: var(--bg-raised);
  transition: border-color 0.15s ease;
}

.pw-field:hover {
  border-color: color-mix(in oklab, var(--line-strong) 60%, var(--ink));
}

.pw-field:has(.pw-input:focus-visible) {
  border-color: var(--ink);
  outline: 3px solid var(--focus);
  outline-offset: 1px;
}

.pw-field:has([aria-invalid="true"]) {
  border-color: var(--danger);
}

.pw-field .pw-input {
  flex: 1;
  min-width: 0;
  min-height: 49px;
  border: 0;
  background: transparent;
}

.pw-field .pw-input:focus-visible {
  outline: none;
}

.pw-toggle {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  margin: 4px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--r-s);
  background: transparent;
  color: var(--ink-2);
  font: 600 0.8125rem/1 var(--sans);
}

.pw-toggle:hover {
  background: var(--hover);
  color: var(--ink);
}

.pw-toggle:focus-visible {
  outline-offset: 0;
}

/* ───────────── Home: library sections ───────────── */

.shelf-heading {
  margin: 0 0 14px;
  font: 500 1.375rem/1.2 var(--serif);
  font-variation-settings: "opsz" 32;
  letter-spacing: -0.01em;
}

.continue {
  min-width: 0;
  margin: 0 0 clamp(36px, 5vw, 56px);
}

/* A row you can swipe through on a phone; the next story peeks in. */
.continue-list {
  display: grid;
  grid-auto-columns: minmax(272px, 340px);
  grid-auto-flow: column;
  gap: 14px;
  margin: 0 calc(var(--gutter) * -1);
  padding: 4px var(--gutter) 12px;
  list-style: none;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-padding-inline: var(--gutter);
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
}

.cl-item {
  position: relative;
  min-width: 0;
  scroll-snap-align: start;
}

.cl-link {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  height: 100%;
  padding: 10px 16px 10px 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--bg-raised);
  text-decoration: none;
  transition: border-color 0.15s ease;
}

.cl-link:hover {
  border-color: var(--line-strong);
}

.cl-item.is-playing .cl-link {
  border-color: color-mix(in oklab, var(--lamp) 70%, transparent);
}

.cl-cover {
  width: 84px;
  height: 84px;
  border-radius: 12px;
}

.cl-text {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.cl-title {
  display: -webkit-box;
  overflow: hidden;
  font: 500 1.0625rem/1.25 var(--serif);
  font-variation-settings: "opsz" 20;
  overflow-wrap: anywhere;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.cl-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  color: var(--ink-3);
  font-size: 0.8125rem;
}

.cl-site {
  max-width: 100%;
  overflow: hidden;
  color: var(--ink-2);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cl-meter {
  display: block;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--bg-sunk);
}

.cl-meter-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--lamp);
}

/* Resume, over the cover: plays right here, at the saved place. */
.cl-play {
  position: absolute;
  top: 50%;
  left: 30px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-top: -22px;
  border: 0;
  border-radius: 50%;
  background: var(--lamp);
  color: var(--on-lamp);
  box-shadow: 0 6px 16px -6px rgb(0 0 0 / 0.5);
}

.cl-play:hover {
  background: color-mix(in oklab, var(--lamp) 88%, var(--ink));
}

.cl-play > * {
  grid-area: 1 / 1;
}

.cl-play .icon {
  width: 20px;
  height: 20px;
}

.cl-play .i-play {
  margin-left: 2px;
}

.cl-play .i-pause,
.cl-item.is-playing .cl-play .i-play,
.cl-play.is-busy .icon {
  display: none;
}

.cl-item.is-playing .cl-play:not(.is-busy) .i-pause,
.cl-play.is-busy .spinner {
  display: block;
}

.library .finished {
  margin-top: 44px;
}

.shelf-finished .shelf-link {
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}

.shelf-finished .shelf-cover {
  width: 52px;
  height: 52px;
  border-radius: 11px;
}

.shelf-finished .shelf-title {
  font-size: 1.0625rem;
  -webkit-line-clamp: 1;
  line-clamp: 1;
}

.shelf-empty-actions {
  margin-top: 16px;
}

.shelf-empty-action .icon {
  width: 18px;
  height: 18px;
}

/* Who can listen, on story rows */
.vis-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px 2px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--ink-2);
  font: 600 0.75rem/1.3 var(--sans);
}

.vis-icon {
  width: 12px;
  height: 12px;
}

.vis-badge.is-down {
  border-color: color-mix(in oklab, var(--danger) 40%, transparent);
  color: var(--danger);
}

/* ───────────── Out of minutes: the way to more ───────────── */

.form-notice:empty,
.failed-notice:empty {
  display: none;
}

.failed-notice {
  max-width: 720px;
  margin-top: 16px;
}

.upsell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 12px;
  align-items: start;
  max-width: 62ch;
  padding: 14px 16px;
  border: 1px solid color-mix(in oklab, var(--lamp) 38%, transparent);
  border-radius: var(--r-m);
  background: var(--lamp-wash);
}

.upsell-mark {
  width: 10px;
  height: 10px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--lamp);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--lamp) 24%, transparent);
}

.upsell-text {
  margin: 0;
  color: var(--ink);
  font-weight: 500;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.upsell-action {
  grid-column: 2;
  justify-self: start;
  margin-top: 8px;
}

/* ───────────── Share sheet ───────────── */

html:has(dialog[open]) {
  overflow: hidden;
  scrollbar-gutter: stable;
}

.sheet {
  width: min(680px, calc(100vw - 32px));
  max-width: none;
  max-height: min(88vh, 940px);
  max-height: min(88dvh, 940px);
  margin: auto;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  background: var(--bg-raised);
  color: var(--ink);
  box-shadow: var(--pop-shadow);
}

.sheet::backdrop {
  background: var(--scrim);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.sheet-head {
  position: sticky;
  z-index: 1;
  top: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 18px 14px 26px;
  background: var(--bg-raised);
}

/* Content scrolling under the sticky head fades out instead of being cut. */
.sheet-head::after {
  content: "";
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  height: 14px;
  background: linear-gradient(var(--bg-raised), transparent);
  pointer-events: none;
}

.sheet-heading {
  min-width: 0;
}

.sheet-title {
  margin: 0;
  font: 500 1.75rem/1.1 var(--serif);
  font-variation-settings: "opsz" 40;
  letter-spacing: -0.012em;
  outline: none;
}

.sheet-sub {
  display: -webkit-box;
  margin: 6px 0 0;
  overflow: hidden;
  color: var(--ink-2);
  font: italic 400 1.0625rem/1.35 var(--serif);
  overflow-wrap: anywhere;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.sheet-close {
  flex: none;
  margin: -6px -4px 0 0;
}

.sheet-close .icon {
  width: 22px;
  height: 22px;
}

.sheet-body {
  display: grid;
  gap: 30px;
  padding: 8px 26px 30px;
}

.sheet-loading {
  margin: 0;
}

.sheet-h3 {
  margin: 0 0 12px;
  padding: 0;
  font: 600 0.9375rem/1.3 var(--sans);
}

@media (max-width: 599px) {
  /* Phones: a sheet from the bottom edge. */
  .sheet {
    width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
    margin: auto 0 0;
    border-width: 1px 0 0;
    border-radius: var(--r-l) var(--r-l) 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .sheet-head {
    padding: 18px 10px 12px 18px;
  }

  .sheet-body {
    padding: 6px 18px 26px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .sheet[open] {
    animation: sheet-in 0.24s cubic-bezier(0.2, 0.7, 0.2, 1);
  }

  .sheet[open]::backdrop {
    animation: fade-in 0.2s ease;
  }
}

@keyframes sheet-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

/* Who can listen: one segmented control */
.vis-group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.vis-seg {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px;
  padding: 4px;
  border-radius: 15px;
  background: var(--bg-sunk);
}

.vis-item {
  position: relative;
  min-width: 0;
}

.vis-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 100%;
  min-height: 48px;
  padding: 8px 10px;
  border-radius: 11px;
  color: var(--ink-2);
  font: 600 0.9375rem/1.2 var(--sans);
  text-align: center;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.vis-label .icon {
  width: 18px;
  height: 18px;
}

.vis-label:hover {
  color: var(--ink);
}

.seg-input:checked + .vis-label {
  background: var(--bg-raised);
  color: var(--ink);
  box-shadow:
    0 0 0 1px var(--line-strong),
    0 2px 6px -2px rgb(34 27 58 / 0.18);
}

.seg-input:focus-visible + .vis-label {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
}

@media (max-width: 559px) {
  .vis-seg {
    grid-template-columns: minmax(0, 1fr);
  }

  .vis-label {
    justify-content: flex-start;
    padding-left: 14px;
  }
}

.vis-hint {
  margin: 10px 4px 0;
  color: var(--ink-2);
  font-size: 0.9375rem;
}

.rights {
  display: grid;
  gap: 12px;
  justify-items: start;
  margin-top: 14px;
  padding: 16px 18px;
  border: 1px solid color-mix(in oklab, var(--lamp) 38%, transparent);
  border-radius: var(--r-m);
  background: var(--lamp-wash);
}

.rights .field-error {
  margin: 0;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.check-input {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  accent-color: var(--ink);
  cursor: pointer;
}

.check-label {
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
}

.sheet-status {
  margin: 10px 4px 0;
  color: var(--ok);
  font-size: 0.9375rem;
  font-weight: 600;
}

.sheet-status:empty {
  display: none;
}

.vis-group .form-error {
  margin: 10px 4px 0;
}

/* Link and embeds */
.share-section {
  min-width: 0;
}

.share-locked {
  max-width: 46ch;
  margin: 0 0 14px;
  color: var(--ink-2);
}

.copy-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.copy-input {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  padding: 10px 14px;
  color: var(--ink-2);
  font-size: 0.9375rem;
  text-overflow: ellipsis;
}

.copy-btn {
  flex: none;
  min-height: 48px;
}

.copy-btn .icon {
  width: 18px;
  height: 18px;
}

.share-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 20px;
  margin: 8px 0 0;
}

.share-open .icon {
  width: 16px;
  height: 16px;
}

.share-plays {
  color: var(--ink-3);
  font-size: 0.875rem;
}

.copy-buffer {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.tabs {
  display: flex;
  gap: 2px;
  margin: 0 -26px;
  padding: 0 26px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

@media (max-width: 599px) {
  .tabs {
    margin: 0 -18px;
    padding: 0 18px;
  }
}

.tab {
  flex: none;
  min-height: 44px;
  margin-bottom: -1px;
  padding: 0 12px;
  border: 0;
  border-bottom: 2.5px solid transparent;
  background: transparent;
  color: var(--ink-2);
  font: 600 0.875rem/1 var(--sans);
}

.tab:hover {
  color: var(--ink);
}

.tab[aria-selected="true"] {
  border-bottom-color: var(--lamp);
  color: var(--ink);
}

.tab:focus-visible {
  border-radius: 8px;
  outline-offset: -3px;
}

.tabpanel {
  padding-top: 18px;
}

.snip-title {
  margin: 0 0 8px;
  font: 500 1.125rem/1.3 var(--serif);
}

.snip-steps {
  display: grid;
  gap: 6px;
  max-width: 60ch;
  margin: 0 0 16px;
  padding-left: 1.3em;
  color: var(--ink-2);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

/* Browsers give markers tabular figures, whose full stop is wide in this face ("1 ."). */
.snip-steps li::marker {
  color: var(--ink-3);
  font-variant-numeric: normal;
}

.snip-code {
  display: grid;
  gap: 10px;
  justify-items: start;
}

.code {
  width: 100%;
  max-height: 180px;
  margin: 0;
  padding: 12px 14px;
  overflow: auto;
  border-radius: var(--r-s);
  background: var(--bg-sunk);
  color: var(--ink);
  font: 400 0.8125rem/1.55 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* An admin took the story down: a calm statement, not an alarm. */
.takedown {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  background: var(--bg-sunk);
}

.takedown-icon {
  width: 24px;
  height: 24px;
  color: var(--ink-2);
}

.takedown-text p {
  margin: 0 0 6px;
  color: var(--ink-2);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.takedown-text p:last-child {
  margin-bottom: 0;
}

.takedown-text .takedown-title {
  color: var(--ink);
  font-weight: 600;
}

/* ───────────── Home, signed in: the library first ───────────── */

/* A greeting in place of the pitch, read warmly: the one stage direction on the page. */
.home-head {
  padding: clamp(18px, 4vw, 44px) 0 clamp(22px, 3vw, 34px);
}

.home-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin: 0;
  font: 400 clamp(2rem, 1.4rem + 2.3vw, 3.1rem)/1.08 var(--serif);
  font-variation-settings: "opsz" 60;
  letter-spacing: -0.022em;
  text-wrap: balance;
  outline: none;
}

.home-title .hero-chip {
  position: static;
  margin: 0;
  font-size: 0.8125rem;
  transform: none;
}

/* Said once after joining with an open invite: where the code that confirms the address went, and its field. */
.join-note {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  max-width: 62ch;
  margin: 18px 0 0;
  padding: 10px 6px 10px 14px;
  border-radius: var(--r-m);
  background: var(--lamp-wash);
}

.join-note-icon {
  margin-top: 1px;
  color: var(--lamp-ink);
}

.join-note-body {
  min-width: 0;
  padding-bottom: 4px;
}

.join-note-text {
  margin: 0;
  padding-top: 1px;
  color: var(--ink);
  font-weight: 500;
  overflow-wrap: anywhere;
  outline: none;
}

/* Confirmed: the line says so, in the calm of done. */
.join-note.is-done {
  background: color-mix(in oklab, var(--ok) 12%, transparent);
}

.join-note.is-done .join-note-icon {
  color: var(--ok);
}

.join-note-close {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin: -8px 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-2);
}

.join-note-close:hover {
  background: var(--hover);
  color: var(--ink);
}

/* ───── The code that confirms an address: #/verify's card, and in a notice (Settings → Account, after joining) ───── */

.code-form {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.code-form .field-label {
  margin: 0;
}

.code-row {
  display: grid;
  gap: 12px;
}

/* Six digits, set as the email sets them: large, spaced, every digit as wide as the next. */
.code-input {
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.16em;
  text-align: center;
}

.code-form .form-error {
  margin: 0;
}

.code-more {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin: 0;
  color: var(--ink-2);
  font-size: 0.9375rem;
}

/* A new code went: where (the address may be long on a phone). */
.code-sent {
  margin: 0;
  color: var(--ink);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.code-sent:empty {
  display: none;
}

/* In a notice: the field and Confirm on one row (the field gives way first; Confirm drops under it only when even
   six digits would not fit beside it). */
.code-form.is-compact {
  gap: 10px;
  margin-top: 12px;
}

.code-form.is-compact .field-label {
  font-size: 0.875rem;
}

.code-form.is-compact .code-row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 10px;
}

.code-form.is-compact .code-input {
  flex: 1 1 7.5rem;
  min-width: 0;
  max-width: 13rem;
  min-height: 48px;
  padding: 9px 12px;
  font-size: 1.25rem;
  text-align: start;
}

/* #/verify's line names the address the code went to: it wraps rather than running off a phone. */
.verify-lede {
  overflow-wrap: anywhere;
}

@media (prefers-reduced-motion: no-preference) {
  .home-head.is-intro .home-words {
    animation: line-in 0.75s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }

  .home-head.is-intro .hero-chip::before {
    animation: lamp-on 1.4s ease-out both;
  }
}

/* "Voice and style": the narrator, style and intensity behind one line that says what is chosen. */
.options {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  background: var(--bg-raised);
}

.options-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 10px 14px 10px 16px;
  border-radius: var(--r-m);
  cursor: pointer;
  list-style: none;
}

.options-summary::-webkit-details-marker {
  display: none;
}

.options-summary::marker {
  content: "";
}

.options-summary:hover {
  background: var(--hover);
}

.options[open] > .options-summary {
  border-bottom: 1px solid var(--line);
  border-radius: var(--r-m) var(--r-m) 0 0;
}

.options-text {
  display: grid;
  flex: 1;
  gap: 1px;
  min-width: 0;
}

.options-title {
  font: 600 0.9375rem/1.3 var(--sans);
}

.options-value {
  color: var(--ink-2);
  font: italic 400 1.0625rem/1.35 var(--serif);
  font-variation-settings: "opsz" 20;
  overflow-wrap: anywhere;
}

.options-value:empty {
  display: none;
}

.options-chev {
  flex: none;
  color: var(--ink-3);
  transition: transform 0.2s ease;
}

.options[open] > .options-summary .options-chev {
  transform: rotate(180deg);
}

.options-body {
  display: grid;
  gap: 24px;
  padding: 18px 16px 20px;
}

/* ───────────── Story: someone else's (an admin's view) ───────────── */

.owner-note {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px 14px;
  align-items: start;
  max-width: 560px;
  margin-top: 22px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  background: var(--bg-raised);
}

.avatar.avatar-sm {
  width: 34px;
  height: 34px;
  font-size: 0.8125rem;
  box-shadow: none;
}

.owner-body {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.owner-name {
  margin: 0;
  font: 500 1.125rem/1.3 var(--serif);
  overflow-wrap: anywhere;
}

.owner-handle {
  color: var(--ink-3);
  font: 500 0.875rem/1.3 var(--sans);
}

.owner-text {
  margin: 0;
  color: var(--ink-2);
  font-size: 0.9375rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.owner-link {
  justify-self: start;
  min-height: 40px;
}

.sheet-body > .owner-note {
  margin-top: 0;
}

/* ───────────── Share sheet: applying a choice, and narrow screens ───────────── */

/* Nothing in the sheet may widen it past the screen: long words and labels wrap instead. */
.sheet-body > * {
  min-width: 0;
}

.vis-apply {
  display: grid;
  gap: 12px;
  justify-items: start;
  margin-top: 14px;
}

.vis-apply .rights {
  justify-self: stretch;
  margin-top: 0;
}

.share-section .btn,
.vis-apply .btn {
  max-width: 100%;
  height: auto;
  padding-block: 10px;
  line-height: 1.25;
  text-align: center;
  white-space: normal;
}

/* ───────────── Very narrow screens (320 px, or a desktop zoomed to 400%) ───────────── */

/*
 * The mark alone stands for the brand where the masthead runs out of room; its name stays for screen readers. Signed
 * in, the minutes ("Under 1 min left") and the menu need it below 380 px; signed out, below 360 px.
 */
@media (max-width: 379px) {
  .masthead:has(.account) .brand-name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

@media (max-width: 359px) {
  .brand-name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .masthead {
    gap: 8px;
  }

  .masthead-end {
    gap: 6px;
  }
}

/* ───────────── Forced colours (Windows High Contrast) ───────────── */

/*
 * Forced colours remove the tints, shadows and gradients that mark what is selected, current or done, and turn
 * transparent borders into visible ones. System colours and outlines survive, so state is redrawn with those.
 */
@media (forced-colors: active) {
  .voice:has(.voice-input:checked) {
    outline: 3px solid Highlight;
    outline-offset: -4px;
  }

  /* After the selection ring, so a focused card shows its focus ring (its filled radio still shows the choice). */
  .voice:has(.voice-input:focus-visible) {
    outline: 3px solid CanvasText;
    outline-offset: 2px;
  }

  .voice-input:checked + .voice-label::before {
    forced-color-adjust: none;
    border-color: Highlight;
    background: radial-gradient(circle, Highlight 0 5px, Canvas 5.5px);
  }

  /*
   * Chosen and current items are filled like a selected list item. Forced colours would paint a Canvas backplate
   * behind their text (hiding HighlightText), so these opt out and name every colour as a system colour.
   */
  .seg-input:checked + .seg-label,
  .chapter.is-current {
    forced-color-adjust: none;
    border-color: Highlight;
    background-color: Highlight;
    color: HighlightText;
  }

  .seg-input:checked + .seg-label :is(.seg-name, .seg-hint, .wave),
  .chapter.is-current :is(.chapter-num, .chapter-title, .chapter-time) {
    color: HighlightText;
  }

  .seg-input:focus-visible + .seg-label,
  .chapter.is-current:focus-visible {
    outline-color: CanvasText;
  }

  .line-text {
    border-left-color: Canvas;
  }

  .line.is-current .line-text {
    border-left-color: Highlight;
  }

  .step.is-current .step-dot {
    border-color: Highlight;
    background-color: Highlight;
  }

  .meter,
  .mini-meter,
  .scrub-track {
    border: 1px solid CanvasText;
  }

  .meter-fill,
  .mini-meter-fill {
    background-color: Highlight;
  }

  /* The ribbon's mood gradient is an inline style; the played part becomes plain Highlight. */
  .scrub-ribbon {
    background: Highlight !important;
  }

  .scrub-veil.is-buffered,
  .scrub-veil.is-rest {
    background-color: Canvas;
  }

  .tick {
    background-color: CanvasText;
  }

  /* The chosen visibility, the open embed tab and the page in the account menu. */
  .seg-input:checked + .vis-label {
    forced-color-adjust: none;
    background-color: Highlight;
    color: HighlightText;
  }

  .tab[aria-selected="true"] {
    border-bottom-color: Highlight;
  }

  .menu-item[aria-current="page"]::after,
  .minutes-dot,
  .upsell-mark {
    background-color: CanvasText;
  }

  .cl-meter {
    border: 1px solid CanvasText;
  }

  .cl-meter-fill {
    background-color: Highlight;
  }

  .avatar {
    border: 1px solid CanvasText;
  }
}

/* ───────────── Motion preferences ───────────── */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ───────────── Browse: the stories people made public ───────────── */

.browse {
  min-width: 0;
}

.browse-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin: 0 0 12px;
}

.browse-head .shelf-heading {
  margin: 0;
}

/* New / Most liked: one control of two pressed-or-not buttons. */
.browse-sort {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--bg-raised);
}

.browse-sort-btn {
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font: 600 0.9375rem/1 var(--sans);
}

.browse-sort-btn:hover {
  background: var(--hover);
}

.browse-sort-btn[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
}

/* Topic chips: one row that scrolls sideways on a phone, wrapping on wider screens. */
.browse-chips {
  display: flex;
  gap: 8px;
  margin: 0 calc(var(--gutter) * -1) 18px;
  padding: 2px var(--gutter) 6px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.browse-chips::-webkit-scrollbar {
  display: none;
}

@media (min-width: 720px) {
  .browse-chips {
    flex-wrap: wrap;
    margin-inline: 0;
    padding-inline: 0;
    overflow: visible;
  }
}

.topic-chip-btn {
  flex: none;
  min-height: 40px;
  padding: 0 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  background: var(--bg-raised);
  color: var(--ink);
  font: 600 0.875rem/1 var(--sans);
  white-space: nowrap;
}

.topic-chip-btn:hover {
  background: var(--hover);
}

.topic-chip-btn[aria-pressed="true"] {
  border-color: var(--lamp);
  background: var(--lamp-wash);
  color: var(--lamp-ink);
}

/* The cards: two to a row on a phone, three on a tablet, four on a wide screen. */
.browse-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 720px) {
  .browse-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 28px 20px;
  }
}

@media (min-width: 1060px) {
  .browse-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* A card places its ▶ from its own width (container units), on the square cover's corner. */
.bc-item {
  position: relative;
  min-width: 0;
  container-type: inline-size;
}

.bc-link {
  display: grid;
  gap: 10px;
  align-content: start;
  padding-bottom: 50px;
  color: inherit;
  text-decoration: none;
}

.bc-cover {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--r-m);
}

.bc-text {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.bc-topic {
  color: var(--lamp-ink);
  font: 700 0.6875rem/1.2 var(--sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.bc-title {
  display: -webkit-box;
  overflow: hidden;
  font: 500 1.0625rem/1.25 var(--serif);
  font-variation-settings: "opsz" 20;
  overflow-wrap: anywhere;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
}

.bc-link:hover .bc-title {
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}

.bc-meta,
.bc-by {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  min-width: 0;
  color: var(--ink-3);
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
}

.bc-site {
  max-width: 100%;
  overflow: hidden;
  color: var(--ink-2);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ▶ on the cover's bottom corner: plays right here, in the player bar. */
.bc-play {
  position: absolute;
  top: calc(100cqw - 54px);
  left: 10px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--lamp);
  color: var(--on-lamp);
  box-shadow: 0 6px 16px -6px rgb(0 0 0 / 0.5);
}

.bc-play:hover {
  background: color-mix(in oklab, var(--lamp) 88%, var(--ink));
}

.bc-play > * {
  grid-area: 1 / 1;
}

.bc-play .icon {
  width: 20px;
  height: 20px;
}

.bc-play .i-play {
  margin-left: 2px;
}

.bc-play .i-pause,
.bc-item.is-playing .bc-play .i-play,
.bc-play.is-busy .icon {
  display: none;
}

.bc-item.is-playing .bc-play:not(.is-busy) .i-pause,
.bc-play.is-busy .spinner {
  display: block;
}

/* The ♥ under the card's words. */
.bc-item > .like {
  position: absolute;
  bottom: 0;
  left: 0;
}

/* ♥ and its count: pressed when you like it. */
.like {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  min-height: 40px;
  padding: 0 12px 0 10px;
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  background: var(--bg-raised);
  color: var(--ink-2);
  font: 600 0.875rem/1 var(--sans);
  font-variant-numeric: tabular-nums;
}

.like:hover {
  background: var(--hover);
}

.like-icon {
  width: 18px;
  height: 18px;
}

/* Not liked, or a visitor's (which opens the sheet that asks them to join): the heart is an outline. */
.like:not([aria-pressed="true"]) .like-icon path {
  fill: transparent;
}

.like[aria-pressed="true"] {
  border-color: color-mix(in oklab, var(--mood-tender) 55%, transparent);
  color: var(--mood-tender);
}

.like-count:empty {
  display: none;
}

.browse-status:empty {
  display: none;
}

.browse-more {
  display: flex;
  margin: 28px auto 0;
}

/* Signed out, home is Browse under a short line on what Opitan is. */
.visitor-lede {
  max-width: 46ch;
  margin: 14px 0 0;
  color: var(--ink-2);
  font: 400 clamp(1.0625rem, 0.98rem + 0.45vw, 1.25rem)/1.5 var(--serif);
  font-variation-settings: "opsz" 20;
}

.visitor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  margin-top: 20px;
}

/* A visitor's ♥: liking needs an account. A small card on wider screens; on a phone it is .sheet's own bottom sheet. */
@media (min-width: 600px) {
  .join-sheet {
    width: min(440px, calc(100vw - 32px));
  }
}

.join-sheet .sheet-body {
  gap: 18px;
}

.join-sheet-text {
  margin: 0;
  color: var(--ink-2);
  line-height: 1.5;
}

.join-sheet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
}

/* ───────────── Home, signed in: listening first ───────────── */

/* The make bar: the link field and its button in one slim card, above Continue listening and Browse. */
.composer.is-bar {
  max-width: 760px;
  margin: 0 0 clamp(32px, 5vw, 48px);
  padding: clamp(16px, 2.5vw, 22px);
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  background: var(--bg-raised);
}

/* ───────────── The Library page ───────────── */

.library-page {
  padding-top: clamp(18px, 4vw, 44px);
}

.page-title {
  margin: 0 0 clamp(22px, 3vw, 34px);
  font: 400 clamp(2rem, 1.4rem + 2.3vw, 3.1rem)/1.08 var(--serif);
  font-variation-settings: "opsz" 60;
  letter-spacing: -0.022em;
  outline: none;
}

/* Your stories, by topic. */
.topic-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.library .liked {
  margin-top: 44px;
}

/* A liked story keeps its ♥ beside it, to take the like back. */
.shelf-liked .shelf-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 8px;
}

.meta-topic {
  color: var(--lamp-ink);
  font-weight: 600;
}

/* Library in the masthead (on a phone it is in the account menu). */
.masthead-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--ink);
  font: 600 0.9375rem/1 var(--sans);
  text-decoration: none;
}

.masthead-link:hover {
  background: var(--hover);
}

.masthead-link[aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
  text-decoration-color: var(--lamp);
}

@media (max-width: 479px) {
  .masthead-link {
    display: none;
  }
}

/* ───────────── The story page: its topic and ♥ ───────────── */

.story-topic {
  margin: 12px 0 0;
}

.topic-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--lamp-wash);
  color: var(--lamp-ink);
  font: 600 0.875rem/1 var(--sans);
}

/* The owner's menu looks like the chip, with an arrow. */
.topic-select {
  --topic-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m7 10 5 5 5-5' fill='none' stroke='%238a5000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  min-height: 44px;
  padding: 0 38px 0 16px;
  border: 1.5px solid transparent;
  border-radius: 999px;
  background-color: var(--lamp-wash);
  background-image: var(--topic-arrow);
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 16px;
  color: var(--lamp-ink);
  /* 16px: iOS zooms the page into a focused control with smaller text. */
  font: 600 1rem/1 var(--sans);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.topic-select:hover {
  border-color: color-mix(in oklab, var(--lamp) 60%, transparent);
}

.topic-select[aria-busy="true"] {
  opacity: 0.7;
  cursor: progress;
}

.topic-select option {
  background-color: var(--bg-raised);
  color: var(--ink);
}

@media (prefers-color-scheme: dark) {
  .topic-select {
    --topic-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m7 10 5 5 5-5' fill='none' stroke='%23f6b75c' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  }
}

/* The ♥ between Play and Share: as tall as Share. */
.listen .like {
  min-height: 48px;
  padding: 0 16px 0 14px;
}
