/* ============================================================
   Adventure Time — Land of Ooo shuffle player
   ============================================================ */

:root {
  --ink:      #17121f;
  --cream:    #fdf6e3;
  --night:    #1b1436;
  --indigo:   #2b1e5c;
  --violet:   #6a4fb0;
  --horizon:  #ff9a6b;
  --grass-1:  #5cb84f;
  --grass-2:  #3d8a38;
  --grass-3:  #2a5f28;
  --finn:     #3ba7e0;
  --jake:     #f5c451;
  --pink:     #ff9ecf;
  --sheet:    #221a45;

  --display: 'Futura', 'Avenir Next', 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
  --ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--night);
  transition: background-color .6s ease;
  color: var(--cream);
  font-family: var(--ui);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

button { font: inherit; color: inherit; }

/* ============================================================
   Backdrop — the Land of Ooo
   ============================================================ */

.ooo {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  transition: opacity .55s ease, filter .55s ease;
}

.sky {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 78% at 50% 100%, rgba(255,154,107,.55) 0%, rgba(255,154,107,0) 55%),
    linear-gradient(180deg, #120e26 0%, var(--night) 26%, var(--indigo) 58%, var(--violet) 85%, #8f6fc4 100%);
}

.stars {
  position: absolute;
  inset: 0 0 38% 0;
  background-image:
    radial-gradient(1.6px 1.6px at 12% 18%, rgba(255,255,255,.9), transparent 60%),
    radial-gradient(1.3px 1.3px at 28% 8%,  rgba(255,255,255,.7), transparent 60%),
    radial-gradient(1.8px 1.8px at 44% 24%, rgba(255,255,255,.85), transparent 60%),
    radial-gradient(1.2px 1.2px at 61% 12%, rgba(255,255,255,.65), transparent 60%),
    radial-gradient(1.7px 1.7px at 74% 26%, rgba(255,255,255,.8), transparent 60%),
    radial-gradient(1.4px 1.4px at 87% 14%, rgba(255,255,255,.75), transparent 60%),
    radial-gradient(1.2px 1.2px at 19% 33%, rgba(255,255,255,.6), transparent 60%),
    radial-gradient(1.5px 1.5px at 53% 38%, rgba(255,255,255,.55), transparent 60%),
    radial-gradient(1.3px 1.3px at 92% 35%, rgba(255,255,255,.6), transparent 60%),
    radial-gradient(1.4px 1.4px at 36% 46%, rgba(255,255,255,.4), transparent 60%);
  animation: twinkle 7s ease-in-out infinite alternate;
}

@keyframes twinkle {
  from { opacity: .55; }
  to   { opacity: 1; }
}

.moon {
  position: absolute;
  top: 9vh;
  right: 12vw;
  width: clamp(46px, 7vw, 92px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 32%, #fffdf4, #f6e6bd 62%, #e9d3a1);
  box-shadow: 0 0 40px 12px rgba(255,240,200,.22), 0 0 120px 40px rgba(255,225,170,.12);
}

.clouds { position: absolute; inset: 0; }

/* Soft cumulus: a base slab plus two puffs, blurred so the seams disappear. */
.cloud {
  position: absolute;
  background: rgba(255,255,255,.15);
  border-radius: 999px;
  filter: blur(7px);
}
.cloud::before,
.cloud::after {
  content: '';
  position: absolute;
  background: inherit;
  border-radius: 50%;
}
.cloud::before { width: 54%; height: 185%; left: 12%;  top: -78%; }
.cloud::after  { width: 40%; height: 145%; right: 14%; top: -48%; }

.c1 { width: 190px; height: 44px; top: 24%; left: -16%; animation: drift 92s linear infinite; }
.c2 { width: 140px; height: 34px; top: 37%; left: -24%; animation: drift 128s linear infinite 14s; opacity: .78; }
.c3 { width: 230px; height: 52px; top: 15%; left: -32%; animation: drift 156s linear infinite 40s; opacity: .62; }
.c4 { width: 120px; height: 30px; top: 47%; left: -14%; animation: drift 108s linear infinite 66s; opacity: .5; }

@keyframes drift {
  from { transform: translateX(0); }
  to   { transform: translateX(160vw); }
}

.hills {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  width: 100%;
  height: min(46vh, 420px);
  display: block;
}
.h-far  { fill: #35733a; }
.h-mid  { fill: var(--grass-2); }
.h-near { fill: var(--grass-1); }

/* Active photo wallpaper — enabled by <body data-backdrop="photo">.
   The procedural night scene stays in the markup and CSS untouched; it is
   simply hidden while the attribute is set. Revert by removing the
   attribute (or setting data-backdrop="procedural"). If a new decorative
   child is ever added to .ooo, add it to the hide list below. */
.wallpaper {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
body[data-backdrop="photo"] .wallpaper { display: block; }
/* The photo belongs to the Adventure Time skin; other skins fade it out. */
.wallpaper { transition: opacity .6s ease; }
body:not([data-skin="adventure-time"]) .wallpaper { opacity: 0; }
body[data-backdrop="photo"] .sky,
body[data-backdrop="photo"] .stars,
body[data-backdrop="photo"] .moon,
body[data-backdrop="photo"] .clouds,
body[data-backdrop="photo"] .hills { display: none; }

/* ============================================================
   View switching
   ============================================================ */

.view {
  position: relative;
  z-index: 1;
  height: 100%;
  display: none;
  flex-direction: column;
}

body[data-view="home"]  .view-home  { display: flex; }
body[data-view="watch"] .view-watch { display: flex; }

body[data-view="watch"] .ooo {
  opacity: .16;
  filter: saturate(.5) blur(3px);
}

/* ============================================================
   Home
   ============================================================ */

.view-home {
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-t) + 24px) 20px calc(var(--safe-b) + 24px);
  gap: 26px;
  text-align: center;
}

.logo {
  appearance: none;
  background: none;
  border: 0;
  padding: 8px 12px;
  margin: 0;
  cursor: pointer;
  display: block;
  /* Sized on the button, with border-box, so the artwork plus its padding can
     never exceed the column — otherwise the sword's pommel clips off-screen. */
  box-sizing: border-box;
  width: min(92vw, 744px);
  max-width: 100%;
  filter: drop-shadow(0 10px 0 rgba(0,0,0,.20)) drop-shadow(0 18px 34px rgba(0,0,0,.45));
  transition: transform .34s cubic-bezier(.34,1.56,.64,1);
  -webkit-tap-highlight-color: transparent;
}

.logo-img {
  display: block;
  width: 100%;
  height: auto;
  /* Clicks belong to the button, never to a dragged-out image ghost. */
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
  opacity: 0;
}

/* The entrance animates opacity/scale/rotate and the idle drift animates
   translate — separate properties, so the two compose instead of clobbering
   each other the way two `transform` animations would. */
.logo.ready .logo-img {
  animation:
    logo-in .78s cubic-bezier(.21,1.22,.42,1) forwards,
    logo-float 6.5s ease-in-out .78s infinite;
}

@keyframes logo-in {
  from { opacity: 0; scale: .84; rotate: -3.2deg; }
  60%  { opacity: 1; }
  to   { opacity: 1; scale: 1; rotate: 0deg; }
}

@keyframes logo-float {
  0%, 100% { translate: 0 0; }
  50%      { translate: 0 -9px; }
}

.logo:hover  { transform: scale(1.035) rotate(-.35deg); }
.logo:active { transform: scale(.965); }

.logo:focus-visible {
  outline: 3px dashed var(--jake);
  outline-offset: 12px;
  border-radius: 14px;
}

/* squash-and-stretch on launch */
.logo.pop { animation: pop .42s cubic-bezier(.34,1.56,.64,1); }
@keyframes pop {
  0%   { transform: scale(1); }
  32%  { transform: scale(.9, 1.1); }
  62%  { transform: scale(1.09, .93); }
  100% { transform: scale(1); }
}

.tagline {
  margin: 0;
  font-size: clamp(.85rem, 2.6vw, 1.05rem);
  letter-spacing: .16em;
  text-transform: lowercase;
  color: rgba(253,246,227,.82);
  text-shadow: 0 2px 8px rgba(0,0,0,.5);
}

.tagline-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* The tagline doubles as the library-error slot (app.js writes the "could not
   reach the library" message here). It stays empty — and fully out of the
   layout, wrapper included, so no phantom gap remains around the logo — until
   an error actually needs the slot. The wrapper is re-shown if the home
   shuffle-scope pill is ever active. */
.tagline:empty { display: none; }
.tagline-wrap:has(.tagline:empty):has(.scope-pill[hidden]) { display: none; }

/* Minimal-text home — enabled by <body data-text="hidden">.
   Hides the whole footer (stat, separators, browse/playlists/settings/account
   links) and the home shuffle-scope pill in one shot — the elements stay in
   the DOM because JS writes into #stat/#account-label/#tagline and binds
   listeners to the buttons. Revert: remove the attribute. */
body[data-text="hidden"] .view-home .home-foot { display: none; }
body[data-text="hidden"] .view-home .scope-pill { display: none; }

.scope-pill {
  appearance: none;
  border: 1.5px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.08);
  color: rgba(253,246,227,.92);
  border-radius: 999px;
  padding: 6px 8px 6px 14px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .01em;
  cursor: pointer;
  transition: background .18s, border-color .18s;
  white-space: nowrap;
}
.scope-pill:hover { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.32); }
.scope-pill[hidden] { display: none; }

