:root {
  --font-sans: "Outfit", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: 8px;
  --radius-sm: 6px;
  --ease: 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
  --z-modal: 60;
  --z-episode: 65;
  --z-backdrop: 70;
  --z-floating: 90;
}

body[data-theme="dark"] {
  --bg: #111315;
  --bg-2: #181b1f;
  --surface: rgba(33, 37, 42, 0.72);
  --surface-strong: rgba(30, 34, 39, 0.96);
  --surface-muted: rgba(255, 255, 255, 0.06);
  --ink: #f5f7f8;
  --muted: #b6bec8;
  --soft: #87909b;
  --line: rgba(255, 255, 255, 0.11);
  --line-strong: rgba(255, 255, 255, 0.2);
  --accent: #4ea5ff;
  --accent-2: #7bd3ff;
  --accent-soft: rgba(78, 165, 255, 0.18);
  --danger: #ff7894;
  --danger-soft: rgba(255, 120, 148, 0.15);
  --shadow: 0 24px 70px rgba(3, 7, 18, 0.38);
  --shadow-tight: 0 12px 30px rgba(3, 7, 18, 0.22);
  --backdrop: rgba(5, 8, 12, 0.72);
  --button-text: #07111e;
}

body[data-theme="light"] {
  --bg: #f3f5f7;
  --bg-2: #ffffff;
  --surface: rgba(255, 255, 255, 0.74);
  --surface-strong: rgba(255, 255, 255, 0.96);
  --surface-muted: rgba(18, 26, 36, 0.05);
  --ink: #151a21;
  --muted: #586576;
  --soft: #8290a0;
  --line: rgba(20, 31, 46, 0.12);
  --line-strong: rgba(20, 31, 46, 0.22);
  --accent: #2563eb;
  --accent-2: #38bdf8;
  --accent-soft: rgba(37, 99, 235, 0.13);
  --danger: #c74d6a;
  --danger-soft: rgba(199, 77, 106, 0.12);
  --shadow: 0 22px 60px rgba(24, 36, 52, 0.14);
  --shadow-tight: 0 12px 28px rgba(24, 36, 52, 0.09);
  --backdrop: rgba(18, 27, 39, 0.38);
  --button-text: #ffffff;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  font-family: var(--font-sans);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--bg-2), transparent 8%) 0, var(--bg) 360px),
    var(--bg);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, color-mix(in srgb, var(--ink), transparent 88%) 0.8px, transparent 0.8px);
  background-size: 20px 20px;
  opacity: 0.12;
}

body.has-modal,
body.has-episode-dialog,
body.has-info-dialog {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
  transform: none !important;
}

img {
  display: block;
  max-width: 100%;
}

* {
  scrollbar-color: color-mix(in srgb, var(--soft), transparent 40%) transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: color-mix(in srgb, var(--soft), transparent 42%);
  background-clip: content-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--soft), transparent 24%);
  background-clip: content-box;
}

.hidden {
  display: none !important;
}

.skip-link,
.sr-only {
  position: absolute;
}

.skip-link {
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--ink);
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: translateY(0);
}

.sr-only {
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.theme-corner-button {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  z-index: var(--z-floating);
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--ink);
  box-shadow: var(--shadow-tight);
  backdrop-filter: blur(18px) saturate(1.1);
  transition: transform var(--ease), border-color var(--ease), background-color var(--ease);
}

.theme-corner-button i {
  font-size: 1.15rem;
}

body.has-modal .theme-corner-button,
body.has-episode-dialog .theme-corner-button,
body.has-info-dialog .theme-corner-button {
  opacity: 0;
  pointer-events: none;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(calc(100% - 40px), 1480px);
  margin: 0 auto;
  padding: 18px 0 72px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 220px minmax(280px, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 72px;
  margin: 0 calc(50% - 50vw);
  padding: 10px max(74px, calc(50vw - 740px)) 10px max(20px, calc(50vw - 740px));
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-2), transparent 10%);
  backdrop-filter: blur(22px) saturate(1.08);
}

.brand-lockup {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.logo-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid color-mix(in srgb, var(--accent), transparent 30%);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--button-text);
  box-shadow: 0 14px 28px color-mix(in srgb, var(--accent), transparent 78%);
}

.logo-mark i {
  font-size: 1.35rem;
}

.brand-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.brand-title {
  overflow: hidden;
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.searchbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 8px;
  min-height: 48px;
}

.search-input-wrap {
  position: relative;
  display: block;
  min-width: 0;
}

.search-field-icon {
  position: absolute;
  top: 50%;
  left: 16px;
  z-index: 1;
  color: var(--soft);
  transform: translateY(-50%);
  pointer-events: none;
}

.searchbar input,
.field input,
.field select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--ink);
  outline: none;
  transition: border-color var(--ease), box-shadow var(--ease), background-color var(--ease);
}

.searchbar input {
  height: 48px;
  padding: 0 16px 0 44px;
  font-size: 0.98rem;
  font-weight: 600;
}

.field input,
.field select {
  min-height: 46px;
  padding: 0 12px;
}

.searchbar input::placeholder,
.field input::placeholder {
  color: var(--soft);
  font-weight: 500;
}

.main-nav {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.nav-link {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.nav-link.is-active,
.nav-link:hover,
.nav-link:focus-visible {
  border-color: var(--line);
  background: var(--surface-muted);
  color: var(--ink);
}

.search-submit,
.primary-action,
.secondary-action,
.utility-button,
.icon-button,
.library-tab,
.text-action,
.favorite-button,
.library-save,
.genre-chip,
.rail-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  outline: none;
  transition: transform var(--ease), border-color var(--ease), box-shadow var(--ease), background-color var(--ease), color var(--ease);
}

.search-submit,
.primary-action {
  padding: 0 18px;
  border-color: transparent;
  background: var(--accent);
  color: var(--button-text);
  font-weight: 800;
  box-shadow: 0 14px 30px color-mix(in srgb, var(--accent), transparent 80%);
}

.search-submit.icon-only-action {
  width: 48px;
  padding: 0;
}

.utility-button,
.icon-button,
.secondary-action,
.library-tab,
.text-action,
.genre-chip,
.rail-arrow {
  padding: 0 13px;
  background: var(--surface-strong);
  font-weight: 800;
}

.icon-button,
.favorite-button,
.library-save,
.rail-arrow {
  width: 42px;
  min-width: 42px;
  padding: 0;
}

.text-action {
  color: var(--danger);
}

.action-icon {
  flex: 0 0 auto;
  font-size: 1.03rem;
}

.status-panel {
  display: flex;
  align-items: center;
  min-height: 44px;
  margin: 16px 0 18px;
}

.status-line,
.section-note,
.inline-status {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.content-shell,
.home-section,
.home-rail,
.results-section {
  display: grid;
  gap: 22px;
  min-width: 0;
}

.content-shell {
  grid-template-columns: 1fr;
  align-items: stretch;
}

.home-section {
  scroll-margin-top: 88px;
}

.featured-panel {
  min-height: 360px;
}

.featured-card {
  position: relative;
  min-height: 430px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  box-shadow: var(--shadow-tight);
  isolation: isolate;
}

.featured-backdrop {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.featured-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--bg), transparent 2%) 0%, color-mix(in srgb, var(--bg), transparent 12%) 34%, color-mix(in srgb, var(--bg), transparent 46%) 68%, color-mix(in srgb, var(--bg), transparent 18%) 100%),
    linear-gradient(180deg, transparent 0%, color-mix(in srgb, var(--bg), transparent 10%) 100%);
}

.featured-overlay {
  display: flex;
  align-items: flex-end;
  min-height: inherit;
  padding: 34px;
}

.featured-copy {
  display: grid;
  gap: 12px;
  max-width: 660px;
}

