/* ==========================================================================
   YingSou 6.0 (R12) — "Obsidian & Ivory Editorial Cinema" Complete Redesign
   Preserves all DOM hooks, accessibility, responsive breakpoints & test contracts
   ========================================================================== */

:root {
  --bg: #f5f2eb;
  --surface: #ffffff;
  --surface2: #eae5dc;
  --surface-elevated: rgba(255, 255, 255, 0.92);
  --ink: #181715;
  --muted: #68635b;
  --line: rgba(32, 28, 22, 0.09);
  --line-strong: rgba(32, 28, 22, 0.16);
  --accent: #c43c27;
  --accent-bright: #df533b;
  --on-accent: #fffaf6;
  --accent-wash: rgba(196, 60, 39, 0.1);
  --accent-soft: var(--accent-wash);
  --gold: #d4953b;
  --probe-good: #2d7a56;
  --radius: 20px;
  --radius-lg: 28px;
  --shadow-sm: 0 4px 14px rgba(28, 22, 16, 0.05);
  --shadow: 0 16px 42px -8px rgba(28, 22, 16, 0.08), 0 4px 12px rgba(28, 22, 16, 0.04);
  --shadow-hover: 0 24px 54px -10px rgba(28, 22, 16, 0.18), 0 8px 20px rgba(196, 60, 39, 0.08);
  --ui-font: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  --display: "Iowan Old Style", "New York", "Baskerville", "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  --header-bg: rgba(250, 247, 241, 0.82);
  --glass: rgba(255, 253, 249, 0.86);
  --nav-track: rgba(32, 28, 22, 0.055);
  --content-width: 1280px;
  --page-gutter: 36px;
  --header-height: 66px;
  --hero-height: 296px;
  --app-safe-top: 0px;
  --app-safe-bottom: 0px;
  --bottom-nav-height: 64px;
  --space-tight: 8px;
  --space-related: 12px;
  --space-group: 20px;
  --space-section: 28px;
}

:root[data-theme=dark] {
  --bg: #0b0c10;
  --surface: #14161d;
  --surface2: #1d202a;
  --surface-elevated: rgba(26, 29, 38, 0.92);
  --ink: #f3f1ec;
  --muted: #98968f;
  --line: rgba(255, 255, 255, 0.085);
  --line-strong: rgba(255, 255, 255, 0.16);
  --accent: #ff6b52;
  --accent-bright: #ff856d;
  --on-accent: #180906;
  --accent-wash: rgba(255, 107, 82, 0.15);
  --accent-soft: var(--accent-wash);
  --gold: #f5c97b;
  --probe-good: #6fd6a3;
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.35);
  --shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.55), 0 4px 14px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 28px 64px -10px rgba(0, 0, 0, 0.75), 0 0 28px rgba(255, 107, 82, 0.14);
  --header-bg: rgba(16, 18, 24, 0.78);
  --glass: rgba(24, 27, 36, 0.84);
  --nav-track: rgba(255, 255, 255, 0.06);
}

@media (display-mode: standalone), (display-mode: fullscreen) {
  :root {
    --app-safe-top: env(safe-area-inset-top, 0px);
    --app-safe-bottom: env(safe-area-inset-bottom, 0px);
  }
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + var(--app-safe-top) + 20px);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-width: 320px;
  background:
    radial-gradient(1100px 500px at 85% -8%, rgba(196, 60, 39, 0.085), transparent 68%),
    radial-gradient(900px 460px at 10% 15%, rgba(212, 149, 59, 0.06), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  font-family: var(--ui-font);
  font-size: 15px;
  color: var(--ink);
  letter-spacing: -0.005em;
}

:root[data-theme=dark] body {
  background:
    radial-gradient(1200px 520px at 82% -10%, rgba(255, 107, 82, 0.12), transparent 68%),
    radial-gradient(950px 480px at 12% 18%, rgba(92, 107, 192, 0.07), transparent 72%),
    var(--bg);
}

::selection {
  background: var(--accent);
  color: var(--on-accent);
}

h1, h2 {
  text-wrap: balance;
}

button, a, input, select, summary {
  touch-action: manipulation;
}

:root[data-ready=true] .launch-cover {
  animation: launch-out .16s both;
}

.skip-link {
  position: fixed;
  z-index: 2147483647;
  left: 18px;
  top: 12px;
  transform: translateY(-160%);
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  transition: transform .18s;
}
.skip-link:focus {
  transform: none;
}

/* ==========================================================================
   1. Floating Glass Header & Segmented Capsule Navigation
   ========================================================================== */
.header {
  position: sticky;
  top: 0;
  z-index: 40;
  max-width: none;
  height: calc(var(--header-height) + var(--app-safe-top));
  padding-top: var(--app-safe-top);
  padding-left: max(var(--page-gutter), env(safe-area-inset-left, 0px), calc((100% - var(--content-width)) / 2));
  padding-right: max(var(--page-gutter), env(safe-area-inset-right, 0px), calc((100% - var(--content-width)) / 2));
  background: var(--header-bg);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.03);
  backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
}

.brand {
  gap: 12px;
  font-family: var(--display);
  font-size: 25px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  filter: drop-shadow(0 6px 14px rgba(196, 60, 39, 0.28));
  transition: transform .25s cubic-bezier(.2, .8, .2, 1);
}
.brand:hover .brand-mark {
  transform: scale(1.06) rotate(-3deg);
}