.scope-x {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(255,255,255,.14);
  font-size: .62rem;
  line-height: 1;
}
.scope-pill:hover .scope-x { background: rgba(255,255,255,.26); }

.scope-pill--home {
  border-color: rgba(23,18,31,.22);
  background: rgba(255,255,255,.45);
  color: var(--ink);
  text-shadow: none;
}
.scope-pill--home:hover { background: rgba(255,255,255,.7); border-color: rgba(23,18,31,.35); }
.scope-pill--home .scope-x { background: rgba(23,18,31,.12); }
.scope-pill--home:hover .scope-x { background: rgba(23,18,31,.22); }

.home-foot {
  position: absolute;
  left: 0; right: 0;
  bottom: calc(var(--safe-b) + 18px);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding: 0 18px;
  font-size: .82rem;
  color: rgba(23,18,31,.72);
  font-weight: 600;
}

.home-foot .dot { opacity: .5; }

.foot-links { display: inline-flex; align-items: center; gap: 10px; }

/* Narrow screens can't fit the stat and both links on one line. Break it into
   two deliberate rows rather than letting "settings" wrap off on its own. */
@media (max-width: 540px) {
  .home-foot { flex-direction: column; gap: 7px; }
  .home-foot > .dot { display: none; }
}

.linky {
  appearance: none;
  background: none;
  border: 0;
  padding: 4px 2px;
  cursor: pointer;
  font-weight: 700;
  color: rgba(23,18,31,.86);
  border-bottom: 2px solid rgba(23,18,31,.28);
  transition: border-color .2s, color .2s;
}
.linky:hover { color: var(--ink); border-bottom-color: var(--ink); }

/* ============================================================
   Player
   ============================================================ */

.view-watch { background: #08060f; }

.wbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: calc(var(--safe-t) + 10px) 14px 10px;
  background: linear-gradient(180deg, rgba(27,20,54,.96), rgba(27,20,54,.72) 70%, transparent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--night) 96%, transparent), color-mix(in srgb, var(--night) 72%, transparent) 70%, transparent);
}

.wbar-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Playback-mode row: shuffle + autoplay toggles, plus the shuffle-scope pill
   when a filtered batch is active. Centred and free to wrap so a long scope
   label never fights the toggles for room on a narrow phone. */
.wbar-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  min-height: 24px;
}

/* Three groups: nav left, transport centred, nav right. The sides flex evenly
   from a zero basis, so the middle group lands on the true centre of the bar
   even though the right side carries one more button than the left — and the
   skip buttons stay hugging the title instead of being flung to the edges. */
.wbar-side {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.wbar-end { justify-content: flex-end; }

.wbar-mid {
  flex: 0 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.wtitle {
  min-width: 0;
  text-align: center;
}

.wcode {
  display: block;
  font-size: .68rem;
  letter-spacing: .22em;
  font-weight: 800;
  color: var(--jake);
  text-transform: uppercase;
  /* The skip buttons narrowed this column; "Season 3 · Episode 12" must ride
     on one line rather than wrapping and shoving the title down. */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wtitle h1 {
  margin: 2px 0 0;
  font-family: var(--display);
  font-size: clamp(.98rem, 3.4vw, 1.5rem);
  font-weight: 800;
  letter-spacing: .01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ghost {
  appearance: none;
  background: rgba(255,255,255,.07);
  border: 1.5px solid rgba(255,255,255,.14);
  border-radius: 999px;
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: rgba(253,246,227,.9);
  transition: background .18s, border-color .18s, transform .18s;
  white-space: nowrap;
}
.ghost:hover { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.3); }
.ghost:active { transform: scale(.95); }

.ico { width: 15px; height: 15px; fill: currentColor; flex: none; }

/* Previous/next episode, flanking the title in the player bar. Round rather
   than pill-shaped so they read as transport controls and not as more of the
   navigation the ghost buttons on the outside provide. */
.skip {
  appearance: none;
  flex: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  background: rgba(255,255,255,.07);
  border: 1.5px solid rgba(255,255,255,.16);
  color: rgba(253,246,227,.92);
  display: grid;
  place-items: center;
  transition: background .18s, border-color .18s, transform .18s;
  -webkit-tap-highlight-color: transparent;
}
.skip:hover { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.32); }
.skip:active { transform: scale(.9); }
.skip:focus-visible { outline: 2px solid var(--jake); outline-offset: 3px; }
.skip:disabled { opacity: .35; cursor: default; transform: none; }

.ico-skip { width: 21px; height: 21px; fill: currentColor; }

.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

#video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}

.loading, .failed {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(8,6,15,.94);
  text-align: center;
  padding: 24px;
}

.loading[hidden], .failed[hidden] { display: none; }

.loading em {
  font-style: normal;
  font-size: .88rem;
  letter-spacing: .1em;
  color: rgba(253,246,227,.7);
}

.spinner {
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,.15);
  border-top-color: var(--jake);
  animation: spin .85s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.failed strong {
  font-family: var(--display);
  font-size: 1.2rem;
  color: var(--pink);
}
.failed p { margin: 0; color: rgba(253,246,227,.72); font-size: .9rem; max-width: 34ch; }

.compat {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(255,158,207,.1);
  border-top: 1px solid rgba(255,158,207,.2);
  font-size: .78rem;
  flex-wrap: wrap;
}
.compat[hidden] { display: none; }
.compat label { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 180px; }
.compat input[type="range"] { flex: 1; accent-color: var(--pink); }

.badge {
  background: var(--pink);
  color: var(--ink);
  font-weight: 800;
  font-size: .64rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 999px;
}

.wfoot {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 16px calc(var(--safe-b) + 16px);
  background: linear-gradient(0deg, rgba(27,20,54,.98), rgba(27,20,54,.7));
  background: linear-gradient(0deg, color-mix(in srgb, var(--night) 98%, transparent), color-mix(in srgb, var(--night) 70%, transparent));
}

.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s, filter .2s;
}

.btn-primary {
  background: var(--jake);
  color: var(--ink);
  font-size: clamp(.92rem, 3vw, 1.12rem);
  padding: 14px 30px;
  border-radius: 999px;
  border: 3px solid var(--ink);
  box-shadow: 0 5px 0 var(--ink), 0 10px 22px rgba(0,0,0,.42);
}
.btn-primary:hover { filter: brightness(1.06); transform: translateY(-2px); box-shadow: 0 7px 0 var(--ink), 0 14px 26px rgba(0,0,0,.45); }
.btn-primary:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink), 0 4px 12px rgba(0,0,0,.4); }
.btn-primary .ico { width: 19px; height: 19px; }

