@font-face { font-family: 'Fraunces'; src: url('/fonts/fraunces.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  --night: #0A0D14;
  --surface: #141925;
  --raised: #1D2333;
  --line: rgba(237, 239, 244, 0.10);
  --text: #EDEFF4;
  --muted: #8C94A8;
  --lamp: #F0B45E;      /* the one accent: a warm porch light */
  --lamp-ink: #241604;
  --danger: #FF8A7A;
  --display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --gutter: clamp(16px, 4vw, 56px);
  --radius-l: 18px; --radius-m: 12px;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--night); color: var(--text); font-family: var(--ui); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
body { min-height: 100vh; min-height: 100dvh; overflow-x: hidden; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
img { display: block; }
:focus-visible { outline: 2px solid var(--lamp); outline-offset: 3px; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.wordmark { font-family: var(--display); font-weight: 600; font-size: clamp(40px, 9vw, 64px); letter-spacing: -0.02em; margin: 0; font-variation-settings: 'opsz' 144; }
.wordmark.small { font-size: 24px; letter-spacing: -0.01em; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 24px;
  border-radius: 999px; border: 0; background: rgba(237,239,244,.12); font-weight: 600; font-size: 17px; text-decoration: none; color: var(--text); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--lamp); color: var(--lamp-ink); }
.btn-primary svg { fill: currentColor; stroke: none; }
.btn-wide { width: 100%; }
.btn-xl { min-height: 64px; font-size: 19px; padding: 0 34px; }
.btn-small { min-height: 40px; padding: 0 16px; font-size: 15px; }
.icon-btn { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 999px; border: 0; background: transparent; position: relative; flex: none; }
.icon-btn.glass { background: rgba(20,25,37,.55); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.icon-btn.big { width: 64px; height: 64px; }
.icon-btn.huge { width: 88px; height: 88px; }
.icon-btn.huge svg { width: 40px; height: 40px; fill: currentColor; stroke: none; }
.icon-btn.big svg { width: 34px; height: 34px; stroke-width: 1.8; }
.icon-btn .skip-num { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; font-weight: 700; padding-top: 2px; }
.icon-btn svg circle { fill: currentColor; stroke: none; }
.pill-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 999px; border: 0;
  background: rgba(20,25,37,.55); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); font-weight: 600; font-size: 15px; }
.pill-btn[aria-pressed="true"] { background: var(--text); color: var(--night); }
.quiet-link { color: var(--muted); font-size: 14px; text-align: center; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- login ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: calc(var(--safe-t) + 24px) var(--gutter) calc(var(--safe-b) + 24px); position: relative; overflow: hidden; }
.login-art { position: absolute; inset: -10%; background:
  radial-gradient(40% 30% at 70% 28%, rgba(240,180,94,.30), transparent 70%),
  radial-gradient(60% 50% at 20% 80%, rgba(58,74,128,.45), transparent 70%),
  radial-gradient(30% 20% at 30% 20%, rgba(120,90,160,.25), transparent 70%), var(--night); filter: blur(10px); }
.login-card { position: relative; width: min(420px, 100%); display: grid; gap: 18px; padding: 36px 28px; border-radius: 28px;
  background: rgba(20,25,37,.72); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); border: 1px solid var(--line); }
.login-lede { margin: -4px 0 6px; color: var(--muted); line-height: 1.5; font-size: 16px; }
.field { display: grid; gap: 8px; font-size: 14px; color: var(--muted); font-weight: 600; }
.field input { font: inherit; font-size: 17px; color: var(--text); background: var(--night); border: 1px solid var(--line); border-radius: var(--radius-m);
  min-height: 52px; padding: 0 16px; width: 100%; }
.field input:focus { border-color: var(--lamp); outline: none; }
.form-error { margin: 0; color: var(--danger); font-size: 15px; }

/* ---------- library ---------- */
.library { padding-bottom: calc(var(--safe-b) + 48px); }
.topbar { position: absolute; z-index: 5; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--safe-t) + 14px) calc(var(--gutter) + var(--safe-r)) 14px calc(var(--gutter) + var(--safe-l)); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.hero { position: relative; min-height: min(78vh, 720px); display: flex; align-items: flex-end; padding: 120px calc(var(--gutter) + var(--safe-r)) 40px calc(var(--gutter) + var(--safe-l)); overflow: hidden; }
.hero-art { position: absolute; inset: 0; background-size: cover; background-position: center 30%; }
.hero-art::after { content: ''; position: absolute; inset: 0; background:
  linear-gradient(to top, var(--night) 2%, rgba(10,13,20,.6) 38%, rgba(10,13,20,.1) 70%, rgba(10,13,20,.45) 100%),
  linear-gradient(to right, rgba(10,13,20,.75), transparent 65%); }
