/* ==========================================================
   StoryTiles — shared styles
   Per-story colours arrive as CSS variables set by player.js:
   --sky-from, --sky-to, --accent
   ========================================================== */

:root {
  --sky-from: #14134a;
  --sky-to: #3a2c8c;
  --accent: #ffc94a;
  --ink: #fffaf0;
  --ink-soft: rgba(255, 250, 240, 0.72);
  --ink-faint: rgba(255, 250, 240, 0.45);
  --glass: rgba(255, 255, 255, 0.1);
  --glass-strong: rgba(255, 255, 255, 0.16);
  --line: rgba(255, 255, 255, 0.16);
  --play-a: #ff8a5c;
  --play-b: #ff5fa2;
  --radius-xl: 32px;
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(120% 70% at 50% 0%, color-mix(in srgb, var(--sky-to) 85%, white 6%) 0%, transparent 70%),
    radial-gradient(90% 60% at 100% 100%, color-mix(in srgb, var(--accent) 22%, transparent) 0%, transparent 70%),
    linear-gradient(170deg, var(--sky-from) 0%, var(--sky-to) 120%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  transition: background 0.6s ease;
}

img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
a { color: inherit; }

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

/* ---------- Starry sky ---------- */
.sky {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.sky i {
  position: absolute;
  width: var(--s, 3px);
  height: var(--s, 3px);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 6px 1px rgba(255, 255, 255, 0.7);
  opacity: 0.25;
  animation: twinkle var(--d, 4s) ease-in-out var(--delay, 0s) infinite;
}
.sky i.spark {
  background: none;
  box-shadow: none;
  width: var(--s, 14px);
  height: var(--s, 14px);
  border-radius: 0;
}
.sky i.spark::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  filter: drop-shadow(0 0 6px var(--accent));
}
@keyframes twinkle {
  0%, 100% { opacity: 0.15; transform: scale(0.7); }
  50% { opacity: 0.95; transform: scale(1); }
}

/* ---------- Layout ---------- */
.page {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
}

/* ---------- Brand header ---------- */
.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 6px 0 18px;
  text-decoration: none;
}
.brand img {
  width: 38px;
  height: 38px;
  filter: drop-shadow(0 6px 14px rgba(255, 95, 162, 0.45));
}
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  font-variation-settings: "SOFT" 100, "WONK" 1;
}
.brand-by {
  margin-top: 3px;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ---------- Story stage ---------- */
.stage {
  display: grid;
  gap: 26px;
  justify-items: center;
  text-align: center;
}

@media (min-width: 860px) {
  .stage {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    align-items: center;
    text-align: left;
    justify-items: stretch;
    gap: 64px;
    min-height: calc(100dvh - 160px);
  }
}

/* Cover */
.cover-wrap {
  position: relative;
  width: min(84vw, 440px);
  aspect-ratio: 1;
  justify-self: center;
  animation: rise 0.9s var(--ease-spring) both;
}
.cover-wrap::before {
  content: "";
  position: absolute;
  inset: 8% 6% -6%;
  border-radius: 40px;
  background: var(--accent);
  filter: blur(46px);
  opacity: 0.45;
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.cover {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--accent) 60%, transparent), transparent 60%),
    linear-gradient(135deg, var(--sky-to), var(--sky-from));
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.35) inset,
    0 30px 60px -20px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.08);
  transform: rotate(-1.5deg);
  transition: transform 0.8s var(--ease-spring);
}
.cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.6s ease;
}
.cover img.loaded { opacity: 1; }
.cover-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}
.cover-fallback img { width: 34%; height: auto; opacity: 0.9; }
.cover.has-image .cover-fallback { display: none; }

/* shimmer while cover loads */
.cover:not(.has-image)::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.14) 50%, transparent 70%);
  background-size: 250% 100%;
  animation: shimmer 1.6s linear infinite;
}
.cover.failed::after { display: none; }
@keyframes shimmer { to { background-position: -150% 0; } }

/* Breathing while playing */
.is-playing .cover { transform: rotate(0deg) scale(1.02); animation: breathe 5s ease-in-out infinite; }
.is-playing .cover-wrap::before { opacity: 0.75; transform: scale(1.06); }
@keyframes breathe {
  0%, 100% { transform: rotate(0deg) scale(1.02); }
  50% { transform: rotate(0deg) scale(1.045); }
}