.btn-sm {
  background: rgba(255,255,255,.1);
  border: 1.5px solid rgba(255,255,255,.22);
  color: var(--cream);
  padding: 9px 16px;
  border-radius: 999px;
  font-size: .78rem;
}
.btn-sm:hover { background: rgba(255,255,255,.18); }

/* icon toggle — shuffle / autoplay switches in the player header. No text: a
   pill track that swaps grey↔green, sliding a knob whose icon cross-fades
   between an "off" and "on" glyph (à la YouTube's autoplay switch). */
.icotoggle { display: inline-flex; align-items: center; cursor: pointer; user-select: none; }
.icotoggle input { position: absolute; opacity: 0; pointer-events: none; }
.icotoggle .icotrack {
  width: 44px; height: 24px;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  border: 1.5px solid rgba(255,255,255,.22);
  position: relative;
  display: block;
  transition: background .2s, border-color .2s;
  flex: none;
}
.icotoggle .icoknob {
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(180,178,196,.9);
  display: grid;
  place-items: center;
  transition: transform .24s cubic-bezier(.34,1.56,.64,1), background .2s;
}
.icotoggle .icoknob svg {
  grid-area: 1 / 1;
  width: 12px; height: 12px;
  fill: var(--ink);
  transition: opacity .15s, transform .15s;
}
.icotoggle .icoknob .ic-on { opacity: 0; transform: scale(.5); }
.icotoggle .icoknob .ic-off { opacity: 1; transform: scale(1); }
.icotoggle input:checked + .icotrack { background: rgba(92,184,79,.28); border-color: var(--grass-2); }
.icotoggle input:checked + .icotrack .icoknob { transform: translateX(20px); background: var(--grass-1); }
.icotoggle input:checked + .icotrack .icoknob .ic-on { opacity: 1; transform: scale(1); }
.icotoggle input:checked + .icotrack .icoknob .ic-off { opacity: 0; transform: scale(.5); }
.icotoggle input:focus-visible + .icotrack { outline: 2px solid var(--jake); outline-offset: 3px; }

/* repeat — not a toggle, a single button that cycles off → one → season. */
.repeat-btn {
  appearance: none;
  flex: none;
  width: 34px; height: 34px;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  background: rgba(255,255,255,.1);
  border: 1.5px solid rgba(255,255,255,.22);
  color: rgba(253,246,227,.55);
  display: grid;
  place-items: center;
  transition: background .18s, border-color .18s, color .18s, transform .18s;
  -webkit-tap-highlight-color: transparent;
}
.repeat-btn svg { width: 19px; height: 19px; fill: currentColor; overflow: visible; }
/* The mode badge sits fixed-color in the icon's corner, independent of the
   button's own grey/green background, so "1" / "S" stay legible either way. */
.repeat-badge-wrap circle { fill: var(--night); stroke: rgba(255,255,255,.35); stroke-width: .6; }
.repeat-badge-wrap { opacity: 0; transition: opacity .15s; }
.repeat-btn[data-mode="one"] .repeat-badge-wrap,
.repeat-btn[data-mode="season"] .repeat-badge-wrap { opacity: 1; }
.repeat-badge { fill: var(--jake); font-size: 8.5px; font-weight: 800; font-family: var(--ui); }
.repeat-btn:hover { background: rgba(255,255,255,.18); }
.repeat-btn:active { transform: scale(.92); }
.repeat-btn:focus-visible { outline: 2px solid var(--jake); outline-offset: 3px; }
.repeat-btn[data-mode="one"], .repeat-btn[data-mode="season"] {
  background: var(--grass-1);
  border-color: var(--grass-2);
  color: var(--ink);
}

/* ============================================================
   Sheets (browse / settings)
   ============================================================ */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(8,6,15,.62);
  backdrop-filter: blur(3px);
  animation: fade .22s ease;
}
.scrim[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  position: fixed;
  z-index: 50;
  right: 0; bottom: 0; left: 0;
  top: 8vh;
  background: var(--sheet);
  border-radius: 22px 22px 0 0;
  border-top: 3px solid rgba(255,255,255,.12);
  display: flex;
  flex-direction: column;
  box-shadow: 0 -20px 60px rgba(0,0,0,.5);
  animation: rise .3s cubic-bezier(.22,1,.36,1);
}
.sheet[hidden] { display: none; }
@keyframes rise { from { transform: translateY(4%); opacity: .4; } to { transform: none; opacity: 1; } }

.sheet-sm { top: auto; max-height: 82vh; }

.sheet-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sheet-bar h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  white-space: nowrap;
}
.sheet-bar .close { padding: 7px 12px; font-size: .9rem; }

.count {
  margin-left: auto;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(253,246,227,.42);
  white-space: nowrap;
}

/* Search + shuffle get their own row: on a phone they cannot share the title
   bar without squeezing the field down to nothing. */
.sheet-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px 0;
}

.searchwrap {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
}

.sico {
  position: absolute;
  left: 13px;
  width: 15px; height: 15px;
  fill: rgba(253,246,227,.4);
  pointer-events: none;
}

#search {
  flex: 1;
  min-width: 0;
  appearance: none;
  background: rgba(0,0,0,.28);
  border: 1.5px solid rgba(255,255,255,.16);
  border-radius: 999px;
  padding: 10px 34px 10px 36px;
  color: var(--cream);
  font-size: .85rem;
  font-family: var(--ui);
}
#search::placeholder { color: rgba(253,246,227,.42); }
#search:focus { outline: none; border-color: var(--jake); }
#search:focus ~ .sico { fill: var(--jake); }
/* Safari's own clear button would sit on top of ours. */
#search::-webkit-search-cancel-button { display: none; }

.clearx {
  position: absolute;
  right: 6px;
  appearance: none;
  background: rgba(255,255,255,.12);
  border: 0;
  border-radius: 50%;
  width: 22px; height: 22px;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: .62rem;
  color: rgba(253,246,227,.75);
}
.clearx[hidden] { display: none; }
.clearx:hover { background: rgba(255,255,255,.24); }