.featured-label,
.section-kicker,
.result-id {
  margin: 0;
  color: var(--soft);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.3;
  text-transform: uppercase;
}

.featured-copy h1 {
  margin: 0;
  color: var(--ink);
  font-size: 3.4rem;
  font-weight: 800;
  line-height: 0.98;
  text-wrap: balance;
}

.featured-meta,
.featured-description {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.featured-meta {
  font-weight: 700;
}

.featured-description {
  max-width: 62ch;
  font-size: 1.03rem;
}

.featured-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  min-width: 0;
}

.section-header.compact {
  display: grid;
  gap: 14px;
  align-items: start;
}

.browse-header {
  align-items: center;
}

.section-header h1,
.section-header h2,
.empty-state h3,
.library-empty h3,
.player-dialog-header h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.1;
  text-wrap: balance;
}

.home-rail h2 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.1;
}

.section-note {
  max-width: 34ch;
  text-align: right;
}

.recommendation-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.genre-chip {
  min-height: 36px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.genre-chip.is-active {
  border-color: transparent;
  background: var(--accent);
  color: var(--button-text);
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 26px 16px;
}

.media-rail {
  grid-template-columns: repeat(auto-fill, minmax(174px, 1fr));
}

.result-card {
  position: relative;
  min-width: 0;
}

.result-open {
  display: grid;
  gap: 10px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.poster-wrap {
  position: relative;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
  box-shadow: var(--shadow-tight);
  transform: translateZ(0);
}

.poster-wrap img,
.poster-fallback {
  width: 100%;
  height: 100%;
}

.poster-wrap img {
  object-fit: cover;
}

.poster-fallback {
  display: grid;
  place-items: center;
  padding: 14px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
  text-transform: uppercase;
}

.rating-badge,
.action-badge,
.favorite-button {
  position: absolute;
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.44);
  border-radius: var(--radius-sm);
  background: rgba(12, 15, 18, 0.74);
  color: #ffffff;
  backdrop-filter: blur(14px);
}

.rating-badge {
  top: 9px;
  right: 9px;
  display: inline-flex;
  gap: 4px;
  align-items: center;
  min-height: 30px;
  padding: 0 8px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
}

.rating-badge i {
  color: var(--accent-2);
}

.action-badge {
  right: 9px;
  bottom: 9px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  opacity: 0;
  transition: opacity var(--ease), transform var(--ease);
}

.favorite-button {
  top: 9px;
  left: 9px;
  width: 36px;
  height: 36px;
  min-height: 36px;
  opacity: 0;
}

.favorite-button.is-saved,
.result-card:hover .favorite-button,
.result-card:focus-within .favorite-button,
.result-card:hover .action-badge,
.result-card:focus-within .action-badge {
  opacity: 1;
}

.favorite-button.is-saved,
.library-save.is-saved {
  border-color: transparent;
  background: var(--danger-soft);
  color: var(--danger);
}

.result-card.is-active .poster-wrap {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-tight);
}

.result-meta {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.result-meta h3 {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.99rem;
  font-weight: 800;
  line-height: 1.22;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-subline,
.result-genres,
.result-people,
.result-description {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.result-genres {
  color: var(--soft);
  font-weight: 700;
}

.genre-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.genre-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-muted);
  color: color-mix(in srgb, var(--muted), var(--ink) 12%);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.result-meta .genre-pill-list {
  gap: 5px;
}

.result-meta .genre-pill {
  min-height: 22px;
  padding: 4px 7px;
  font-size: 0.7rem;
}

.featured-genres {
  margin-top: -2px;
}

.featured-genres .genre-pill {
  min-height: 28px;
  padding: 6px 10px;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(10, 15, 22, 0.52);
  color: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
}

.result-people {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.result-description {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.skeleton-card {
  pointer-events: none;
}

.skeleton-block,
.skeleton-line,
.skeleton-badge {
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface-strong), transparent 16%), transparent);
  background-size: 220% 100%;
  animation: shimmer 1.2s linear infinite;
}

.skeleton-line {
  height: 12px;
  border-radius: 999px;
}

.skeleton-line.short {
  width: 64%;
}

.empty-state {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr);
  gap: 14px 18px;
  align-items: center;
  min-height: 150px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-tight);
}

.empty-state::after {
  content: "\e4a9";
  grid-column: 1;
  grid-row: 1 / span 3;
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--button-text);
  font-family: "Phosphor-Bold";
  font-size: 1.8rem;
}

.empty-state > * {
  grid-column: 2;
}

.empty-state h3,
.empty-state p {
  margin: 0;
}

.empty-state p {
  color: var(--muted);
}

.library-panel {
  display: grid;
  gap: 16px;
  margin-top: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-tight);
  backdrop-filter: blur(20px) saturate(1.08);
}

.library-panel .section-header.compact {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.library-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.shelf-page {
  scroll-margin-top: 104px;
}

.shelf-count {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
  color: var(--muted);
  font-weight: 800;
}

.library-tabs {
  display: flex;
  gap: 8px;
}

.library-tab {
  color: var(--muted);
}

.library-tab.is-active {
  border-color: transparent;
  background: var(--accent);
  color: var(--button-text);
}

.count-pill {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: color-mix(in srgb, currentColor, transparent 84%);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.library-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  min-height: 0;
}

.library-empty {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 110px;
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.library-empty > i {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--accent);
}

.library-empty h3,
.library-empty p {
  margin: 0;
}

.library-empty h3 {
  font-size: 1rem;
}

.library-empty p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.library-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-strong), transparent 8%);
}

.library-open {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.library-thumb {
  width: 44px;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.library-thumb img,
.library-thumb .poster-fallback {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.library-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.library-copy h3,
.library-copy p {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-copy h3 {
  font-size: 0.94rem;
  font-weight: 800;
}

.library-copy p {
  color: var(--muted);
  font-size: 0.82rem;
}

.library-genres {
  gap: 5px;
}

.library-genres .genre-pill {
  min-height: 21px;
  padding: 3px 7px;
  font-size: 0.68rem;
}

.library-save {
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  background: var(--surface-strong);
  color: var(--muted);
}

.player-modal,
.episode-modal,
.info-modal {
  position: fixed;
  inset: 0;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--backdrop);
}

.episode-dialog-header,
.player-dialog-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
}

.player-dialog-header h2,
.episode-dialog-header h2 {
  font-size: 1.35rem;
}

.segmented-field,
.field,
.toggle {
  display: grid;
  gap: 8px;
  margin: 0;
}

.segmented-field {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  border: 0;
}

.segmented-field legend,
.field span {
  width: 100%;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.segment,
.toggle {
  position: relative;
}

.segment input,
.toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segment span,
.toggle span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-weight: 800;
}

.segment input:checked + span,
.toggle input:checked + span {
  border-color: transparent;
  background: var(--accent);
  color: var(--button-text);
}

.field-row,
.toggle-row,
.episode-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.episode-modal {
  z-index: var(--z-episode);
  display: grid;
  place-items: center;
  padding: 22px;
}

.info-modal {
  z-index: var(--z-episode);
  display: grid;
  place-items: center;
  padding: 22px;
}

.info-dialog {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(0, 1fr);
  width: min(1080px, 100%);
  max-height: min(820px, calc(100dvh - 44px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.info-art {
  position: relative;
  min-height: 100%;
  overflow: hidden;
  background: var(--surface-muted);
}

.info-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, transparent 0%, rgba(3, 7, 18, 0.22) 100%),
    linear-gradient(90deg, transparent 0%, color-mix(in srgb, var(--surface-strong), transparent 18%) 100%);
}

.info-art img,
.info-art-fallback {
  width: 100%;
  height: 100%;
  min-height: 560px;
  object-fit: cover;
}

.info-art-fallback {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-family: var(--font-mono);
  font-weight: 600;
  text-transform: uppercase;
}

.info-body {
  display: grid;
  gap: 16px;
  align-content: start;
  min-height: 0;
  padding: 20px;
  overflow-y: auto;
}

.info-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
}

.info-header h2 {
  margin: 0;
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1.02;
  text-wrap: balance;
}

.info-description {
  max-width: 70ch;
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.info-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.info-fact {
  display: grid;
  grid-template-columns: 24px minmax(0, 0.42fr) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 44px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.info-fact i {
  color: var(--accent);
}

.info-fact span {
  color: var(--soft);
  font-size: 0.8rem;
  font-weight: 800;
}

.info-fact strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.info-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.info-episodes-section {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.info-section-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
}

.info-section-header h3 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.1;
}

.info-episode-list {
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}

.episode-season-label {
  margin: 10px 0 2px;
  color: var(--soft);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
}

.episode-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 34px;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 64px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-muted), transparent 12%);
  color: inherit;
  text-align: left;
  transition: transform var(--ease), border-color var(--ease), background-color var(--ease);
}