/* Floating badge on the cover */
.cover-badge {
  position: absolute;
  right: -6px;
  bottom: 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px 9px 11px;
  border-radius: 999px;
  background: rgba(20, 16, 50, 0.72);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid var(--line);
  font-size: 0.8rem;
  font-weight: 800;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  transform: rotate(2deg);
  opacity: 0;
  transition: opacity 0.4s ease;
}
.is-playing .cover-badge { opacity: 1; }
.bars { display: inline-flex; align-items: flex-end; gap: 3px; height: 14px; }
.bars span {
  width: 3px;
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
  transform-origin: bottom;
  animation: bar 0.9s ease-in-out infinite;
}
.bars span:nth-child(2) { animation-delay: -0.3s; }
.bars span:nth-child(3) { animation-delay: -0.6s; }
.bars span:nth-child(4) { animation-delay: -0.15s; }
@keyframes bar { 0%, 100% { transform: scaleY(0.3); } 50% { transform: scaleY(1); } }

/* Info column */
.info {
  width: 100%;
  max-width: 460px;
  animation: rise 0.9s 0.12s var(--ease-spring) both;
}
@media (min-width: 860px) { .info { max-width: 440px; } }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--line);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.eyebrow::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

.title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 8.4vw, 3.4rem);
  line-height: 1.02;
  letter-spacing: -0.025em;
  font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 96;
  text-wrap: balance;
}
.teaser {
  margin: 12px 0 0;
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--ink-soft);
  text-wrap: pretty;
}
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  justify-content: center;
}
@media (min-width: 860px) { .meta { justify-content: flex-start; } }
.meta li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--glass);
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--ink-soft);
}
.meta li[hidden] { display: none; }
.meta svg { width: 15px; height: 15px; opacity: 0.85; }

/* ---------- Play button ---------- */
.player { margin-top: 26px; }

.play-big {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  min-height: 76px;
  padding: 0 28px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-size: 1.3rem;
  font-weight: 900;
  letter-spacing: 0.01em;
  color: #fff;
  background: linear-gradient(135deg, var(--play-a), var(--play-b));
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.5) inset,
    0 -4px 0 rgba(0, 0, 0, 0.12) inset,
    0 18px 40px -12px color-mix(in srgb, var(--play-b) 80%, transparent);
  transition: transform 0.25s var(--ease-spring), box-shadow 0.25s ease, opacity 0.3s ease;
  animation: pulse-ring 2.6s ease-out 1.2s infinite;
}
.play-big::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent 55%);
  pointer-events: none;
}
.play-big:hover { transform: translateY(-2px) scale(1.01); }
.play-big:active { transform: scale(0.97); }
.play-big:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }
.play-big .icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
}
.play-big .icon svg { width: 22px; height: 22px; margin-left: 3px; }
.play-big[disabled] { opacity: 0.7; cursor: progress; animation: none; }
@keyframes pulse-ring {
  0% { box-shadow: 0 1px 0 rgba(255,255,255,.5) inset, 0 -4px 0 rgba(0,0,0,.12) inset, 0 18px 40px -12px color-mix(in srgb, var(--play-b) 80%, transparent), 0 0 0 0 color-mix(in srgb, var(--play-b) 55%, transparent); }
  70%, 100% { box-shadow: 0 1px 0 rgba(255,255,255,.5) inset, 0 -4px 0 rgba(0,0,0,.12) inset, 0 18px 40px -12px color-mix(in srgb, var(--play-b) 80%, transparent), 0 0 0 18px transparent; }
}

.spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Controls (after first play) ---------- */
.controls {
  padding: 20px 20px 18px;
  border-radius: 28px;
  background: var(--glass);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  backdrop-filter: blur(20px) saturate(150%);
  box-shadow: 0 20px 50px -24px rgba(0, 0, 0, 0.6);
  animation: rise 0.5s var(--ease-spring) both;
}
.controls[hidden], .play-big[hidden] { display: none; }