.hero-body { position: relative; max-width: 640px; display: grid; gap: 14px; }
.hero-title { font-family: var(--display); font-weight: 650; font-size: clamp(52px, 12vw, 112px); line-height: .92; letter-spacing: -0.035em; margin: 0; font-variation-settings: 'opsz' 144; text-wrap: balance; }
.hero-meta { color: var(--muted); font-size: 16px; font-weight: 600; margin: 0; }
.hero-desc { margin: 0; color: rgba(237,239,244,.82); font-size: 17px; line-height: 1.5; max-width: 56ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.section { padding: 8px calc(var(--gutter) + var(--safe-r)) 8px calc(var(--gutter) + var(--safe-l)); }
.section h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; margin: 26px 0 14px; }
.seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--surface); margin-top: 8px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; min-height: 44px; padding: 0 18px; border-radius: 999px; font-weight: 600; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--raised); color: var(--text); }

.rail { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
@media (max-width: 719px) {
  .rail { grid-auto-flow: column; grid-auto-columns: 80%; grid-template-columns: none; overflow-x: auto; scroll-snap-type: x mandatory;
    margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter) 8px; scroll-padding: 0 var(--gutter); scrollbar-width: none; }
  .rail::-webkit-scrollbar { display: none; }
  .rail > * { scroll-snap-align: start; }
}
.card { display: grid; gap: 12px; text-align: left; border: 0; padding: 0; background: none; border-radius: var(--radius-l); }
.card-art { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius-l); overflow: hidden; background: var(--surface); }
.card-art img { width: 100%; height: 100%; object-fit: cover; }
.card:active .card-art { transform: scale(.985); }
.card.is-current .card-art { box-shadow: 0 0 0 3px var(--lamp); }
.card-progress { position: absolute; left: 12px; right: 12px; bottom: 12px; height: 4px; border-radius: 4px; background: rgba(237,239,244,.25); overflow: hidden; }
.card-progress i { display: block; height: 100%; background: var(--lamp); }
.card-badge { position: absolute; top: 10px; right: 10px; padding: 5px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; background: rgba(10,13,20,.7); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.card-text { display: grid; gap: 4px; padding: 0 4px; }
.card-kicker { color: var(--muted); font-size: 14px; font-weight: 600; }
.card-title { font-size: 18px; font-weight: 650; }
.card-desc { color: var(--muted); font-size: 15px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 0; }
.show-tiles { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.show-tile { position: relative; aspect-ratio: 16/9; border-radius: var(--radius-l); overflow: hidden; border: 0; padding: 0; text-align: left; background: var(--surface); }
.show-tile .gen-art, .show-tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.show-tile span { position: absolute; left: 14px; bottom: 12px; right: 14px; font-family: var(--display); font-weight: 650; font-size: 26px; letter-spacing: -0.02em; text-shadow: 0 2px 16px rgba(0,0,0,.6); }
.show-tile[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--lamp); }
.empty { padding: 140px var(--gutter) 40px; max-width: 640px; display: grid; gap: 14px; }
.empty h1 { font-family: var(--display); font-size: 44px; margin: 0; letter-spacing: -0.02em; }
.empty p { color: var(--muted); line-height: 1.55; margin: 0; }
.empty code { color: var(--text); background: var(--surface); padding: 2px 6px; border-radius: 6px; }

/* generated placeholder art: night sky + porch light + the episode numeral */
.gen-art { position: absolute; inset: 0; overflow: hidden; }
.gen-art b { position: absolute; right: 6%; bottom: -14%; font-family: var(--display); font-weight: 800; font-size: 170px; line-height: 1; color: transparent;
  -webkit-text-stroke: 1.5px rgba(237,239,244,.35); letter-spacing: -0.04em; font-variation-settings: 'opsz' 144; }
.hero-art .gen-art b { font-size: min(60vw, 560px); right: 4%; bottom: -12%; -webkit-text-stroke-width: 2px; color: rgba(237,239,244,.03); }

/* ---------- seats (presence) ---------- */
.seats { display: flex; gap: 8px; align-items: center; }
.seat { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 999px; background: rgba(20,25,37,.6); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); font-size: 14px; font-weight: 600; white-space: nowrap; }
.seat-dot { width: 32px; height: 32px; border-radius: 999px; display: grid; place-items: center; background: var(--raised); font-weight: 700; font-size: 14px; box-shadow: 0 0 0 2px var(--muted); }
.seat[data-s="watching"] .seat-dot { box-shadow: 0 0 0 2px var(--lamp), 0 0 18px rgba(240,180,94,.55); color: var(--lamp); }
.seat[data-s="waiting"] .seat-dot { box-shadow: 0 0 0 2px var(--lamp); animation: breathe 1.4s ease-in-out infinite; }
.seat[data-s="away"] { opacity: .55; }
.seat[data-s="away"] .seat-dot { box-shadow: 0 0 0 2px var(--muted); background: transparent; border: 1px dashed var(--muted); }
.seat small { color: var(--muted); font-weight: 600; }
@keyframes breathe { 50% { box-shadow: 0 0 0 2px var(--lamp), 0 0 22px rgba(240,180,94,.8); } }
@media (max-width: 560px) { .seat small { display: none; } .topbar .seat span { display: none; } .topbar .seat { padding: 4px; } }