.episode-row:hover,
.episode-row:focus-visible {
  border-color: var(--line-strong);
  background: var(--surface-muted);
}

.episode-index {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
}

.episode-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.episode-copy strong,
.episode-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.episode-copy strong {
  font-size: 0.92rem;
  font-weight: 800;
}

.episode-copy span {
  color: var(--muted);
  font-size: 0.82rem;
}

.episode-row > i {
  color: var(--accent);
}

.episode-empty {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
}

.episode-empty p {
  margin: 0;
}

.episode-dialog {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 16px;
  width: min(560px, 100%);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.episode-selection-card {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.episode-poster {
  width: 82px;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
}

.episode-poster img,
.episode-poster .poster-fallback {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.episode-selection-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.episode-selection-copy h3,
.episode-selection-copy p {
  margin: 0;
}

.episode-selection-copy h3 {
  overflow: hidden;
  font-size: 1.08rem;
  font-weight: 800;
  line-height: 1.22;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.episode-selection-copy p:last-child {
  color: var(--muted);
}

.episode-form {
  display: grid;
  gap: 14px;
}

.player-modal {
  z-index: var(--z-modal);
  display: grid;
  place-items: center;
  padding: 22px;
}

.player-dialog {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 16px;
  width: min(1180px, 100%);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.player-dialog-header {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: stretch;
}

.dialog-title-block {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 0 2px;
}

.dialog-title-block h2,
.dialog-title-block p {
  min-width: 0;
}

.player-modal.is-expanded {
  padding: 8px;
}

.player-modal.is-expanded .player-dialog {
  width: 100%;
  height: 100%;
  max-width: none;
  grid-template-rows: auto minmax(0, 1fr);
}

.player-modal.is-expanded .player-frame-wrap {
  height: 100%;
  min-height: 0;
  aspect-ratio: auto;
}

.player-dialog:fullscreen,
.player-dialog:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  padding: 16px;
  border: 0;
  border-radius: 0;
  background: #080a0d;
  color: #ffffff;
  grid-template-rows: auto minmax(0, 1fr);
}

.player-dialog:fullscreen .player-dialog-header h2,
.player-dialog:fullscreen .inline-status,
.player-dialog:fullscreen .section-kicker,
.player-dialog:-webkit-full-screen .player-dialog-header h2,
.player-dialog:-webkit-full-screen .inline-status,
.player-dialog:-webkit-full-screen .section-kicker {
  color: rgba(255, 255, 255, 0.86);
}

.player-dialog:fullscreen .player-frame-wrap,
.player-dialog:-webkit-full-screen .player-frame-wrap {
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: var(--radius-sm);
  aspect-ratio: auto;
}

.player-frame-wrap:fullscreen,
.player-frame-wrap:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  border: 0;
  border-radius: 0;
  background: #05070a;
  aspect-ratio: auto;
}

.player-frame-wrap:fullscreen .player-placeholder,
.player-frame-wrap:-webkit-full-screen .player-placeholder {
  display: none;
}

#player-frame:fullscreen,
#player-frame:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  border: 0;
  background: #05070a;
  opacity: 1;
}

.player-frame-wrap:fullscreen #player-frame,
.player-frame-wrap:-webkit-full-screen #player-frame {
  width: 100%;
  height: 100%;
  opacity: 1;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-muted), transparent 8%);
}

.dialog-actions .icon-button {
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
}

.seek-status {
  flex: 1 1 260px;
  max-width: none;
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.player-frame-wrap {
  position: relative;
  overflow: hidden;
  min-height: min(70dvh, 620px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #02070f;
  aspect-ratio: 16 / 9;
}

.player-placeholder,
#player-frame {
  position: absolute;
  inset: 0;
}

.player-placeholder {
  display: grid;
  place-items: center;
  padding: 24px;
  color: rgba(255, 255, 255, 0.76);
  text-align: center;
}

#player-frame {
  width: 100%;
  height: 100%;
  border: 0;
  opacity: 0;
  transition: opacity var(--ease);
}

#player-frame.is-visible {
  opacity: 1;
}

.theme-corner-button:hover,
.theme-corner-button:focus-visible,
.search-submit:hover,
.search-submit:focus-visible,
.primary-action:hover,
.primary-action:focus-visible,
.secondary-action:hover,
.secondary-action:focus-visible,
.utility-button:hover,
.utility-button:focus-visible,
.icon-button:hover,
.icon-button:focus-visible,
.library-tab:hover,
.library-tab:focus-visible,
.text-action:hover,
.text-action:focus-visible,
.favorite-button:hover,
.favorite-button:focus-visible,
.library-save:hover,
.library-save:focus-visible,
.genre-chip:hover,
.genre-chip:focus-visible,
.rail-arrow:hover,
.rail-arrow:focus-visible,
.result-open:hover,
.result-open:focus-visible,
.library-open:hover,
.library-open:focus-visible {
  transform: translateY(-1px);
}

.search-submit:active,
.primary-action:active,
.secondary-action:active,
.utility-button:active,
.icon-button:active,
.library-tab:active,
.text-action:active,
.favorite-button:active,
.library-save:active,
.genre-chip:active,
.rail-arrow:active,
.result-open:active,
.library-open:active {
  transform: translateY(0);
}

.result-open:hover .poster-wrap,
.result-open:focus-visible .poster-wrap {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-tight);
}