.brand small {
  font-family: var(--ui-font);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  margin-top: 3px;
  opacity: 0.85;
}

.header nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--nav-track);
  border: 1px solid var(--line);
}

.header nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 6px 20px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.01em;
  transition: all .22s cubic-bezier(.2, .8, .2, 1);
}

.header nav a::after {
  display: none;
}

.header nav a:hover {
  color: var(--ink);
  background: rgba(128, 128, 128, 0.08);
}

.header nav a.active {
  color: var(--on-accent);
  background: linear-gradient(135deg, var(--accent-bright) 0%, var(--accent) 100%);
  box-shadow: 0 4px 14px rgba(196, 60, 39, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

#theme {
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
#theme:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(196, 60, 39, 0.14);
}

/* ==========================================================================
   2. Main Container, Command Header & Tactile Category Pills
   ========================================================================== */
main {
  width: 100%;
  max-width: calc(var(--content-width) + 2 * var(--page-gutter));
  padding: 24px max(var(--page-gutter), env(safe-area-inset-right, 0px)) 92px max(var(--page-gutter), env(safe-area-inset-left, 0px));
  outline: none;
}

.page-top {
  position: relative;
  align-items: flex-end;
  margin-bottom: 22px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-wash);
  color: var(--accent);
  font-size: 10px;
  line-height: 1.4;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.page-top h1 {
  font-family: var(--display);
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.page-top p {
  font-size: 13px;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
}

.page-top .right {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.page-top .right:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

/* Side-by-side Editorial Header + Command Search Bar on Desktop Home */
@media (min-width: 920px) {
  body[data-route=home] main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    column-gap: 24px;
    padding-top: 14px;
  }
  body[data-route=home] main > * {
    grid-column: 1 / -1;
  }
  body[data-route=home] main > .home-top {
    grid-column: 1 / 2;
    justify-content: flex-start;
    gap: 14px;
    margin-bottom: 10px;
  }
  body[data-route=home] main > .home-top .right {
    margin-left: 4px;
    align-self: flex-end;
    margin-bottom: 2px;
  }
  body[data-route=home] main > .discovery-search {
    grid-column: 2 / 3;
    align-self: end;
    margin: 0 0 12px;
  }
}

.discovery-search {
  height: 52px;
  width: 100%;
  max-width: none;
  padding: 0 8px 0 18px;
  margin: 0 0 16px;
  gap: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  font-size: 13.5px;
  transition: all .22s cubic-bezier(.2, .8, .2, 1);
}
.discovery-search:hover {
  border-color: var(--accent);
  box-shadow: 0 10px 28px -6px rgba(196, 60, 39, 0.16);
  transform: translateY(-1px);
}
.discovery-search svg {
  color: var(--accent);
  width: 18px;
  height: 18px;
}
.discovery-search span:last-child {
  padding: 7px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent-bright) 0%, var(--accent) 100%);
  color: var(--on-accent);
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(196, 60, 39, 0.25);
}

/* Tactile Floating Category Chips */
#categories {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 10px;
  border-bottom: 0;
  scrollbar-width: none;
}
#categories button {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 68px;
  min-height: 40px;
  padding: 8px 20px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: all .2s cubic-bezier(.2, .8, .2, 1);
}
#categories button:hover {
  color: var(--ink);
  border-color: var(--accent);
  transform: translateY(-1px);
}
#categories button.active {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
  font-weight: 700;
  box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.25);
}
:root[data-theme=dark] #categories button.active {
  background: linear-gradient(135deg, var(--accent-bright) 0%, var(--accent) 100%);
  color: var(--on-accent);
  border-color: transparent;
  box-shadow: 0 8px 22px -4px rgba(255, 107, 82, 0.4);
}

/* ==========================================================================
   3. Widescreen IMAX Hero Stage with 3D Floating Framed Poster
   ========================================================================== */
.hero-wrap {
  --hero-radius: 26px;
  position: relative;
  margin: 8px 0 16px;
  padding-bottom: 0;
  isolation: isolate;
  border-radius: var(--hero-radius);
}
.hero-wrap:not(:empty) {
  box-shadow: 0 26px 60px -14px rgba(18, 14, 10, 0.32), 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.hero,
.home-hero-skeleton {
  height: var(--hero-height);
}
.home-hero-skeleton {
  border-radius: var(--hero-radius);
  aspect-ratio: auto;
}

.hero {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: inherit;
  clip-path: inset(0 round var(--hero-radius));
  background: #0c0d12;
}

/* Atmospheric Dual-Depth Key Art Backdrop */
.hero .hero-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 60% 24%;
  filter: saturate(1.12) brightness(0.68) contrast(1.06);
  transform: scale(1.03);
  transition: transform 8s cubic-bezier(.2, .7, .3, 1);
}
.hero-slide.active .hero-backdrop {
  transform: scale(1.07);
}

/* Cinema Lighting Vignette */
.hero .hero-slide::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(circle at 82% 50%, rgba(196, 60, 39, 0.22), transparent 52%),
    linear-gradient(90deg, rgba(10, 11, 15, 0.96) 0%, rgba(10, 11, 15, 0.86) 34%, rgba(10, 11, 15, 0.28) 66%, rgba(10, 11, 15, 0.72) 100%),
    linear-gradient(0deg, rgba(10, 11, 15, 0.78) 0%, transparent 52%);
  pointer-events: none;
}

