/* Frontdoor — Material 3 Expressive
   One seed colour (--seed, set from THEME_COLOR) generates every colour role below.
   Elements with class .dyn (the detail dialog) re-derive the palette from their own --seed,
   which app.js sets from the poster. */

/* ------------------------------------------------------------ colour roles */
/* Static fallback: M3 baseline scheme, for browsers without relative colour syntax */
:root, .dyn {
  color-scheme: light;
  --primary: #6750a4; --on-primary: #fff; --primary-container: #eaddff; --on-primary-container: #4f378b;
  --secondary-container: #e8def8; --on-secondary-container: #4a4458;
  --tertiary: #7d5260; --tertiary-container: #ffd8e4; --on-tertiary-container: #633b48;
  --surface: #fef7ff; --surface-lowest: #fff; --surface-low: #f7f2fa; --surface-mid: #f3edf7;
  --surface-high: #ece6f0; --surface-highest: #e6e0e9;
  --on-surface: #1d1b20; --on-surface-variant: #49454f; --outline: #79747e; --outline-variant: #cac4d0;
  --error: #b3261e; --error-container: #f9dedc; --on-error-container: #410e0b;
  --scrim: #000;
}
@media (prefers-color-scheme: dark) {
  :root, .dyn {
    color-scheme: dark;
    --primary: #d0bcff; --on-primary: #381e72; --primary-container: #4f378b; --on-primary-container: #eaddff;
    --secondary-container: #4a4458; --on-secondary-container: #e8def8;
    --tertiary: #efb8c8; --tertiary-container: #633b48; --on-tertiary-container: #ffd8e4;
    --surface: #141218; --surface-lowest: #0f0d13; --surface-low: #1d1b20; --surface-mid: #211f26;
    --surface-high: #2b2930; --surface-highest: #36343b;
    --on-surface: #e6e0e9; --on-surface-variant: #cac4d0; --outline: #938f99; --outline-variant: #49454f;
    --error: #f2b8b5; --error-container: #8c1d18; --on-error-container: #f9dedc;
  }
}

/* Dynamic scheme generated from --seed (tones approximated in OKLCH) */
@supports (color: oklch(from red l c h)) {
  :root, .dyn {
    --primary: oklch(from var(--seed) .48 min(c, .17) h);
    --on-primary: #fff;
    --primary-container: oklch(from var(--seed) .91 min(c * .45, .07) h);
    --on-primary-container: oklch(from var(--seed) .36 min(c, .13) h);
    --secondary-container: oklch(from var(--seed) .91 min(c * .25, .035) h);
    --on-secondary-container: oklch(from var(--seed) .3 min(c * .3, .04) h);
    --tertiary: oklch(from var(--seed) .5 min(c * .8, .1) calc(h + 60));
    --tertiary-container: oklch(from var(--seed) .91 min(c * .4, .05) calc(h + 60));
    --on-tertiary-container: oklch(from var(--seed) .32 min(c * .6, .07) calc(h + 60));
    --surface: oklch(from var(--seed) .985 min(c * .08, .012) h);
    --surface-lowest: oklch(from var(--seed) 1 0 h);
    --surface-low: oklch(from var(--seed) .97 min(c * .09, .012) h);
    --surface-mid: oklch(from var(--seed) .955 min(c * .1, .014) h);
    --surface-high: oklch(from var(--seed) .94 min(c * .11, .016) h);
    --surface-highest: oklch(from var(--seed) .925 min(c * .12, .018) h);
    --on-surface: oklch(from var(--seed) .22 min(c * .1, .012) h);
    --on-surface-variant: oklch(from var(--seed) .4 min(c * .15, .02) h);
    --outline: oklch(from var(--seed) .58 min(c * .12, .02) h);
    --outline-variant: oklch(from var(--seed) .84 min(c * .1, .015) h);
  }
  @media (prefers-color-scheme: dark) {
    :root, .dyn {
      --primary: oklch(from var(--seed) .82 min(c * .8, .12) h);
      --on-primary: oklch(from var(--seed) .32 min(c, .13) h);
      --primary-container: oklch(from var(--seed) .4 min(c, .13) h);
      --on-primary-container: oklch(from var(--seed) .92 min(c * .45, .06) h);
      --secondary-container: oklch(from var(--seed) .37 min(c * .3, .04) h);
      --on-secondary-container: oklch(from var(--seed) .91 min(c * .25, .035) h);
      --tertiary: oklch(from var(--seed) .84 min(c * .5, .07) calc(h + 60));
      --tertiary-container: oklch(from var(--seed) .4 min(c * .6, .07) calc(h + 60));
      --on-tertiary-container: oklch(from var(--seed) .92 min(c * .4, .05) calc(h + 60));
      --surface: oklch(from var(--seed) .17 min(c * .12, .015) h);
      --surface-lowest: oklch(from var(--seed) .14 min(c * .1, .012) h);
      --surface-low: oklch(from var(--seed) .2 min(c * .12, .015) h);
      --surface-mid: oklch(from var(--seed) .215 min(c * .12, .016) h);
      --surface-high: oklch(from var(--seed) .25 min(c * .12, .017) h);
      --surface-highest: oklch(from var(--seed) .285 min(c * .12, .018) h);
      --on-surface: oklch(from var(--seed) .92 min(c * .08, .012) h);
      --on-surface-variant: oklch(from var(--seed) .82 min(c * .12, .02) h);
      --outline: oklch(from var(--seed) .64 min(c * .12, .02) h);
      --outline-variant: oklch(from var(--seed) .38 min(c * .12, .02) h);
    }
  }
}

/* ------------------------------------------------------------ shape, type, motion */
:root {
  --seed: #6750a4;
  --shape-xs: 8px; --shape-s: 12px; --shape-m: 16px; --shape-l: 24px; --shape-xl: 28px; --shape-xxl: 40px; --full: 999px;
  --font: "Roboto Flex", "Roboto", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  /* M3 Expressive motion: spatial springs overshoot, effects don't */
  --spring-fast: linear(0, .013 1%, .05 2.1%, .2 4.5%, .43 7.3%, .79 11.4%, .93 13.4%, 1.04 15.4%, 1.11 17.5%, 1.15 19.6%, 1.16 21.4%, 1.15 23.6%, 1.1 27%, 1.03 32%, .99 37%, .98 42%, .99 52%, 1);
  --spring-gentle: linear(0, .009, .035 2.1%, .141 4.4%, .281 6.7%, .723 12.9%, .938 16.7%, 1.017, 1.077, 1.121, 1.149 24.3%, 1.159, 1.163, 1.161, 1.154 29.9%, 1.129 32.8%, 1.051 39.6%, 1.017 43.1%, .991, .977 51%, .974 53.8%, .975 57.1%, .997 69.8%, 1.003 76.9%, 1);
  --emphasized: cubic-bezier(.2, 0, 0, 1);
  --nav-h: 80px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--surface); color: var(--on-surface);
  font: 400 16px/1.5 var(--font); letter-spacing: .01em;
}
a { color: inherit; }
img { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; letter-spacing: inherit; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--primary); color: var(--on-primary); padding: 10px 18px; border-radius: var(--full); z-index: 20; }
.muted { color: var(--on-surface-variant); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Material Symbols (ligature icons). Width is fixed so a not-yet-loaded icon never spills text. */
.ms {
  font-family: "Material Symbols Rounded"; font-weight: normal; font-style: normal;
  font-size: 24px; line-height: 1; width: 1em; height: 1em; overflow: hidden; display: inline-block;
  white-space: nowrap; word-wrap: normal; direction: ltr; flex: none; text-transform: none;
  -webkit-font-feature-settings: "liga"; font-feature-settings: "liga"; -webkit-font-smoothing: antialiased;
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 24;
  transition: font-variation-settings .3s var(--emphasized);
  vertical-align: middle; user-select: none;
  visibility: hidden; /* shown once the icon font has loaded (html.ms-ready) */
}
.ms-ready .ms { visibility: inherit; }
.ms.sm { font-size: 18px; font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 20; }
.ms.fill { font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 24; }

/* ------------------------------------------------------------ top app bar + navigation */
.top { position: sticky; top: 0; z-index: 6; background: var(--surface); transition: background .3s; }
.top.scrolled { background: var(--surface-mid); }
.top-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; font-size: 1.375rem; font-weight: 700; font-stretch: 112%; letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-mark { width: 36px; height: 36px; flex: none; background: var(--primary); -webkit-mask: url(/shapes/sunny.svg) center/contain no-repeat; mask: url(/shapes/sunny.svg) center/contain no-repeat; transition: transform .6s var(--spring-gentle); }
.brand:hover .brand-mark { transform: rotate(45deg) scale(1.08); }

.navbar { display: flex; gap: 4px; }
.navbar a { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--on-surface-variant); font-weight: 600; font-size: .875rem; letter-spacing: .02em; border-radius: var(--full); }
.nav-ind { display: grid; place-items: center; border-radius: var(--full); transition: background .2s, width .4s var(--spring-fast); }
.navbar a:hover { color: var(--on-surface); }
.navbar a[aria-current="page"] { color: var(--on-secondary-container); }
.navbar a[aria-current="page"] .ms { font-variation-settings: "FILL" 1, "wght" 600, "GRAD" 0, "opsz" 24; }

/* wide: horizontal pills in the app bar */
@media (min-width: 720px) {
  .navbar a { padding: 10px 20px 10px 16px; transition: background .2s; }
  .navbar a:hover { background: var(--surface-high); }
  .navbar a[aria-current="page"] { background: var(--secondary-container); }
}
/* narrow: M3 navigation bar pinned to the bottom */
@media (max-width: 719.98px) {
  body { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
  .navbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 8; gap: 0;
    height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface-mid); justify-content: space-around;
  }
  .navbar a { flex: 1; flex-direction: column; justify-content: center; gap: 4px; font-size: .75rem; border-radius: 0; }
  .nav-ind { width: 56px; height: 32px; }
  .navbar a:hover .nav-ind { background: var(--surface-highest); }
  .navbar a[aria-current="page"] { color: var(--on-surface); }
  .navbar a[aria-current="page"] .nav-ind { background: var(--secondary-container); color: var(--on-secondary-container); width: 64px; }
}

main { flex: 1; padding-top: 4px; padding-bottom: 56px; outline: none; }
.foot { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; align-items: center; color: var(--on-surface-variant); font-size: .875rem; padding-top: 24px; padding-bottom: 28px; }
.foot a { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; padding: 6px 12px 6px 8px; border-radius: var(--full); }
.foot a:hover { background: var(--surface-high); color: var(--on-surface); }

/* ------------------------------------------------------------ hero */
.hero {
  position: relative; overflow: hidden; margin-top: 8px;
  padding: 48px 24px 32px; border-radius: var(--shape-xxl);
  background: var(--primary-container); color: var(--on-primary-container);
}
@media (min-width: 720px) { .hero { padding: 72px 56px 48px; } }
.hero::before, .hero::after { content: ""; position: absolute; pointer-events: none; background: var(--primary); opacity: .12; }
.hero::before { width: 340px; height: 340px; right: -90px; top: -110px; -webkit-mask: url(/shapes/cookie.svg) center/contain no-repeat; mask: url(/shapes/cookie.svg) center/contain no-repeat; animation: spin 60s linear infinite; }
.hero::after { width: 180px; height: 180px; right: 160px; bottom: -80px; background: var(--tertiary); opacity: .16; -webkit-mask: url(/shapes/clover.svg) center/contain no-repeat; mask: url(/shapes/clover.svg) center/contain no-repeat; animation: spin 80s linear infinite reverse; }
@keyframes spin { to { transform: rotate(360deg); } }
.hero > * { position: relative; max-width: 760px; }
.hero h1 {
  font-size: clamp(2.25rem, 7vw, 3.75rem); line-height: 1.05; font-weight: 800; font-stretch: 118%;
  letter-spacing: -.02em; margin: 0 0 12px; text-wrap: balance;
}
.hero p { margin: 0 0 28px; font-size: 1.125rem; opacity: .85; }

/* M3 search bar */
.searchbar {
  display: flex; align-items: center; gap: 12px; height: 56px;
  background: var(--surface-highest); color: var(--on-surface);
  border-radius: var(--full); padding: 0 6px 0 18px;
  transition: box-shadow .2s, background .2s;
}
.hero .searchbar { background: var(--surface-lowest); height: 64px; padding-left: 22px; box-shadow: 0 1px 3px #0002, 0 4px 12px #0001; }
.searchbar:focus-within { box-shadow: inset 0 0 0 2px var(--primary); }
.hero .searchbar:focus-within { box-shadow: 0 0 0 3px var(--primary); }
.searchbar .ms { color: var(--on-surface-variant); }
.searchbar input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 1rem; height: 100%; }
.hero .searchbar input { font-size: 1.125rem; }
.searchbar input::placeholder { color: var(--on-surface-variant); }
.searchbar input::-webkit-search-cancel-button { display: none; }

/* buttons: pill at rest, morph to rounder-square while pressed */
.btn, .searchbar button, .more {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 52px; padding: 0 24px; border: 0; border-radius: var(--full); cursor: pointer;
  font-weight: 600; font-size: 1rem; letter-spacing: .01em; text-decoration: none;
  background: var(--primary); color: var(--on-primary);
  transition: border-radius .35s var(--spring-fast), transform .35s var(--spring-fast), filter .2s;
}
.btn:hover, .searchbar button:hover, .more:hover { filter: brightness(1.08); }
.btn:active, .searchbar button:active, .more:active { border-radius: var(--shape-m); transform: scale(.97); }
.searchbar button { height: 52px; }
.btn.tonal, .more { background: var(--secondary-container); color: var(--on-secondary-container); }
.btn.lg { height: 64px; padding: 0 32px; font-size: 1.125rem; }

.stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.stat { display: inline-flex; align-items: baseline; gap: 6px; padding: 8px 16px; border-radius: var(--full); background: color-mix(in srgb, var(--surface-lowest) 55%, transparent); font-size: .9375rem; }
.stat b { font-size: 1.125rem; font-weight: 800; font-stretch: 112%; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ sections */
.section { margin-top: 48px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.section-head h2 { font-size: 1.75rem; font-weight: 700; font-stretch: 110%; letter-spacing: -.01em; margin: 0; }
.text-btn { display: inline-flex; align-items: center; gap: 4px; padding: 10px 14px 10px 16px; border-radius: var(--full); color: var(--primary); font-weight: 600; text-decoration: none; white-space: nowrap; transition: background .2s; }
.text-btn:hover { background: color-mix(in srgb, var(--primary) 10%, transparent); }
.text-btn .ms { transition: transform .4s var(--spring-fast); }
.text-btn:hover .ms { transform: translateX(3px); }

/* ------------------------------------------------------------ poster cards */
.poster-card { all: unset; cursor: pointer; display: flex; flex-direction: column; gap: 10px; min-width: 0; -webkit-tap-highlight-color: transparent; }
.poster {
  aspect-ratio: 2/3; border-radius: var(--shape-l); overflow: hidden; position: relative;
  background: var(--surface-high);
  transition: border-radius .45s var(--spring-fast), transform .45s var(--spring-fast);
}
.poster img { width: 100%; height: 100%; object-fit: cover; }
.poster:empty::after, .poster.noimg::after {
  content: ""; position: absolute; inset: 30%; background: var(--outline-variant);
  -webkit-mask: url(/shapes/clover.svg) center/contain no-repeat; mask: url(/shapes/clover.svg) center/contain no-repeat;
}
.poster-card:hover .poster { border-radius: var(--shape-xxl); transform: scale(1.03); }
.poster-card:active .poster { border-radius: var(--shape-m); transform: scale(.97); }
.poster-card:focus-visible .poster { outline: 3px solid var(--primary); outline-offset: 3px; }
.poster .badge { position: absolute; left: 8px; top: 8px; }
.poster-title { font-weight: 600; font-size: .9375rem; line-height: 1.3; padding: 0 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.poster-sub { color: var(--on-surface-variant); font-size: .8125rem; margin-top: -6px; padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.badge {
  display: inline-flex; align-items: center; gap: 3px; height: 24px; padding: 0 10px;
  border-radius: var(--full); font-size: .75rem; font-weight: 700; letter-spacing: .03em;
  background: var(--tertiary-container); color: var(--on-tertiary-container);
}
.badge.tv { background: var(--primary-container); color: var(--on-primary-container); }
.poster .badge { background: var(--tertiary); color: var(--surface-lowest); box-shadow: 0 1px 4px #0003; }
.poster .badge.tv { background: var(--primary); color: var(--on-primary); }

.strip { display: grid; grid-auto-flow: column; grid-auto-columns: 136px; gap: 14px; overflow-x: auto; padding: 4px 4px 12px; margin: 0 -4px; scroll-snap-type: x proximity; scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.strip > * { scroll-snap-align: start; }
@media (min-width: 720px) { .strip { grid-auto-columns: 168px; gap: 20px; } }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 24px 14px; }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(auto-fill, minmax(164px, 1fr)); gap: 32px 20px; } }

/* ------------------------------------------------------------ service tiles */
.services { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.service {
  display: flex; gap: 16px; align-items: center; padding: 18px 20px 18px 18px;
  background: var(--surface-low); border-radius: var(--shape-xl); text-decoration: none;
  transition: background .2s, border-radius .45s var(--spring-fast), transform .45s var(--spring-fast);
}
.service:hover { background: var(--surface-high); border-radius: var(--shape-l); }
.service:active { transform: scale(.98); border-radius: var(--shape-m); }
.service-icon { position: relative; flex: none; width: 56px; height: 56px; display: grid; place-items: center; font-size: 1.5rem; color: var(--on-primary-container); }
.service-icon::before {
  content: ""; position: absolute; inset: 0; background: var(--primary-container);
  -webkit-mask: url(/shapes/cookie.svg) center/contain no-repeat; mask: url(/shapes/cookie.svg) center/contain no-repeat;
  transition: transform .7s var(--spring-gentle);
}
.services .service:nth-child(3n+2) .service-icon { color: var(--on-tertiary-container); }
.services .service:nth-child(3n+2) .service-icon::before { background: var(--tertiary-container); -webkit-mask-image: url(/shapes/clover.svg); mask-image: url(/shapes/clover.svg); }
.services .service:nth-child(3n) .service-icon { color: var(--on-secondary-container); }
.services .service:nth-child(3n) .service-icon::before { background: var(--secondary-container); -webkit-mask-image: url(/shapes/sunny.svg); mask-image: url(/shapes/sunny.svg); }
.service:hover .service-icon::before { transform: rotate(40deg) scale(1.06); }
.service-icon > * { position: relative; }
.service-icon .ms { font-size: 28px; font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 24; }
.service-icon img { width: 30px; height: 30px; object-fit: contain; }
.service h3 { margin: 0; font-size: 1.0625rem; font-weight: 700; }
.service p { margin: 2px 0 0; color: var(--on-surface-variant); font-size: .875rem; line-height: 1.4; }

/* ------------------------------------------------------------ library */
.page-head { padding: 28px 0 4px; }
.page-head h1 { font-size: clamp(2rem, 6vw, 2.75rem); font-weight: 800; font-stretch: 116%; letter-spacing: -.02em; line-height: 1.1; margin: 0 0 6px; }
.page-head p { margin: 0; color: var(--on-surface-variant); }
.page-head a { color: var(--primary); font-weight: 600; }
.controls { display: flex; flex-wrap: wrap; gap: 12px; margin: 20px 0 20px; align-items: center; }
.controls .searchbar { flex: 1 1 320px; }

/* M3 Expressive connected button group */
.seg { display: inline-flex; gap: 2px; }
.seg button {
  display: inline-flex; align-items: center; gap: 6px; height: 48px; padding: 0 18px; border: 0; cursor: pointer;
  background: var(--surface-high); color: var(--on-surface-variant); font-weight: 600; font-size: .875rem;
  border-radius: var(--shape-xs);
  transition: border-radius .4s var(--spring-fast), background .2s, color .2s, padding .4s var(--spring-fast);
}
.seg button:first-child { border-radius: var(--full) var(--shape-xs) var(--shape-xs) var(--full); }
.seg button:last-child { border-radius: var(--shape-xs) var(--full) var(--full) var(--shape-xs); }
.seg button:hover { background: var(--surface-highest); }
.seg button[aria-pressed="true"] { border-radius: var(--full); background: var(--secondary-container); color: var(--on-secondary-container); padding: 0 18px 0 14px; }
.seg button .ms { width: 0; transition: width .35s var(--spring-fast); }
.seg button[aria-pressed="true"] .ms { width: 18px; }

.select-wrap { position: relative; display: inline-flex; }
.select-wrap .ms { position: absolute; right: 12px; top: 50%; translate: 0 -50%; pointer-events: none; color: var(--on-surface-variant); }
select {
  appearance: none; height: 48px; padding: 0 42px 0 18px; border: 0; border-radius: var(--full); cursor: pointer;
  background: var(--surface-high); color: var(--on-surface); font-weight: 600; font-size: .875rem; max-width: 100%;
}
select:hover { background: var(--surface-highest); }
.result-count { color: var(--on-surface-variant); font-size: .875rem; margin: -4px 0 18px; min-height: 1.4em; }
.more { display: flex; margin: 36px auto 0; }

/* ------------------------------------------------------------ new additions */
.day { margin-top: 28px; }
.day h2 {
  position: sticky; top: 72px; z-index: 2; display: inline-flex; margin: 0 0 8px; padding: 6px 16px;
  border-radius: var(--full); background: var(--tertiary-container); color: var(--on-tertiary-container);
  font-size: .875rem; font-weight: 700; letter-spacing: .02em;
}
.entry {
  display: grid; grid-template-columns: 72px 1fr; gap: 16px; align-items: start;
  padding: 12px; margin: 0 -12px 4px; width: calc(100% + 24px);
  border: 0; background: none; text-align: left; cursor: pointer; border-radius: var(--shape-xl);
  transition: background .2s, border-radius .45s var(--spring-fast);
}
.entry:hover { background: var(--surface-low); border-radius: var(--shape-l); }
.entry:active { background: var(--surface-mid); }
@media (min-width: 720px) { .entry { grid-template-columns: 88px 1fr; gap: 20px; } }
.entry .poster { border-radius: var(--shape-m); }
.entry:hover .poster { border-radius: var(--shape-l); }
.entry h3 { margin: 4px 0 4px; font-size: 1.125rem; font-weight: 700; line-height: 1.3; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.entry .what { font-size: .9375rem; font-weight: 500; }
.entry .gen { color: var(--on-surface-variant); font-size: .875rem; }
.entry .desc { color: var(--on-surface-variant); font-size: .875rem; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ------------------------------------------------------------ detail dialog */
dialog {
  width: min(780px, calc(100vw - 24px)); max-height: calc(100dvh - 32px);
  padding: 0; border: 0; border-radius: var(--shape-xxl);
  background: var(--surface-high); color: var(--on-surface); overflow: auto; overscroll-behavior: contain;
  transition: opacity .25s var(--emphasized), transform .5s var(--spring-gentle), overlay .3s allow-discrete, display .3s allow-discrete;
}
dialog[open] { opacity: 1; transform: none; }
@starting-style { dialog[open] { opacity: 0; transform: translateY(24px) scale(.94); } }
dialog::backdrop { background: color-mix(in srgb, var(--scrim) 45%, transparent); }
.detail-hero { position: relative; aspect-ratio: 16/7; background: var(--primary-container) center/cover no-repeat; }
.detail-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 25%, var(--surface-high)); }
.icon-btn {
  position: absolute; top: 12px; right: 12px; z-index: 3; width: 48px; height: 48px; display: grid; place-items: center;
  border: 0; border-radius: var(--full); cursor: pointer;
  background: color-mix(in srgb, var(--surface-highest) 85%, transparent); color: var(--on-surface);
  backdrop-filter: blur(8px); transition: border-radius .35s var(--spring-fast), transform .35s var(--spring-fast);
}
.icon-btn:active { border-radius: var(--shape-m); transform: scale(.92); }
.detail-main { display: grid; grid-template-columns: 112px 1fr; gap: 18px; padding: 0 20px 24px; margin-top: -64px; position: relative; z-index: 1; }
.detail-main.no-hero { margin-top: 0; padding-top: 64px; }
@media (min-width: 640px) { .detail-main { grid-template-columns: 168px 1fr; gap: 28px; padding: 0 32px 32px; margin-top: -100px; } }
.detail-main .poster { box-shadow: 0 4px 16px #0003; border-radius: var(--shape-l); }
.detail-info { padding-top: 60px; min-width: 0; }
@media (min-width: 640px) { .detail-info { padding-top: 104px; } }
.detail-info h2 { font-size: clamp(1.6rem, 4.5vw, 2.25rem); font-weight: 800; font-stretch: 114%; letter-spacing: -.015em; line-height: 1.1; margin: 0 0 10px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--on-surface-variant); font-size: .875rem; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 12px;
  border-radius: var(--shape-xs); border: 1px solid var(--outline-variant); font-size: .875rem; font-weight: 500;
}
.chip.filled { border-color: transparent; background: var(--surface-highest); }
.chip .ms { font-size: 18px; }
.detail-text { grid-column: 1 / -1; }
.detail-text p { margin: 0 0 18px; font-size: 1rem; line-height: 1.6; }
.in-lib {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 16px 0 10px; margin-bottom: 16px;
  border-radius: var(--full); background: var(--primary-container); color: var(--on-primary-container); font-weight: 700; font-size: .875rem;
}
.label { margin: 0 0 8px; font-size: .875rem; font-weight: 700; letter-spacing: .02em; color: var(--on-surface-variant); }
.seasons { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; font-size: .9375rem; margin: 0 0 24px; padding: 16px 20px; background: var(--surface-mid); border-radius: var(--shape-l); }
.facts dt { color: var(--on-surface-variant); }
.facts dd { margin: 0; }
.ep-list { list-style: none; padding: 0; margin: 0 0 22px; font-size: .9375rem; columns: 2 240px; column-gap: 24px; }
.ep-list li { padding: 4px 0; break-inside: avoid; }
.ep-list b { font-variant-numeric: tabular-nums; color: var(--primary); font-weight: 700; margin-right: 8px; }

/* M3 Expressive loading indicator: a morphing, spinning shape */
.loader { display: grid; place-items: center; padding: 96px 0; }
.loader span { width: 48px; height: 48px; background: var(--primary); -webkit-mask: url(/shapes/cookie.svg) center/contain no-repeat; mask: url(/shapes/cookie.svg) center/contain no-repeat; animation: morph 1.6s var(--emphasized) infinite; }
@keyframes morph {
  0% { transform: rotate(0) scale(1); -webkit-mask-image: url(/shapes/cookie.svg); mask-image: url(/shapes/cookie.svg); }
  50% { transform: rotate(180deg) scale(.82); -webkit-mask-image: url(/shapes/clover.svg); mask-image: url(/shapes/clover.svg); }
  100% { transform: rotate(360deg) scale(1); -webkit-mask-image: url(/shapes/cookie.svg); mask-image: url(/shapes/cookie.svg); }
}

/* ------------------------------------------------------------ states */
.empty { text-align: center; padding: 48px 16px; color: var(--on-surface-variant); }
.empty .blob { width: 96px; height: 96px; margin: 0 auto 18px; display: grid; place-items: center; background: var(--secondary-container); color: var(--on-secondary-container); -webkit-mask: url(/shapes/clover.svg) center/contain no-repeat; mask: url(/shapes/clover.svg) center/contain no-repeat; }
.empty .blob .ms { font-size: 40px; }
.empty h3 { color: var(--on-surface); margin: 0 0 6px; font-size: 1.25rem; font-weight: 700; }
.error { display: flex; gap: 10px; align-items: center; background: var(--error-container); color: var(--on-error-container); padding: 14px 18px; border-radius: var(--shape-l); }
.skel { background: var(--surface-high); border-radius: var(--shape-l); animation: pulse 1.6s var(--emphasized) infinite; }
@keyframes pulse { 50% { opacity: .55; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01s !important; }
}