.result-open:focus-visible,
.library-open:focus-visible,
.searchbar input:focus,
.field input:focus,
.field select:focus,
.search-submit:focus-visible,
.primary-action:focus-visible,
.secondary-action:focus-visible,
.utility-button:focus-visible,
.icon-button:focus-visible,
.library-tab:focus-visible,
.text-action:focus-visible,
.favorite-button:focus-visible,
.library-save:focus-visible,
.genre-chip:focus-visible,
.rail-arrow:focus-visible,
.theme-corner-button:focus-visible,
.segment input:focus-visible + span,
.toggle input:focus-visible + span {
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.searchbar input:focus,
.field input:focus,
.field select:focus {
  border-color: var(--accent);
}

@keyframes shimmer {
  0% {
    background-position: 100% 0;
  }

  100% {
    background-position: -100% 0;
  }
}

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: 1fr;
    align-items: stretch;
    padding-right: 74px;
  }

  .main-nav {
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .browse-header,
  .library-panel .section-header.compact {
    display: grid;
    align-items: start;
  }

  .recommendation-chips,
  .library-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .theme-corner-button {
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    width: 42px;
    height: 42px;
  }

  .app-shell {
    width: min(calc(100% - 24px), 1480px);
    padding-top: 8px;
  }

  .topbar {
    gap: 12px;
    min-height: 0;
    padding: 12px 60px 12px 12px;
  }

  .brand-lockup {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .logo-mark {
    width: 42px;
    height: 42px;
  }

  .searchbar {
    grid-template-columns: minmax(0, 1fr) 48px;
    min-height: 0;
  }

  .nav-link span {
    font-size: 0.88rem;
  }

  .status-panel {
    margin: 12px 0 18px;
  }

  .featured-panel {
    min-height: 0;
  }

  .featured-card {
    min-height: 520px;
  }

  .featured-card::after {
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--bg), transparent 44%) 0%, color-mix(in srgb, var(--bg), transparent 6%) 58%, var(--bg) 100%);
  }

  .featured-overlay {
    padding: 22px;
  }

  .featured-copy h1 {
    font-size: 2.2rem;
  }

  .section-header {
    display: grid;
    align-items: start;
  }

  .section-header h1 {
    font-size: 1.48rem;
  }

  .section-note {
    max-width: none;
    text-align: left;
  }

  .results-grid,
  .media-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 12px;
  }

  .result-meta h3 {
    white-space: normal;
  }

  .result-description {
    display: none;
  }

  .library-panel {
    padding: 16px;
  }

  .library-list {
    grid-template-columns: 1fr;
  }

  .library-tabs {
    width: 100%;
  }

  .library-tab {
    flex: 1 1 0;
    min-width: 0;
  }

  .field-row,
  .toggle-row,
  .episode-actions,
  .episode-dialog-header,
  .player-dialog-header {
    grid-template-columns: 1fr;
  }

  .episode-modal,
  .info-modal,
  .player-modal {
    padding: 10px;
  }

  .episode-dialog,
  .info-dialog,
  .player-dialog {
    padding: 14px;
  }

  .info-dialog {
    grid-template-columns: 1fr;
    max-height: calc(100dvh - 20px);
    padding: 0;
  }

  .info-art {
    min-height: 220px;
    max-height: 260px;
  }

  .info-art img,
  .info-art-fallback {
    min-height: 220px;
  }

  .info-body {
    padding: 16px;
  }

  .info-header h2 {
    font-size: 1.6rem;
  }

  .info-facts {
    grid-template-columns: 1fr;
  }

  .info-section-header {
    display: grid;
    align-items: start;
  }

  .info-episode-list {
    max-height: 300px;
  }

  .episode-row {
    grid-template-columns: 50px minmax(0, 1fr) 28px;
  }

  .episode-dialog-header .icon-button {
    width: 100%;
  }

  .episode-selection-card {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .episode-poster {
    width: 64px;
  }

  .dialog-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: stretch;
  }

  .dialog-actions .seek-status {
    grid-column: 1 / -1;
    text-align: left;
  }

  .dialog-actions .icon-button,
  .dialog-actions .utility-button {
    width: 100%;
    min-width: 0;
    padding: 0 10px;
  }

  .dialog-actions .utility-button span:not(.sr-only) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .player-frame-wrap {
    min-height: min(58dvh, 420px);
  }
}

@media (max-width: 430px) {
  .brand-title {
    font-size: 1rem;
  }

  .brand-copy,
  .status-line,
  .section-note,
  .inline-status,
  .result-subline,
  .result-genres,
  .search-submit span,
  .utility-button span,
  .primary-action span,
  .secondary-action span,
  .library-tab span,
  .text-action span {
    font-size: 0.86rem;
  }

  .featured-copy h1 {
    font-size: 1.9rem;
  }

  .featured-description {
    font-size: 0.96rem;
  }
}

/* design-taste-frontend revamp */
body[data-theme="dark"] {
  --bg: #0f1318;
  --bg-2: #151a21;
  --surface: rgba(22, 28, 36, 0.72);
  --surface-strong: rgba(24, 30, 38, 0.96);
  --surface-muted: rgba(255, 255, 255, 0.055);
  --ink: #f7f9fc;
  --muted: #b7c0cc;
  --soft: #8692a2;
  --line: rgba(255, 255, 255, 0.105);
  --line-strong: rgba(255, 255, 255, 0.2);
  --accent: #4d9fff;
  --accent-2: #4d9fff;
  --accent-soft: rgba(77, 159, 255, 0.17);
  --danger: #ef7f9d;
  --danger-soft: rgba(239, 127, 157, 0.14);
  --shadow: 0 34px 90px rgba(3, 7, 18, 0.42);
  --shadow-tight: 0 18px 46px rgba(3, 7, 18, 0.24);
  --backdrop: rgba(5, 8, 13, 0.76);
  --button-text: #06111f;
}

body[data-theme="light"] {
  --bg: #f7f9fc;
  --bg-2: #ffffff;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: rgba(255, 255, 255, 0.96);
  --surface-muted: rgba(15, 23, 42, 0.045);
  --ink: #131821;
  --muted: #596679;
  --soft: #8592a4;
  --line: rgba(15, 23, 42, 0.11);
  --line-strong: rgba(15, 23, 42, 0.19);
  --accent: #2f80ed;
  --accent-2: #2f80ed;
  --accent-soft: rgba(47, 128, 237, 0.13);
  --danger: #c25572;
  --danger-soft: rgba(194, 85, 114, 0.12);
  --shadow: 0 34px 80px rgba(23, 37, 58, 0.16);
  --shadow-tight: 0 18px 42px rgba(23, 37, 58, 0.1);
  --backdrop: rgba(13, 19, 30, 0.42);
  --button-text: #ffffff;
}

body {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--bg-2), transparent 6%) 0, var(--bg) 420px),
    var(--bg);
}

body::before {
  background-image:
    linear-gradient(color-mix(in srgb, var(--ink), transparent 95%) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--ink), transparent 95%) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.34;
  mask-image: linear-gradient(180deg, rgb(17, 19, 21), transparent 82%);
}

.app-shell {
  width: min(calc(100% - 48px), 1440px);
  padding: 16px 0 84px;
}

.topbar {
  top: 12px;
  grid-template-columns: 230px minmax(320px, 1fr) auto;
  min-height: 68px;
  margin: 0;
  padding: 10px 64px 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-strong), transparent 7%);
  box-shadow: var(--shadow-tight);
  backdrop-filter: blur(24px) saturate(1.08);
}

.logo-mark,
.theme-corner-button,
.search-submit,
.primary-action {
  background: var(--accent);
}

.logo-mark {
  position: relative;
  overflow: hidden;
  border-color: color-mix(in srgb, var(--accent), white 18%);
  color: var(--button-text);
}

.logo-mark::after {
  content: "";
  position: absolute;
  inset: -40%;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.34) 48%, transparent 66%);
  transform: translateX(-85%) rotate(12deg);
  animation: logoSweep 5.8s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}

.logo-mark i {
  position: relative;
  z-index: 1;
}

.brand-title {
  font-size: 1.12rem;
}

.brand-copy {
  letter-spacing: 0;
}

.searchbar {
  grid-template-columns: minmax(0, 1fr) 48px;
}

.searchbar input,
.field input,
.field select {
  border-color: var(--line);
  background: color-mix(in srgb, var(--surface-strong), transparent 7%);
  box-shadow: inset 0 1px 0 color-mix(in srgb, white, transparent 94%);
}

.searchbar input {
  height: 48px;
}