/* Floating 3D Framed Poster Showcase on Right (Zero Crop, Zero Hard Seam) */
.hero .hero-image,
.hero-slide.active .hero-image {
  position: absolute;
  z-index: 2;
  inset: 22px 48px 54px auto;
  width: auto;
  height: calc(100% - 76px);
  aspect-ratio: 2 / 3;
  object-fit: cover;
  object-position: center top;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  box-shadow: -16px 24px 48px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(0, 0, 0, 0.4);
  filter: none;
  transform: perspective(1000px) rotateY(-8deg) scale(0.96);
  transition: transform .65s cubic-bezier(.2, .8, .2, 1), box-shadow .65s ease;
}
.hero-slide.active .hero-image {
  transform: perspective(1000px) rotateY(-4deg) scale(1);
}

.hero .hero-copy {
  position: relative;
  z-index: 3;
  max-width: calc(100% - 300px);
  padding: 32px 44px 52px;
  justify-content: center;
}

.hero-topline {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  max-width: 100%;
}

.hero .tag {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 13px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffe8df;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  backdrop-filter: blur(12px);
}
.hero .tag::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ff6b52;
  box-shadow: 0 0 8px #ff6b52;
}

.hero-rating {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #fbe1a6 0%, #e5ad52 100%);
  color: #261704;
  font-size: 11.5px;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(229, 173, 82, 0.35);
}
.hero-rating::before {
  content: "★";
  font-size: 11px;
}

.hero h2 {
  max-width: 100%;
  margin: 14px 0 10px;
  font-family: var(--display);
  font-size: clamp(28px, 3.2vw, 42px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.18;
  color: #ffffff;
  text-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

.hero .hero-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  color: rgba(245, 240, 232, 0.88);
  font-size: 13px;
  font-weight: 500;
}
.hero .hero-meta span {
  padding: 2px 9px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 11.5px;
}
.hero .hero-meta span + span::before {
  display: none;
}

.hero p.hero-overview {
  display: -webkit-box;
  max-width: 540px;
  margin: 0 0 18px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: rgba(230, 224, 216, 0.82);
  font-size: 13px;
  line-height: 1.65;
}

.hero .primary {
  min-height: 46px;
  padding: 11px 24px;
  gap: 9px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff6b52 0%, #c83b24 100%);
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 700;
  box-shadow: 0 12px 28px -4px rgba(200, 59, 36, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}
.hero .primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
  box-shadow: 0 16px 34px -4px rgba(200, 59, 36, 0.7);
}
.hero .primary svg {
  width: 16px;
  height: 16px;
}

.hero-controls {
  right: 20px;
  bottom: 10px;
  z-index: 4;
  gap: 6px;
}
.hero-controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: rgba(15, 16, 20, 0.55);
  color: #fff;
  backdrop-filter: blur(14px);
  transition: background .2s, transform .2s, border-color .2s;
}
.hero-controls button:hover {
  background: rgba(255, 107, 82, 0.85);
  border-color: rgba(255, 255, 255, 0.4);
  transform: scale(1.06);
}

.hero-dots {
  left: 34px;
  bottom: 8px;
  z-index: 4;
  transform: none;
  height: 40px;
  gap: 0;
}
.hero-dots button,
.hero-dots button.active {
  width: 30px;
  min-width: 30px;
  height: 40px;
  padding: 0;
}
.hero-dots button::after {
  top: 18px;
  left: 12px;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.38);
}
.hero-dots button.active::after {
  left: 5px;
  width: 20px;
  background: #ff6b52;
  box-shadow: 0 0 10px rgba(255, 107, 82, 0.8);
}

/* ==========================================================================
   4. Continue Watching ("接着看") Glass Cinema Tickets
   ========================================================================== */