.shuffle-these { flex: none; gap: 7px; padding: 9px 14px; }
.shuffle-these .ico { width: 14px; height: 14px; }
.shuffle-these:disabled { opacity: .4; cursor: default; }

/* Tiles / list view switch, tucked between search and "shuffle these". */
.viewtoggle {
  display: flex;
  flex: none;
  border: 1.5px solid rgba(255,255,255,.16);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(0,0,0,.22);
}
.viewbtn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: none;
  border: 0;
  color: rgba(253,246,227,.6);
  cursor: pointer;
  transition: background .16s, color .16s;
}
.viewbtn svg { width: 16px; height: 16px; fill: currentColor; }
.viewbtn:hover { color: var(--cream); background: rgba(255,255,255,.08); }
.viewbtn[aria-pressed="true"] { background: var(--jake); color: var(--ink); }
.viewbtn:focus-visible { outline: 2px solid var(--jake); outline-offset: 1px; z-index: 1; }

/* The seasons rail: the static "All" chip plus one pill per season/bucket,
   rebuilt from the library in buildFilterDefs. The .chips base rule supplies
   the rail styling; .chip-season chips carry no extra rules of their own. */

/* Toolbar rails. Horizontal scroll rather than wrapping — the "All" control
   and the cross-cutting view chips would otherwise wrap into a tall block and
   push the accordion a third of the way down the sheet. */
.chips {
  display: flex;
  gap: 7px;
  padding: 12px 18px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  appearance: none;
  flex: none;
  cursor: pointer;
  background: rgba(255,255,255,.07);
  border: 1.5px solid rgba(255,255,255,.14);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .06em;
  color: rgba(253,246,227,.82);
  white-space: nowrap;
  transition: background .16s, border-color .16s, color .16s;
}
.chip:hover { background: rgba(255,255,255,.15); }
.chip[aria-pressed="true"] {
  background: var(--jake);
  border-color: var(--jake);
  color: var(--ink);
}
.chip:focus-visible { outline: 2px solid var(--jake); outline-offset: 2px; }

.sheet-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 18px calc(var(--safe-b) + 26px);
}
.sheet-body.pad { padding-top: 18px; }

.season {
  margin-bottom: 14px;
}
.season-h {
  position: sticky;
  top: -14px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px;
  padding: 8px 0;
  background: var(--sheet);
  font-family: var(--display);
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--jake);
}
.season-h:first-child { margin-top: 0; }
.season-h .sname { white-space: nowrap; }

.season-toggle {
  appearance: none;
  flex: 1;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  margin: -4px -8px;
  background: none;
  border: 0;
  border-radius: 8px;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
  text-align: left;
}
.season-toggle:hover { color: #fff; }
.season-toggle:focus-visible { outline: 2px solid var(--jake); outline-offset: 2px; }

.season-toggle .caret {
  flex: none;
  width: 12px;
  font-size: .66rem;
  color: rgba(253,246,227,.55);
  transition: transform .18s;
}

.season-toggle .scount {
  font-family: var(--ui);
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .12em;
  color: rgba(253,246,227,.45);
  white-space: nowrap;
}
.season-h .scount { margin-left: auto; }

.season-only {
  appearance: none;
  flex: none;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
  border-radius: 999px;
  padding: 3px 9px;
  font-family: var(--ui);
  font-size: .58rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(253,246,227,.55);
  cursor: pointer;
  transition: background .16s, color .16s, border-color .16s;
}
.season-only:hover { background: rgba(255,255,255,.16); color: var(--cream); border-color: var(--jake); }
.season-only:focus-visible { outline: 2px solid var(--jake); outline-offset: 2px; }

.season-body[hidden] { display: none; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.card {
  appearance: none;
  background: rgba(0,0,0,.26);
  border: 1.5px solid rgba(255,255,255,.1);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  padding: 0;
  transition: transform .18s cubic-bezier(.34,1.56,.64,1), border-color .18s;
  display: flex;
  flex-direction: column;
  /* Keyboard nav scrolls cards into view; keep them clear of the sticky header. */
  scroll-margin: 56px 0 24px;
}
.card:hover { transform: translateY(-3px); border-color: var(--jake); }
.card:active { transform: scale(.97); }
.card:focus-visible { outline: 3px solid var(--jake); outline-offset: 2px; border-color: var(--jake); }

.card .thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #120e26 center/cover no-repeat;
  display: block;
  border-bottom: 1.5px solid rgba(255,255,255,.08);
}

.card .m-dur {
  position: absolute;
  right: 5px; bottom: 5px;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(8,6,15,.78);
  font-size: .64rem;
  font-weight: 700;
  color: rgba(253,246,227,.86);
  letter-spacing: .02em;
}

.card .meta { padding: 8px 10px 10px; }
.card .m-code { font-size: .62rem; font-weight: 800; letter-spacing: .12em; color: var(--jake); }
.card .m-title {
  margin: 3px 0 0;
  font-size: .8rem;
  font-weight: 600;
  line-height: 1.28;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Already-shuffled episodes stay legible but recede, so an unseen one is the
   thing your eye lands on. */
.card.seen .thumb { opacity: .42; }
.card.seen .m-title { color: rgba(253,246,227,.6); }
.card.seen:hover .thumb { opacity: .78; }

.flag {
  position: absolute;
  left: 5px; top: 5px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(8,6,15,.78);
  font-size: .58rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(253,246,227,.8);
}
.flag.now { background: var(--jake); color: var(--ink); }

.card.now { border-color: var(--jake); box-shadow: 0 0 0 2px rgba(245,196,81,.42); }
.card.now .thumb { opacity: 1; }

.empty { padding: 40px 0; text-align: center; color: rgba(253,246,227,.5); font-size: .9rem; }
.empty b { display: block; margin-bottom: 6px; color: rgba(253,246,227,.8); font-size: 1rem; }

/* settings */
.shead {
  margin: 22px 0 10px;
  font-family: var(--display);
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--jake);
}
.shead:first-child { margin-top: 0; }

.check {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 0;
  cursor: pointer;
  font-size: .92rem;
  font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check span {
  width: 22px; height: 22px;
  border-radius: 7px;
  border: 2.5px solid rgba(255,255,255,.3);
  flex: none;
  position: relative;
  transition: background .16s, border-color .16s;
}
.check input:checked + span { background: var(--grass-1); border-color: var(--grass-2); }
.check input:checked + span::after {
  content: '';
  position: absolute;
  left: 6px; top: 2px;
  width: 5px; height: 10px;
  border: solid var(--ink);
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}
.check input:disabled + span { opacity: .6; }
.check:has(input:disabled:not(:checked)) { opacity: .55; cursor: default; }
.check[hidden], .note[hidden] { display: none; }
.check em { margin-left: auto; font-style: normal; font-size: .78rem; color: rgba(253,246,227,.45); font-weight: 500; }

.note {
  margin: 12px 0 0;
  font-size: .78rem;
  line-height: 1.55;
  color: rgba(253,246,227,.55);
}

/* caption customization */
.cc-panel {
  margin-top: 14px;
  padding: 14px 14px 4px;
  border-radius: 14px;
  background: rgba(0,0,0,.22);
  border: 1px solid rgba(255,255,255,.08);
}
.cc-panel[hidden] { display: none; }

.cc-preview {
  height: 108px;
  border-radius: 10px;
  margin-bottom: 14px;
  background:
    linear-gradient(rgba(0,0,0,.15), rgba(0,0,0,.15)),
    repeating-conic-gradient(rgba(255,255,255,.05) 0% 25%, transparent 0% 50%) 0 0/22px 22px,
    var(--indigo);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  overflow: hidden;
}
.cc-preview-text {
  display: inline-block;
  max-width: 100%;
  text-align: center;
  border-radius: 4px;
  white-space: nowrap;
}

.cc-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,.07);
  font-size: .85rem;
  font-weight: 600;
}
.cc-field:last-of-type { border-bottom: 0; }
.cc-field > span:first-child { flex: 1; min-width: 0; }
.cc-field em {
  font-style: normal;
  font-size: .76rem;
  font-weight: 500;
  color: rgba(253,246,227,.5);
  width: 3.4em;
  text-align: right;
  flex: none;
}

.cc-field select {
  appearance: none;
  background: rgba(0,0,0,.28);
  border: 1.5px solid rgba(255,255,255,.16);
  border-radius: 9px;
  padding: 7px 28px 7px 11px;
  color: var(--cream);
  font-size: .82rem;
  font-family: var(--ui);
  font-weight: 600;
  flex: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23fdf6e3' d='M7 10l5 5 5-5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 6px center;
  background-size: 18px;
}
.cc-field select:focus { outline: none; border-color: var(--jake); }

.cc-field input[type="range"] {
  flex: 1;
  min-width: 0;
  accent-color: var(--jake);
}

.cc-field input[type="color"] {
  appearance: none;
  width: 40px;
  height: 30px;
  flex: none;
  border: 1.5px solid rgba(255,255,255,.16);
  border-radius: 8px;
  background: none;
  padding: 0;
  cursor: pointer;
}
.cc-field input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.cc-field input[type="color"]::-webkit-color-swatch { border: none; border-radius: 5px; }

#cc-reset {
  margin: 10px 0 14px;
  width: 100%;
}

/* ============================================================
   Responsive + motion
   ============================================================ */

@media (min-width: 760px) {
  .sheet { left: auto; width: min(620px, 92vw); top: 0; border-radius: 22px 0 0 22px; border-top: 0; border-left: 3px solid rgba(255,255,255,.12); }
  .sheet-sm { width: min(460px, 92vw); }
  @keyframes rise { from { transform: translateX(4%); opacity: .4; } to { transform: none; opacity: 1; } }
}

/* The player bar carries five controls around the title. Drop the word labels
   well before the phone breakpoint, or the episode name is left with a sliver
   of the row on any ordinary laptop window. */
@media (max-width: 860px) {
  .ghost span { display: none; }
  .ghost { padding: 9px 10px; }
}

@media (max-width: 520px) {
  .wfoot { gap: 12px; }
  /* Close the bar up so the title keeps a readable share of the row. */
  .wbar { gap: 8px; }
  .wbar-side, .wbar-mid { gap: 7px; }
  .skip { width: 36px; height: 36px; }
  .ico-skip { width: 19px; height: 19px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
  .sheet-tools, .chips { padding-left: 14px; padding-right: 14px; }
  .shuffle-these span { display: none; }
  .shuffle-these { padding: 9px 12px; }
  .count { display: none; }
  .viewbtn { width: 30px; height: 30px; }
  .lrow { gap: 10px; padding: 6px 9px 6px 6px; }
  .lrow .lthumb { width: 104px; }
  .lrow .cardmark { width: 28px; height: 28px; font-size: .78rem; }
}

/* Landscape phone: hand the whole screen to the video. */
@media (max-height: 470px) and (orientation: landscape) {
  body[data-view="watch"] .wbar,
  body[data-view="watch"] .wfoot { padding-top: 6px; padding-bottom: 6px; }
  body[data-view="watch"] .wtitle h1 { font-size: .95rem; }
  .btn-primary { padding: 10px 20px; }
  .skip { width: 34px; height: 34px; }
  .ico-skip { width: 18px; height: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  /* The logo fades in via an animation, so make sure it is simply visible
     rather than depending on a near-zero-duration one landing. */
  .logo-img { opacity: 1; }
}

/* ============================================================
   Accounts, playlists, stars and vetoes
   Additive: every rule below is new UI, and none of it overrides
   the player styles above.
   ============================================================ */

/* ---- footer marks (star / add-to / veto) ---------------------------- */

.wfoot-marks {
  display: flex;
  align-items: center;
  gap: 8px;
}

.markbtn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.22);
  background: rgba(255,255,255,.08);
  color: var(--cream);
  cursor: pointer;
  transition: background .16s, transform .16s, color .16s, border-color .16s;
}
.markbtn svg { width: 20px; height: 20px; fill: currentColor; }
.markbtn:hover:not(:disabled) { background: rgba(255,255,255,.18); }
.markbtn:active:not(:disabled) { transform: scale(.92); }
.markbtn:disabled { opacity: .35; cursor: default; }
.markbtn:focus-visible { outline: 2px solid var(--jake); outline-offset: 3px; }

#mark-star.on { color: var(--jake); border-color: var(--jake); background: rgba(245,196,81,.18); }
#mark-veto.on { color: var(--pink); border-color: var(--pink); background: rgba(255,158,207,.16); }

.wfoot-lists { flex: none; }

/* The footer now holds three things; keep the primary button centred and let
   the flanking groups take equal space so it does not drift. */
.wfoot {
  justify-content: space-between;
  gap: 12px;
}
.wfoot-marks, .wfoot-lists { flex: 1 1 0; }
.wfoot-marks { justify-content: flex-start; }
.wfoot-lists { display: inline-flex; justify-content: flex-end; }

@media (max-width: 560px) {
  .wfoot-lists span { display: none; }
  .markbtn { width: 38px; height: 38px; }
  .markbtn svg { width: 18px; height: 18px; }
}

/* ---- browse card marks ---------------------------------------------- */

.cardmarks {
  position: absolute;
  top: 6px;
  left: 6px;
  display: flex;
  gap: 5px;
  opacity: 0;
  transition: opacity .16s;
}
/* Touch has no hover, so the controls have to be permanently visible there. */
.card:hover .cardmarks,
.card:focus-within .cardmarks { opacity: 1; }
@media (pointer: coarse) {
  .cardmarks { opacity: 1; }
}

.cardmark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(0,0,0,.62);
  border: 1px solid rgba(255,255,255,.28);
  color: rgba(253,246,227,.8);
  font-size: .78rem;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.cardmark:hover { background: rgba(0,0,0,.8); transform: scale(1.08); }
.cardmark:focus-visible { outline: 2px solid var(--jake); outline-offset: 2px; }
.cardmark.on { color: var(--jake); border-color: var(--jake); }
.cardmark:nth-child(2).on { color: var(--pink); border-color: var(--pink); }

.card.vetoed .thumb { filter: grayscale(.7); }
.card.vetoed .m-title { color: rgba(253,246,227,.5); }
.flag.veto { background: rgba(255,158,207,.85); color: var(--ink); }

/* ---- list view rows ------------------------------------------------ */