.main-nav {
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.nav-link {
  min-height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
}

.nav-link.is-active,
.nav-link:hover,
.nav-link:focus-visible {
  border-color: transparent;
  background: var(--surface-strong);
  box-shadow: inset 0 1px 0 color-mix(in srgb, white, transparent 90%);
}

.utility-button,
.icon-button,
.secondary-action,
.library-tab,
.text-action,
.genre-chip,
.rail-arrow,
.library-save {
  background: color-mix(in srgb, var(--surface-strong), transparent 6%);
  box-shadow: inset 0 1px 0 color-mix(in srgb, white, transparent 92%);
}

.search-submit,
.primary-action {
  border-color: color-mix(in srgb, var(--accent), white 16%);
  box-shadow: 0 16px 34px color-mix(in srgb, var(--accent), transparent 78%);
}

.primary-action,
.secondary-action,
.utility-button,
.icon-button,
.library-tab,
.genre-chip,
.rail-arrow {
  transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1), border-color 260ms cubic-bezier(0.16, 1, 0.3, 1), background-color 260ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 260ms cubic-bezier(0.16, 1, 0.3, 1), color 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

.primary-action:active,
.secondary-action:active,
.utility-button:active,
.icon-button:active,
.library-tab:active,
.genre-chip:active,
.rail-arrow:active,
.search-submit:active {
  transform: translateY(1px) scale(0.99);
}

.status-panel {
  min-height: 40px;
  margin: 14px 0 24px;
}

.status-line {
  max-width: 76ch;
  font-size: 0.95rem;
}

.content-shell,
.home-section,
.home-rail,
.results-section {
  gap: 26px;
}

.featured-panel {
  min-height: 0;
}

.featured-card {
  min-height: 390px;
  border-color: var(--line);
  background: color-mix(in srgb, var(--surface-strong), transparent 4%);
  box-shadow: var(--shadow);
}

.featured-card::after {
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--bg), transparent 1%) 0%, color-mix(in srgb, var(--bg), transparent 12%) 44%, color-mix(in srgb, var(--bg), transparent 42%) 100%),
    linear-gradient(180deg, transparent 0%, color-mix(in srgb, var(--bg), transparent 6%) 100%);
}

.featured-overlay {
  align-items: center;
  padding: 40px;
}

.featured-copy {
  gap: 14px;
  max-width: 620px;
}

.featured-copy h1 {
  font-size: 3.15rem;
  line-height: 0.98;
}

.featured-description {
  max-width: 60ch;
}

.section-header {
  align-items: center;
}

.section-header h1,
.section-header h2,
.empty-state h3,
.library-empty h3,
.player-dialog-header h2 {
  font-size: 1.78rem;
  letter-spacing: 0;
}

.home-rail {
  gap: 14px;
}

.home-rail h2 {
  font-size: 1.04rem;
}

.rail-heading {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  min-width: 0;
}

.rail-controls {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  flex: 0 0 auto;
}

.rail-arrow {
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  color: var(--muted);
}

.rail-arrow:disabled {
  opacity: 0.32;
}

.recommendation-chips {
  gap: 8px;
}

.genre-chip {
  min-height: 38px;
  border-color: var(--line);
}

.genre-chip.is-active,
.library-tab.is-active,
.segment input:checked + span,
.toggle input:checked + span {
  border-color: color-mix(in srgb, var(--accent), white 16%);
  background: var(--accent);
  color: var(--button-text);
}

.results-grid {
  gap: 30px 18px;
}

.media-rail {
  grid-auto-flow: column;
  grid-auto-columns: minmax(164px, 188px);
  grid-template-columns: none;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 16px;
  scroll-padding-inline: 2px;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.media-rail:focus-visible {
  border-radius: var(--radius);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}

.media-rail::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.media-rail .result-card {
  scroll-snap-align: start;
}

.result-card {
  animation: cardReveal 420ms cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: calc(var(--index, 0) * 42ms);
}

.poster-wrap {
  border-color: color-mix(in srgb, var(--line), transparent 4%);
  background: color-mix(in srgb, var(--surface-muted), transparent 4%);
  box-shadow: 0 18px 40px color-mix(in srgb, var(--bg), transparent 68%);
  transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1), border-color 260ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

.result-open:hover .poster-wrap,
.result-open:focus-visible .poster-wrap {
  transform: translateY(-5px);
  border-color: color-mix(in srgb, var(--accent), transparent 20%);
  box-shadow: 0 0 0 3px var(--accent-soft), 0 24px 52px color-mix(in srgb, var(--bg), transparent 56%);
}

.result-meta {
  gap: 5px;
}

.result-meta h3 {
  white-space: normal;
}

.result-subline,
.result-genres,
.result-people,
.result-description {
  font-size: 0.84rem;
}

.rating-badge,
.action-badge,
.favorite-button {
  border-color: rgba(255, 255, 255, 0.36);
  background: rgba(10, 15, 22, 0.76);
}

.empty-state {
  border-style: dashed;
  background: color-mix(in srgb, var(--surface-strong), transparent 8%);
  box-shadow: none;
}

.empty-state::after {
  background: var(--accent);
}

.library-panel,
.episode-dialog,
.player-dialog {
  border-color: var(--line);
  background: color-mix(in srgb, var(--surface-strong), transparent 4%);
  box-shadow: var(--shadow-tight);
}

.library-panel {
  margin-top: 6px;
  padding: 18px;
}

.library-item {
  border-color: var(--line);
  background: color-mix(in srgb, var(--surface-strong), transparent 10%);
  transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1), border-color 260ms cubic-bezier(0.16, 1, 0.3, 1), background-color 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

.library-item:hover,
.library-item:focus-within {
  transform: translateY(-1px);
  border-color: var(--line-strong);
}

.modal-backdrop {
  background: var(--backdrop);
  backdrop-filter: blur(14px) saturate(0.92);
}

.info-modal {
  z-index: var(--z-episode);
  padding: 26px;
}

.info-dialog {
  grid-template-columns: minmax(320px, 0.82fr) minmax(0, 1.18fr);
  width: min(1160px, calc(100vw - 44px));
  max-height: min(800px, calc(100dvh - 44px));
  align-items: stretch;
  border-color: color-mix(in srgb, var(--line-strong), transparent 18%);
  background: color-mix(in srgb, var(--surface-strong), transparent 2%);
  box-shadow: var(--shadow);
  backdrop-filter: blur(28px) saturate(1.08);
}

.info-dialog.has-episodes {
  grid-template-columns: minmax(280px, 0.68fr) minmax(360px, 0.92fr) minmax(320px, 0.82fr);
  width: min(1380px, calc(100vw - 44px));
}

.info-dialog.is-loading .info-description,
.info-dialog.is-loading .info-fact {
  position: relative;
  overflow: hidden;
}

.info-dialog.is-loading .info-description::after,
.info-dialog.is-loading .info-fact::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, white, transparent 88%), transparent);
  transform: translateX(-100%);
  animation: loadingSweep 1.25s linear infinite;
}

.info-art {
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 24px;
  background: color-mix(in srgb, var(--bg-2), var(--bg) 48%);
}

.info-art::after {
  display: none;
}

.info-art-stage {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: min(620px, calc(100dvh - 120px));
  overflow: hidden;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--accent), transparent 78%), transparent 32%),
    color-mix(in srgb, var(--bg-2), var(--bg) 42%);
  isolation: isolate;
}

.info-art .info-backdrop-media {
  position: absolute;
  inset: -34px;
  z-index: -2;
  width: calc(100% + 68px);
  height: calc(100% + 68px);
  min-height: 0;
  object-fit: cover;
  opacity: 0.46;
  filter: blur(18px) saturate(0.9);
  transform: scale(1.06);
}

.info-art-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--bg), transparent 80%), color-mix(in srgb, var(--bg), transparent 8%)),
    linear-gradient(90deg, color-mix(in srgb, var(--bg), transparent 30%), transparent 45%, color-mix(in srgb, var(--bg), transparent 24%));
}