.home-resume {
  margin-top: 14px;
  padding: 14px 18px;
  border-radius: 22px;
  background: var(--surface-elevated);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.home-resume .section-head {
  align-items: center;
  min-height: 32px;
  margin-bottom: 12px;
  padding-bottom: 0;
  border: 0;
}
.home-resume .section-head h2 {
  font-family: var(--display);
  font-size: 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.home-resume .section-head h2::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-wash);
}
.home-resume .resume-row {
  gap: 14px;
  padding: 2px 2px 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.resume-card {
  flex: 0 0 286px;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 16px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: all .22s cubic-bezier(.2, .8, .2, 1);
}
.resume-thumb {
  position: relative;
  width: 46px;
  height: 66px;
  flex: none;
  border-radius: 9px;
  overflow: hidden;
  background: radial-gradient(circle at 75% 20%, var(--accent-wash), var(--surface2));
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
}
.resume-thumb::before {
  content: attr(data-initial);
  font-family: var(--display);
  font-size: 16px;
  font-weight: 800;
  color: var(--accent);
}
.resume-thumb img {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  z-index: 1;
}
.resume-card strong {
  font-size: 14px;
  font-weight: 700;
}
.resume-card small {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.4;
}
.resume-progress {
  height: 4px;
  margin-top: 8px;
  border-radius: 999px;
  background: var(--surface2);
}
.resume-progress i {
  background: linear-gradient(90deg, var(--accent), #f39c6b);
  border-radius: 999px;
}
.resume-card > svg {
  width: 34px;
  height: 34px;
  padding: 8px;
  border-radius: 50%;
  background: var(--accent-wash);
  color: var(--accent);
  transition: background .2s, color .2s, transform .2s;
}
@media (hover: hover) {
  .resume-card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: var(--shadow);
  }
  .resume-card:hover > svg {
    background: var(--accent);
    color: var(--on-accent);
    transform: scale(1.08);
  }
}

/* ==========================================================================
   5. Editorial Shelves & Gallery Poster Cards
   ========================================================================== */
.section {
  margin-top: var(--space-section);
}

.section-head {
  align-items: flex-end;
  margin-bottom: 16px;
  min-height: 42px;
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 10px;
}
.section-head > div:first-child {
  min-width: 0;
}
.section-kicker {
  display: inline-block;
  margin-bottom: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-wash);
  color: var(--accent);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.16em;
  line-height: 1.5;
  text-transform: uppercase;
}
.section-head h2 {
  font-family: var(--display);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.section-head small {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.shelf-controls {
  display: flex;
  gap: 8px;
  margin-left: auto;
  flex: none;
}
.shelf-controls[hidden] {
  display: none;
}
.section-head .shelf-controls button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: all .2s ease;
}
.shelf-controls button svg {
  width: 18px;
  height: 18px;
}
.section-head .shelf-controls button:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  transform: translateY(-1px);
}
.section-head .shelf-controls button:disabled {
  opacity: 0.35;
  cursor: default;
}

.grid {
  gap: 30px 20px;
}

.film-shelf {
  position: relative;
}
.film-shelf .grid {
  grid-auto-columns: calc((100% - 100px) / 6);
  gap: 20px;
  padding: 4px 2px 16px;
  scroll-padding-inline: 4px;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}

.card {
  position: relative;
  min-width: 0;
  border-radius: 16px;
  text-align: left;
  scroll-margin-top: calc(var(--header-height) + 20px);
  scroll-margin-bottom: 96px;
  transform: translateY(0);
  transition: transform .28s cubic-bezier(.2, .8, .2, 1);
}

.card .poster {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  background: var(--surface2);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transition: transform .28s cubic-bezier(.2, .8, .2, 1), box-shadow .28s ease, border-color .28s ease;
}

/* Hover Play Glass Badge */
.card .poster::after {
  content: "▶";
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: -24px 0 0 -24px;
  padding-left: 3px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  background: rgba(196, 60, 39, 0.88);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: 16px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: scale(0.78);
  transition: opacity .22s ease, transform .25s cubic-bezier(.2, .8, .2, 1);
  pointer-events: none;
}

/* Criterion-Style Editorial Poster Fallback */
img[data-poster].broken,
img[data-poster][data-poster-state="error"],
.card .poster img[data-poster-state="error"] {
  display: none !important;
}
.card .poster img[data-poster-state="loading"] {
  opacity: 0;
}
.card .poster img[data-poster-state="ready"] {
  position: relative;
  z-index: 1;
  opacity: 1;
  transition: transform .5s cubic-bezier(.2, .8, .2, 1), opacity .3s ease;
}

.poster-fallback {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 22px 16px 38px;
  text-align: center;
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--ink);
  background:
    radial-gradient(circle at 80% 18%, var(--accent-wash), transparent 62%),
    linear-gradient(160deg, var(--surface) 0%, var(--surface2) 100%);
}
.poster-fallback::before {
  content: "YINGSOU ARCHIVE";
  font-family: var(--ui-font);
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.22em;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-wash);
  color: var(--accent);
}

/* Frosted Glass Gold Rating Badge */
.rating {
  z-index: 2;
  top: 9px;
  right: 9px;
  padding: 4px 8px;
  border: 1px solid rgba(255, 218, 150, 0.32);
  border-radius: 999px;
  background: rgba(15, 16, 20, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 11px;
  font-weight: 800;
  color: #ffd899;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
.rating:not(.unrated)::before {
  content: "★ ";
  font-size: 9.5px;
  color: #f7c365;
}
.rating.unrated {
  padding: 3px 8px;
  font-size: 9.5px;
  font-weight: 600;
  color: rgba(245, 240, 234, 0.88);
  border-color: rgba(255, 255, 255, 0.14);
}

.poster-caption {
  z-index: 2;
  padding: 36px 11px 10px;
  background: linear-gradient(transparent, rgba(10, 11, 14, 0.88));
  font-size: 11px;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: 0.01em;
}
.card .poster-caption::after {
  content: none;
}

.card h3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: normal;
  overflow: hidden;
  overflow-wrap: anywhere;
  min-height: 2.7em;
  margin: 10px 2px 3px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  transition: color .2s ease;
}

.card p {
  margin-left: 2px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}

.card:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
  border-radius: 16px;
}

@media (hover: hover) {
  .card:hover {
    transform: translateY(-7px);
  }
  .card:hover .poster {
    border-color: var(--accent);
    box-shadow: var(--shadow-hover);
  }
  .card:hover .poster::after {
    opacity: 1;
    transform: scale(1);
  }
  .card:hover .poster img {
    transform: scale(1.055);
  }
  .card:hover h3 {
    color: var(--accent);
  }
}

