/* Newsreader is served from this server (SIL Open Font License); no outside font service is contacted. */
@font-face { font-family: 'Newsreader'; font-style: normal; font-weight: 200 800; font-display: swap; src: url('/fonts/newsreader-latin-wght-normal.woff2') format('woff2'); }
@font-face { font-family: 'Newsreader'; font-style: italic; font-weight: 200 800; font-display: swap; src: url('/fonts/newsreader-latin-wght-italic.woff2') format('woff2'); }
/* Georgia stands in at Newsreader's proportions, so headings do not jump when the typeface arrives. */
@font-face { font-family: 'Newsreader Fallback'; src: local('Georgia'); size-adjust: 96%; ascent-override: 92%; descent-override: 26%; line-gap-override: 0%; }

:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --surface: #14171b;
  --raised: #1d2126;
  --line: rgba(255, 255, 255, .09);
  --line-strong: rgba(255, 255, 255, .18);
  --ink: #f3eee6;
  --soft: #cdcfcb;
  --muted: #8f9695;
  --gold: #e3bb8a;
  --serif: 'Newsreader', 'Newsreader Fallback', Georgia, 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --gutter: clamp(20px, 5.5vw, 96px);
  --ease: cubic-bezier(.22, .8, .24, 1);
  /* One set of timings: fast for presses, base for things that open, slow for pictures arriving. */
  --t-fast: .15s;
  --t-base: .26s;
  --t-slow: .5s;
}

* { box-sizing: border-box; }
html { background: var(--bg); scrollbar-gutter: stable; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body.modal-open { overflow: hidden; }
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:disabled { opacity: .45; cursor: default; }
a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.quiet { color: var(--muted); font-size: 13px; }

/* Top bar */
.topbar { position: fixed; inset: 0 0 auto; z-index: 10; height: 72px; padding: 0 var(--gutter); display: flex; align-items: center; gap: 36px; background: linear-gradient(rgba(8, 10, 13, .82), rgba(8, 10, 13, 0)); transition: background-color .3s, backdrop-filter .3s; }
.topbar.scrolled { background: rgba(11, 13, 16, .9); -webkit-backdrop-filter: saturate(1.4) blur(22px); backdrop-filter: saturate(1.4) blur(22px); box-shadow: 0 1px 0 var(--line); }
.brand { display: flex; align-items: center; gap: 12px; font-size: 15px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; }
.brand-mark { font: 600 30px/1 var(--serif); letter-spacing: -.16em; padding-right: .16em; }
.brand-mark span { color: var(--gold); }
.brand-mark.small { font-size: 20px; }
nav { display: flex; gap: 6px; align-items: center; }
.nav { padding: 8px 14px; border-radius: 999px; font-size: 14px; color: var(--soft); transition: color .2s, background-color .2s; }
.nav:hover { color: var(--ink); }
.nav.active { color: var(--ink); background: rgba(255, 255, 255, .1); }
.header-tools { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-button { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: var(--soft); transition: background-color .2s, color .2s; }
.icon-button:hover { background: rgba(255, 255, 255, .08); color: var(--ink); }
.profile { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(140deg, #4a3f30, #26282a); border: 1px solid rgba(227, 187, 138, .4); color: var(--gold); font: 500 17px/1 var(--serif); }

.search-panel { position: fixed; z-index: 20; top: 12px; left: var(--gutter); right: var(--gutter); max-width: 720px; margin: 0 auto; height: 52px; padding: 0 6px 0 18px; display: flex; align-items: center; gap: 12px; background: rgba(29, 33, 38, .94); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); border: 1px solid var(--line-strong); border-radius: 999px; box-shadow: 0 18px 60px rgba(0, 0, 0, .55); color: var(--muted); }
.search-panel input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--ink); font-size: 16px; }
.search-panel input::placeholder { color: var(--muted); }
.search-panel input::-webkit-search-cancel-button { display: none; }

/* Hero */
.hero { position: relative; min-height: min(86vh, 860px); display: flex; align-items: flex-end; overflow: hidden; }
.hero-art, .hero-shade { position: absolute; inset: 0; }
.hero-art img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 18%; opacity: 0; transition: opacity var(--t-slow) ease-out; }
.hero-art img.shown { opacity: 1; }
.hero-shade { background: linear-gradient(90deg, var(--bg) 0%, rgba(11, 13, 16, .86) 26%, rgba(11, 13, 16, .3) 60%, rgba(11, 13, 16, 0) 82%), linear-gradient(0deg, var(--bg) 0%, rgba(11, 13, 16, .55) 22%, rgba(11, 13, 16, 0) 52%); }
.hero-content { position: relative; width: min(640px, 100%); padding: 140px var(--gutter) 72px; box-sizing: content-box; }
.feature-label { font: italic 400 20px/1.3 var(--serif); color: var(--gold); margin-bottom: 10px; }
.hero h1 { font: 400 clamp(44px, 6.2vw, 92px)/1 var(--serif); letter-spacing: -.025em; text-wrap: balance; margin-bottom: 20px; }
.meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; color: var(--soft); }
.meta .badge { border: 1px solid rgba(255, 255, 255, .38); border-radius: 5px; font-size: 11.5px; font-weight: 600; line-height: 1; padding: 4px 6px; letter-spacing: .02em; }
.meta .rating { display: inline-flex; align-items: center; gap: 5px; }
.meta .rating .i { width: 14px; height: 14px; color: var(--gold); }
.hero-description { margin-top: 18px; max-width: 54ch; font-size: 16px; line-height: 1.6; color: var(--soft); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hero-progress { margin-top: 22px; display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--soft); }
.bar { width: 190px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .2); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--gold); border-radius: 4px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.primary, .secondary { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 0 26px; border-radius: 999px; font-size: 15px; font-weight: 600; white-space: nowrap; transition: transform .2s var(--ease), background-color .2s, border-color .2s; }
.primary { background: var(--ink); color: #101317; padding-left: 22px; }
.primary:hover:not(:disabled) { background: #fff; }
.secondary { background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .16); }
.secondary:hover:not(:disabled) { background: rgba(255, 255, 255, .17); border-color: rgba(255, 255, 255, .26); }
.secondary.circle { width: 48px; padding: 0; }
.secondary.circle .i { width: 22px; height: 22px; }
.primary:active:not(:disabled), .secondary:active:not(:disabled) { transform: scale(.97); }

/* Library */
.library-body { padding: 0 var(--gutter); position: relative; }
.hero:not([hidden]) + .library-body { margin-top: -28px; }
.library-section { margin-bottom: 46px; }
.row-heading { margin-bottom: 16px; }
.row-heading h2 { font-size: 20px; font-weight: 600; letter-spacing: -.015em; }
.cards { display: flex; gap: 18px; }
.cards.shelf { overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; margin: -12px calc(var(--gutter) * -1) -12px; padding: 12px var(--gutter); scroll-padding-inline: var(--gutter); }
.cards.shelf::-webkit-scrollbar { display: none; }
.cards.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 30px 20px; }
.card { flex: none; width: clamp(148px, 14.5vw, 208px); text-align: left; scroll-snap-align: start; }
.cards.grid .card { width: auto; }
.card.wide { width: clamp(264px, 25vw, 372px); }
.card-image { position: relative; aspect-ratio: 2 / 3; overflow: hidden; border-radius: 12px; background: linear-gradient(150deg, #2a2e33, #171a1e); box-shadow: 0 0 0 1px var(--line), 0 10px 28px rgba(0, 0, 0, .35); transition: transform .35s var(--ease), box-shadow .35s var(--ease); }
.card.wide .card-image { aspect-ratio: 16 / 9; }
.card-image img { display: block; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .35s ease-out; }
.card-image img.in { opacity: 1; }
.card-image img.was { opacity: 1; transition: none; }
.card:active .card-image { transform: scale(.97); transition-duration: var(--t-fast); }
.card:hover .card-image, .card:focus-visible .card-image { transform: translateY(-5px); box-shadow: 0 0 0 1px var(--line-strong), 0 22px 44px rgba(0, 0, 0, .55); }
.card-title { position: absolute; inset: auto 0 0; padding: 40px 14px 14px; font: 500 19px/1.15 var(--serif); background: linear-gradient(transparent, rgba(8, 10, 13, .92)); display: none; }
.card.no-art .card-title, .card-image .frame + .card-title { display: block; }
.card-play { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(8, 10, 13, .28); opacity: 0; transition: opacity .25s; }
.card-play .i { width: 46px; height: 46px; padding: 13px; border-radius: 50%; background: rgba(243, 238, 230, .94); color: #101317; }
.card:hover .card-play, .card:focus-visible .card-play { opacity: 1; }
.card-tag { position: absolute; top: 10px; right: 10px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: rgba(8, 10, 13, .82); color: var(--gold); }
.card-tag .i { width: 15px; height: 15px; stroke-width: 2.4; }
.card-progress { position: absolute; left: 12px; right: 12px; bottom: 12px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .28); overflow: hidden; }
.card-progress span { display: block; height: 100%; background: var(--gold); border-radius: 4px; }
.card h3 { margin-top: 12px; font-size: 15px; font-weight: 500; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-meta { margin-top: 2px; font-size: 13px; color: var(--muted); }
.section-heading { padding-top: 124px; margin-bottom: 30px; display: flex; align-items: baseline; justify-content: space-between; gap: 20px; }
.section-heading h1 { font: 400 clamp(34px, 4.4vw, 54px)/1.05 var(--serif); letter-spacing: -.02em; }
.welcome, .library-failure { padding: 90px 0 110px; max-width: 520px; }
.library-failure { padding-top: 150px; min-height: 70vh; }
.welcome h2, .library-failure h2 { font: 400 34px/1.15 var(--serif); letter-spacing: -.015em; margin-bottom: 12px; }
.welcome p, .library-failure p { color: var(--muted); margin-bottom: 26px; }
.loading { padding: 80px 0; color: var(--muted); }
.note-card { display: flex; gap: 18px; align-items: center; padding: 22px 24px; margin: 8px 0 50px; border-radius: 16px; background: var(--surface); color: var(--muted); font-size: 14px; max-width: 640px; }
.note-card strong { display: block; color: var(--ink); font-weight: 600; margin-bottom: 2px; }
.note-card .i { width: 22px; height: 22px; color: var(--gold); }
.scan-status { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 18px; margin: 0 0 28px; border-radius: 14px; background: var(--surface); color: var(--soft); font-size: 14px; }
body:has(.hero[hidden]) .scan-status { margin-top: 110px; }
.scan-status:not([hidden]) ~ .section-heading { padding-top: 0; }
.scan-status button { margin-left: auto; color: var(--gold); font-weight: 600; min-height: 36px; padding: 0 8px; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); flex: none; animation: pulse 1.6s ease-in-out infinite; }
footer { display: flex; align-items: center; gap: 10px; padding: 26px 0 calc(34px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
footer button { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 6px; color: var(--soft); }
footer button:hover { color: var(--ink); }
footer .i { width: 16px; height: 16px; }

/* Dialogs */
dialog { color: var(--ink); background: var(--surface); border: 0; padding: 0; border-radius: 22px; box-shadow: 0 0 0 1px var(--line), 0 40px 140px rgba(0, 0, 0, .8); max-width: calc(100% - 28px); max-height: min(92dvh, 900px); overscroll-behavior: contain; }
dialog[open]:not(.player) { animation: rise var(--t-base) var(--ease); }
/* A plain dark scrim: blurring the whole page behind a dialog cost dropped frames on phones. */
dialog::backdrop { background: rgba(4, 6, 8, .8); animation: fade var(--t-base) ease-out; }
dialog.closing { animation: fall .18s ease-in forwards !important; }
dialog.closing::backdrop { animation: fade-out .18s ease-in forwards; }
.dialog-close { position: absolute; z-index: 2; top: 16px; right: 16px; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: rgba(12, 15, 18, .78); color: var(--soft); }
.dialog-close:hover { color: var(--ink); background: rgba(12, 15, 18, .85); }
dialog h2 { font: 400 36px/1.1 var(--serif); letter-spacing: -.02em; }
dialog h3 { font-size: 15px; font-weight: 600; margin: 26px 0 8px; }
dialog p { color: var(--soft); font-size: 15px; }

.detail { width: 900px; }
.detail-art { height: clamp(220px, 44vh, 400px); background: var(--raised) center 20% / cover no-repeat; position: relative; }
.detail-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(rgba(20, 23, 27, 0) 35%, var(--surface)); }
.detail-body { position: relative; display: flex; gap: 30px; padding: 0 40px 40px; margin-top: -92px; }
.detail-poster { width: 170px; aspect-ratio: 2 / 3; object-fit: cover; flex: none; align-self: flex-start; border-radius: 12px; box-shadow: 0 0 0 1px var(--line-strong), 0 18px 44px rgba(0, 0, 0, .6); }
.detail-main { min-width: 0; flex: 1; padding-top: 34px; }
.detail h2 { font-size: clamp(32px, 4.4vw, 48px); text-wrap: balance; }
.tagline { font: italic 400 19px/1.35 var(--serif); color: var(--gold); margin-top: 6px; }
.detail .meta { margin-top: 14px; }
.detail-description { margin-top: 24px; line-height: 1.65; max-width: 62ch; }
.credits { margin: 22px 0 0; display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: 14px; }
.credits dt { color: var(--muted); }
.credits dd { margin: 0; color: var(--soft); }
.episode-list:not(:empty) { padding: 0 40px 36px; }
.episode-list h3 { margin: 0 0 6px; font-size: 18px; }
.episode-row { display: flex; gap: 18px; align-items: center; width: 100%; text-align: left; padding: 12px; margin: 0 -12px; width: calc(100% + 24px); border-radius: 14px; transition: background-color .2s; }
.episode-row:hover:not(:disabled) { background: rgba(255, 255, 255, .06); }
.episode-row img { width: 148px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 9px; flex: none; background: var(--raised); }
.episode-row .words { min-width: 0; flex: 1; }
.episode-row strong { display: block; font-size: 15px; font-weight: 600; }
.episode-row small { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.episode-row .words p { font-size: 13px; color: var(--muted); margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.episode-row > .i { color: var(--soft); margin-right: 6px; }

.settings { width: 540px; padding: 40px; }
.settings h2 { margin-bottom: 22px; }
.profile-settings { display: flex; gap: 14px; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.profile-settings .quiet { font-size: 15px; }
.profile-settings strong { color: var(--ink); overflow-wrap: anywhere; }
.settings .secondary, .profile-name-form .secondary { min-height: 42px; padding: 0 18px; font-size: 14px; }
.profile-name-form { padding-bottom: 6px; border-bottom: 1px solid var(--line); padding-bottom: 26px; }
.profile-name-form label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.profile-name-form > div { display: flex; gap: 10px; }
input:not([type=search]) { min-width: 0; width: 100%; height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: #0e1114; color: var(--ink); font-size: 16px; }
.folder-example { display: grid; gap: 4px; margin: 14px 0; padding: 16px 18px; border-radius: 14px; background: #0e1114; }
.folder-example strong { font-size: 12px; color: var(--muted); font-weight: 600; }
.folder-example code { font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--soft); overflow-wrap: anywhere; margin-bottom: 8px; }
.folder-example code:last-child { margin-bottom: 0; }
.settings-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 22px; }
.text-button { min-height: 44px; padding: 0 12px; color: var(--muted); font-size: 14px; }
.text-button:hover { color: var(--ink); }
.fine, .preview-note { display: block; font-size: 12px; color: var(--muted); margin-top: 22px; line-height: 1.5; }
.preview-note { margin-top: 10px; }

.profiles { width: 560px; padding: 52px 44px 40px; text-align: center; }
.profile-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin: 34px 0 28px; }
.profile-choice { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 16px 8px; border-radius: 18px; font-size: 16px; font-weight: 500; overflow-wrap: anywhere; transition: background-color .2s; }
.profile-choice:hover:not(:disabled) { background: rgba(255, 255, 255, .05); }
.profile-avatar { width: 108px; height: 108px; display: grid; place-items: center; border-radius: 50%; background: linear-gradient(140deg, #4a3f30, #26282a); border: 1px solid rgba(227, 187, 138, .4); font: 400 48px/1 var(--serif); color: var(--gold); transition: transform .3s var(--ease), border-color .3s; }
.profile-choice-blue .profile-avatar { background: linear-gradient(140deg, #2f434d, #1f292f); border-color: rgba(150, 190, 206, .4); color: #b6d6e0; }
.profile-choice:hover:not(:disabled) .profile-avatar { transform: scale(1.05); border-color: var(--ink); }
.profile-choice small { color: var(--gold); font-size: 12px; font-weight: 400; margin-top: -8px; }

.auth { width: 440px; padding: 44px; }
.auth::backdrop { background: var(--bg); }
.auth .brand-mark { display: block; font-size: 40px; margin-bottom: 26px; }
.auth h1 { font: 400 38px/1.1 var(--serif); letter-spacing: -.02em; margin-bottom: 10px; }
.auth label { display: block; font-size: 13px; color: var(--soft); margin-top: 18px; }
.auth input { margin-top: 8px; }
.auth .primary { width: 100%; margin-top: 6px; padding: 0 26px; }
.form-error { color: #f0aea2 !important; font-size: 13px !important; min-height: 22px; margin-top: 10px; }

#toast.leaving { opacity: 0; transition: opacity .2s ease-in; }
#toast { position: fixed; z-index: 100; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: min(90%, 480px); padding: 13px 20px; border-radius: 999px; background: rgba(36, 41, 46, .96); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); box-shadow: 0 0 0 1px var(--line-strong), 0 14px 44px rgba(0, 0, 0, .55); font-size: 14px; text-align: center; animation: rise .3s var(--ease); }

/* Player */
.player[open] { animation: fade var(--t-base) ease-out; }
.player.closing { animation: fade-out .18s ease-in forwards !important; }
.player { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; border-radius: 0; background: #000; box-shadow: none; overflow: hidden; }
.stage { position: absolute; inset: 0; background: #000; overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.player-top, .player-bottom { position: absolute; left: 0; right: 0; z-index: 2; transition: opacity .35s, transform .35s var(--ease); }
.player-top { top: 0; display: flex; align-items: center; gap: 16px; padding: max(18px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) 46px max(22px, env(safe-area-inset-left)); background: linear-gradient(rgba(0, 0, 0, .72), rgba(0, 0, 0, 0)); }
.player-bottom { bottom: 0; padding: 64px max(22px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left)); background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, .82)); }
.stage.idle { cursor: none; }
.stage.idle .player-top { opacity: 0; transform: translateY(-8px); pointer-events: none; }
.stage.idle .player-bottom { opacity: 0; transform: translateY(8px); pointer-events: none; }
.player-heading { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.player-heading strong { font: 500 21px/1.2 var(--serif); letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-heading span { font-size: 13px; color: rgba(255, 255, 255, .72); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-heading span.warn { color: #f3c1a0; }
.player-profile { font-size: 13px; color: rgba(255, 255, 255, .6); }
.stage button { color: #fff; }
.round, .player-tools button { min-width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 999px; transition: background-color .2s, transform .2s var(--ease); }
.round { background: rgba(255, 255, 255, .14); }
.round:hover, .player-tools button:hover:not(:disabled) { background: rgba(255, 255, 255, .16); }
.player-tools button:active:not(:disabled) { transform: scale(.92); }
.player-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.stage button:active:not(:disabled) { transform: scale(.92); }
.player-tools .i { width: 24px; height: 24px; }
.player-tools .big .i { width: 28px; height: 28px; }
.player-tools .label { padding: 0 14px; font-size: 14px; font-weight: 500; }
.player-tools .label .i { width: 18px; height: 18px; }
.player-tools .spacer { flex: 1; }
.player-tools [aria-pressed="true"] { background: rgba(255, 255, 255, .92); color: #101317; }
.player-tools [aria-pressed="true"]:hover:not(:disabled) { background: #fff; }
.player-time { min-width: 9ch; margin-left: 10px; font-size: 14px; font-variant-numeric: tabular-nums; color: rgba(255, 255, 255, .86); white-space: nowrap; }
.player-time .slash { margin: 0 6px; opacity: .5; }
.when-playing, .stage.is-playing .when-paused, .when-muted, .stage.is-muted .when-sound { display: none; }
.stage.is-playing .when-playing, .stage.is-muted .when-muted { display: block; }
.scrub { position: relative; height: 26px; cursor: pointer; touch-action: none; outline-offset: 2px; }
.scrub-track { position: absolute; left: 0; right: 0; top: 11px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .24); overflow: hidden; transition: top .15s, height .15s; }
.scrub:hover .scrub-track, .scrub.dragging .scrub-track { top: 10px; height: 6px; }
.scrub-buffer { position: absolute; inset: 0; }
.scrub-buffer i { position: absolute; top: 0; bottom: 0; background: rgba(255, 255, 255, .34); }
.scrub-fill { position: absolute; top: 0; bottom: 0; left: 0; width: 0; background: var(--gold); transition: width .25s linear; }
.scrub.dragging .scrub-fill, .scrub.dragging .scrub-thumb { transition: none; }
.scrub-thumb { position: absolute; top: 13px; left: 0; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: #fff; box-shadow: 0 1px 6px rgba(0, 0, 0, .5); transform: scale(0); transition: transform .15s var(--ease), left .25s linear; }
.scrub:hover .scrub-thumb, .scrub.dragging .scrub-thumb, .scrub:focus-visible .scrub-thumb { transform: scale(1); }
.scrub-tip { position: absolute; bottom: 30px; left: 0; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 10px; background: rgba(20, 23, 27, .94); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; pointer-events: none; }
.scrub-tip:has(.scrub-frame:not([hidden])) { padding: 5px 5px 4px; }
.scrub-frame { display: block; border-radius: 6px; background-color: #000; background-repeat: no-repeat; }
/* Subtitles step up out of the way while the controls are showing. */
.stage video::-webkit-media-text-track-container { transition: transform var(--t-base) var(--ease); }
.stage:not(.idle) video::-webkit-media-text-track-container { transform: translateY(-104px); }
.listening-art { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 90px 24px 150px; background: #07090b; text-align: center; }
.stage.listening .listening-art { display: flex; }
.stage.listening #pip-play, .stage.listening #fullscreen-play { display: none; }
.listening-art img { height: min(46vh, 380px); aspect-ratio: 2 / 3; object-fit: cover; border-radius: 14px; box-shadow: 0 0 0 1px var(--line-strong), 0 30px 80px rgba(0, 0, 0, .7); }
.listening-art img[hidden] + p { font-size: 17px; }
.listening-art p { color: rgba(255, 255, 255, .7); font-size: 14px; }
.player-wait { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.player-wait span { width: 54px; height: 54px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .22); border-top-color: #fff; animation: spin .8s linear infinite; }
.player-flash { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); padding: 12px 20px; border-radius: 999px; background: rgba(0, 0, 0, .7); font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; pointer-events: none; z-index: 2; }
.player-error { position: absolute; z-index: 3; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(420px, calc(100% - 40px)); padding: 26px; border-radius: 18px; background: rgba(29, 33, 38, .96); text-align: center; }
.player-error p { margin-bottom: 18px; }
video::cue { font-family: var(--sans); background: rgba(0, 0, 0, .6); }

.player-flash.left { left: 22%; }
.player-flash.right { left: 78%; }
.skeleton .card-image { animation: breathe 1.5s ease-in-out infinite; box-shadow: none; }
.skeleton .bone { height: 12px; width: 62%; margin-top: 14px; border-radius: 6px; background: var(--raised); animation: breathe 1.5s ease-in-out infinite; }
.skeleton .bone.title { width: 150px; height: 18px; margin: 0 0 20px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); } }
@keyframes fall { to { opacity: 0; transform: translateY(10px) scale(.985); } }
@keyframes fade { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes breathe { 50% { opacity: .5; } }
@keyframes sheet-out { to { opacity: 0; transform: translateY(60px); } }
#toast { animation-name: toast; }
@keyframes toast { from { opacity: 0; transform: translate(-50%, 10px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; } }

@media (hover: none) {
  .pointer-only { display: none !important; }
  .card:hover .card-image { transform: none; }
  .card-play { display: none; }
  .scrub-thumb { transform: scale(1); }
  /* Finger-sized targets (44 px) without changing how anything looks. */
  .scrub { height: 44px; margin: -9px 0; }
  .scrub-track { top: 20px; }
  .scrub:hover .scrub-track, .scrub.dragging .scrub-track { top: 19px; }
  .scrub-thumb { top: 22px; }
  .scrub-tip { bottom: 42px; }
  .nav { min-height: 44px; }
  .profile { position: relative; }
  .profile::after { content: ''; position: absolute; inset: -5px; }
  .dialog-close { width: 44px; height: 44px; }
  .scan-status button { min-height: 44px; }
}
@media (min-width: 1700px) { .card { width: 220px; } .card.wide { width: 400px; } }
@media (max-width: 760px) {
  .topbar { height: auto; flex-wrap: wrap; gap: 0; padding-top: max(10px, env(safe-area-inset-top)); padding-bottom: 8px; background: linear-gradient(rgba(8, 10, 13, .9), rgba(8, 10, 13, 0)); }
  .topbar.scrolled { background: rgba(11, 13, 16, .9); }
  .brand-name { font-size: 15px; }
  nav { order: 3; width: 100%; margin: 6px -10px 0; gap: 2px; overflow-x: auto; scrollbar-width: none; }
  nav::-webkit-scrollbar { display: none; }
  .nav { padding: 7px 13px; }
  .search-panel { top: max(10px, env(safe-area-inset-top)); }
  .hero { min-height: min(88vh, 720px); }
  .hero-art img { object-position: 62% top; }
  .hero-shade { background: linear-gradient(0deg, var(--bg) 4%, rgba(11, 13, 16, .93) 30%, rgba(11, 13, 16, .35) 62%, rgba(11, 13, 16, .12) 80%, rgba(11, 13, 16, .5)); }
  .hero-content { padding-top: 220px; padding-bottom: 48px; }
  .hero h1 { margin-bottom: 14px; }
  .hero-description { font-size: 15px; }
  .actions { gap: 10px; }
  .primary, .secondary { padding: 0 20px; }
  .section-heading { padding-top: 132px; }
  .cards { gap: 14px; }
  .cards.grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 24px 14px; }
  .card { width: 132px; }
  .card.wide { width: 250px; }
  dialog:not(.player):not(.auth) { width: 100%; max-width: 100%; max-height: 94dvh; margin: auto 0 0; border-radius: 24px 24px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  dialog[open]:not(.player):not(.auth) { animation-name: sheet; }
  dialog.closing:not(.player):not(.auth) { animation-name: sheet-out !important; }
  .detail-art { height: 240px; }
  .detail-body { padding: 0 22px 26px; margin-top: -60px; gap: 16px; }
  .detail-poster { width: 96px; border-radius: 9px; }
  .detail-main { padding-top: 0; }
  .detail-main > h2, .detail-main > .tagline, .detail-main > .meta { margin-left: 112px; }
  .detail-poster { position: absolute; }
  .detail-main > .actions { margin-top: 34px; }
  .detail-poster[hidden] ~ .detail-main > h2, .detail-poster[hidden] ~ .detail-main > .tagline, .detail-poster[hidden] ~ .detail-main > .meta { margin-left: 0; }
  .detail-main > .meta { min-height: 22px; }
  .detail .actions .primary { flex: 1; }
  .episode-list:not(:empty) { padding: 0 22px 28px; }
  .episode-row img { width: 112px; }
  .settings, .profiles { padding: 36px 22px 30px; }
  .auth { padding: 34px 24px; }
  .profile-avatar { width: 92px; height: 92px; font-size: 40px; }
  .player-heading strong { font-size: 18px; }
  .player-profile, #restart-play { display: none; }
  .player-tools { gap: 0; }
  .player-time { margin-left: 6px; font-size: 13px; }
}
@keyframes sheet { from { transform: translateY(40px); opacity: 0; } }
@media (orientation: landscape) and (max-height: 500px) {
  .player-top { padding-bottom: 30px; }
  .player-bottom { padding-top: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  /* Looping effects would flicker at that speed: stop the decorative ones, and step the spinner calmly. */
  .pulse, .skeleton .card-image, .skeleton .bone { animation: none !important; }
  .player-wait span { animation: spin 1.2s steps(8) infinite !important; }
}