.list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lrow {
  appearance: none;
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 7px 12px 7px 8px;
  background: rgba(0,0,0,.26);
  border: 1.5px solid rgba(255,255,255,.1);
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  scroll-margin: 56px 0 24px;
  transition: transform .18s cubic-bezier(.34,1.56,.64,1), border-color .18s, background .18s;
}
.lrow:hover { transform: translateY(-2px); border-color: var(--jake); background: rgba(0,0,0,.34); }
.lrow:active { transform: scale(.99); }
.lrow:focus-visible { outline: 3px solid var(--jake); outline-offset: 2px; border-color: var(--jake); }

.lrow .lthumb {
  position: relative;
  flex: none;
  width: 150px;
  aspect-ratio: 16 / 9;
  border-radius: 7px;
  background: #120e26 center/cover no-repeat;
  overflow: hidden;
  border-bottom: 1.5px solid rgba(255,255,255,.08);
}

.lrow .lmeta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.lrow .lcode {
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .14em;
  color: var(--jake);
}
.lrow .ltitle {
  font-size: .82rem;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.lrow .ldur {
  flex: none;
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: rgba(253,246,227,.55);
}
.lrow .ldesc {
  font-size: .7rem;
  line-height: 1.35;
  color: rgba(253,246,227,.62);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 62ch;
}
.lrow .ldesc.ocr {
  font-style: italic;
  color: rgba(253,246,227,.45);
}

.lmarks {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: none;
}
.lrow .cardmark { width: 30px; height: 30px; font-size: .82rem; }
.lrow .flag { top: 4px; left: 4px; }

/* ---- vertical action rail: share on top, star/veto stacked below -------- */

.lside {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* ---- corner controls on thumbnails -------------------------------------- */

/* Share (grid + list) and quick download (list thumb) sit top-right of the
   poster. Always visible, unlike the star/veto which wait for hover. */
.tcorner {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
}
.dl-trigger { font-size: .92rem; font-weight: 800; }

.lrow.now { border-color: var(--jake); box-shadow: 0 0 0 2px rgba(245,196,81,.42); }
.lrow.now .lthumb { opacity: 1; }
.lrow.seen .lthumb { opacity: .45; }
.lrow.seen .ltitle { color: rgba(253,246,227,.6); }
.lrow.seen:hover .lthumb { opacity: .8; }
.lrow.vetoed .lthumb { filter: grayscale(.7); }
.lrow.vetoed .ltitle { color: rgba(253,246,227,.5); }

/* ---- download menu ------------------------------------------------------ */

/* Fixed-position popover shared by every download trigger. Note [hidden] must
   win over the flex display below — the UA's display:none is overridden by
   any explicit display, so the hidden state is re-declared. */
.dlmenu[hidden] { display: none; }
.dlmenu {
  position: fixed;
  z-index: 300;
  min-width: 224px;
  max-width: min(340px, calc(100vw - 16px));
  padding: 6px;
  border-radius: 14px;
  border: 1.5px solid rgba(255,255,255,.16);
  background: rgba(14,10,26,.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 14px 40px rgba(0,0,0,.55);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dl-item {
  appearance: none;
  display: flex;
  align-items: center;
  width: 100%;
  gap: 8px;
  padding: 9px 11px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: rgba(253,246,227,.92);
  font: inherit;
  font-size: .82rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.dl-item:hover { background: rgba(245,196,81,.16); color: var(--jake); }
.dl-item:focus-visible { outline: 2px solid var(--jake); outline-offset: -2px; }

/* ---- the second chip row -------------------------------------------- */

.chips-view { padding-top: 0; }
.chip-view { font-size: .72rem; }
.chip-view[aria-pressed="true"] { background: var(--finn); border-color: var(--finn); color: var(--ink); }

/* ---- the storyline tier chip row ------------------------------------ */

.chips-tier { padding-top: 0; }
.chip-tier { font-size: .72rem; }
/* Three-tier system from the community viewing guide: required = core
   storyline (green), recommended = worth watching (blue), filler = skippable
   (muted). The pressed chip inverts to its accent so the active tier reads
   at a glance. */
.chip-tier[data-key="required"][aria-pressed="true"] { background: var(--grass-2); border-color: var(--grass-2); color: var(--cream); }
.chip-tier[data-key="recommended"][aria-pressed="true"] { background: var(--finn); border-color: var(--finn); color: var(--ink); }
.chip-tier[data-key="filler"][aria-pressed="true"] { background: rgba(253,246,227,.55); border-color: rgba(253,246,227,.55); color: var(--ink); }

/* Small tier tag on cards and list rows: colored dot + short label. */
.tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .6rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(253,246,227,.68);
}
.tier-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.tier-badge.tier-required { color: var(--grass-2); }
.tier-badge.tier-recommended { color: var(--finn); }
.tier-badge.tier-filler { color: rgba(253,246,227,.45); }
.card .meta .tier-badge { margin-top: 3px; }
.lrow .lmeta .tier-badge { margin-top: 2px; }

/* ---- account & playlist sheets --------------------------------------- */

.anote {
  margin: 0 0 14px;
  font-size: .84rem;
  line-height: 1.6;
  color: rgba(253,246,227,.62);
}

.awho {
  margin: 0 0 4px;
  font-family: var(--display);
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: .02em;
  color: var(--jake);
  overflow-wrap: anywhere;
}

.aerr {
  margin: 10px 0 0;
  font-size: .82rem;
  line-height: 1.5;
  color: var(--pink);
}

.ahint {
  font-style: normal;
  font-size: .74rem;
  line-height: 1.5;
  color: rgba(253,246,227,.45);
}

.aform { display: flex; flex-direction: column; gap: 14px; margin: 16px 0 0; }

.afield { display: flex; flex-direction: column; gap: 6px; }
.afield > span {
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(253,246,227,.5);
}
.afield input {
  font: inherit;
  font-size: 1rem;
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid rgba(253,246,227,.22);
  background: rgba(0,0,0,.28);
  color: var(--cream);
  min-width: 0;
}
.afield input:focus { outline: none; border-color: var(--jake); }

.btn-block { width: 100%; justify-content: center; }

.arow { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.arow-inline { flex-direction: row; align-items: center; gap: 8px; margin-top: 0; }
.arow-inline input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: .92rem;
  padding: 10px 13px;
  border-radius: 11px;
  border: 2px solid rgba(253,246,227,.2);
  background: rgba(0,0,0,.26);
  color: var(--cream);
}
.arow-inline input:focus { outline: none; border-color: var(--jake); }

.apane { margin-top: 4px; }
.segmented {
  display: inline-flex;
  border: 1.5px solid rgba(255,255,255,.22);
  border-radius: 999px;
  overflow: hidden;
  margin: 4px 0 6px;
}
.seg {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 9px 17px;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .04em;
  transition: background .16s, color .16s;
}
.seg.on { background: var(--jake); color: var(--ink); }
.seg:focus-visible { outline: 2px solid var(--jake); outline-offset: 2px; }

.astats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 18px 0 4px;
}
.astat {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px;
  padding: 11px 8px;
  text-align: center;
}
.astat b {
  display: block;
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--jake);
}
.astat span {
  display: block;
  margin-top: 3px;
  font-size: .64rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(253,246,227,.45);
}

/* ---- migration choices ------------------------------------------------ */

.achoices { display: flex; flex-direction: column; gap: 10px; margin: 4px 0 16px; }

.achoice {
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-align: left;
  padding: 14px 16px;
  border-radius: 14px;
  border: 2px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.05);
  color: inherit;
  cursor: pointer;
  font: inherit;
  transition: border-color .16s, background .16s, transform .16s;
}
.achoice:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.3); }
.achoice:active { transform: scale(.99); }
.achoice:focus-visible { outline: 2px solid var(--jake); outline-offset: 2px; }
.achoice b { font-size: .95rem; font-weight: 800; }
.achoice span { font-size: .8rem; line-height: 1.55; color: rgba(253,246,227,.6); }
.achoice.primary { border-color: var(--jake); background: rgba(245,196,81,.12); }
.achoice.primary b { color: var(--jake); }
.achoice.danger:hover { border-color: var(--pink); }
.achoice.danger b { color: var(--pink); }

/* ---- playlist manager -------------------------------------------------- */

.plcard {
  margin-top: 14px;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.045);
}

.plhead { display: flex; align-items: baseline; gap: 10px; }
.plhead b { font-size: .96rem; font-weight: 800; overflow-wrap: anywhere; }
.plcount {
  margin-left: auto;
  font-size: .7rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(253,246,227,.4);
  white-space: nowrap;
}

.pltools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.pltools .linky.danger { color: var(--pink); border-bottom-color: rgba(255,158,207,.4); }

.plitems { margin: 12px 0 0; padding: 0 0 0 20px; display: flex; flex-direction: column; gap: 4px; }
.plitems li {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .82rem;
  color: rgba(253,246,227,.75);
}
.plname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.plmove {
  appearance: none;
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.07);
  color: inherit;
  cursor: pointer;
  font-size: .78rem;
  line-height: 1;
}
.plmove:hover:not(:disabled) { background: rgba(255,255,255,.16); }
.plmove:disabled { opacity: .3; cursor: default; }
.plmove:focus-visible { outline: 2px solid var(--jake); outline-offset: 2px; }

/* ---- add-to-playlist popover -------------------------------------------- */

.plmenu {
  position: fixed;
  z-index: 60;
  min-width: 200px;
  max-width: min(88vw, 300px);
  max-height: 60vh;
  overflow-y: auto;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(27,20,54,.97);
  background: color-mix(in srgb, var(--night) 97%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 18px 42px rgba(0,0,0,.55);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.plmenu-item {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: .86rem;
  text-align: left;
  padding: 10px 12px;
  border-radius: 9px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.plmenu-item:hover { background: rgba(255,255,255,.12); }
.plmenu-item.on { color: var(--jake); }
.plmenu-item:focus-visible { outline: 2px solid var(--jake); outline-offset: -2px; }

/* ---- toast --------------------------------------------------------------- */

.attoast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + var(--safe-b));
  transform: translate(-50%, 20px);
  z-index: 80;
  max-width: min(90vw, 420px);
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(27,20,54,.96);
  background: color-mix(in srgb, var(--night) 96%, transparent);
  border: 1.5px solid rgba(255,255,255,.18);
  box-shadow: 0 12px 32px rgba(0,0,0,.5);
  font-size: .85rem;
  line-height: 1.4;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s;
}
.attoast.on { opacity: 1; transform: translate(-50%, 0); }

/* ============================================================
   Show bar — the library switcher on home + the wbar select
   ============================================================ */

.showbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: -6px;
  max-width: min(92vw, 640px);
}

.showchip {
  appearance: none;
  border: 1.5px solid rgba(255,255,255,.22);
  background: rgba(255,255,255,.06);
  color: rgba(253,246,227,.9);
  border-radius: 999px;
  padding: 7px 16px;
  font: 600 .92rem/1.2 var(--ui);
  letter-spacing: .04em;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, color .18s ease;
  -webkit-tap-highlight-color: transparent;
}

.showchip:hover { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.4); }
.showchip[aria-pressed="true"] {
  background: var(--jake);
  border-color: var(--jake);
  color: var(--ink);
}

.show-select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 6px;
  padding: 6px 10px;
  border: 1.5px solid rgba(255,255,255,.18);
  border-radius: 999px;
  background: rgba(0,0,0,.25);
}

.show-select-wrap .ico { width: 16px; height: 16px; fill: rgba(253,246,227,.85); flex: none; }

.show-select {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(253,246,227,.95);
  font: 600 .92rem/1.2 var(--ui);
  cursor: pointer;
  max-width: 160px;
}

.show-select option { background: #17121f; color: #fdf6e3; }

/* ============================================================
   Skins — one look per show, series and hub
   app.js sets body[data-skin] from the manifest's branding and
   hands over its colours as --night / --indigo / --jake. Each
   skin owns one .scene inside the backdrop; switching skins
   cross-fades between them.
   ============================================================ */

.logo[hidden],
.marquee[hidden] { display: none; }

.scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: opacity .6s ease, visibility 0s linear .6s;
  pointer-events: none;
}

body[data-skin="seinfeld"] .scene-seinfeld,
body[data-skin="movies"] .scene-movies,
body[data-skin="star-wars"] .scene-star-wars {
  opacity: 1;
  visibility: visible;
  transition: opacity .6s ease, visibility 0s;
}

/* Nobody needs twinkling stars behind a film: freeze the scenes while watching. */
body[data-view="watch"] .scene,
body[data-view="watch"] .scene * { animation-play-state: paused; }

/* ---- Seinfeld: the stand-up brick wall under a spotlight ------------- */

.scene-seinfeld {
  background:
    radial-gradient(ellipse 36% 46% at 50% 40%, rgba(255,232,190,.34) 0%, rgba(255,214,160,.13) 52%, rgba(255,200,140,0) 74%),
    radial-gradient(ellipse 95% 85% at 50% 40%, rgba(14,6,4,0) 32%, rgba(14,6,4,.84) 100%),
    url('/themes/bricks.svg') center top / 168px 112px repeat,
    #2e1510;
}

.stage-floor {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 15vh;
}