.browse-sort {
  gap: 8px;
  margin: 14px 0 26px;
}
.browse-sort button {
  border-radius: 999px;
  padding: 8px 18px;
  font-weight: 600;
  background: var(--surface);
}
.browse-sort button.active {
  background: var(--accent-wash);
  border-color: var(--accent);
  color: var(--accent);
}

.home-update-status {
  margin-top: 48px;
  padding-top: 18px;
  border-top: 1px solid var(--line-strong);
  font-size: 12px;
  color: var(--muted);
}
.home-update-status summary {
  width: max-content;
  min-height: 40px;
  padding: 8px 0;
  color: var(--muted);
}

/* ==========================================================================
   6. Spotlight Search Command Center & Tactile Pill Filters
   ========================================================================== */
.search-shell {
  width: 100%;
  margin: 10px 0 24px;
  max-width: none;
}

.search-box {
  width: 100%;
  height: 62px;
  min-height: 62px;
  padding: 8px 10px 8px 22px;
  gap: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.search-box > svg {
  width: 21px;
  height: 21px;
  color: var(--accent);
}
.search-box input {
  min-width: 0;
  font-size: 16px;
  font-weight: 500;
  caret-color: var(--accent);
}
.search-box input::placeholder {
  font-size: 15px;
  color: var(--muted);
  opacity: 0.85;
}
.search-box input:focus-visible {
  outline: none;
  box-shadow: none;
}
.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-wash), var(--shadow);
}
.search-box input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.search-clear {
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  width: 40px;
  min-width: 40px;
  height: 44px;
  min-height: 44px;
  border-radius: 50%;
  color: var(--muted);
}
.search-clear[hidden] {
  display: none;
}
.search-clear:hover {
  color: var(--ink);
  background: var(--surface2);
}
.search-clear svg {
  width: 17px;
  height: 17px;
}

#submitSearch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 96px;
  min-height: 46px;
  padding: 0 24px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent-bright) 0%, var(--accent) 100%);
  color: var(--on-accent);
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(196, 60, 39, 0.28);
  white-space: nowrap;
}

.button-spinner {
  width: 13px;
  height: 13px;
  flex: none;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.search-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin: 6px 0 22px;
}
.search-toolbar .filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0;
}
.filters select,
.watch-actions select,
.episode-groups select {
  appearance: none;
  -webkit-appearance: none;
  min-height: 42px;
  padding: 8px 34px 8px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2368635b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: border-color .18s ease, box-shadow .18s ease;
}
:root[data-theme=dark] .filters select,
:root[data-theme=dark] .watch-actions select,
:root[data-theme=dark] .episode-groups select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2398968f' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
.filters select:hover,
.search-advanced summary:hover,
.watch-actions select:hover,
.watch-actions button:hover {
  border-color: var(--accent);
}

.search-toolbar #searchCount {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface2);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.search-toolbar .search-advanced {
  margin: 0;
}
.search-toolbar .search-advanced summary {
  padding: 9px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  min-height: 42px;
  font-weight: 600;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.search-toolbar .search-advanced[open] {
  order: 4;
  flex-basis: 100%;
}
.search-toolbar .search-advanced[open] > .filters {
  margin-top: 12px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.search-toolbar .search-refresh {
  margin: 0 0 0 auto;
  min-height: 42px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--accent-wash);
  font-size: 12px;
  font-weight: 600;
}

.suggestions {
  gap: 10px;
}
.suggestions button,
.search-chips.suggestions > button {
  padding: 8px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 550;
  box-shadow: var(--shadow-sm);
  transition: all .18s ease;
}
.suggestions button:hover,
.search-chips.suggestions > button:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-wash);
  transform: translateY(-2px);
}

.search-status {
  font-size: 12px;
}
.search-status .loading {
  justify-content: flex-start;
  padding: 8px 0 14px;
}

/* ==========================================================================
   7. Watch / Player Workspace & Bento Source Selector Cards
   ========================================================================== */
.watch-heading h1,
.watch-title h1 {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.025em;
}

.watch-mode .stage {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 22px;
  box-shadow: 0 28px 72px -12px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.watch-actions button,
.watch-actions select {
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.selector-card,
.film-details {
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.selector-heading h2,
.episode-heading h2 {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 750;
}

.source-switch-tip {
  font-size: 12px;
  line-height: 18px;
  margin: 6px 0 10px;
  color: var(--muted, #777);
}

.source-panel .source-row,
.watch-sheet .source-row {
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(32, 24, 18, 0.03);
  transition: transform .18s ease, border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}
@media (hover: hover) {
  .source-panel .source-row:hover:not(:disabled),
  .watch-sheet .source-row:hover:not(:disabled),
  .episodes button:hover:not(:disabled) {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(32, 24, 18, 0.08);
  }
}
.source-panel .source-row.active,
.watch-sheet .source-row.active {
  background: linear-gradient(145deg, var(--accent-wash), var(--surface));
  border-color: var(--accent);
  box-shadow: 0 8px 22px rgba(196, 60, 39, 0.14);
}
.source-row .source-indicator span:not(.source-spinner) {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface2);
  font-weight: 600;
}
.source-row[data-status="ok"] .source-indicator span:not(.source-spinner) {
  background: rgba(45, 122, 86, 0.14);
  color: var(--probe-good);
}

.episodes button {
  border-radius: 10px;
  font-weight: 600;
  transition: all .18s ease;
}
.episodes button.active {
  background: linear-gradient(135deg, var(--accent-bright) 0%, var(--accent) 100%);
  color: var(--on-accent);
  box-shadow: 0 6px 14px rgba(196, 60, 39, 0.28);
}

/* ==========================================================================
   8. Bento Studio Account Dashboard & Library Cards
   ========================================================================== */
.empty,
.auth-invite {
  max-width: 680px;
  margin: 44px auto;
  padding: 48px 32px;
  border: 1px solid var(--line-strong);
  border-radius: 26px;
  background:
    radial-gradient(circle at 50% 0%, var(--accent-wash), transparent 65%),
    var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}
.empty svg {
  width: 44px;
  height: 44px;
  color: var(--accent);
  opacity: 0.85;
}
.empty h2,
.auth-invite h2 {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.025em;
}
.empty p,
.auth-invite p {
  max-width: 460px;
  margin: 10px auto 24px;
  font-size: 13.5px;
  line-height: 1.85;
}
.auth-invite-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  border-radius: 18px;
  background: var(--accent-wash);
  color: var(--accent);
  font-size: 24px;
}
.auth-benefits {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  margin: 0 0 26px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}
.auth-benefits span::before {
  content: "✓";
  margin-right: 6px;
  color: var(--accent);
}

.primary,
.secondary {
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.primary {
  background: linear-gradient(135deg, var(--accent-bright) 0%, var(--accent) 100%);
  color: var(--on-accent);
  box-shadow: 0 8px 20px rgba(196, 60, 39, 0.22);
}
.primary:hover {
  filter: brightness(1.06);
  box-shadow: 0 12px 26px rgba(196, 60, 39, 0.32);
}
.secondary {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.text-button {
  color: var(--accent);
  font-weight: 600;
}

.account-wrap {
  max-width: 480px;
  margin: 32px auto;
}
.account-wrap > .panel {
  position: relative;
  overflow: hidden;
  padding: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 26px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.account-wrap > .panel::before {
  content: "YINGSOU CINEMA";
  display: inline-block;
  margin-bottom: 22px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-wash);
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.2em;
}
.account-wrap > .panel::after {
  content: "";
  position: absolute;
  right: -85px;
  top: -95px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-wash), transparent 70%);
  pointer-events: none;
}
.panel h1 {
  font-family: var(--display);
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.035em;
}
.form-field input {
  min-height: 48px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  font-size: 14px;
}
.form-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}

.account-dashboard .panel,
.profile-usage > a,
.account-entry {
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.profile-card {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(480px 240px at 96% -18%, var(--accent-wash), transparent 70%),
    var(--surface) !important;
}
.account-dashboard .account-sidebar {
  top: calc(var(--header-height) + env(safe-area-inset-top, 0px) + 20px);
  border-radius: 20px;
}
.account-page-heading h1,
.account-identity h2 {
  font-family: var(--display);
  font-weight: 800;
}
.profile-usage > a {
  position: relative;
  overflow: hidden;
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}
.profile-usage strong {
  font-family: var(--display);
  font-size: 34px;
  font-weight: 800;
  color: var(--accent);
}
@media (hover: hover) {
  .profile-usage > a:hover,
  .account-entry:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: var(--shadow);
  }
}

.history-row {
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}

.auth-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 20px 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--accent-wash);
  color: var(--accent);
  font-size: 13px;
  line-height: 1.6;
}
.auth-context strong {
  font-weight: 600;
  overflow-wrap: anywhere;
}
.auth-context a {
  display: inline-flex;
  align-items: center;
  flex: none;
  min-height: 44px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

dialog {
  overscroll-behavior: contain;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 32px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
}
dialog.watch-sheet,
.audio-dialog,
.account-confirm {
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  box-shadow: 0 32px 96px rgba(0, 0, 0, 0.38);
}
dialog::backdrop {
  background: rgba(10, 11, 14, 0.62);
  backdrop-filter: blur(8px);
}
.dialog-top {
  gap: 16px;
  align-items: flex-start;
}
.dialog-top .icon-button {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  flex: none;
}
.sheet-scroll {
  overscroll-behavior: contain;
}

.noscript {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-content: center;
  padding: 30px;
  background: var(--bg);
  color: var(--ink);
  text-align: center;
}
.noscript strong {
  font-size: 24px;
}
.noscript p {
  max-width: 480px;
  color: var(--muted);
}

#toast {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 11px 22px;
  font-weight: 600;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
}

/* ==========================================================================
   9. Responsive Breakpoints (Wide Desktop, Tablet, Mobile)
   ========================================================================== */
@media (min-width: 1500px) {
  :root {
    --content-width: 1360px;
  }
}

@media (max-width: 1100px) {
  :root {
    --page-gutter: 28px;
    --hero-height: 310px;
  }
  .hero .hero-copy {
    max-width: calc(100% - 220px);
    padding-left: 30px;
  }
  .hero .hero-image,
  .hero-slide.active .hero-image {
    inset: 20px 28px 50px auto;
    height: calc(100% - 70px);
  }
  .hero h2 {
    font-size: 32px;
  }
  .hero p.hero-overview {
    -webkit-line-clamp: 1;
  }
  .film-shelf .grid {
    grid-auto-columns: calc((100% - 48px) / 4);
    column-gap: 16px;
  }
  .grid {
    gap: 26px 16px;
  }
}