.progress { position: relative; height: 28px; display: flex; align-items: center; }
.progress input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 28px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  --pct: 0%;
}
.progress input::-webkit-slider-runnable-track {
  height: 10px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, var(--play-a), var(--play-b)) 0 / var(--pct) 100% no-repeat,
    rgba(255, 255, 255, 0.18);
}
.progress input::-moz-range-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}
.progress input::-moz-range-progress {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--play-a), var(--play-b));
}
.progress input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  margin-top: -7px;
  border-radius: 50%;
  background: #fff;
  border: 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35), 0 0 0 5px color-mix(in srgb, var(--play-b) 35%, transparent);
  transition: transform 0.2s var(--ease-spring);
}
.progress input::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  border: 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35), 0 0 0 5px color-mix(in srgb, var(--play-b) 35%, transparent);
}
.progress input:active::-webkit-slider-thumb { transform: scale(1.2); }
.progress input:focus-visible { outline: 3px solid #fff; outline-offset: 2px; border-radius: 999px; }

.times {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 0.82rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--ink-faint);
}

.buttons {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-top: 10px;
}
.ctrl {
  display: grid;
  place-items: center;
  gap: 4px;
  justify-self: center;
  min-width: 72px;
  padding: 8px;
  border: 0;
  background: none;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  border-radius: 18px;
  transition: transform 0.2s var(--ease-spring), color 0.2s ease;
}
.ctrl .disc {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--glass-strong);
  border: 1px solid var(--line);
}
.ctrl svg { width: 24px; height: 24px; }
.ctrl:hover { color: var(--ink); }
.ctrl:active { transform: scale(0.92); }
.ctrl:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

.ctrl-main .disc {
  width: 84px;
  height: 84px;
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, var(--play-a), var(--play-b));
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.5) inset,
    0 14px 30px -10px color-mix(in srgb, var(--play-b) 85%, transparent);
}
.ctrl-main svg { width: 34px; height: 34px; }
.ctrl-main .i-play { margin-left: 4px; }
.ctrl-main .i-play, .is-playing .ctrl-main .i-pause { display: block; }
.ctrl-main .i-pause, .is-playing .ctrl-main .i-play { display: none; }
.ctrl-main .spinner { display: none; width: 30px; height: 30px; }
.is-buffering .ctrl-main .spinner { display: block; }
.is-buffering .ctrl-main svg { display: none !important; }

/* ---------- Status / error messages ---------- */
.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  color: #2a2146;
  text-align: left;
  font-size: 0.95rem;
  line-height: 1.4;
  animation: rise 0.4s var(--ease-spring) both;
}
.notice[hidden] { display: none; }
.notice strong { display: block; font-size: 1rem; }
.notice .emoji { font-size: 1.6rem; line-height: 1; }
.notice button {
  margin-top: 10px;
  padding: 9px 16px;
  border: 0;
  border-radius: 999px;
  background: #2a2146;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

/* The End */
.the-end {
  margin-top: 16px;
  padding: 18px;
  border-radius: 24px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 30%, transparent), rgba(255, 255, 255, 0.08));
  border: 1px solid var(--line);
  text-align: center;
  animation: rise 0.6s var(--ease-spring) both;
}
.the-end[hidden] { display: none; }
.the-end h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-variation-settings: "SOFT" 100, "WONK" 1;
}
.the-end p { margin: 4px 0 14px; color: var(--ink-soft); }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: #2a2146;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s var(--ease-spring);
}
.pill:active { transform: scale(0.95); }
.pill svg { width: 18px; height: 18px; }
.pill.ghost { background: var(--glass-strong); color: var(--ink); border: 1px solid var(--line); }

/* Promises strip */
.promises {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 16px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-faint);
}
@media (min-width: 860px) { .promises { justify-content: flex-start; } }
.promises li::before { content: "✦ "; color: var(--accent); }

/* Random Story note (only on /random-story) */
.random-note {
  margin: 18px 0 0;
  text-align: center;
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.random-note a { color: var(--accent); font-weight: 800; }
@media (min-width: 860px) { .random-note { text-align: left; } }

/* Footer */
.footer {
  margin-top: 44px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--ink-faint);
}
.footer .tagline {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--ink-soft);
  font-variation-settings: "SOFT" 100;
}
.footer a { text-decoration: none; font-weight: 800; }
.footer a:hover { text-decoration: underline; }
/* Link to the StoryTiles web store (story-tiles.com) */
.footer .shop-link {
  display: table;
  margin: 12px auto 0;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink-soft);
}
.footer .shop-link:hover { color: var(--accent); text-decoration: none; }

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Home page ---------- */
.hero {
  padding: 24px 0 10px;
  text-align: center;
  animation: rise 0.9s var(--ease-spring) both;
}
.hero-tile {
  width: 112px;
  height: 112px;
  margin: 0 auto 22px;
  filter: drop-shadow(0 22px 40px rgba(255, 95, 162, 0.5));
  animation: float 6s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-10px) rotate(3deg); }
}
.hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.6rem, 11vw, 5rem);
  line-height: 0.98;
  letter-spacing: -0.035em;
  font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
  text-wrap: balance;
}
.hero h1 em {
  font-style: italic;
  background: linear-gradient(100deg, #ffd25a, #ff8a5c 45%, #ff5fa2);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p {
  max-width: 34ch;
  margin: 16px auto 0;
  font-size: 1.1rem;
  line-height: 1.55;
  color: var(--ink-soft);
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 560px;
  margin: 30px auto 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.steps li {
  padding: 16px 10px;
  border-radius: 22px;
  background: var(--glass);
  border: 1px solid var(--line);
  text-align: center;
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--ink-soft);
}
.steps .em { display: block; font-size: 1.8rem; margin-bottom: 6px; }

.shelf-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 48px 0 16px;
}
.shelf-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-variation-settings: "SOFT" 100, "WONK" 1;
}
.shelf-head span { font-size: 0.85rem; font-weight: 800; color: var(--ink-faint); }

.shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tile {
  display: block;
  padding: 10px 10px 16px;
  border-radius: 28px;
  background: var(--glass);
  border: 1px solid var(--line);
  text-decoration: none;
  transition: transform 0.35s var(--ease-spring), background 0.3s ease;
  animation: rise 0.7s var(--ease-spring) both;
}
.tile:hover { transform: translateY(-4px) rotate(-0.6deg); background: var(--glass-strong); }
.tile:active { transform: scale(0.98); }
.tile:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.tile-art {
  position: relative;
  aspect-ratio: 1;
  border-radius: 20px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--t-to, #3a2c8c), var(--t-from, #14134a));
}
.tile-art img { width: 100%; height: 100%; object-fit: cover; }
.tile-art .play-chip {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--play-a), var(--play-b));
  box-shadow: 0 8px 20px -6px rgba(0, 0, 0, 0.5);
}
.tile-art .play-chip svg { width: 18px; height: 18px; margin-left: 2px; }
.tile h3 {
  margin: 14px 6px 4px;
  font-family: var(--font-display);
  font-size: 1.2rem;
  line-height: 1.15;
  font-variation-settings: "SOFT" 100, "WONK" 1;
}
.tile p { margin: 0 6px; font-size: 0.86rem; font-weight: 700; color: var(--ink-faint); }

/* ---------- Not found ---------- */
.lost {
  max-width: 420px;
  margin: 30px auto 0;
  text-align: center;
  animation: rise 0.8s var(--ease-spring) both;
}
.lost .moon { font-size: 4.5rem; animation: float 6s ease-in-out infinite; }
.lost h1 {
  margin: 10px 0 8px;
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-variation-settings: "SOFT" 100, "WONK" 1;
}
.lost p { color: var(--ink-soft); line-height: 1.55; margin: 0 0 22px; }

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

/* ---------- Phones: keep the Play button above the fold ----------
   On narrow screens the cover is sized from the visible screen height
   and the Play button sits straight under the title, so it can be
   tapped without scrolling. Description and details follow below. */
@media (max-width: 859px) {
  .page { padding-top: max(10px, env(safe-area-inset-top)); }
  .brand { padding: 2px 0 12px; }
  .brand img { width: 32px; height: 32px; }

  .stage { gap: 18px; }
  .cover-wrap {
    width: max(170px, min(84vw, 440px, 40vh));
    width: max(170px, min(84vw, 440px, 40svh));
  }

  .info { display: flex; flex-direction: column; align-items: center; }
  .info > * { width: 100%; }
  .info > .eyebrow { width: auto; margin-bottom: 10px; }
  .title { font-size: clamp(1.8rem, 7.6vw, 2.6rem); }
  .info > .player { order: 1; margin-top: 18px; }
  .info > .teaser { order: 2; margin-top: 18px; }
  .info > .meta { order: 3; }
  .info > .random-note { order: 4; }
  .info > .promises { order: 5; }
  .teaser[hidden], .random-note[hidden] { display: none; }
}

/* Very short screens (small phones, landscape) */
@media (max-width: 859px) and (max-height: 600px) and (orientation: portrait) {
  .cover-wrap {
    width: max(150px, min(84vw, 440px, 34vh));
    width: max(150px, min(84vw, 440px, 34svh));
  }
  .play-big { min-height: 66px; }
}

/* Phones held sideways: cover beside the details */
@media (max-width: 959px) and (max-height: 500px) and (orientation: landscape) {
  .brand { padding-bottom: 6px; }
  .stage {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 24px;
    text-align: left;
  }
  .cover-wrap { width: min(40vw, 62vh); width: min(40vw, 62svh); }
  .info { align-items: flex-start; }
  .info > .eyebrow { margin-bottom: 6px; }
  .title { font-size: clamp(1.4rem, 4.4vw, 2rem); }
  .info > .player { margin-top: 12px; }
  .meta, .promises { justify-content: flex-start; }
  .random-note { text-align: left; }
}

/* ---------- Video share page (/video/<slug>) ---------- */
.loading-line { text-align: center; color: var(--ink-soft); font-weight: 800; margin-top: 40px; }
/* Frame: a 9:16 version of the story cover, with the same glow, tilt and breathing */
.video-wrap {
  position: relative;
  width: min(84vw, 400px, calc((100dvh - 150px) * 9 / 16));
  width: min(84vw, 400px, calc((100svh - 150px) * 9 / 16));
  aspect-ratio: 9 / 16;
  justify-self: center;
  animation: rise 0.9s var(--ease-spring) both;
}
.video-wrap::before {
  content: "";
  position: absolute;
  inset: 8% 6% -4%;
  border-radius: 40px;
  background: var(--accent);
  filter: blur(46px);
  opacity: 0.45;
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.video-frame {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: linear-gradient(160deg, var(--sky-to), var(--sky-from));
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.35) inset,
    0 30px 60px -20px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.08);
  transform: rotate(-1.5deg);
  transition: transform 0.8s var(--ease-spring);
  isolation: isolate;
}
.has-started .video-frame { transform: rotate(0deg) scale(1.01); }
.is-playing .video-wrap::before { opacity: 0.75; transform: scale(1.05); }
.video-wrap .cover-badge { right: -10px; bottom: 26px; }

/* Before the first play: the cover art, softly blurred to fill the tall frame */
.video-poster { position: absolute; inset: 0; transition: opacity 0.5s ease; }
.video-poster-fill {
  position: absolute;
  inset: -10%;
  width: 120%;
  height: 120%;
  max-width: none;
  object-fit: cover;
  filter: blur(26px) saturate(150%) brightness(0.95);
  opacity: 0;
  transition: opacity 0.6s ease;
}
.video-poster-fill.loaded { opacity: 1; }
.video-poster::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(70% 45% at 50% 46%, transparent, color-mix(in srgb, var(--sky-from) 55%, transparent)),
    linear-gradient(180deg, transparent 60%, color-mix(in srgb, var(--sky-from) 70%, transparent));
}
.video-poster-art {
  position: absolute;
  z-index: 1;
  left: 9%;
  right: 9%;
  top: 50%;
  width: auto;
  height: auto;
  aspect-ratio: 1;
  border-radius: 22px;
  transform: translateY(-50%) rotate(1.5deg);
  animation: none;
}
.is-playing .video-poster-art { transform: translateY(-50%) rotate(1.5deg); animation: none; }

.video-frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  background: transparent;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.has-started .video-frame video { opacity: 1; }
.has-started .video-poster { opacity: 0; }