.scene-seinfeld .stage-floor {
  background: linear-gradient(180deg, #1c0d09 0%, #0b0503 100%);
  box-shadow: 0 -1px 0 rgba(255,214,160,.14), 0 -20px 44px rgba(0,0,0,.55);
}

body[data-skin="seinfeld"] .logo { width: min(86vw, 600px); }

/* ---- Movies: the red-curtain picture palace ------------------------- */

.scene-movies {
  background:
    radial-gradient(ellipse 60% 40% at 50% 100%, rgba(255,196,120,.30) 0%, rgba(255,160,90,0) 70%),
    radial-gradient(ellipse 80% 70% at 50% 45%, rgba(10,0,2,0) 38%, rgba(10,0,2,.72) 100%),
    linear-gradient(180deg, rgba(0,0,0,.30) 0%, rgba(0,0,0,0) 30%, rgba(0,0,0,0) 70%, rgba(0,0,0,.45) 100%),
    repeating-linear-gradient(90deg, #3c070d 0, #6e0f19 22px, #9c1c29 40px, #6e0f19 58px, #3c070d 80px),
    #3c070d;
}

.scene-movies .valance {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: max(64px, 10vh);
  background:
    linear-gradient(180deg, rgba(0,0,0,.35), rgba(0,0,0,0) 60%),
    repeating-linear-gradient(90deg, #5a0b14 0, #8e1a27 30px, #5a0b14 60px);
  box-shadow: 0 10px 26px rgba(0,0,0,.55);
}

/* gold braid along the valance, with a tasselled fringe beneath */
.scene-movies .valance::before,
.scene-movies .valance::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
}
.scene-movies .valance::before {
  bottom: 0;
  height: 6px;
  background: linear-gradient(90deg, #a87a26, #f5d27a 25%, #a87a26 50%, #f5d27a 75%, #a87a26);
}
.scene-movies .valance::after {
  top: 100%;
  height: 14px;
  background: repeating-linear-gradient(90deg, rgba(245,196,81,.85) 0 3px, transparent 3px 8px);
  -webkit-mask: linear-gradient(180deg, #000, rgba(0,0,0,.25));
          mask: linear-gradient(180deg, #000, rgba(0,0,0,.25));
}

.scene-movies .stage-floor {
  height: 12vh;
  background: linear-gradient(180deg, #2a1208 0%, #120703 100%);
  box-shadow: 0 -1px 0 rgba(255,210,140,.22), 0 -24px 60px rgba(255,170,90,.10);
}

/* The hub's title: a marquee board with chasing bulbs, standing in for
   the start button the Movies hub deliberately does not have. */
.marquee {
  margin: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: clamp(22px, 4vw, 34px) clamp(38px, 8vw, 80px);
  border-radius: 20px;
  background: linear-gradient(180deg, #210b07, #120604);
  box-shadow:
    0 0 0 4px #8a611c,
    0 0 0 7px #2a1406,
    0 24px 60px rgba(0,0,0,.6),
    0 0 110px rgba(255,190,90,.20);
  font-family: var(--display);
  font-weight: 800;
  text-align: center;
  animation: marquee-in .7s cubic-bezier(.21,1.22,.42,1) both;
}

.marquee::before,
.marquee::after {
  content: '';
  position: absolute;
  inset: 10px;
  border-radius: 13px;
  border: 7px dotted #ffdc84;
  filter: drop-shadow(0 0 5px rgba(255,205,110,.95));
  pointer-events: none;
}
/* Two offset rings of bulbs blinking out of phase read as a chase. */
.marquee::after {
  inset: 13px;
  border-color: #fff1c4;
  animation: bulbs 1.2s steps(1, end) infinite;
}
.marquee::before { animation: bulbs 1.2s steps(1, end) infinite .6s; }

@keyframes bulbs {
  0%   { opacity: 1; }
  50%  { opacity: .18; }
}

@keyframes marquee-in {
  from { opacity: 0; transform: scale(.9) translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.marquee-kicker {
  font-size: clamp(.68rem, 1.8vw, .86rem);
  letter-spacing: .5em;
  padding-left: .5em;
  text-transform: uppercase;
  color: #ffd978;
}

.marquee-title {
  font-size: clamp(2.8rem, 11vw, 6rem);
  line-height: 1;
  letter-spacing: .1em;
  padding-left: .1em;
  text-transform: uppercase;
  color: #fff4d6;
  text-shadow: 0 0 2px #fff, 0 0 18px rgba(255,200,110,.7), 0 0 44px rgba(255,160,60,.35);
}

/* ---- Star Wars: a long time ago, in a galaxy far, far away ---------- */

.scene-star-wars {
  background:
    radial-gradient(ellipse 55% 40% at 80% 16%, rgba(70,90,180,.16), rgba(70,90,180,0) 70%),
    radial-gradient(ellipse 50% 45% at 14% 86%, rgba(130,50,120,.12), rgba(130,50,120,0) 70%),
    #000;
}

/* Three tiled star layers drift at different speeds for a little parallax.
   Each layer sits one tile taller than the screen and slides exactly one
   tile per loop, so the repeat is seamless. */
.starfield {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  will-change: transform;
}

.sf-far {
  top: -180px;
  background-image:
    radial-gradient(1px 1px at 14px 22px, #fff, transparent),
    radial-gradient(1px 1px at 58px 96px, rgba(255,255,255,.8), transparent),
    radial-gradient(1px 1px at 101px 41px, rgba(255,255,255,.7), transparent),
    radial-gradient(1px 1px at 142px 150px, #fff, transparent),
    radial-gradient(1px 1px at 33px 131px, rgba(255,255,255,.6), transparent),
    radial-gradient(1px 1px at 166px 70px, rgba(255,255,255,.75), transparent),
    radial-gradient(1px 1px at 80px 170px, rgba(210,225,255,.8), transparent),
    radial-gradient(1px 1px at 124px 8px, rgba(255,255,255,.65), transparent);
  background-size: 180px 180px;
  opacity: .75;
  animation: drift-180 150s linear infinite;
}

.sf-mid {
  top: -260px;
  background-image:
    radial-gradient(1.5px 1.5px at 40px 60px, #fff, transparent),
    radial-gradient(1.5px 1.5px at 190px 30px, rgba(255,244,214,.9), transparent),
    radial-gradient(1.5px 1.5px at 120px 200px, rgba(255,255,255,.85), transparent),
    radial-gradient(1.5px 1.5px at 230px 150px, rgba(200,220,255,.9), transparent),
    radial-gradient(1.5px 1.5px at 70px 235px, #fff, transparent);
  background-size: 260px 260px;
  animation: drift-260 120s linear infinite, twinkle 5s ease-in-out infinite alternate;
}

.sf-near {
  top: -420px;
  background-image:
    radial-gradient(2px 2px at 90px 120px, #fff, transparent),
    radial-gradient(2.2px 2.2px at 330px 60px, rgba(255,240,200,.95), transparent),
    radial-gradient(2px 2px at 250px 330px, rgba(210,230,255,.95), transparent);
  background-size: 420px 420px;
  animation: drift-420 100s linear infinite;
}

@keyframes drift-180 { to { transform: translate3d(0, 180px, 0); } }
@keyframes drift-260 { to { transform: translate3d(0, 260px, 0); } }
@keyframes drift-420 { to { transform: translate3d(0, 420px, 0); } }

body[data-skin="star-wars"] .logo {
  width: min(88vw, 640px);
  filter: drop-shadow(0 0 20px rgba(255,232,31,.22)) drop-shadow(0 18px 34px rgba(0,0,0,.6));
}

/* Sheets (settings, browse, playlists) take a panel colour from the skin. */
body[data-skin="seinfeld"]  { --sheet: #2b1611; }
body[data-skin="star-wars"] { --sheet: #0e1122; }

/* ---- Showbar chips per skin ---------------------------------------- */

/* A hub chip opens a second level of buttons; the chevron says so. */
.showchip-group::after { content: ' ›'; }

.showchip-back {
  color: rgba(253,246,227,.72);
  background: transparent;
}

body[data-skin="movies"] .showchip,
body[data-skin="star-wars"] .showchip {
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
}

body[data-skin="movies"] .showchip:not(.showchip-back) {
  border-color: rgba(245,196,81,.55);
  background: rgba(24,6,4,.55);
  color: #ffe6a8;
}
body[data-skin="movies"] .showchip:not(.showchip-back):hover { background: rgba(245,196,81,.18); }

/* In the Movies hub the series buttons are the only way in — make them big. */
body[data-skin="movies"] .showbar[data-level="group"] .showchip:not(.showchip-back) {
  padding: 13px 30px;
  font-size: .95rem;
}

body[data-skin="star-wars"] .showchip:not(.showchip-back) { border-color: rgba(255,232,31,.4); }
body[data-skin="star-wars"] .showchip[aria-pressed="true"] { box-shadow: 0 0 18px rgba(255,232,31,.35); }