@media (max-width: 900px) {
  .account-dashboard .account-sidebar {
    display: block;
    position: static;
    padding: 10px 12px;
    border-radius: 16px;
  }
  .account-dashboard .account-sidebar-user,
  .account-dashboard .account-nav-group {
    display: none;
  }
  .account-dashboard .account-sidebar nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    white-space: nowrap;
  }
  .account-dashboard .account-sidebar nav a {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 12px;
  }
}

@media (max-width: 760px) {
  :root {
    --page-gutter: 18px;
    --header-height: 64px;
    --hero-height: 236px;
    --space-section: 32px;
  }
  body {
    background-attachment: scroll;
  }
  .header {
    padding-left: 18px;
    padding-right: 18px;
  }
  .brand {
    font-size: 21px;
    gap: 9px;
    line-height: 1.15;
  }
  .brand-mark {
    width: 32px;
    height: 32px;
    flex: none;
  }
  .brand small {
    font-size: 8.5px;
    line-height: 1.4;
    letter-spacing: 0.06em;
    margin-top: 3px;
  }
  .header nav {
    display: none;
  }
  #theme {
    width: 40px;
    height: 40px;
  }
  #theme svg {
    width: 20px;
    height: 20px;
  }
  main {
    padding-top: 16px;
    padding-bottom: calc(var(--bottom-nav-height) + var(--app-safe-bottom) + 28px);
  }
  .page-top {
    margin-bottom: 14px;
  }
  .page-top h1 {
    font-size: 27px;
  }
  .page-top p {
    margin-top: 6px;
    font-size: 12px;
  }
  .eyebrow {
    margin-bottom: 6px;
    font-size: 9px;
    padding: 2px 8px;
  }
  .discovery-search {
    height: 50px;
    margin-bottom: 12px;
    padding: 0 7px 0 15px;
    font-size: 13px;
  }
  .discovery-search span:last-child {
    padding: 6px 12px;
    font-size: 11px;
  }
  #categories {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
    padding: 2px 1px 8px;
    overflow: visible;
  }
  #categories button {
    width: 100%;
    min-width: 0;
    min-height: 38px;
    padding: 7px 2px;
    font-size: 12px;
  }

  /* Mobile Hero Stage */
  .hero-wrap {
    --hero-radius: 20px;
    margin: 10px 0 18px;
  }
  .home-hero-skeleton {
    border-radius: 20px;
  }
  .hero .hero-image,
  .hero-slide.active .hero-image {
    inset: 14px 14px 48px auto;
    height: calc(100% - 62px);
    border-radius: 11px;
    transform: none;
  }
  .hero .hero-copy {
    max-width: calc(100% - 140px);
    padding: 14px 8px 46px 16px;
  }
  .hero-topline {
    gap: 6px;
  }
  .hero .tag,
  .hero-rating {
    padding: 3px 8px;
    font-size: 9.5px;
  }
  .hero h2 {
    margin: 7px 0 6px;
    font-size: 19.5px;
    line-height: 1.24;
  }
  .hero .hero-meta {
    margin-bottom: 10px;
    font-size: 10px;
    flex-wrap: nowrap;
    white-space: nowrap;
    overflow: hidden;
  }
  .hero .hero-meta span {
    padding: 1px 6px;
    font-size: 10px;
  }
  .hero p.hero-overview {
    display: none;
  }
  .hero .primary {
    min-height: 38px;
    padding: 8px 15px;
    font-size: 11.5px;
  }
  .hero .primary svg {
    width: 14px;
    height: 14px;
  }
  .hero-controls {
    right: 10px;
    bottom: 6px;
    gap: 4px;
  }
  .hero-controls button {
    width: 36px;
    height: 36px;
  }
  .hero-controls svg {
    width: 14px;
    height: 14px;
  }
  .hero-dots {
    left: 10px;
    bottom: 6px;
    height: 36px;
  }
  .hero-dots button,
  .hero-dots button.active {
    width: 26px;
    min-width: 26px;
    height: 36px;
  }
  .hero-dots button::after {
    top: 16px;
    left: 10px;
  }
  .hero-dots button.active::after {
    left: 4px;
  }

  .home-resume {
    padding: 14px;
    border-radius: 18px;
  }
  .home-resume .section-head h2 {
    font-size: 18px;
  }
  .home-resume .resume-card {
    flex-basis: min(240px, 84%);
    padding: 9px 11px;
  }
  .home-resume .resume-thumb {
    width: 38px;
    height: 54px;
  }

  .section-head {
    margin-bottom: 14px;
    padding-bottom: 10px;
  }
  .section-head h2 {
    font-size: 21px;
  }
  .section-kicker {
    font-size: 8.5px;
    margin-bottom: 4px;
  }
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px 11px;
  }
  .film-shelf .grid {
    grid-auto-columns: calc((100% - 22px) / 3);
    gap: 11px;
  }
  .card .poster {
    border-radius: 12px;
  }
  .card .poster::after {
    display: none;
  }
  .card h3 {
    margin: 8px 1px 3px;
    font-size: 13px;
    line-height: 1.4;
  }
  .card p {
    font-size: 10.5px;
  }
  .poster-caption {
    padding: 26px 7px 6px;
    font-size: 9.5px;
  }
  .rating {
    top: 6px;
    right: 6px;
    padding: 2px 6px;
    font-size: 10px;
  }
  .rating.unrated {
    font-size: 8.5px;
    padding: 2px 5px;
  }

  /* Mobile Search */
  body[data-route=search] .search-shell {
    margin: 6px 0 16px;
  }
  body[data-route=search] .search-box {
    height: 54px;
    min-height: 54px;
    padding: 0 8px 0 15px;
    gap: 8px;
  }
  body[data-route=search] .search-box input {
    font-size: 16px;
  }
  body[data-route=search] #submitSearch {
    min-width: 60px;
    min-height: 40px;
    padding: 0 14px;
    font-size: 12px;
  }
  .search-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 6px;
    margin-bottom: 12px;
  }
  .search-toolbar > .filters {
    display: contents;
  }
  .search-toolbar > .filters select {
    width: 100%;
    max-width: none;
    min-width: 0;
    min-height: 40px;
    padding: 6px 26px 6px 11px;
    font-size: 12px;
  }
  .search-toolbar #typeFilter,
  .search-toolbar #panFilter {
    grid-column: 1;
    grid-row: 1;
  }
  .search-toolbar #sortFilter {
    grid-column: 2;
    grid-row: 1;
  }
  .search-toolbar #searchCount {
    grid-column: 1 / 3;
    grid-row: 3;
    justify-self: start;
  }
  .search-toolbar .search-advanced {
    grid-column: 3;
    grid-row: 1;
  }
  .search-toolbar .search-advanced summary {
    min-height: 40px;
    padding: 6px 11px;
    font-size: 12px;
  }
  .search-toolbar .search-refresh {
    grid-column: 3;
    grid-row: 3;
    min-height: 36px;
    font-size: 12px;
  }
  .search-toolbar .search-advanced[open] {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .form-field input,
  .episode-find input,
  .watch-sheet input[type=search],
  .watch-sheet select,
  .search-advanced select,
  .admin-search input {
    font-size: 16px;
  }

  /* Mobile Glass Bottom Navigation */
  .bottom-nav {
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    height: calc(var(--bottom-nav-height) + var(--app-safe-bottom));
    min-height: 0;
    gap: 0;
    padding: 4px max(10px, env(safe-area-inset-right, 0px)) calc(4px + var(--app-safe-bottom)) max(10px, env(safe-area-inset-left, 0px));
    border-top: 1px solid var(--line-strong);
    background: var(--header-bg);
    backdrop-filter: blur(24px) saturate(1.6);
    -webkit-backdrop-filter: blur(24px) saturate(1.6);
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.06);
  }
  .bottom-nav a {
    position: relative;
    display: grid;
    grid-template-rows: 22px 14px;
    align-content: start;
    justify-items: center;
    gap: 3px;
    width: auto;
    min-width: 0;
    height: 56px;
    min-height: 56px;
    padding: 6px 2px 10px;
    font-size: 11px;
    line-height: 14px;
    border-radius: 12px;
  }
  .bottom-nav svg {
    width: 21px;
    height: 21px;
    align-self: center;
  }
  .bottom-nav a.active {
    font-weight: 700;
    color: var(--accent);
  }
  .bottom-nav a.active::after {
    content: "";
    position: absolute;
    top: auto;
    bottom: 3px;
    left: 50%;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    box-shadow: 0 0 6px var(--accent);
  }

  .watch-mode .stage {
    border-radius: 0;
    scroll-margin-top: calc(var(--header-height) + var(--app-safe-top) + 12px);
  }
  .watch-mode main {
    padding-bottom: calc(112px + var(--app-safe-bottom));
  }
  .watch-dock {
    padding: 6px max(16px, env(safe-area-inset-right, 0px)) calc(8px + var(--app-safe-bottom)) max(16px, env(safe-area-inset-left, 0px));
    background: var(--header-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }
  .watch-dock .dock-context {
    line-height: 16px;
    margin-bottom: 5px;
  }
  .watch-dock .dock-actions button {
    min-height: 44px;
    border-radius: 999px;
  }
}

@media (max-width: 380px) {
  :root {
    --page-gutter: 15px;
  }
  .hero .hero-image,
  .hero-slide.active .hero-image {
    inset: 16px 14px 48px auto;
    height: calc(100% - 64px);
  }
  .hero .hero-copy {
    max-width: calc(100% - 104px);
    padding-left: 16px;
  }
  .hero h2 {
    font-size: 20px;
  }
  .grid {
    gap: 20px 9px;
  }
  .film-shelf .grid {
    grid-auto-columns: calc((100% - 18px) / 3);
    gap: 9px;
  }
}

@media (hover: none) {
  .card:hover,
  .card:hover .poster img {
    transform: none;
  }
  .card:active .poster {
    transform: scale(0.985);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .hero .hero-image,
  .hero-slide.active .hero-image,
  .card,
  .card .poster,
  .card .poster img,
  .discovery-search,
  .primary,
  .secondary,
  .button-spinner {
    transition: none;
    animation: none;
    transform: none;
  }
}