/* ---------- player ---------- */
.player { position: fixed; inset: 0; background: #000; z-index: 10; }
.stage { position: absolute; inset: 0; background: #000; overflow: hidden; }
.stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.stage video::cue { background: rgba(0,0,0,.6); color: #fff; font-family: var(--ui); font-size: var(--cue-size, 1em); line-height: 1.3; }
.tap-layer { position: absolute; inset: 0; }
.controls { position: absolute; inset: 0; display: grid; grid-template-rows: auto 1fr auto; pointer-events: none; transition: opacity .25s ease; }
.controls > * { pointer-events: auto; }
.controls .scrim { position: absolute; left: 0; right: 0; pointer-events: none; }
.scrim-top { top: 0; height: 160px; background: linear-gradient(to bottom, rgba(0,0,0,.65), transparent); }
.scrim-bottom { bottom: 0; height: 220px; background: linear-gradient(to top, rgba(0,0,0,.75), transparent); }
.stage.idle .controls { opacity: 0; }
.stage.idle .controls > * { pointer-events: none; }
.stage.idle { cursor: none; }
.ctl-top { position: relative; display: flex; align-items: center; gap: 14px; padding: calc(var(--safe-t) + 14px) calc(var(--gutter) + var(--safe-r)) 0 calc(var(--gutter) + var(--safe-l)); }
.now-title { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.now-title span { color: rgba(237,239,244,.7); font-size: 14px; font-weight: 600; }
.now-title strong { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctl-center { position: relative; display: flex; align-items: center; justify-content: center; gap: clamp(24px, 8vw, 72px); pointer-events: none; }
.ctl-center > * { pointer-events: auto; }
.stage:not(.paused) .i-play, .stage.paused .i-pause { display: none; }
.ctl-bottom { position: relative; display: grid; gap: 10px; padding: 0 calc(var(--gutter) + var(--safe-r)) calc(var(--safe-b) + 18px) calc(var(--gutter) + var(--safe-l)); }
.timeline { display: flex; align-items: center; gap: 14px; }
.time { font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 600; min-width: 52px; color: rgba(237,239,244,.85); }
.time:last-child { text-align: right; }
.scrub-wrap { position: relative; flex: 1; height: 44px; display: flex; align-items: center; }
.scrub-buffer { position: absolute; left: 0; height: 6px; border-radius: 6px; background: rgba(237,239,244,.35); pointer-events: none; top: 19px; }
input[type=range] { -webkit-appearance: none; appearance: none; position: relative; width: 100%; height: 44px; background: transparent; margin: 0; touch-action: none; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 6px; background: linear-gradient(to right, var(--text) var(--fill, 0%), rgba(237,239,244,.2) var(--fill, 0%)); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 6px; background: linear-gradient(to right, var(--text) var(--fill, 0%), rgba(237,239,244,.2) var(--fill, 0%)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; border-radius: 999px; background: var(--text); box-shadow: 0 2px 10px rgba(0,0,0,.5); }
input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border: 0; border-radius: 999px; background: var(--text); }
.ctl-row { display: flex; align-items: center; gap: 10px; }
.ctl-row .spacer { flex: 1; }
.sync-chip { font-size: 13px; font-weight: 600; color: var(--muted); }
@media (max-width: 560px) { .pill-btn { padding: 0 14px; } #btn-cc span, .sync-chip { display: none; } .ctl-center { gap: 28px; } .ctl-row { gap: 8px; } }
@media (max-height: 460px) { .icon-btn.huge { width: 72px; height: 72px; } .icon-btn.big { width: 56px; height: 56px; } .scrim-bottom { height: 160px; } }

.stage.pseudo-fs { position: fixed; inset: 0; z-index: 50; }
.hold { position: absolute; top: calc(var(--safe-t) + 84px); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 12px;
  padding: 8px 8px 8px 18px; border-radius: 999px; background: rgba(20,25,37,.82); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  font-weight: 600; font-size: 15px; max-width: calc(100% - 32px); z-index: 3; }
.spinner { width: 18px; height: 18px; border-radius: 999px; border: 2.5px solid rgba(237,239,244,.2); border-top-color: var(--lamp); animation: spin .9s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.gate { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; background: rgba(10,13,20,.6); z-index: 6; text-align: center; padding: 24px; }
.gate p { color: var(--muted); margin: 0; }
.upnext { position: absolute; right: calc(var(--gutter) + var(--safe-r)); bottom: calc(var(--safe-b) + 140px); width: min(380px, calc(100% - 32px)); padding: 18px; border-radius: var(--radius-l);
  background: rgba(20,25,37,.88); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); display: grid; gap: 12px; z-index: 4; }
.upnext h3 { margin: 0; font-family: var(--display); font-size: 26px; letter-spacing: -0.01em; }
.upnext p { margin: 0; color: var(--muted); }
.upnext .row { display: flex; gap: 10px; flex-wrap: wrap; }
.media-error { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(460px, calc(100% - 32px)); padding: 22px; border-radius: var(--radius-l);
  background: rgba(20,25,37,.94); display: grid; gap: 12px; z-index: 5; }
.media-error h3 { margin: 0; font-size: 20px; }
.media-error p { margin: 0; color: var(--muted); line-height: 1.5; }
.conn { position: absolute; bottom: calc(var(--safe-b) + 130px); left: 50%; transform: translateX(-50%); padding: 8px 16px; border-radius: 999px; background: rgba(20,25,37,.9); font-size: 14px; font-weight: 600; z-index: 7; }

/* ---------- sheets ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 40; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 82dvh; overflow-y: auto; overscroll-behavior: contain; background: var(--surface);
  border-radius: 24px 24px 0 0; padding: 10px calc(var(--gutter) + var(--safe-r)) calc(var(--safe-b) + 28px) calc(var(--gutter) + var(--safe-l)); animation: rise .28s cubic-bezier(.2,.8,.2,1); }
@media (min-width: 900px) { .sheet { left: auto; top: 0; width: min(560px, 46vw); max-height: none; border-radius: 24px 0 0 24px; animation-name: slide; } }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } .seat[data-s="waiting"] .seat-dot { animation: none; } }
.sheet-grip { width: 44px; height: 5px; border-radius: 5px; background: var(--line); margin: 0 auto 14px; }
.sheet h2 { margin: 6px 0 14px; font-size: 24px; letter-spacing: -0.01em; }
.sheet .rail { grid-template-columns: 1fr; grid-auto-flow: row; overflow: visible; margin: 0; padding: 0; }
.sheet .card { grid-template-columns: 42% 1fr; align-items: center; }
.sheet .card-art { border-radius: var(--radius-m); }
.sheet .gen-art b { font-size: 90px; }
.setting { display: grid; gap: 10px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.setting:last-child { border-bottom: 0; }
.setting > span { font-weight: 650; }
.setting p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.setting .seg { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); border-radius: 18px; }
.setting .btn { justify-self: start; }

/* ---------- toasts ---------- */
.toasts { position: fixed; z-index: 60; left: 50%; top: calc(var(--safe-t) + 16px); transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; pointer-events: none; width: max-content; max-width: calc(100% - 32px); }
.toast { padding: 10px 18px; border-radius: 999px; background: rgba(29,35,51,.95); font-size: 15px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: toast-in .2s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } }
