/* DranaZ — white streaming UI, posters as the color. Tokens are documented in docs/DESIGN.md. */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-soft: #faf6f7;
  --surface: #f3edef;
  --surface-2: #e8dfe2;
  --line: rgb(58 20 34 / 11%);
  --text: #1c1015;
  --muted: #5f4b53;
  --faint: #86727a;
  --garnet: #d9334f;
  --garnet-deep: #b01f3a;
  --garnet-soft: rgb(217 51 79 / 10%);
  --champagne: #ebc57e;
  --gold-ink: #85590a;
  --player: #000000;

  --font-display: "Gloock", "Georgia", serif;
  --font-ui: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;

  --nav-h: 68px;
  --tab-h: 64px;
  --gutter: clamp(16px, 4vw, 56px);
  --max: 1520px;
  --r-card: 10px;
  --r-panel: 16px;
  --shadow-card: 0 1px 2px rgb(58 20 34 / 8%), 0 8px 24px rgb(58 20 34 / 10%);
  --ease-out: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; } /* author display rules must not beat the hidden attribute */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--garnet-deep); outline-offset: 3px; border-radius: 6px; }
#view:focus { outline: none; }
.muted { color: var(--muted); }

/* Line icons: fill/stroke on the <svg> so per-path attributes (e.g. the play triangle) still win. */
.icon { display: inline-flex; flex: none; }
.icon svg, .topbar svg:not(.brand-logo), .tabbar svg {
  width: 20px; height: 20px;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.icon svg.filled path { fill: currentColor; }

.skip-link { position: fixed; top: 8px; left: 8px; z-index: 100; padding: 10px 14px; border-radius: 8px; background: var(--text); color: var(--bg); transform: translateY(-160%); }
.skip-link:focus { transform: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 48px; padding: 0 24px 0 20px;
  border: 0; border-radius: 999px;
  font-size: 16px; font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, transform .15s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--garnet); color: #fff; }
.btn-primary:hover { background: var(--garnet-deep); }
.btn-ghost { background: var(--surface); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn .icon svg { width: 22px; height: 22px; }

.chip-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 16px 0 13px;
  border: 0; border-radius: 999px;
  background: var(--surface); color: var(--text);
  font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, color .15s;
}
.chip-btn:hover { background: var(--surface-2); }
.chip-btn[aria-pressed="true"] { background: var(--garnet-soft); color: var(--garnet-deep); }
.link-btn { padding: 0; border: 0; background: none; color: var(--garnet-deep); font-size: 14px; font-weight: 600; text-decoration: none; }
.link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }

.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  padding: 4px 10px; border-radius: 6px;
  background: var(--surface); color: var(--text);
  font-size: 13px; font-weight: 600; line-height: 1.3;
}
.badge-gold { background: var(--champagne); color: #3a2410; }
.badge-line { background: none; box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); font-weight: 500; }

/* ---------- Top bar ---------- */
.topbar {
  position: fixed; inset: 0 0 auto; z-index: 50;
  display: flex; align-items: center; gap: clamp(16px, 2.5vw, 36px);
  height: var(--nav-h); padding: 0 var(--gutter);
  background: rgb(255 255 255 / 94%);
  border-bottom: 1px solid transparent;
  backdrop-filter: blur(16px) saturate(1.4);
  transition: border-color .2s;
  view-transition-name: topbar;
}
.topbar.is-solid { border-bottom-color: var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: none; }
.brand-logo { width: 36px; height: 36px; }
.brand-name { font-family: var(--font-display); font-size: 25px; line-height: 1; letter-spacing: -.01em; }
.topnav { display: flex; gap: 4px; }
.topnav a { padding: 8px 12px; border-radius: 8px; color: var(--muted); font-size: 15px; font-weight: 500; text-decoration: none; transition: color .15s, background-color .15s; }
.topnav a:hover { color: var(--text); background: var(--surface); }
.topnav a[aria-current="page"] { color: var(--text); font-weight: 600; text-decoration: underline 2px var(--garnet); text-underline-offset: 9px; }

.top-search {
  display: flex; align-items: center; gap: 10px;
  width: clamp(220px, 28vw, 420px); height: 42px; margin-left: auto; padding: 0 10px 0 14px;
  border: 1px solid transparent; border-radius: 999px;
  background: var(--surface); color: var(--faint);
  transition: border-color .15s, background-color .15s;
}
.top-search:hover { border-color: var(--line); }
.top-search span { flex: 1; text-align: left; font-size: 14.5px; }
.top-search kbd { padding: 1px 7px; border: 1px solid var(--line); border-radius: 5px; background: var(--bg); color: var(--faint); font: 600 12px var(--font-ui); }
.install-btn {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  height: 40px; padding: 0 14px 0 11px; border: 1px solid rgb(217 51 79 / 35%); border-radius: 999px;
  background: none; color: var(--garnet-deep); font-size: 14px; font-weight: 600;
}
.install-btn:hover { background: var(--garnet-soft); }
.install-btn[hidden], .top-search-mobile { display: none; }
.top-search-mobile { border: 0; background: none; padding: 0; }

/* ---------- Bottom tab bar (mobile) ---------- */
.tabbar { display: none; }

/* ---------- Hero ---------- */
.hero { position: relative; isolation: isolate; overflow: hidden; }
.hero-loading { min-height: min(70svh, 640px); background: var(--bg-soft); }
.hero-media { position: absolute; inset: 0; z-index: -1; }
.hero-backdrop {
  position: absolute; inset: -12%; width: 124%; height: 124%; max-width: none;
  object-fit: cover; filter: blur(56px) saturate(1.25); opacity: .55;
}
.hero-media::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(to right, rgb(255 255 255 / 94%) 0%, rgb(255 255 255 / 70%) 50%, rgb(255 255 255 / 30%) 100%),
    linear-gradient(to bottom, rgb(255 255 255 / 0%) 60%, var(--bg) 100%);
}
.hero-inner {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 48px;
  max-width: var(--max); min-height: min(70svh, 640px); margin: 0 auto;
  padding: calc(var(--nav-h) + 40px) var(--gutter) 64px;
}
.hero-copy { display: grid; gap: 20px; justify-items: start; max-width: 640px; min-width: 0; }
.hero-title {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(38px, 5vw, 68px); line-height: 1.03; letter-spacing: -.015em;
  text-wrap: balance;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.hero-text {
  max-width: 54ch; color: var(--muted); font-size: 17px; line-height: 1.55; white-space: pre-line;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 4px; }

/* The poster deck: the one memorable element of the home page. */
.hero-deck { position: relative; width: calc(250px + 4 * 36px); height: calc(250px * 720 / 523); }
.deck-card {
  --pos: 0;
  position: absolute; top: 0; left: 0; width: 250px; aspect-ratio: 523 / 720;
  padding: 0; border: 0; border-radius: 14px; overflow: hidden; background: var(--surface);
  transform-origin: left center;
  transform: translateX(calc(var(--pos) * 36px)) scale(calc(1 - var(--pos) * .07));
  opacity: max(0, calc(1 - var(--pos) * .24));
  z-index: calc(10 - var(--pos));
  box-shadow: 0 22px 50px rgb(58 20 34 / 28%), 0 0 0 1px rgb(58 20 34 / 8%);
  transition: transform .6s var(--ease-out), opacity .45s;
}
.deck-card img { width: 100%; height: 100%; object-fit: cover; }
.hero-segments { display: none; }

/* ---------- Rails ---------- */
.rails { position: relative; z-index: 2; display: grid; gap: clamp(28px, 3.5vw, 44px); padding: 8px 0 56px; }
.rails:first-child { padding-top: calc(var(--nav-h) + 24px); } /* hero missing (empty/failed catalogue) */
.rail { max-width: var(--max); width: 100%; margin: 0 auto; }
.rail-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 0 var(--gutter) 14px; }
.rail-head h2 { font-family: var(--font-display); font-weight: 400; font-size: clamp(21px, 2vw, 26px); line-height: 1.2; }
.rail-more { color: var(--muted); font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.rail-more:hover { color: var(--garnet-deep); }
.rail-viewport { position: relative; }
.rail-track {
  display: grid; grid-auto-flow: column; grid-auto-columns: clamp(126px, 13.5vw, 184px); gap: 14px;
  overflow-x: auto; overscroll-behavior-x: contain;
  padding: 2px var(--gutter) 6px; scroll-padding-inline: var(--gutter);
  scroll-snap-type: x proximity; scrollbar-width: none;
}
.rail-track::-webkit-scrollbar { display: none; }
.rail-arrow {
  /* vertically centred on the poster image (card width × poster ratio ÷ 2) */
  position: absolute; top: calc(clamp(126px, 13.5vw, 184px) * 720 / 523 / 2 - 20px); z-index: 3;
  display: grid; place-items: center; width: 44px; height: 44px;
  border: 0; border-radius: 50%; background: var(--bg); color: var(--text);
  box-shadow: var(--shadow-card);
  opacity: 0; transition: opacity .2s, transform .15s;
}
.rail-arrow:hover { transform: scale(1.06); }
.rail-arrow.prev { left: max(8px, calc(var(--gutter) - 22px)); }
.rail-arrow.next { right: max(8px, calc(var(--gutter) - 22px)); }
.rail-arrow .icon svg { width: 22px; height: 22px; }
.rail-viewport:hover .rail-arrow, .rail-arrow:focus-visible { opacity: 1; }
.rail[data-at-start] .rail-arrow.prev, .rail[data-at-end] .rail-arrow.next { opacity: 0; pointer-events: none; }
.rail-error { padding: 24px 0; color: var(--muted); grid-column: 1 / -1; width: min(520px, 80vw); }
@media (hover: none) { .rail-arrow { display: none; } }

/* ---------- Poster card ---------- */
.poster { display: flex; flex-direction: column; gap: 8px; min-width: 0; text-decoration: none; scroll-snap-align: start; }
.poster-art {
  position: relative; display: block; aspect-ratio: 523 / 720; overflow: hidden;
  border-radius: var(--r-card); background: var(--surface);
}
.poster-art img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--ease-out); }
.poster:hover .poster-art img { transform: scale(1.045); }
.poster:focus-visible { outline: none; }
.poster:focus-visible .poster-art { outline: 2px solid var(--garnet-deep); outline-offset: 3px; }
.badge-vf {
  position: absolute; top: 8px; left: 8px;
  padding: 2px 6px; border-radius: 4px; background: var(--champagne); color: #3a2410;
  font-size: 11px; font-weight: 700; letter-spacing: .02em;
}
.poster-eps {
  position: absolute; left: 8px; bottom: 8px;
  padding: 3px 8px; border-radius: 6px; background: rgb(20 8 12 / 72%); backdrop-filter: blur(6px);
  color: #fff; font-size: 12px; font-weight: 600;
}
.poster-title {
  font-size: 14px; font-weight: 600; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.poster-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: -4px; color: var(--faint); font-size: 12.5px; }

/* Skeletons */
.is-skeleton .poster-art, .skeleton-line, .next-item.is-skeleton {
  background: linear-gradient(100deg, var(--surface) 30%, var(--bg-soft) 50%, var(--surface) 70%) 0 0 / 300% 100%;
  animation: shimmer 1.4s linear infinite;
}
.skeleton-line { display: block; height: 12px; width: 82%; border-radius: 6px; }
.skeleton-line.short { width: 48%; }
.skeleton-line.wide { height: 34px; width: 90%; }
@keyframes shimmer { to { background-position: -300% 0; } }

/* Wide cards: landscape thumbnails (anime). Rails switch to wider columns when most cards are wide. */
.poster.is-wide .poster-art { aspect-ratio: 16 / 9; }
.rail.is-wide .rail-track { grid-auto-columns: clamp(220px, 24vw, 320px); }
.rail.is-wide .rail-arrow { top: calc(clamp(220px, 24vw, 320px) * 9 / 16 / 2 - 20px); }
.hero.is-wide .hero-deck { width: calc(420px + 4 * 36px); height: calc(420px * 9 / 16); }
.hero.is-wide .deck-card { width: 420px; aspect-ratio: 16 / 9; }
.next-item.is-wide { grid-template-columns: 128px minmax(0, 1fr); }
.next-item.is-wide .next-art { aspect-ratio: 16 / 9; }

.poster-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 28px 16px; }

/* ---------- Watch ---------- */
.watch {
  position: relative; isolation: isolate;
  display: grid; grid-template-columns: auto minmax(0, 1fr) 360px; align-items: start; gap: 32px;
  max-width: var(--max); margin: 0 auto; padding: calc(var(--nav-h) + 24px) var(--gutter) 64px;
}
.watch-ambient {
  position: absolute; inset: 0 0 auto; z-index: -1;
  width: 100%; height: 60vh; object-fit: cover;
  filter: blur(90px) saturate(1.4); opacity: .18;
  mask-image: linear-gradient(to bottom, #000 20%, transparent);
  pointer-events: none;
}
.watch-player { position: sticky; top: calc(var(--nav-h) + 16px); }
.player-frame {
  --ar: .5625;
  position: relative; height: min(calc(100svh - var(--nav-h) - 48px), 880px); aspect-ratio: var(--ar); max-width: 100%;
  overflow: hidden; border-radius: var(--r-panel); background: var(--player);
  box-shadow: 0 24px 60px rgb(58 20 34 / 22%);
}
.player-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player-frame.is-landscape { width: 100%; height: auto; }
.watch:has(.is-landscape) { grid-template-columns: minmax(0, 1fr) 360px; }
.watch:has(.is-landscape) .watch-player { position: static; }
.watch:has(.is-landscape) .watch-next { grid-column: 2; grid-row: 1 / span 2; }

.watch-info { display: grid; gap: 18px; align-content: start; justify-items: start; min-width: 0; padding-top: 8px; }
.watch-title { font-family: var(--font-display); font-weight: 400; font-size: clamp(28px, 2.8vw, 42px); line-height: 1.08; letter-spacing: -.01em; text-wrap: balance; }
.watch-stats { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: -6px; color: var(--muted); font-size: 14px; }
.watch-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.synopsis {
  max-width: 68ch; color: #34232a; font-size: 15.5px; line-height: 1.65; white-space: pre-line;
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden;
}
.synopsis.is-open { display: block; }
.story { display: grid; gap: 10px; justify-items: start; width: 100%; padding-top: 18px; border-top: 1px solid var(--line); }
.story h2 { font-family: var(--font-display); font-weight: 400; font-size: 22px; }

.watch-next { display: grid; gap: 12px; min-width: 0; }
.watch-next h2 { font-family: var(--font-display); font-weight: 400; font-size: 24px; }
.next-list { display: grid; gap: 2px; }
.next-item {
  display: grid; grid-template-columns: 72px minmax(0, 1fr); align-items: center; gap: 14px;
  padding: 8px; margin-inline: -8px; border-radius: 12px; text-decoration: none;
  transition: background-color .15s;
}
.next-item:hover { background: var(--bg-soft); }
.next-item.is-skeleton { height: 115px; margin: 0 0 6px; }
.next-art { display: block; aspect-ratio: 523 / 720; overflow: hidden; border-radius: 8px; background: var(--surface); }
.next-art img { width: 100%; height: 100%; object-fit: cover; }
.next-copy { display: grid; gap: 4px; }
.next-title { font-size: 14.5px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.next-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; color: var(--faint); font-size: 12.5px; }
.tag-vf { color: var(--gold-ink); font-weight: 700; }

/* ---------- Pages (search, library) ---------- */
.page { max-width: var(--max); margin: 0 auto; padding: calc(var(--nav-h) + 36px) var(--gutter) 72px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.page-title { display: flex; align-items: center; gap: 14px; font-family: var(--font-display); font-weight: 400; font-size: clamp(34px, 4vw, 52px); line-height: 1.05; }
.page > .page-title { margin-bottom: 24px; }
.page-count { padding: 3px 12px; border-radius: 999px; background: var(--surface); color: var(--muted); font: 600 15px var(--font-ui); }

.search-field {
  display: flex; align-items: center; gap: 12px;
  max-width: 720px; height: 58px; padding: 0 18px;
  border: 1px solid transparent; border-radius: 16px; background: var(--surface); color: var(--faint);
}
.search-field:focus-within { border-color: var(--garnet); background: var(--bg); }
.search-field input::-webkit-search-cancel-button { display: none; }
.search-field .icon svg { width: 22px; height: 22px; }
.search-field input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); font-size: 18px; }
.search-field input::placeholder { color: var(--faint); }
.seg { display: inline-flex; gap: 2px; margin-top: 14px; padding: 4px; border-radius: 999px; background: var(--surface); }
.seg-btn { padding: 8px 16px; border: 0; border-radius: 999px; background: none; color: var(--muted); font-size: 14px; font-weight: 600; }
.seg-btn[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.search-status { min-height: 22px; margin: 22px 0 18px; color: var(--muted); font-size: 14.5px; }
.sentinel { height: 1px; }
.suggestions h2 { margin-bottom: 14px; font-family: var(--font-display); font-weight: 400; font-size: 24px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 10px 18px; border: 0; border-radius: 999px; background: var(--surface); font-size: 15px; font-weight: 500; }
.chip::first-letter { text-transform: uppercase; }
.chip:hover { background: var(--surface-2); }

.empty { display: grid; justify-items: start; gap: 14px; max-width: 46ch; padding: 32px 0; }
.empty h2 { font-family: var(--font-display); font-weight: 400; font-size: 28px; }
.empty p { color: var(--muted); }
.notice { max-width: var(--max); margin: 0 auto; padding: calc(var(--nav-h) + 40px) var(--gutter) 40px; color: var(--muted); }

/* ---------- Search overlay ---------- */
body.has-overlay { overflow: hidden; }
.search-overlay {
  position: fixed; inset: 0; z-index: 70;
  display: flex; flex-direction: column;
  background: var(--bg);
  animation: overlay-in .2s var(--ease-out);
}
.search-overlay[hidden] { display: none; }
@keyframes overlay-in { from { opacity: 0; transform: translateY(12px); } }
.search-bar {
  display: flex; align-items: center; gap: 10px;
  width: 100%; max-width: var(--max); margin: 0 auto; padding: 12px var(--gutter);
  border-bottom: 1px solid var(--line);
}
.search-bar .search-field { flex: 1; max-width: none; height: 52px; }
.close-btn {
  display: grid; place-items: center; flex: none; width: 46px; height: 46px;
  border: 0; border-radius: 50%; background: var(--surface); color: var(--text);
}
.close-btn:hover { background: var(--surface-2); }
.close-btn .icon svg { width: 22px; height: 22px; }
.search-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.search-inner { max-width: var(--max); margin: 0 auto; padding: 4px var(--gutter) 48px; }
.search-popular { margin-top: 32px; }
.search-popular h2 { margin-bottom: 14px; font-family: var(--font-display); font-weight: 400; font-size: 24px; }

/* ---------- Install invitation ---------- */
.install-sheet {
  position: fixed; left: 50%; bottom: 24px; z-index: 75;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px;
  width: min(640px, calc(100% - 32px)); padding: 16px 18px;
  border-radius: 20px; background: var(--bg); box-shadow: 0 20px 60px rgb(58 20 34 / 25%), 0 0 0 1px var(--line);
  opacity: 0; transform: translate(-50%, 24px);
  transition: opacity .25s, transform .3s var(--ease-out);
}
.install-sheet.is-open { opacity: 1; transform: translate(-50%, 0); }
.install-sheet img { border-radius: 12px; }
.install-copy strong { display: block; font-size: 16px; }
.install-copy p { color: var(--muted); font-size: 14px; line-height: 1.4; }
.install-actions { display: flex; align-items: center; gap: 16px; }
.install-actions .btn { height: 42px; padding: 0 20px; font-size: 15px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 80;
  padding: 12px 18px; border-radius: 12px; background: var(--text); color: var(--bg);
  font-size: 14.5px; font-weight: 600; box-shadow: 0 16px 40px rgb(58 20 34 / 25%);
  opacity: 0; transform: translate(-50%, 16px); pointer-events: none;
  transition: opacity .2s, transform .25s var(--ease-out);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- View transitions ---------- */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .22s; }
.tabbar { view-transition-name: tabbar; }

/* ---------- Responsive ---------- */
@media (max-width: 1240px) {
  .watch { grid-template-columns: auto minmax(0, 1fr); }
  .watch-next { grid-column: 2; }
  .watch:has(.is-landscape) { grid-template-columns: minmax(0, 1fr); }
  .watch:has(.is-landscape) .watch-next { grid-column: 1; grid-row: auto; }
}

@media (max-width: 900px) {
  .topnav { display: none; }
  .hero-deck { display: none; }
  .hero-inner { grid-template-columns: minmax(0, 1fr); }
  .watch { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-top: var(--nav-h); }
  .watch-player { position: static; margin-inline: calc(var(--gutter) * -1); background: var(--player); }
  .player-frame { height: min(72svh, 760px); margin-inline: auto; border-radius: 0; box-shadow: none; }
  .watch-next { grid-column: 1; }
  .watch-ambient { display: none; }
}

@media (max-width: 760px) {
  :root { --nav-h: 58px; }
  body { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); }
  .topbar { gap: 12px; }
  .brand-logo { width: 32px; height: 32px; }
  .brand-name { font-size: 22px; }
  .top-search { display: none; }
  .install-btn { margin-left: auto; padding: 0; width: 40px; justify-content: center; font-size: 0; }
  .top-search-mobile { display: grid; place-items: center; width: 42px; height: 42px; margin-left: auto; margin-right: -8px; border-radius: 50%; color: var(--text); }
  .install-btn:not([hidden]) + .top-search-mobile { margin-left: 0; }

  .tabbar {
    position: fixed; inset: auto 0 0; z-index: 50;
    display: grid; grid-template-columns: repeat(4, 1fr);
    height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid var(--line); background: rgb(255 255 255 / 96%); backdrop-filter: blur(16px);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--faint); font-size: 11.5px; font-weight: 600; text-decoration: none; }
  .tabbar svg { width: 23px; height: 23px; }
  .tabbar a[aria-current="page"] { color: var(--text); }
  .tabbar a[aria-current="page"] svg { color: var(--garnet); stroke-width: 2.2; }

  /* Mobile hero: the poster itself on top, fading into white, like a story card. */
  .hero-media { top: var(--nav-h); bottom: auto; height: 58svh; }
  .hero-backdrop { inset: 0; width: 100%; height: 100%; object-position: center 20%; filter: none; opacity: 1; }
  .hero-media::after { background: linear-gradient(to bottom, rgb(255 255 255 / 0%) 45%, var(--bg) 100%); }
  .hero-inner { min-height: 0; }
  .hero-loading { min-height: calc(var(--nav-h) + 50svh + 190px); }
  .hero-inner { display: block; padding: calc(var(--nav-h) + 50svh) var(--gutter) 28px; }
  .hero-copy { gap: 12px; }
  .hero-title { font-size: clamp(30px, 8.5vw, 40px); }
  .hero-text { font-size: 15px; -webkit-line-clamp: 2; }
  .hero-actions { width: 100%; }
  .hero-actions .btn { flex: 1; height: 46px; padding-inline: 14px; }
  .hero-segments { display: flex; gap: 6px; width: 100%; }
  .segment { flex: 1; padding: 10px 0; border: 0; background: none; }
  .segment span { position: relative; display: block; height: 3px; overflow: hidden; border-radius: 3px; background: var(--surface-2); }
  .segment span::after { content: ""; position: absolute; inset: 0; background: var(--text); transform: scaleX(0); transform-origin: left; }
  .segment[aria-selected="true"] span::after { transform: scaleX(1); }
  .segment.is-running span::after { animation: segment 9s linear forwards; }
  @keyframes segment { from { transform: scaleX(0); } to { transform: scaleX(1); } }

  .rail-track { gap: 10px; grid-auto-columns: 34vw; }
  .rail.is-wide .rail-track { grid-auto-columns: 72vw; }
  .poster-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 20px 10px; }
  .poster-title { font-size: 13.5px; }
  .watch-title { font-size: 28px; }
  .page { padding-top: calc(var(--nav-h) + 20px); }
  .page-title { font-size: 34px; }
  .search-field { height: 52px; }
  .search-field input { font-size: 17px; }
  .toast { bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 14px); }
  .search-bar { padding-block: 8px; }
  .close-btn { width: 42px; height: 42px; }
  .install-sheet { bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 10px); grid-template-columns: auto minmax(0, 1fr); gap: 12px 14px; padding: 14px; }
  .install-actions { grid-column: 1 / -1; justify-content: flex-end; }
}

/* Phones: the player fills the width at the video's own ratio, so no black bars on the sides. */
@media (max-width: 600px) {
  .watch-player { background: none; }
  .player-frame { width: 100%; height: auto; aspect-ratio: var(--ar); }
}

@media (max-width: 380px) {
  .chip-btn { padding-inline: 12px 13px; }
  .watch-actions .chip-btn:last-child span { display: none; }
}

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