.info-poster-card {
  position: relative;
  display: grid;
  place-items: center;
  width: min(78%, 340px);
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius);
  background: #0b1017;
  box-shadow: 0 32px 70px rgba(3, 7, 18, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.info-art .info-poster-image {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  background: #0b1017;
}

.info-poster-image-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  gap: 12px;
  place-items: center;
  align-content: center;
  padding: 22px;
  color: var(--muted);
  text-align: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent),
    color-mix(in srgb, var(--surface-muted), #05070a 38%);
}

.info-poster-image-fallback i {
  color: var(--accent);
  font-size: 2rem;
}

.info-poster-image-fallback span {
  max-width: 16ch;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.15;
}

.info-media-strip {
  position: absolute;
  right: 18px;
  bottom: 18px;
  left: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.info-media-strip span {
  min-height: 30px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-sm);
  background: rgba(10, 15, 22, 0.64);
  color: rgba(255, 255, 255, 0.88);
  font-family: var(--font-mono);
  font-size: 0.73rem;
  font-weight: 600;
  backdrop-filter: blur(14px);
}

.info-art-fallback {
  display: grid;
  gap: 10px;
  place-items: center;
  min-height: 620px;
  width: 100%;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.info-art-fallback i {
  color: var(--accent);
  font-size: 2rem;
}

.info-body {
  grid-template-rows: auto auto auto auto;
  gap: 18px;
  padding: 28px;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}

.info-header {
  gap: 16px;
}

.info-header h2 {
  font-size: 2.45rem;
  line-height: 1;
}

.info-description {
  max-width: 72ch;
  color: color-mix(in srgb, var(--muted), var(--ink) 8%);
  font-size: 1.02rem;
  line-height: 1.62;
}

.info-facts {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.info-fact {
  grid-template-columns: 26px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: start;
  min-height: 0;
  padding: 12px;
  background: color-mix(in srgb, var(--surface-muted), transparent 3%);
  box-shadow: inset 0 1px 0 color-mix(in srgb, white, transparent 94%);
}

.info-fact.is-wide {
  grid-column: 1 / -1;
}

.info-fact i {
  grid-row: 1 / span 2;
  margin-top: 2px;
}

.info-fact span {
  min-width: 0;
  font-size: 0.74rem;
  line-height: 1.2;
}

.info-fact strong {
  min-width: 0;
  overflow: visible;
  font-size: 0.92rem;
  line-height: 1.35;
  text-overflow: clip;
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
}

.info-fact .genre-pill-list {
  gap: 7px;
}

.info-fact .genre-pill {
  min-height: 26px;
  padding: 5px 9px;
  color: var(--ink);
}

.info-pill-value {
  display: block;
}

.info-actions {
  gap: 10px;
  padding: 0 0 2px;
  background: transparent;
}

.info-episodes-section {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
  min-height: 0;
  height: min(800px, calc(100dvh - 44px));
  max-height: min(800px, calc(100dvh - 44px));
  padding: 28px;
  border-left: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-muted), transparent 42%);
  overflow: hidden;
}

.info-section-header {
  display: grid;
  gap: 6px;
  align-items: start;
}

.info-episode-list {
  min-height: 0;
  height: min(620px, calc(100dvh - 230px));
  max-height: min(620px, calc(100dvh - 230px));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 10px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.episode-season-label {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 7px 0 5px;
  background: color-mix(in srgb, var(--surface-strong), transparent 4%);
}

.episode-row {
  grid-template-columns: 52px minmax(0, 1fr) 30px;
  gap: 12px;
  align-items: start;
  min-height: 104px;
  padding: 14px 12px;
  background: color-mix(in srgb, var(--surface-muted), transparent 8%);
  contain: paint;
  overflow: hidden;
}

.episode-index,
.episode-row > i {
  align-self: center;
}

.episode-copy {
  align-self: center;
  gap: 5px;
  overflow: hidden;
}

.episode-copy strong,
.episode-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
}

.episode-copy span {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-height: 1.32;
}

.episode-copy strong {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-height: 1.16;
}

.player-dialog {
  width: min(1240px, 100%);
}

.dialog-actions {
  background: color-mix(in srgb, var(--surface-muted), transparent 6%);
  box-shadow: inset 0 1px 0 color-mix(in srgb, white, transparent 94%);
}

.player-frame-wrap {
  background: #05070a;
}

@keyframes logoSweep {
  0%,
  58% {
    transform: translateX(-85%) rotate(12deg);
  }

  74%,
  100% {
    transform: translateX(85%) rotate(12deg);
  }
}

@keyframes cardReveal {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes loadingSweep {
  to {
    transform: translateX(100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .logo-mark::after,
  .result-card,
  .skeleton-block,
  .skeleton-line,
  .skeleton-badge,
  .info-dialog.is-loading .info-description::after,
  .info-dialog.is-loading .info-fact::after {
    animation: none;
  }
}

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr);
    padding-right: 62px;
  }

  .main-nav {
    width: 100%;
  }

  .info-dialog {
    grid-template-columns: minmax(260px, 0.78fr) minmax(0, 1fr);
  }

  .info-dialog.has-episodes {
    grid-template-columns: minmax(260px, 0.78fr) minmax(0, 1fr);
  }

  .info-dialog.has-episodes .info-episodes-section {
    grid-column: 1 / -1;
    height: auto;
    max-height: 320px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .info-dialog.has-episodes .info-episode-list {
    height: 220px;
    max-height: 220px;
  }

  .info-art-stage,
  .info-art-fallback {
    min-height: 560px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(calc(100% - 24px), 1440px);
    padding-top: 10px;
  }

  .topbar {
    top: 8px;
    grid-template-columns: minmax(0, 1fr) 44px;
    grid-template-areas:
      "brand empty"
      "search search"
      "nav nav";
    padding: 10px 58px 10px 10px;
  }

  .brand-lockup {
    grid-area: brand;
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .searchbar {
    grid-area: search;
  }

  .main-nav {
    grid-area: nav;
    display: grid;
    grid-template-columns: repeat(4, 42px);
    width: max-content;
    overflow: visible;
  }

  .nav-link {
    gap: 5px;
    justify-content: center;
    min-width: 0;
    padding: 0;
  }

  .nav-link span {
    display: none;
  }

  .utility-button {
    width: 44px;
    min-width: 44px;
    padding: 0;
  }

  .utility-button span {
    display: none;
  }

  .featured-card {
    min-height: 480px;
  }

  .featured-overlay {
    align-items: end;
    padding: 22px;
  }

  .featured-copy h1 {
    font-size: 2.15rem;
  }

  .media-rail {
    grid-auto-columns: minmax(142px, 46%);
    gap: 20px 12px;
  }

  .results-section .results-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .info-modal {
    align-items: start;
    padding: 10px;
    overflow-y: auto;
  }

  .info-dialog {
    grid-template-columns: 1fr;
    width: 100%;
    max-height: none;
    min-height: auto;
  }

  .info-dialog.has-episodes {
    grid-template-columns: 1fr;
  }

  .info-art {
    min-height: 340px;
    max-height: none;
    padding: 16px;
  }

  .info-art-stage,
  .info-art-fallback {
    min-height: 316px;
  }

  .info-poster-card {
    width: min(48%, 168px);
  }

  .info-media-strip {
    right: 12px;
    bottom: 12px;
    left: 12px;
  }

  .info-body {
    padding: 18px;
    overflow: visible;
  }

  .info-header {
    grid-template-columns: minmax(0, 1fr) 42px;
  }

  .info-header h2 {
    font-size: 1.75rem;
  }

  .info-facts {
    grid-template-columns: 1fr;
  }

  .info-actions .primary-action,
  .info-actions .secondary-action {
    flex: 1 1 150px;
  }

  .info-episodes-section,
  .info-dialog.has-episodes .info-episodes-section {
    grid-column: auto;
    height: auto;
    max-height: none;
    padding: 0 18px 18px;
    border-top: 1px solid var(--line);
    border-left: 0;
    background: transparent;
    overflow: visible;
  }

  .info-episode-list {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .episode-season-label {
    top: 0;
  }

  .dialog-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 430px) {
  .theme-corner-button {
    width: 40px;
    height: 40px;
  }

  .searchbar {
    grid-template-columns: minmax(0, 1fr) 44px;
  }

  .search-submit.icon-only-action {
    width: 44px;
  }

  .main-nav {
    gap: 4px;
  }

  .nav-link span {
    display: none;
  }

  .nav-link {
    min-height: 40px;
  }

  .media-rail {
    grid-auto-columns: minmax(132px, 54%);
  }

  .results-section .results-grid,
  .results-grid:not(.media-rail) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .info-art {
    min-height: 300px;
  }

  .info-art-stage,
  .info-art-fallback {
    min-height: 276px;
  }

  .info-poster-card {
    width: min(50%, 148px);
  }

  .info-media-strip span {
    min-height: 28px;
    padding: 6px 8px;
    font-size: 0.68rem;
  }

  .episode-row {
    grid-template-columns: 48px minmax(0, 1fr) 28px;
    min-height: 112px;
    padding: 13px 10px;
  }

  .info-body {
    padding: 16px;
  }

  .info-header h2 {
    font-size: 1.55rem;
  }

  .info-description {
    font-size: 0.95rem;
  }

  .episode-row {
    grid-template-columns: 48px minmax(0, 1fr) 30px;
    gap: 8px;
    padding: 10px 8px;
  }
}

/* mobile and player usability pass */
.player-modal {
  display: block;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.player-dialog {
  margin: 0 auto;
  max-width: 1240px;
}

.player-frame-wrap {
  min-height: clamp(360px, 62dvh, 620px);
}

.dialog-actions {
  align-items: center;
}

.dialog-actions .icon-button {
  flex: 0 0 40px;
}

@media (max-width: 760px) {
  body {
    min-width: 320px;
  }

  .theme-corner-button {
    top: max(10px, env(safe-area-inset-top));
    right: max(10px, env(safe-area-inset-right));
  }

  .app-shell {
    width: min(calc(100% - 20px), 1440px);
    padding-bottom: max(52px, env(safe-area-inset-bottom));
  }

  .topbar {
    gap: 10px;
    padding: 10px 56px 10px 10px;
  }

  .status-panel {
    display: none;
  }

  .content-shell,
  .home-section,
  .home-rail,
  .results-section {
    gap: 22px;
  }

  .section-header,
  .rail-heading {
    gap: 10px;
  }

  .rail-controls {
    gap: 6px;
  }

  .rail-arrow {
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
  }

  .recommendation-chips {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .recommendation-chips::-webkit-scrollbar {
    display: none;
  }

  .genre-chip {
    flex: 0 0 auto;
  }

  .result-meta {
    gap: 6px;
  }

  .result-meta h3 {
    font-size: 0.96rem;
    line-height: 1.18;
  }

  .result-subline,
  .result-genres {
    font-size: 0.78rem;
    line-height: 1.35;
  }

  .genre-pill-list {
    gap: 5px;
  }

  .genre-pill {
    min-height: 24px;
    padding: 4px 8px;
    font-size: 0.68rem;
  }

  .featured-card {
    min-height: 430px;
  }

  .featured-copy {
    max-width: none;
  }

  .featured-copy h1 {
    font-size: clamp(1.85rem, 9vw, 2.2rem);
    line-height: 1.02;
  }

  .featured-actions {
    width: 100%;
  }

  .featured-actions .primary-action,
  .featured-actions .secondary-action {
    flex: 1 1 140px;
    justify-content: center;
  }

  .library-panel {
    padding: 14px;
  }

  .library-item {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 12px;
  }

  .player-modal {
    padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  }

  .player-dialog {
    width: 100%;
    padding: 12px;
    gap: 12px;
  }

  .player-dialog-header {
    gap: 10px;
  }

  .player-dialog-header h2 {
    font-size: 1.28rem;
    line-height: 1.12;
  }

  .player-dialog-header .inline-status {
    font-size: 0.84rem;
    line-height: 1.4;
  }

  .dialog-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    padding: 8px;
  }

  .dialog-actions .seek-status {
    grid-column: 1 / -1;
    font-size: 0.78rem;
  }

  .dialog-actions .icon-button {
    width: 100%;
    min-width: 0;
    height: 42px;
    min-height: 42px;
    padding: 0;
  }

  .player-frame-wrap {
    min-height: 0;
    height: min(52dvh, calc((100vw - 44px) * 0.5625));
    border-radius: var(--radius-sm);
    aspect-ratio: auto;
  }

}

@media (max-width: 430px) {
  .app-shell {
    width: min(calc(100% - 16px), 1440px);
  }

  .topbar {
    padding-right: 52px;
  }

  .searchbar {
    gap: 6px;
  }

  .main-nav {
    grid-template-columns: repeat(4, 40px);
  }

  .media-rail {
    grid-auto-columns: minmax(134px, 56%);
  }

  .results-section .results-grid,
  .results-grid:not(.media-rail) {
    gap: 18px 10px;
  }

  .featured-card {
    min-height: 390px;
  }

  .featured-overlay {
    padding: 18px;
  }

  .player-dialog {
    padding: 10px;
  }

  .dialog-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .player-frame-wrap {
    height: min(46dvh, calc((100vw - 32px) * 0.5625));
    min-height: 186px;
  }

  .info-actions .primary-action,
  .info-actions .secondary-action {
    flex-basis: 100%;
  }
}

/* screenshot layout remake */
body[data-theme="dark"] {
  --bg: #0d1626;
  --bg-2: #101a2c;
  --surface: rgba(20, 31, 50, 0.72);
  --surface-strong: rgba(16, 26, 44, 0.94);
  --surface-muted: rgba(255, 255, 255, 0.06);
  --ink: #f7f9ff;
  --muted: #aab6c9;
  --soft: #70809a;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --accent: #4a9cff;
  --accent-2: #ffc34d;
  --accent-soft: rgba(74, 156, 255, 0.2);
  --shadow-tight: 0 18px 36px rgba(1, 5, 14, 0.3);
}

body[data-theme="light"] {
  --bg: #e9edf4;
  --bg-2: #f7f9fd;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: rgba(255, 255, 255, 0.94);
  --surface-muted: rgba(19, 34, 57, 0.06);
  --ink: #142033;
  --muted: #5d6b80;
  --soft: #7f8da1;
  --line: rgba(18, 34, 58, 0.09);
  --line-strong: rgba(18, 34, 58, 0.18);
  --accent: #256dea;
  --accent-2: #c68216;
  --accent-soft: rgba(37, 109, 234, 0.17);
  --shadow-tight: 0 18px 36px rgba(51, 68, 95, 0.13);
}

body {
  background:
    radial-gradient(circle at 50% -14%, color-mix(in srgb, var(--accent), transparent 88%), transparent 38rem),
    var(--bg);
}

body::before {
  opacity: 0;
}

.app-shell {
  width: min(calc(100% - 100px), 1280px);
  padding: 14px 0 84px;
}

.topbar {
  top: 12px;
  width: 100vw;
  grid-template-columns: 172px minmax(320px, 1fr) auto;
  gap: 14px;
  min-height: 42px;
  margin-right: calc(50% - 50vw);
  margin-left: calc(50% - 50vw);
  padding: 10px 92px 10px max(32px, env(safe-area-inset-left));
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.brand-lockup {
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 9px;
  min-width: 160px;
}

.logo-mark {
  width: 42px;
  height: 42px;
  min-height: 42px;
  border-radius: 10px;
}

.brand-title {
  font-size: 1.02rem;
  line-height: 1.02;
}

.brand-copy {
  margin-top: 1px;
  color: var(--soft);
  font-size: 0.68rem;
  line-height: 1.12;
}

.theme-corner-button {
  top: max(14px, env(safe-area-inset-top));
  right: max(32px, env(safe-area-inset-right));
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border-color: transparent;
}

.searchbar {
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
}

.searchbar input {
  height: 42px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-strong), transparent 8%);
}

.search-submit.icon-only-action {
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  border-radius: 999px;
}

.main-nav {
  min-width: max-content;
  min-height: 42px;
  padding: 4px;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-strong), transparent 5%);
}

.nav-link {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: 0;
  color: color-mix(in srgb, var(--muted), transparent 16%);
}

.nav-link.is-active,
.nav-link:hover,
.nav-link:focus-visible {
  background: color-mix(in srgb, var(--surface-strong), white 9%);
  color: var(--ink);
  box-shadow: none;
}

.content-shell,
.home-section,
.home-rail,
.results-section {
  gap: 28px;
}

.featured-panel {
  min-height: 0;
}

.featured-card {
  min-height: clamp(340px, 41vw, 520px);
  border: 0;
  border-radius: 20px;
  background: color-mix(in srgb, var(--surface-strong), transparent 8%);
  box-shadow: none;
}

.featured-backdrop {
  object-position: center 38%;
}

.featured-card::after {
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--bg), transparent 0%) 0%, color-mix(in srgb, var(--bg), transparent 8%) 36%, color-mix(in srgb, var(--bg), transparent 48%) 68%, color-mix(in srgb, var(--bg), transparent 12%) 100%),
    linear-gradient(180deg, transparent 0%, color-mix(in srgb, var(--bg), transparent 2%) 100%);
}

.featured-overlay {
  align-items: center;
  padding: clamp(40px, 5vw, 70px);
}

.featured-copy {
  gap: 16px;
  max-width: 660px;
}

.featured-copy h1 {
  font-size: clamp(3rem, 5.2vw, 4.55rem);
  line-height: 0.94;
}

.featured-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 11px;
  align-items: center;
  color: var(--muted);
  font-size: 0.8rem;
}

.featured-meta::first-letter {
  text-transform: uppercase;
}

.featured-genres .genre-pill {
  min-height: 24px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.68rem;
}

.primary-action,
.secondary-action,
.genre-chip,
.rail-arrow {
  border-radius: 999px;
}

.primary-action,
.secondary-action {
  min-height: 46px;
  padding: 0 24px;
}

.featured-actions {
  gap: 12px;
  margin-top: 10px;
}

.browse-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 18px;
  align-items: end;
}

.section-header h1,
.section-header h2 {
  font-size: 1.78rem;
  line-height: 1.04;
}

.recommendation-chips {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.recommendation-chips::-webkit-scrollbar {
  display: none;
}

.genre-chip {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 14px;
  background: color-mix(in srgb, var(--surface-strong), white 2%);
  font-size: 0.76rem;
}

.home-rail {
  gap: 16px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.home-rail h2 {
  font-size: 0.98rem;
  line-height: 1.15;
}

.rail-arrow {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
}

.media-rail {
  grid-auto-columns: minmax(112px, 152px);
  gap: 18px;
  padding-bottom: 10px;
}

.media-rail .result-open {
  gap: 0;
}

.media-rail .result-meta {
  display: none;
}

.media-rail .poster-wrap {
  border-color: color-mix(in srgb, var(--line), transparent 18%);
  border-radius: 9px;
  box-shadow: 0 18px 32px rgba(1, 5, 14, 0.28);
}

.media-rail .action-badge {
  display: none;
}

.rating-badge {
  top: 8px;
  right: 8px;
  min-height: 26px;
  padding: 0 7px;
  border-color: rgba(255, 255, 255, 0.18);
  border-radius: 7px;
  background: rgba(11, 19, 34, 0.82);
  font-size: 0.68rem;
}

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: 164px minmax(220px, 1fr) auto;
    align-items: center;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: 100%;
    padding: 18px 28px max(64px, env(safe-area-inset-bottom));
  }

  .topbar {
    position: relative;
    top: 0;
    z-index: 1;
    width: auto;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "brand"
      "search";
    gap: 12px;
    min-height: 0;
    margin-right: 0;
    margin-left: 0;
    padding: 0;
  }

  .brand-lockup {
    grid-area: brand;
    width: max-content;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 8px;
  }

  .logo-mark {
    width: 34px;
    height: 34px;
    min-height: 34px;
    border-radius: 8px;
  }

  .logo-mark i {
    font-size: 1rem;
  }

  .brand-title {
    font-size: 1rem;
  }

  .brand-copy {
    font-size: 0.68rem;
  }

  .theme-corner-button {
    position: absolute;
    top: max(18px, env(safe-area-inset-top));
    right: max(28px, env(safe-area-inset-right));
    width: 38px;
    height: 38px;
  }

  .searchbar {
    grid-area: search;
    grid-template-columns: minmax(0, 1fr) 42px;
    gap: 8px;
    width: 100%;
  }

  .searchbar .search-input-wrap {
    display: block;
  }

  .searchbar input {
    height: 42px;
    border-radius: 12px;
  }

  .search-submit.icon-only-action {
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
    border-radius: 12px;
  }

  .main-nav {
    display: none;
  }

  .content-shell {
    margin-top: 26px;
  }

  .home-section,
  .content-shell,
  .home-rail,
  .results-section {
    gap: 22px;
  }

  .featured-panel {
    display: none;
  }

  .browse-header {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .section-kicker,
  .featured-label,
  .result-id {
    font-size: 0.68rem;
  }

  .section-header h1,
  .section-header h2 {
    font-size: 1.62rem;
  }

  .recommendation-chips {
    max-width: calc(100vw - 56px);
  }

  .genre-chip {
    min-height: 30px;
    padding: 0 13px;
  }

  .home-rail {
    padding-top: 24px;
  }

  .rail-arrow {
    width: 32px;
    min-width: 32px;
    height: 32px;
    min-height: 32px;
  }

  .media-rail {
    display: grid;
    grid-auto-flow: row;
    grid-auto-columns: initial;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 14px;
    overflow: visible;
    padding: 0;
    scroll-padding-inline: 0;
    scroll-snap-type: none;
  }

  .media-rail .result-card {
    scroll-snap-align: none;
  }

  .media-rail .favorite-button:not(.is-saved) {
    display: none;
  }

  .media-rail .favorite-button {
    top: 8px;
    left: 8px;
    width: 30px;
    height: 30px;
    min-height: 30px;
    border-radius: 8px;
  }
}

@media (max-width: 430px) {
  .app-shell {
    padding-right: 28px;
    padding-left: 28px;
  }

  .media-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 14px;
  }
}

@media (max-width: 350px) {
  .app-shell {
    padding-right: 22px;
    padding-left: 22px;
  }

  .recommendation-chips {
    max-width: calc(100vw - 44px);
  }
}

/* Keep the title-details close action pinned to the dialog corner. */
.info-header {
  grid-template-columns: minmax(0, 1fr);
  padding-right: 58px;
}

#info-close {
  position: absolute;
  top: 28px;
  right: 28px;
  z-index: 3;
}

.info-dialog.has-episodes .info-section-header {
  padding-right: 58px;
}

@media (max-width: 760px) {
  .info-header {
    padding-right: 0;
  }

  #info-close {
    top: 14px;
    right: 14px;
  }

  .info-dialog.has-episodes .info-section-header {
    padding-right: 0;
  }
}