/* The whole frame is a play/pause button */
.video-tap {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
}
.video-tap:focus-visible { outline: 3px solid #fff; outline-offset: -6px; border-radius: inherit; }
.video-tap-chip {
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, var(--play-a), var(--play-b));
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.5) inset,
    0 16px 34px -10px color-mix(in srgb, var(--play-b) 85%, transparent);
  transition: opacity 0.3s ease, transform 0.3s var(--ease-spring);
  animation: chip-pulse 2.6s ease-out 1.2s infinite;
}
.video-tap-chip svg { width: 32px; height: 32px; margin-left: 4px; }
.video-tap:hover .video-tap-chip { transform: scale(1.06); }
.video-tap:active .video-tap-chip { transform: scale(0.94); }
.is-playing .video-tap-chip, .is-buffering .video-tap-chip { opacity: 0; transform: scale(0.8); }
.has-started:not(.is-playing) .video-tap-chip { animation: none; }
@keyframes chip-pulse {
  0% { box-shadow: 0 1px 0 rgba(255,255,255,.5) inset, 0 16px 34px -10px color-mix(in srgb, var(--play-b) 85%, transparent), 0 0 0 0 color-mix(in srgb, var(--play-b) 55%, transparent); }
  70%, 100% { box-shadow: 0 1px 0 rgba(255,255,255,.5) inset, 0 16px 34px -10px color-mix(in srgb, var(--play-b) 85%, transparent), 0 0 0 20px transparent; }
}

.video-fs {
  position: absolute;
  z-index: 3;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(20, 16, 50, 0.55);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: var(--ink);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.video-fs[hidden] { display: none; }
.video-fs svg { width: 18px; height: 18px; }
.has-started .video-fs { opacity: 1; }

/* Mute button icons */
.ctrl .i-muted, .is-muted .ctrl .i-sound { display: none; }
.is-muted .ctrl .i-muted { display: block; }

/* Short clip / Full story switch */
.video-tabs {
  display: inline-flex;
  gap: 4px;
  margin: 16px 0 0;
  padding: 4px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--line);
}
.video-tabs[hidden] { display: none; }
.video-tabs button {
  padding: 8px 16px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--ink-soft);
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.video-tabs button.is-active { background: #fff; color: #2a2146; }
.video-tabs button:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

.video-page .the-end .pill { margin: 0 auto; }

/* Download / share / copy / listen */
.video-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 22px;
}
.video-actions .pill { justify-content: center; padding: 12px 16px; }
.video-actions .pill[hidden] { display: none; }
.video-actions .pill:disabled { opacity: 0.6; cursor: default; }
.video-note { color: var(--ink-soft); font-weight: 700; margin: 12px 0 0; }
.video-note[hidden] { display: none; }

.video-captions {
  margin-top: 22px;
  padding: 4px 16px;
  border-radius: 22px;
  background: var(--glass);
  border: 1px solid var(--line);
  text-align: left;
}
.video-captions[hidden] { display: none; }
.video-captions summary { cursor: pointer; font-weight: 900; padding: 12px 0; }
.video-captions[open] { padding-bottom: 16px; }
.video-caption { margin-top: 10px; }
.video-caption > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.video-caption .pill { padding: 6px 14px; font-size: 0.85rem; }
.video-caption pre { margin: 0; padding: 12px 14px; border-radius: 14px; background: rgba(8, 8, 40, 0.25); border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; font: 700 0.92rem/1.5 var(--font-body); color: var(--ink); }

@media (min-width: 860px) {
  .video-page { grid-template-columns: auto minmax(0, 1fr); gap: 72px; }
  .video-page .info { max-width: 460px; }
}
@media (max-width: 859px) {
  /* Leave room for the title and Play button above the fold */
  .video-wrap {
    width: max(170px, min(78vw, 400px, calc(54vh * 9 / 16)));
    width: max(170px, min(78vw, 400px, calc(54svh * 9 / 16)));
  }
  .info > .video-tabs { width: auto; }
  .info > .video-actions { order: 3; }
  .info > .video-note { order: 3; }
  .info > .video-captions { order: 4; }
  .video-tap-chip { width: 64px; height: 64px; }
  .video-tap-chip svg { width: 26px; height: 26px; }
}
@media (max-width: 959px) and (max-height: 500px) and (orientation: landscape) {
  .video-wrap { width: calc(78vh * 9 / 16); width: calc(78svh * 9 / 16); }
}
