:root {
  color-scheme: light;
  --bg: #f4f5f2;
  --surface: #ffffff;
  --surface-2: #e9ece8;
  --surface-3: #dce1dc;
  --text: #171a19;
  --muted: #606965;
  --line: #cbd1cc;
  --line-strong: #aab3ad;
  --accent: #087f6b;
  --accent-hover: #056555;
  --accent-soft: #d6eee8;
  --amber: #a66200;
  --amber-soft: #f8e8c9;
  --danger: #b3263e;
  --danger-soft: #f8dce1;
  --focus: #008f7a;
  --hero-text: #ffffff;
  --hero-muted: #d8dfdc;
  --hero-shade: rgba(10, 13, 12, 0.68);
  --shadow: 0 10px 30px rgba(25, 31, 28, 0.14);
  --header-height: 3.75rem;
  --page-gutter: max(1rem, 3vw);
  --content-width: 96rem;
  --reading-width: 78rem;
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1110;
  --surface: #171a18;
  --surface-2: #222724;
  --surface-3: #303733;
  --text: #f1f4f1;
  --muted: #a5aea8;
  --line: #343b37;
  --line-strong: #56605a;
  --accent: #57d4b8;
  --accent-hover: #83e2cd;
  --accent-soft: #173c34;
  --amber: #f2b85b;
  --amber-soft: #3f3018;
  --danger: #ff8799;
  --danger-soft: #421e25;
  --focus: #6ce2c7;
  --hero-muted: #d4dbd7;
  --hero-shade: rgba(5, 7, 6, 0.72);
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.38);
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    color-scheme: dark;
    --bg: #0f1110;
    --surface: #171a18;
    --surface-2: #222724;
    --surface-3: #303733;
    --text: #f1f4f1;
    --muted: #a5aea8;
    --line: #343b37;
    --line-strong: #56605a;
    --accent: #57d4b8;
    --accent-hover: #83e2cd;
    --accent-soft: #173c34;
    --amber: #f2b85b;
    --amber-soft: #3f3018;
    --danger: #ff8799;
    --danger-soft: #421e25;
    --focus: #6ce2c7;
    --hero-muted: #d4dbd7;
    --hero-shade: rgba(5, 7, 6, 0.72);
    --shadow: 0 12px 34px rgba(0, 0, 0, 0.38);
  }
}

/* Cinema surfaces: the media lobby and detail pages commit to a dark,
   ambient-lit room regardless of the chosen console theme. */
body.media-home-page,
body.media-detail-page,
body.media-requests-page {
  overflow-x: clip;
  color-scheme: dark;
  --bg: #0a0d0c;
  --surface: #141816;
  --surface-2: #1d2320;
  --surface-3: #2a312d;
  --text: #f1f4f1;
  --muted: #a5aea8;
  --line: #2c332f;
  --line-strong: #56605a;
  --accent: #57d4b8;
  --accent-hover: #83e2cd;
  --accent-soft: #173c34;
  --amber: #f2b85b;
  --amber-soft: #3f3018;
  --danger: #ff8799;
  --danger-soft: #421e25;
  --focus: #6ce2c7;
  --hero-muted: #d4dbd7;
  --hero-shade: rgba(5, 7, 6, 0.72);
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.38);
  --ambient: #223b34;
  --ease-out: cubic-bezier(0.19, 1, 0.22, 1);
  color: var(--text);
  background: var(--bg);
}

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

html {
  min-width: 20rem;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

img {
  max-width: 100%;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.icon {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.button-link {
  display: inline-flex;
  min-height: 2.5rem;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: #ffffff;
  background: var(--accent);
  cursor: pointer;
  font-weight: 700;
  line-height: 1.2;
}

button:hover,
.button-link:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
  text-decoration: none;
}

.button-secondary {
  border-color: var(--line-strong);
  color: var(--text);
  background: var(--surface-2);
}

.button-secondary:hover {
  border-color: var(--text);
  background: var(--surface-3);
}

.button-danger {
  border-color: var(--danger);
  color: #ffffff;
  background: var(--danger);
}

.button-danger:hover {
  border-color: var(--danger);
  background: #8f1d31;
}

.link-button,
.language-switcher {
  display: flex;
  gap: 0.35rem;
  padding: 0.15rem 0.4rem;
}

.language-switcher .language-option {
  flex: 1;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
}

.language-switcher .language-option.is-current {
  border-color: var(--accent);
  color: var(--accent);
}

.menu-command {
  min-height: 0;
  padding: 0;
  border: 0;
  color: var(--text);
  background: transparent;
  font-weight: 500;
}

.link-button:hover,
.menu-command:hover {
  color: var(--accent);
  background: transparent;
}

input,
select,
textarea {
  width: 100%;
  min-height: 2.5rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--text);
  background: var(--surface);
}

textarea {
  resize: vertical;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  z-index: 200;
  top: 0.5rem;
  left: -10000px;
  padding: 0.6rem 0.8rem;
  color: var(--surface);
  background: var(--text);
}

.skip-link:focus {
  left: 0.5rem;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.site-header {
  position: sticky;
  z-index: 70;
  top: 0;
  display: flex;
  min-height: var(--header-height);
  align-items: center;
  gap: 1.5rem;
  padding: 0 var(--page-gutter);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

/* On cinema pages the header floats transparently over the hero and
   gains a glass panel once the page scrolls. */
body.media-home-page .site-header,
body.media-detail-page .site-header,
body.media-requests-page .site-header {
  position: fixed;
  right: 0;
  left: 0;
  border-bottom-color: transparent;
  background: linear-gradient(rgba(6, 9, 8, 0.62), rgba(6, 9, 8, 0));
  transition:
    background 320ms ease,
    border-color 320ms ease,
    backdrop-filter 320ms ease;
}

body.media-home-page .site-header.is-solid,
body.media-detail-page .site-header.is-solid,
body.media-requests-page .site-header.is-solid {
  border-bottom-color: rgba(241, 244, 241, 0.08);
  background: rgba(10, 13, 12, 0.78);
  backdrop-filter: blur(14px) saturate(1.25);
  -webkit-backdrop-filter: blur(14px) saturate(1.25);
}

body.media-home-page .media-home-heading {
  padding-top: calc(var(--header-height) + 1.5rem);
}

body.media-home-page .media-home-shell > .messages,
body.media-detail-page .media-detail-shell > .messages {
  position: relative;
  z-index: 5;
  margin-top: calc(var(--header-height) + 1rem);
}

.brand {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.45rem;
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 850;
}

.brand:hover {
  color: var(--accent);
  text-decoration: none;
}

.brand .icon {
  width: 1.15rem;
  height: 1.15rem;
  color: var(--accent);
}

.primary-nav {
  display: flex;
  min-width: 0;
  align-self: stretch;
  align-items: center;
  gap: 1.2rem;
}

.primary-nav a {
  display: inline-flex;
  height: 100%;
  align-items: center;
  gap: 0.4rem;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-weight: 650;
}

.primary-nav a:hover,
.primary-nav a[aria-current="page"] {
  border-bottom-color: var(--accent);
  color: var(--text);
  text-decoration: none;
}

.media-view-switcher {
  display: flex;
  min-width: 0;
  max-width: min(34rem, 34vw);
  flex: 0 1 auto;
  gap: 0.15rem;
  padding: 0.2rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  scrollbar-width: none;
}

.media-view-switcher::-webkit-scrollbar {
  display: none;
}

.media-view-option {
  min-width: 0;
  min-height: 2.15rem;
  flex: 0 0 auto;
  gap: 0.4rem;
  padding: 0.4rem 0.65rem;
  border-color: transparent;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  font-size: 0.76rem;
  font-weight: 750;
  white-space: nowrap;
}

.media-view-option:hover {
  border-color: var(--line-strong);
  color: var(--text);
  background: var(--surface);
}

.media-view-option.is-active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
}

.icon-button {
  width: 2.25rem;
  height: 2.25rem;
  min-width: 0;
  min-height: 0;
  padding: 0.35rem;
  border-color: var(--line);
  color: var(--muted);
  background: transparent;
}

.icon-button:hover {
  border-color: var(--line-strong);
  color: var(--text);
  background: var(--surface-2);
}

.header-utility {
  border-color: transparent;
}

.account-menu {
  position: relative;
}

.account-menu > summary {
  display: grid;
  width: 2.35rem;
  height: 2.35rem;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--text);
  background: var(--surface-2);
  cursor: pointer;
  list-style: none;
}

.account-menu > summary .icon {
  width: 1.2rem;
  height: 1.2rem;
}

.account-menu > summary::-webkit-details-marker,
.workspace-switcher > summary::-webkit-details-marker {
  display: none;
}

.account-menu > nav {
  position: absolute;
  z-index: 100;
  top: calc(100% + 0.55rem);
  right: 0;
  display: grid;
  width: min(20rem, calc(100vw - 2rem));
  padding: 0.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.account-menu > nav a,
.account-menu .menu-command {
  display: flex;
  width: 100%;
  min-height: 2.5rem;
  align-items: center;
  justify-content: flex-start;
  gap: 0.7rem;
  margin: 0;
  padding: 0.65rem 0.7rem;
  border: 0;
  border-radius: 5px;
  color: var(--text);
  background: transparent;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.account-menu > nav a:hover,
.account-menu .menu-command:hover {
  color: var(--text);
  background: var(--surface-2);
  text-decoration: none;
}

.account-menu > nav form {
  margin: 0;
}

.account-identity {
  display: grid;
  gap: 0.1rem;
  margin: 0 0 0.35rem;
  padding: 0.55rem 0.7rem 0.75rem;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.account-identity span,
.account-identity strong {
  font-size: 0.72rem;
}

.account-identity span {
  color: var(--muted);
}

.account-menu-separator {
  height: 1px;
  margin: 0.35rem 0;
  background: var(--line);
}

.workspace-switcher {
  position: relative;
}

.workspace-switcher > summary {
  display: grid;
  min-height: 2.5rem;
  grid-template-columns: 1rem minmax(0, auto) 0.8rem;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: var(--surface-2);
  cursor: pointer;
  list-style: none;
}

.workspace-switcher > summary:hover {
  border-color: var(--line-strong);
}

.workspace-summary-copy {
  display: grid;
  min-width: 0;
  max-width: 18rem;
  line-height: 1.12;
}

.workspace-summary-copy strong,
.workspace-summary-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-summary-copy strong {
  font-size: 0.78rem;
}

.workspace-summary-copy small {
  color: var(--muted);
  font-size: 0.66rem;
}

.summary-chevron {
  width: 0.8rem;
  height: 0.8rem;
  transition: transform 140ms ease;
}

.workspace-switcher[open] .summary-chevron {
  transform: rotate(180deg);
}

.workspace-menu {
  position: absolute;
  z-index: 90;
  top: calc(100% + 0.45rem);
  right: 0;
  width: min(27rem, calc(100vw - 2rem));
  padding: 0.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.workspace-menu > a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem;
  border-radius: 5px;
  color: var(--text);
}

.workspace-menu > a:hover,
.workspace-menu > a[aria-current="page"] {
  background: var(--surface-2);
  text-decoration: none;
}

.workspace-menu > a > span {
  display: grid;
  min-width: 0;
}

.workspace-menu > a strong,
.workspace-menu > a small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-menu > a small {
  color: var(--muted);
  font-size: 0.78rem;
}

.workspace-menu-actions {
  display: grid;
  gap: 0.15rem;
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--line);
}

.workspace-menu-actions a {
  display: flex;
  min-height: 2.4rem;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.7rem;
  border-radius: 5px;
  color: var(--text);
  font-weight: 600;
}

.workspace-menu-actions a:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.global-progress {
  position: fixed;
  z-index: 180;
  top: 0;
  left: 0;
  width: 32%;
  height: 3px;
  background: var(--accent);
  transform: translateX(-110%);
}

.is-loading .global-progress,
.htmx-request .global-progress,
.htmx-request.global-progress {
  visibility: visible;
  animation: global-progress 1s ease-in-out infinite;
}

@keyframes global-progress {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(420%); }
}

.container {
  width: min(var(--content-width), calc(100% - (2 * var(--page-gutter))));
  margin: 0 auto;
  padding: 2.5rem 0 5rem;
}

:root[data-layout="focused"] .container:not(.media-home-shell):not(.media-detail-shell) {
  max-width: var(--reading-width);
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0.2rem 0;
  font-size: 2.75rem;
  line-height: 1.06;
}

h2 {
  margin: 0;
  font-size: 1.45rem;
  line-height: 1.2;
}

h3 {
  margin: 0;
  font-size: 1.05rem;
}

section {
  margin-top: 2.5rem;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
}

.muted,
small {
  color: var(--muted);
}

small {
  display: block;
  margin-top: 0.3rem;
}

.page-heading,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.page-heading {
  margin-bottom: 2rem;
}

.section-heading > div {
  display: grid;
  gap: 0.3rem;
}

.pill,
.status {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  padding: 0.2rem 0.45rem;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--muted);
  background: var(--surface);
  font-size: 0.75rem;
  line-height: 1.25;
  white-space: nowrap;
}

.status-healthy,
.status-succeeded,
.status-running,
.status-available,
.status-present {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.status-expected,
.status-requested,
.status-downloading,
.status-partial {
  border-color: var(--amber);
  color: var(--amber);
  background: var(--amber-soft);
}

.status-failed,
.status-unavailable,
.status-missing,
.status-identity_mismatch {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-soft);
}

.messages {
  position: relative;
  z-index: 20;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent-soft);
}

.messages p {
  margin: 0;
}

.media-home-shell,
.media-detail-shell {
  width: 100%;
  max-width: none;
  padding: 0 0 5rem;
}

.media-home-shell > .messages,
.media-detail-shell > .messages {
  width: min(var(--content-width), calc(100% - (2 * var(--page-gutter))));
  margin: 1rem auto;
}

.media-showcase {
  --showcase-interval: 7000ms;
  position: relative;
  height: calc(100svh - 5rem);
  min-height: 30rem;
  margin-top: 0;
  overflow: hidden;
  isolation: isolate;
  color: #ffffff;
  background: #10140f;
  touch-action: pan-y;
}

/* Ambient wash tinted by the active title's dominant color. */
.media-showcase::before {
  position: absolute;
  z-index: 2;
  inset: 0;
  background: radial-gradient(
    120% 90% at 76% 8%,
    color-mix(in oklab, var(--ambient, #223b34) 55%, transparent),
    transparent 64%
  );
  content: "";
  mix-blend-mode: screen;
  opacity: 0.3;
  transition: background 900ms ease;
  pointer-events: none;
}

.media-showcase-slides,
.media-showcase-slide {
  position: absolute;
  inset: 0;
}

.media-showcase-slide {
  visibility: hidden;
  opacity: 0;
  transition: visibility 700ms ease, opacity 700ms ease;
}

.media-showcase-slide.is-active {
  visibility: visible;
  opacity: 1;
}

.media-showcase-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.18);
  background: #27302b;
}

.media-showcase-fallback .icon {
  width: 9rem;
  height: 9rem;
  stroke-width: 1;
}

.media-showcase-backdrop,
.media-showcase-trailer,
.media-showcase-shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.media-showcase-backdrop {
  z-index: 1;
  object-fit: cover;
  object-position: center 24%;
  transform: scale(1.045);
  transition: opacity 700ms ease, transform 12s linear;
}

.media-showcase-slide.is-active .media-showcase-backdrop {
  transform: scale(1);
}

.media-showcase-trailer {
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity 700ms ease;
}

.media-showcase-trailer.is-active {
  opacity: 1;
}

.media-showcase-trailer iframe {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 177.78vh;
  min-width: 100%;
  height: 56.25vw;
  min-height: 100%;
  border: 0;
  transform: translate(-50%, -50%);
}

.media-showcase.has-active-trailer .media-showcase-slide.is-active .media-showcase-backdrop {
  opacity: 0.18;
}

.media-showcase-shade {
  z-index: 3;
  background:
    linear-gradient(90deg, rgba(7, 10, 8, 0.88) 0%, rgba(7, 10, 8, 0.5) 43%, rgba(7, 10, 8, 0.05) 78%),
    linear-gradient(0deg, var(--bg, #0a0d0c) 0%, rgba(10, 13, 12, 0.55) 16%, rgba(10, 13, 12, 0) 52%);
}

.media-showcase-hitarea {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: block;
  cursor: pointer;
}

.media-showcase-content {
  position: absolute;
  z-index: 5;
  bottom: 7rem;
  left: var(--page-gutter);
  width: min(45rem, calc(100% - (2 * var(--page-gutter))));
  opacity: 0;
  transform: translateY(1rem);
  transition: opacity 500ms ease 160ms, transform 500ms ease 160ms;
}

:root[data-layout="focused"] .media-showcase-content {
  left: max(var(--page-gutter), calc((100% - var(--reading-width)) / 2));
}

.media-showcase-slide.is-active .media-showcase-content {
  opacity: 1;
  transform: translateY(0);
}

.media-showcase .eyebrow {
  color: #7be1ca;
}

.showcase-kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.55rem;
  margin: 0 0 0.35rem;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.25;
}

.showcase-kicker span:first-child {
  color: #7be1ca;
}

.showcase-meta {
  margin-bottom: 0;
}

.media-showcase h1 {
  max-width: 18ch;
  margin: 0.3rem 0 0.55rem;
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  line-height: 1;
  text-wrap: balance;
}

.showcase-title {
  transform-origin: left bottom;
  transition: transform 600ms var(--ease-out, ease);
}

.showcase-title-logo img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(26rem, 82%);
  max-height: 8.5rem;
  object-fit: contain;
  filter: drop-shadow(0 4px 18px rgba(0, 0, 0, 0.55));
}

.showcase-title-logo .showcase-title-fallback {
  display: none;
}

.showcase-title-logo.image-missing .showcase-title-fallback,
.showcase-title-logo.image-pending .showcase-title-fallback {
  display: inline;
}

/* Trailer choreography: the wordmark steps back, the copy folds away,
   and a live badge plus mute control appear. */
.media-showcase.has-active-trailer .media-showcase-slide.is-active .showcase-title {
  transform: scale(0.78);
}

.media-showcase .hero-tagline,
.media-showcase .hero-summary {
  transition: opacity 450ms ease, max-height 450ms ease, margin 450ms ease;
}

.media-showcase.has-active-trailer .media-showcase-slide.is-active .hero-tagline,
.media-showcase.has-active-trailer .media-showcase-slide.is-active .hero-summary {
  overflow: hidden;
  max-height: 0;
  margin: 0;
  opacity: 0;
}

.showcase-trailer-badge {
  display: none;
  align-items: center;
  gap: 0.4rem;
  color: #7be1ca;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.showcase-trailer-badge::before {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #7be1ca;
  content: "";
  animation: showcase-badge-pulse 1.6s ease-in-out infinite;
}

.media-showcase.has-active-trailer .showcase-trailer-badge {
  display: inline-flex;
}

@keyframes showcase-badge-pulse {
  50% { opacity: 0.35; }
}

.showcase-mute {
  border-color: rgba(255, 255, 255, 0.56);
  color: #ffffff;
  background: rgba(11, 15, 13, 0.62);
  backdrop-filter: blur(8px);
}

.showcase-mute:hover {
  border-color: #ffffff;
  background: rgba(11, 15, 13, 0.82);
}

.media-showcase.has-active-trailer .media-showcase-pick.is-active::after {
  animation-play-state: paused;
}

.media-showcase .hero-tagline {
  max-width: 40rem;
}

.media-showcase .hero-summary {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.showcase-play {
  border-color: #ffffff;
  color: #101412;
  background: #ffffff;
}

.showcase-play:hover {
  border-color: #dfe6e2;
  color: #101412;
  background: #dfe6e2;
}

.showcase-details {
  border-color: rgba(255, 255, 255, 0.56);
  color: #ffffff;
  background: rgba(11, 15, 13, 0.62);
  backdrop-filter: blur(8px);
}

.showcase-details:hover {
  border-color: #ffffff;
  color: #ffffff;
  background: rgba(11, 15, 13, 0.82);
}

.media-showcase-controls {
  position: absolute;
  z-index: 6;
  right: var(--page-gutter);
  bottom: 1rem;
  left: var(--page-gutter);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.45rem;
}

.media-showcase-picks {
  display: flex;
  min-width: 0;
  gap: 0.35rem;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
}

.media-showcase-picks::-webkit-scrollbar {
  display: none;
}

.media-showcase-pick,
.showcase-arrow,
.showcase-toggle {
  border-color: rgba(255, 255, 255, 0.35);
  color: rgba(255, 255, 255, 0.82);
  background: rgba(10, 14, 12, 0.68);
  backdrop-filter: blur(8px);
}

.media-showcase-pick:hover,
.showcase-arrow:hover,
.showcase-toggle:hover {
  border-color: rgba(255, 255, 255, 0.8);
  color: #ffffff;
  background: rgba(10, 14, 12, 0.86);
}

.media-showcase-pick {
  position: relative;
  display: grid;
  width: 9rem;
  min-height: 3rem;
  flex: 0 0 9rem;
  grid-template-columns: auto minmax(0, 1fr);
  justify-content: start;
  gap: 0.45rem;
  overflow: hidden;
  padding: 0.55rem 0.65rem;
  text-align: left;
}

.media-showcase-pick.is-active {
  border-color: #7be1ca;
  color: #ffffff;
  background: rgba(10, 14, 12, 0.9);
}

.media-showcase-pick-index {
  color: #7be1ca;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.media-showcase-pick-title {
  overflow: hidden;
  font-size: 0.72rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-showcase-pick::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: #7be1ca;
  content: "";
  transform: scaleX(0);
  transform-origin: left;
}

.media-showcase.is-timing .media-showcase-pick.is-active::after {
  animation: showcase-progress var(--showcase-interval) linear forwards;
}

@keyframes showcase-progress {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.media-hero {
  position: relative;
  display: flex;
  min-height: 25rem;
  height: min(58vh, 38rem);
  align-items: flex-end;
  margin-top: 0;
  overflow: hidden;
  color: var(--hero-text);
  background: #2d3430;
}

.media-hero.image-missing {
  min-height: 19rem;
  height: min(42vh, 25rem);
}

.media-hero-fallback,
.media-detail-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.18);
}

.media-hero-fallback .icon,
.media-detail-fallback .icon {
  width: 8rem;
  height: 8rem;
  stroke-width: 1;
}

.media-hero-backdrop,
.media-detail-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

[data-image-container].image-missing > [data-fallback-image] {
  display: none;
}

.media-hero-backdrop {
  object-position: center 25%;
}

.media-hero-shade,
.media-detail-shade {
  position: absolute;
  inset: 0;
  background: var(--hero-shade);
}

.media-hero-content {
  position: relative;
  z-index: 2;
  width: min(44rem, calc(100% - (2 * var(--page-gutter))));
  margin: 0 var(--page-gutter) 4rem;
}

:root[data-layout="focused"] .media-hero-content {
  margin-left: max(var(--page-gutter), calc((100% - var(--reading-width)) / 2));
}

.media-hero-content .eyebrow,
.media-detail-hero .eyebrow {
  color: #7be1ca;
}

.media-hero h1 {
  max-width: 16ch;
  margin: 0.35rem 0 0.6rem;
  font-size: 3.6rem;
  text-wrap: balance;
}

.hero-tagline {
  margin: 0 0 0.65rem;
  color: var(--hero-muted);
  font-size: 1.2rem;
  font-weight: 650;
}

.hero-summary {
  max-width: 42rem;
  margin: 0;
  color: var(--hero-muted);
  font-size: 1rem;
  line-height: 1.65;
}

.hero-actions,
.detail-actions,
.command-bar,
.form-actions,
.connector-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-top: 1.2rem;
}

.command-bar form {
  margin: 0;
}

.media-home-heading {
  width: min(var(--content-width), calc(100% - (2 * var(--page-gutter))));
  margin: 2.5rem auto;
}

.media-shelf,
.shelf-loader {
  margin-top: 2.1rem;
}

.shelf-heading {
  display: flex;
  width: min(var(--content-width), calc(100% - (2 * var(--page-gutter))));
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 auto 0.55rem;
}

.shelf-heading h2 {
  font-size: 1.2rem;
  letter-spacing: 0;
}

.shelf-heading p {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.shelf-title-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text);
}

.shelf-title-link:hover {
  color: var(--accent);
  text-decoration: none;
}

.shelf-title-chevron {
  width: 0.95rem;
  height: 0.95rem;
  color: var(--accent);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 160ms ease, transform 160ms var(--ease-out, ease);
}

.shelf-title-link:hover .shelf-title-chevron,
.shelf-title-link:focus-visible .shelf-title-chevron {
  opacity: 1;
  transform: translateX(0);
}
.home-shelves {
  display: contents;
}

.shelf-view-all {
  display: inline-flex;
  min-height: 2rem;
  align-items: center;
  gap: 0.2rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.shelf-view-all:hover {
  color: var(--accent);
  text-decoration: none;
}

.shelf-view-all .icon {
  width: 0.9rem;
  height: 0.9rem;
}

.media-rail-wrap {
  position: relative;
}

.media-rail {
  display: flex;
  align-items: stretch;
  gap: 0.55rem;
  padding: 0.4rem var(--page-gutter) 0.5rem;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-padding-inline: var(--page-gutter);
  scroll-snap-type: inline proximity;
  scrollbar-width: none;
  /* cards dissolve at the gutters instead of hard-clipping */
  -webkit-mask-image: linear-gradient(
    90deg,
    transparent,
    #000 var(--page-gutter),
    #000 calc(100% - var(--page-gutter)),
    transparent
  );
  mask-image: linear-gradient(
    90deg,
    transparent,
    #000 var(--page-gutter),
    #000 calc(100% - var(--page-gutter)),
    transparent
  );
}

.media-rail.is-auto-scrolling {
  scroll-snap-type: none;
}

.media-rail [data-rail-clone] {
  pointer-events: none;
}

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

.media-rail > * {
  scroll-snap-align: start;
}

:root[data-layout="focused"] .media-rail {
  padding-left: max(var(--page-gutter), calc((100% - var(--reading-width)) / 2));
  padding-right: max(var(--page-gutter), calc((100% - var(--reading-width)) / 2));
}

.rail-arrow {
  position: absolute;
  z-index: 8;
  top: 38%;
  display: grid;
  width: 2.6rem;
  height: 2.6rem;
  min-height: 0;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  backdrop-filter: blur(10px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity 160ms ease, border-color 160ms ease, background 160ms ease;
}
.rail-arrow[hidden] {
  display: none;
}

.rail-arrow-previous {
  left: calc(var(--page-gutter) * 0.3);
}

.rail-arrow-next {
  right: calc(var(--page-gutter) * 0.3);
}

.media-rail-wrap:hover .rail-arrow,
.media-rail-wrap:focus-within .rail-arrow {
  opacity: 1;
}

.rail-arrow:hover {
  border-color: var(--text);
  background: var(--surface);
}

@media (hover: none) {
  .rail-arrow {
    display: none;
  }
}

.media-card {
  display: grid;
  flex: 0 0 auto;
  width: clamp(8.6rem, 12vw, 10.8rem);
  min-width: 0;
  align-content: start;
  gap: 0.45rem;
  color: var(--text);
}

.media-card-art-wrap {
  position: relative;
  min-width: 0;
}

.media-card:hover {
  text-decoration: none;
}

.media-card-art {
  position: relative;
  display: block;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.24);
  transition:
    transform 260ms var(--ease-out, ease),
    border-color 160ms ease,
    box-shadow 260ms ease;
}

.media-card-art img {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-card:hover .media-card-art,
.media-card:focus-within .media-card-art {
  border-color: var(--line-strong);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.42);
  transform: translateY(-4px) scale(1.03);
}

.media-card-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  color: var(--accent);
  background: var(--surface-3);
}

.media-card-fallback .icon {
  width: 3rem;
  height: 3rem;
  stroke-width: 1.5;
}

.media-card-badges {
  position: absolute;
  right: 0.4rem;
  bottom: 0.4rem;
  left: 0.4rem;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.media-card-badges span {
  display: grid;
  width: 1.65rem;
  height: 1.65rem;
  place-items: center;
  padding: 0;
  border-radius: 3px;
  color: #ffffff;
  background: rgba(11, 15, 13, 0.82);
}

.media-card-badges .icon {
  width: 0.9rem;
  height: 0.9rem;
}

.media-card-play {
  position: absolute;
  z-index: 4;
  top: 0.5rem;
  right: 0.5rem;
  display: grid;
  width: 2.5rem;
  height: 2.5rem;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 50%;
  color: #ffffff;
  background: rgba(10, 14, 12, 0.82);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.32);
  opacity: 0;
  transition: background 150ms ease, transform 150ms ease, opacity 150ms ease;
}

.media-card-art-wrap:hover .media-card-play,
.media-card-play:focus-visible {
  opacity: 1;
}

@media (hover: none) {
  .media-card-play {
    opacity: 1;
  }
}

.media-card-play:hover {
  color: #101412;
  background: #ffffff;
  text-decoration: none;
  transform: scale(1.05);
}

.media-card-copy {
  display: grid;
  min-width: 0;
  gap: 0.18rem;
  color: var(--text);
}

.media-card-copy:hover {
  color: var(--accent);
  text-decoration: none;
}

.media-card-copy strong {
  display: -webkit-box;
  overflow: hidden;
  font-size: 0.86rem;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.media-card-copy > span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.73rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Continue-watching cards: landscape stills with progress and resume affordance. */
.media-card-wide {
  width: clamp(14.5rem, 19vw, 18rem);
}

.media-card-wide .media-card-art {
  aspect-ratio: 16 / 9;
}

.media-card-resume {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(8, 11, 10, 0.42);
  opacity: 0;
  transition: opacity 160ms ease;
}

.media-card-resume > span {
  display: grid;
  width: 2.9rem;
  height: 2.9rem;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  color: #ffffff;
  background: rgba(8, 11, 10, 0.6);
}

.media-card-wide .media-card-art-wrap:hover .media-card-resume,
.media-card-wide .media-card-art:focus-visible .media-card-resume {
  opacity: 1;
}

.media-card-progress {
  position: absolute;
  z-index: 3;
  right: 0;
  bottom: 0;
  left: 0;
  display: block;
  height: 3px;
  background: rgba(241, 244, 241, 0.24);
}

.media-card-progress b {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

/* Weekly-popular cards: ranked numeral behind the poster. */
.media-card-ranked {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  align-items: flex-end;
}

.media-rank {
  z-index: 0;
  flex: 0 0 auto;
  margin-right: -1.05rem;
  margin-bottom: 2.7rem;
  color: var(--bg);
  font-size: clamp(4.4rem, 6.5vw, 6.4rem);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.06em;
  line-height: 0.78;
  -webkit-text-stroke: 2px var(--line-strong);
  user-select: none;
  transition: -webkit-text-stroke-color 160ms ease;
}

.media-card-ranked:hover .media-rank {
  -webkit-text-stroke-color: var(--accent);
}

.media-card-ranked .media-card {
  position: relative;
  z-index: 1;
  width: clamp(7.8rem, 10.5vw, 9.8rem);
}

/* Dashed "view all" card ending a shelf. */
.media-card-more {
  display: grid;
  flex: 0 0 auto;
  width: clamp(8.6rem, 12vw, 10.8rem);
  aspect-ratio: 2 / 3;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  text-align: center;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.media-card-more > span {
  display: grid;
  gap: 0.45rem;
  justify-items: center;
}

.media-card-more .icon {
  width: 1.3rem;
  height: 1.3rem;
}

.media-card-more:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}

.media-card-more-wide {
  width: clamp(14.5rem, 19vw, 18rem);
  aspect-ratio: 16 / 9;
}

.shelf-skeletons {
  display: grid;
  grid-auto-columns: clamp(8.6rem, 12vw, 10.8rem);
  grid-auto-flow: column;
  gap: 0.55rem;
  padding: 0.4rem var(--page-gutter) 0.5rem;
  overflow: hidden;
}

.shelf-skeletons span {
  aspect-ratio: 2 / 3;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(
    100deg,
    var(--surface-2) 40%,
    var(--surface-3) 50%,
    var(--surface-2) 60%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.6s linear infinite;
}

.shelf-loader-heading {
  width: 11rem;
  height: 1.3rem;
  margin: 0 var(--page-gutter) 0.8rem;
  border-radius: 4px;
  background: var(--surface-2);
}

@keyframes skeleton-shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .shelf-skeletons span {
    animation: none;
  }
}

.catalog-shell {
  width: 100%;
  max-width: none;
  padding-top: 0;
}

.catalog-heading {
  width: min(var(--content-width), calc(100% - (2 * var(--page-gutter))));
  margin: 2rem auto 1.2rem;
}

.catalog-filters {
  position: sticky;
  z-index: 45;
  top: var(--header-height);
  display: grid;
  grid-template-columns: minmax(14rem, 2fr) repeat(3, minmax(9rem, 1fr)) auto auto auto;
  align-items: end;
  gap: 0.65rem;
  padding: 0.8rem var(--page-gutter);
  border-block: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.08);
}

.catalog-filters label {
  display: grid;
  gap: 0.3rem;
  min-width: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.filter-label,
.more-filters > summary {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.catalog-filters input,
.catalog-filters select {
  min-width: 0;
}

.more-filters {
  position: relative;
  align-self: end;
}

.more-filters > summary,
.filter-reset {
  display: inline-flex;
  min-height: 2.5rem;
  align-items: center;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--text);
  background: var(--surface-2);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  list-style: none;
  white-space: nowrap;
}

.filter-submit .icon,
.filter-reset .icon,
.more-filters > summary .icon {
  width: 0.9rem;
  height: 0.9rem;
}

.more-filters > summary::-webkit-details-marker {
  display: none;
}

.more-filters > div {
  position: absolute;
  z-index: 80;
  top: calc(100% + 0.55rem);
  right: 0;
  display: grid;
  width: min(42rem, calc(100vw - 2rem));
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.type-filter {
  position: relative;
  align-self: end;
}

.type-filter > summary {
  display: flex;
  min-width: 9rem;
  min-height: 2.5rem;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  list-style: none;
  white-space: nowrap;
}

.type-filter > summary::-webkit-details-marker {
  display: none;
}

.type-filter[open] > summary {
  border-color: var(--accent);
}

.type-filter .filter-count {
  margin-left: auto;
  padding: 0.1rem 0.4rem;
  border-radius: 5px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 0.7rem;
}

.type-filter-menu {
  position: absolute;
  z-index: 80;
  top: calc(100% + 0.55rem);
  left: 0;
  display: grid;
  width: min(32rem, calc(100vw - 2rem));
  grid-template-columns: minmax(0, 2fr) minmax(9rem, 1fr);
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.type-filter-menu fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.type-filter-menu legend {
  margin-bottom: 0.65rem;
  padding: 0;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 750;
}

.type-filter-menu fieldset > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.25rem 0.75rem;
}

.type-filter-menu fieldset > div label,
.filter-checkbox {
  display: flex;
  min-height: 2rem;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 500;
}

.type-filter-menu input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  min-height: 0;
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
}

.hierarchy-options {
  padding-left: 1rem !important;
  border-left: 1px solid var(--line) !important;
}

.filter-submit,
.filter-reset {
  margin: 0;
}

.filter-reset:hover {
  background: var(--surface-3);
  text-decoration: none;
}

.catalog-results {
  width: min(var(--content-width), calc(100% - (2 * var(--page-gutter))));
  margin: 1.25rem auto 0;
}

.catalog-result-status {
  display: flex;
  min-height: 1.5rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
  gap: 1rem 0.85rem;
}

.catalog-grid .media-card {
  width: auto;
}

.catalog-sentinel {
  display: grid;
  min-height: 8rem;
  grid-column: 1 / -1;
  place-items: center;
  align-content: center;
  gap: 0.6rem;
}

.loading-spinner {
  width: 1.6rem;
  height: 1.6rem;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spinner 700ms linear infinite;
}

@keyframes spinner {
  to { transform: rotate(360deg); }
}

.media-detail-hero {
  position: relative;
  display: grid;
  min-height: 42rem;
  align-content: end;
  margin-top: 0;
  overflow: hidden;
  color: var(--hero-text);
  background: #29302c;
}

.media-detail-hero.image-missing {
  min-height: 35rem;
}

.media-detail-backdrop {
  object-position: center 22%;
}

.detail-breadcrumbs {
  position: absolute;
  z-index: 3;
  top: 1rem;
  left: var(--page-gutter);
}

.detail-breadcrumbs a,
.detail-breadcrumbs {
  color: var(--hero-muted);
}

.detail-breadcrumbs a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.media-detail-intro {
  position: relative;
  z-index: 2;
  display: grid;
  width: min(var(--content-width), calc(100% - (2 * var(--page-gutter))));
  grid-template-columns: minmax(11rem, 15rem) minmax(0, 48rem);
  align-items: end;
  gap: 2rem;
  margin: 7rem auto 3.5rem;
}

:root[data-layout="focused"] .media-detail-intro,
:root[data-layout="focused"] .media-detail-content {
  max-width: var(--reading-width);
}

.detail-poster {
  position: relative;
  display: grid;
  width: 100%;
  aspect-ratio: 2 / 3;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: var(--radius);
  color: #7be1ca;
  background: #303834;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.4);
  font-size: 5rem;
  font-weight: 900;
}

.detail-poster-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.detail-poster-fallback .icon {
  width: 4rem;
  height: 4rem;
  stroke-width: 1.4;
}

.detail-poster img {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-title-block h1 {
  max-width: 22ch;
  margin: 0.35rem 0 0.6rem;
  font-size: 3.25rem;
  text-wrap: balance;
}

.detail-tagline {
  max-width: 48rem;
  margin: 0;
  color: var(--hero-muted);
  font-size: 1.08rem;
  font-weight: 650;
}

.detail-facts,
.tag-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.8rem;
  margin-top: 0.85rem;
}

.detail-facts span {
  color: var(--hero-muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.detail-facts .rating {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: #ffd37f;
}

.detail-facts .rating .icon {
  width: 0.8rem;
  height: 0.8rem;
  fill: currentColor;
}

.tag-list {
  gap: 0.35rem;
}

.tag-list span {
  padding: 0.18rem 0.42rem;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 4px;
  color: var(--hero-text);
  background: rgba(8, 12, 10, 0.5);
  font-size: 0.72rem;
}

.detail-summary {
  max-width: 48rem;
  margin: 1rem 0 0;
  color: var(--hero-muted);
  line-height: 1.65;
}

.detail-actions form {
  margin: 0;
}

.personal-progress {
  display: grid;
  max-width: 27rem;
  gap: 0.35rem;
  margin-top: 1.25rem;
}

.personal-progress > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.8rem;
}

.personal-progress progress {
  width: 100%;
  height: 0.45rem;
  border: 0;
  border-radius: 2px;
  overflow: hidden;
  color: #65d8be;
  background: rgba(255, 255, 255, 0.25);
}

.personal-progress progress::-webkit-progress-bar {
  background: rgba(255, 255, 255, 0.25);
}

.personal-progress progress::-webkit-progress-value {
  background: #65d8be;
}

.personal-progress progress::-moz-progress-bar {
  background: #65d8be;
}

.personal-progress small {
  color: var(--hero-muted);
}

.job-status-panel {
  display: grid;
  gap: 1rem;
}

.job-status-panel .page-heading,
.job-status-panel .data-list,
.job-status-panel .metric-grid {
  margin-bottom: 0;
}

.job-progress {
  display: grid;
  gap: 0.45rem;
}

.job-progress > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.job-progress strong {
  color: var(--text);
}

.job-progress progress {
  width: 100%;
  height: 0.55rem;
  overflow: hidden;
  border: 0;
  border-radius: 3px;
  color: var(--accent);
  background: var(--surface-3);
}

.job-progress progress::-webkit-progress-bar {
  background: var(--surface-3);
}

.job-progress progress::-webkit-progress-value,
.job-progress progress::-moz-progress-bar {
  background: var(--accent);
}

.job-counter-grid {
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
}

.job-counter-grid .metric {
  padding: 0.8rem;
}

.media-detail-content {
  display: grid;
  width: min(var(--content-width), calc(100% - (2 * var(--page-gutter))));
  min-width: 0;
  gap: 2.2rem;
  margin: 2.2rem auto 0;
}

.detail-section {
  min-width: 0;
  padding-top: 0.4rem;
}

/* Detail hero: melt into the page and clear the floating header. */
body.media-detail-page .detail-breadcrumbs {
  top: calc(var(--header-height) + 0.75rem);
}

body.media-detail-page .media-detail-shade {
  background:
    linear-gradient(90deg, rgba(7, 10, 8, 0.82) 0%, rgba(7, 10, 8, 0.45) 45%, rgba(7, 10, 8, 0.12) 80%),
    linear-gradient(0deg, var(--bg) 0%, rgba(10, 13, 12, 0.5) 18%, rgba(10, 13, 12, 0.08) 55%);
}

body.media-detail-page .media-detail-hero::before {
  position: absolute;
  z-index: 2;
  inset: 0;
  background: radial-gradient(
    120% 90% at 76% 8%,
    color-mix(in oklab, var(--ambient, #223b34) 55%, transparent),
    transparent 64%
  );
  content: "";
  mix-blend-mode: screen;
  opacity: 0.28;
  pointer-events: none;
}

.media-detail-hero .media-detail-shade,
.media-detail-hero .media-detail-intro,
.media-detail-hero .detail-breadcrumbs {
  z-index: 3;
}

.detail-title {
  transform-origin: left bottom;
}

.detail-title-logo img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(24rem, 90%);
  max-height: 7.5rem;
  object-fit: contain;
  filter: drop-shadow(0 4px 18px rgba(0, 0, 0, 0.55));
}

.detail-title-logo .detail-title-fallback {
  display: none;
}

.detail-title-logo.image-missing .detail-title-fallback,
.detail-title-logo.image-pending .detail-title-fallback {
  display: inline;
}

.detail-facts .fact-chip {
  padding: 0.05rem 0.42rem;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 4px;
  font-size: 0.72rem;
}

.detail-facts .fact-protected {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: #7be1ca;
}

.detail-facts .fact-protected .icon {
  width: 0.85rem;
  height: 0.85rem;
}

.detail-play {
  border-color: #ffffff;
  color: #101412;
  background: #ffffff;
}

.detail-play:hover {
  border-color: #dfe6e2;
  color: #101412;
  background: #dfe6e2;
}

.detail-actions .button-secondary,
.detail-trailer-button {
  border-color: rgba(255, 255, 255, 0.56);
  color: #ffffff;
  background: rgba(11, 15, 13, 0.62);
  backdrop-filter: blur(8px);
}

.detail-actions .button-secondary:hover,
.detail-trailer-button:hover {
  border-color: #ffffff;
  color: #ffffff;
  background: rgba(11, 15, 13, 0.82);
}

.detail-star.is-starred .icon {
  color: var(--amber);
  fill: currentColor;
}

/* Rails on the detail page sit on the page background below the hero. */
.detail-shelf {
  margin-top: 1.8rem;
}

.detail-shelf .shelf-heading h2 {
  font-size: 1.2rem;
}

/* Cast and creators as a horizontally scanning rail of people. */
.credit-rail {
  display: flex;
  gap: 0.55rem;
  margin-top: 1rem;
  padding-bottom: 0.4rem;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
}

.credit-card {
  display: grid;
  flex: 0 0 auto;
  width: 8.4rem;
  justify-items: center;
  gap: 0.3rem;
  padding: 0.85rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
}

.credit-avatar {
  display: grid;
  width: 3.2rem;
  height: 3.2rem;
  place-items: center;
  border-radius: 50%;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 1.3rem;
  font-weight: 800;
}

.credit-card strong {
  overflow: hidden;
  max-width: 100%;
  font-size: 0.8rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.credit-card .credit-detail {
  overflow: hidden;
  max-width: 100%;
  color: var(--muted);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Hover preview portal: one floating card, positioned by script. */
.preview-portal {
  position: fixed;
  z-index: 90;
  width: 21rem;
  max-width: calc(100vw - 2rem);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: scale(0.88);
  transform-origin: center;
  transition: opacity 160ms ease, transform 200ms var(--ease-out, ease);
  pointer-events: none;
}

.preview-portal.is-open {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.preview-art {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--surface-2);
}

.preview-art img {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-art-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--surface-3);
}

.preview-art-fallback .icon {
  width: 2.6rem;
  height: 2.6rem;
  stroke-width: 1.5;
}

.preview-body {
  display: grid;
  gap: 0.5rem;
  padding: 0.85rem 1rem 1rem;
}

.preview-title {
  font-size: 0.95rem;
  line-height: 1.3;
}

.preview-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.preview-actions form {
  margin: 0;
}

.preview-btn {
  display: grid;
  width: 2.3rem;
  height: 2.3rem;
  min-height: 0;
  place-items: center;
  padding: 0;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  color: var(--text);
  background: transparent;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.preview-btn:hover {
  border-color: var(--text);
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

.preview-btn-primary {
  border-color: #ffffff;
  color: #101412;
  background: #ffffff;
}

.preview-btn-primary:hover {
  border-color: #dfe6e2;
  background: #dfe6e2;
  color: #101412;
}

.preview-btn.is-starred {
  border-color: var(--amber);
  color: var(--amber);
}

.preview-btn.is-starred .icon {
  fill: currentColor;
}

.preview-btn-end {
  margin-left: auto;
}

.preview-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
}

.preview-chip {
  padding: 0.02rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
}

.preview-protected {
  display: inline-flex;
  color: var(--accent);
}

.preview-protected .icon {
  width: 0.85rem;
  height: 0.85rem;
}

.preview-genres {
  margin: 0;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 650;
}

.preview-summary {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

/* Inline trailer lightbox. */
.trailer-dialog {
  width: min(64rem, calc(100vw - 2rem));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--text);
  background: #0b0e0d;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
}

.trailer-dialog::backdrop {
  background: rgba(5, 7, 6, 0.82);
  backdrop-filter: blur(4px);
}

.trailer-dialog-frame {
  aspect-ratio: 16 / 9;
  background: #000000;
}

.trailer-dialog-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.trailer-dialog-close {
  position: absolute;
  z-index: 2;
  top: 0.6rem;
  right: 0.6rem;
  border-color: rgba(255, 255, 255, 0.56);
  color: #ffffff;
  background: rgba(11, 15, 13, 0.72);
}

.trailer-dialog-close:hover {
  border-color: #ffffff;
  background: rgba(11, 15, 13, 0.92);
}

/* Native lobby player: shares the trailer lightbox shell. */
.player-dialog-stage video {
  display: block;
  width: 100%;
  height: 100%;
  background: #000000;
}

.player-dialog-bar {
  display: grid;
  gap: 0.3rem;
  padding: 0.7rem 1rem 0.9rem;
  color: var(--text, #f1f4f1);
}

.player-dialog-bar strong {
  font-size: 0.95rem;
}

.player-dialog-error {
  margin: 0;
  color: var(--amber, #f2b85b);
  font-size: 0.82rem;
}

.player-dialog-error a {
  color: inherit;
  text-decoration: underline;
}

.player-dialog-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
}

.player-dialog-controls label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted, #a5aea8);
  font-size: 0.76rem;
  font-weight: 650;
}

.player-dialog-controls select {
  width: auto;
  min-height: 2.1rem;
  padding: 0.25rem 0.5rem;
  border-color: rgba(241, 244, 241, 0.25);
  color: var(--text, #f1f4f1);
  background: rgba(11, 15, 13, 0.72);
  font-size: 0.8rem;
}

.player-dialog-controls .icon-button {
  border-color: rgba(241, 244, 241, 0.3);
  color: var(--text, #f1f4f1);
  background: rgba(11, 15, 13, 0.72);
}

.player-dialog-mode {
  margin-left: auto;
  color: var(--accent, #57d4b8);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Mobile-first: the player takes the whole viewport on small screens. */
@media (max-width: 48rem) {
  .player-dialog {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
    display: flex;
    flex-direction: column;
  }

  .player-dialog .player-dialog-stage {
    flex: 1 1 auto;
    display: flex;
    aspect-ratio: auto;
    min-height: 0;
  }

  .player-dialog .player-dialog-stage video {
    object-fit: contain;
  }

  .player-dialog-bar {
    padding-bottom: max(0.9rem, env(safe-area-inset-bottom));
  }
}

.player-dialog:fullscreen {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  border: 0;
  border-radius: 0;
}

.player-dialog:fullscreen .player-dialog-stage {
  flex: 1 1 auto;
  aspect-ratio: auto;
  min-height: 0;
}

.availability-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.availability-item {
  min-height: 8rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.availability-item > div {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.7rem;
}

.availability-item p {
  margin: 1rem 0 0;
  color: var(--muted);
}

.schedule-list {
  display: grid;
  gap: 0;
  margin-top: 1rem;
  border-block: 1px solid var(--line);
}

.schedule-list article {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) minmax(12rem, auto);
  gap: 0.35rem 1rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line);
}

.schedule-list article:last-child {
  border-bottom: 0;
}

.schedule-list article > div {
  display: flex;
  gap: 0.6rem;
}

.schedule-list article > div span,
.schedule-list time {
  color: var(--muted);
}

.detail-split,
.two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2.5rem;
}

.credit-list {
  display: grid;
  margin-top: 1rem;
  border-top: 1px solid var(--line);
}

.credit-list > div {
  display: grid;
  grid-template-columns: 5.8rem minmax(8rem, 1fr) minmax(8rem, 1fr);
  gap: 0.8rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.86rem;
}

.credit-list > div > span:last-child,
.credit-role {
  color: var(--muted);
}

.data-list {
  margin: 1rem 0 0;
}

.data-list div {
  display: grid;
  grid-template-columns: minmax(7rem, 0.75fr) minmax(0, 2fr);
  gap: 1rem;
  padding: 0.62rem 0;
  border-bottom: 1px solid var(--line);
}

.data-list dt {
  color: var(--muted);
}

.data-list dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.child-list {
  display: grid;
  margin-top: 1rem;
  border-block: 1px solid var(--line);
}

.child-list a {
  display: grid;
  min-height: 3.1rem;
  grid-template-columns: 2.5rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.8rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
  color: var(--text);
}

.child-list a:last-child {
  border-bottom: 0;
}

.child-list a:hover {
  color: var(--accent);
  text-decoration: none;
}

.child-index {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.media-timeline,
.timeline {
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.media-timeline li {
  position: relative;
  margin-left: 0.35rem;
  padding: 0 0 1.25rem 1.45rem;
  border-left: 1px solid var(--line-strong);
}

.media-timeline li:last-child {
  padding-bottom: 0;
}

.timeline-marker {
  position: absolute;
  top: 0.2rem;
  left: -0.32rem;
  width: 0.58rem;
  height: 0.58rem;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--accent);
}

.media-timeline li > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.media-timeline time,
.media-timeline p {
  color: var(--muted);
  font-size: 0.8rem;
}

.media-timeline p {
  margin: 0.2rem 0 0;
}

.curation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.curation-item {
  display: grid;
  align-content: start;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.curation-item p {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.curation-item form {
  display: grid;
  gap: 0.55rem;
}

.curation-item label {
  color: var(--muted);
  font-size: 0.78rem;
}

.source-section {
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
}

.diagnostic-panel {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin-top: 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.diagnostic-panel > summary {
  padding: 0.85rem 1rem;
  cursor: pointer;
  font-weight: 700;
}

.diagnostic-panel[open] > summary {
  border-bottom: 1px solid var(--line);
}

.diagnostic-panel > :not(summary) {
  margin-right: 1rem;
  margin-left: 1rem;
}

.diagnostic-panel > .table-wrap {
  width: auto;
  max-width: calc(100% - 2rem);
}

.diagnostic-panel .table-wrap table {
  min-width: 48rem;
}

.source-records {
  display: grid;
  min-width: 0;
  gap: 0.75rem;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  color: var(--muted);
}

.card-grid,
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
}

.card,
.metric,
.workflow-panel,
.form-card,
.action-card,
.auth-panel {
  padding: 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.card-link {
  color: var(--text);
}

.card-link:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.compact {
  display: flex;
  min-height: 3.5rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 0.9rem;
}

.stack {
  display: grid;
  gap: 0.7rem;
}

.metric {
  min-height: 7rem;
}

.metric strong {
  display: block;
  font-size: 2rem;
}

.metric span {
  color: var(--muted);
}

.operator-grid {
  align-items: start;
}

.operator-grid section {
  margin-top: 0;
}

.workspace-card {
  display: grid;
  min-height: 10rem;
  align-content: space-between;
  gap: 1.2rem;
}

.workspace-card p {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.workspace-card-status {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1.2rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.workspace-card-status > span {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.workspace-card-status .icon {
  color: var(--accent);
}

.workspace-card-status strong {
  color: var(--text);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

.workspace-stat-pending .icon {
  color: var(--amber);
}

.workspace-card-watch {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.workspace-watch-figures {
  display: grid;
  gap: 0.1rem;
}

.workspace-watch-value {
  font-size: 1.35rem;
  font-weight: 750;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.workspace-watch-label {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.workspace-watch-secondary {
  color: var(--muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.workspace-sparkline {
  flex: 1 1 auto;
  max-width: 11rem;
  height: 2rem;
  min-width: 0;
}

.workspace-sparkline polyline {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.workspace-card-services {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.service-chip {
  padding: 0.16rem 0.55rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 650;
  color: var(--muted);
}

.service-chip.is-healthy {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  color: var(--accent);
}

.service-chip.is-unhealthy {
  border-color: color-mix(in srgb, var(--danger) 60%, transparent);
  color: var(--danger);
}

.service-chip.is-disabled {
  opacity: 0.5;
  border-style: dashed;
}

.form-card,
.action-card,
.form-stack {
  display: grid;
  gap: 1rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.form-grid label {
  display: grid;
  gap: 0.4rem;
  min-width: 0;
}

.library-choice-list {
  margin: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.library-choice-list legend {
  padding: 0 0.4rem;
  font-weight: 750;
}

.library-choice-list > div {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0.45rem 1rem;
}

.form-stack .library-choice-list label {
  display: flex;
  min-height: 2.5rem;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
}

.library-choice-list input {
  width: 1rem;
  height: 1rem;
  margin: 0;
}

.settings-list {
  display: grid;
  margin-top: 1.25rem;
  border-block: 1px solid var(--line);
}

.settings-row {
  display: grid;
  min-height: 4.8rem;
  grid-template-columns: 2.5rem minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--line);
}

.settings-row:last-child {
  border-bottom: 0;
}

.settings-row-icon {
  display: grid;
  width: 2.5rem;
  height: 2.5rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--accent);
  background: var(--surface-2);
}

.settings-row h2 {
  font-size: 1rem;
}

.settings-row p {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.settings-row-actions {
  display: flex;
  gap: 0.35rem;
}

.settings-row-actions form {
  margin: 0;
}

.form-stack label {
  display: grid;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.form-stack .errorlist {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--danger);
}

.portal-actions {
  margin-top: 0;
}

#workspace-action-panel:not(:empty) {
  margin-top: 1.25rem;
}

.workflow-panel {
  width: min(54rem, 100%);
}

.workflow-panel h2 {
  margin: 0.2rem 0 0;
  font-size: 1.35rem;
}

.workflow-panel fieldset {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 0;
  padding: 1rem 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.workflow-panel fieldset.library-choice-list {
  display: block;
  padding: 1rem;
  border: 1px solid var(--line);
}

.workflow-panel legend {
  padding: 0 0.65rem 0 0;
  font-weight: 700;
}

.workflow-panel fieldset label:has(textarea),
.workflow-panel fieldset label:has(select) {
  grid-column: 1 / -1;
}

.checkbox-field {
  display: flex !important;
  min-height: 2.75rem;
  align-items: center;
  gap: 0.65rem !important;
  color: var(--text) !important;
}

.checkbox-field input {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
}

.busy-label {
  min-width: 5.5rem;
  color: var(--muted);
}

.htmx-indicator {
  visibility: hidden;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  visibility: visible;
}

.connector-card {
  display: grid;
  align-content: start;
  gap: 1rem;
}

.connector-card h2 {
  margin: 0;
}

.connector-actions form {
  margin: 0;
}

.summary {
  max-width: 55rem;
  line-height: 1.65;
}

.plain-list {
  padding-left: 1.2rem;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
}

.timeline li {
  padding: 1rem 0 1rem 1.4rem;
  border-left: 2px solid var(--line);
}

.timeline li div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.timeline time {
  color: var(--muted);
}

.audit-filter {
  display: grid;
  grid-template-columns: minmax(16rem, 32rem) auto;
  align-items: end;
  justify-content: start;
  gap: 0.8rem;
}

.audit-list {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

.audit-event h2 {
  margin: 0.2rem 0 0;
  font-size: 1.15rem;
}

.audit-context {
  margin-top: 1rem;
}

.audit-context summary {
  color: var(--accent);
  cursor: pointer;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 3rem 1rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  text-align: center;
}

.error,
.error-panel {
  color: var(--danger);
}

.error-panel {
  padding: 1rem;
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  background: var(--danger-soft);
}

.auth-shell {
  display: grid;
  min-height: calc(100vh - 10rem);
  place-items: center;
  margin: 0;
}

.auth-panel {
  display: grid;
  width: min(29rem, 100%);
  gap: 1.3rem;
  padding: 1.8rem;
}

.auth-heading h1 {
  margin: 0.35rem 0 0;
  font-size: 2.1rem;
}

.auth-primary {
  justify-content: center;
}

.auth-form {
  margin: 0;
}

.auth-form button {
  width: 100%;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.auth-divider::before,
.auth-divider::after {
  width: 100%;
  height: 1px;
  background: var(--line);
  content: "";
}

code {
  overflow-wrap: anywhere;
}

.onboarding-shell {
  display: grid;
  width: min(64rem, 100%);
  gap: 2rem;
  margin: clamp(1.5rem, 6vh, 4.5rem) auto;
}

.onboarding-heading {
  max-width: 42rem;
}

.onboarding-heading h1 {
  margin: 0.3rem 0 0.45rem;
  font-size: clamp(2rem, 5vw, 3.25rem);
}

.onboarding-heading > p:last-child,
.section-heading p {
  margin: 0.25rem 0 0;
  color: var(--muted);
}

.onboarding-form {
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.onboarding-form > button,
.workspace-preference > button {
  justify-self: start;
}

.preference-fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.preference-fieldset legend {
  margin-bottom: 0.75rem;
  padding: 0;
  font-weight: 750;
}

.interest-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(8.5rem, 1fr));
  gap: 0.75rem;
}

.interest-option {
  position: relative;
  display: grid !important;
  min-width: 0;
  min-height: 8.5rem;
  grid-template-rows: 2.5rem auto;
  align-content: center;
  justify-items: start;
  gap: 0.8rem !important;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text) !important;
  background: var(--surface);
  cursor: pointer;
  transition:
    border-color 140ms ease,
    background-color 140ms ease,
    transform 140ms ease;
}

.interest-option:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
  transform: translateY(-1px);
}

.interest-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.interest-option:has(input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.interest-option > input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

.interest-option-icon {
  display: grid;
  width: 2.5rem;
  height: 2.5rem;
  place-items: center;
  border-radius: 6px;
  color: var(--accent);
  background: var(--surface-2);
}

.interest-option:has(input:checked) .interest-option-icon {
  color: var(--surface);
  background: var(--accent);
}

.interest-option-icon .icon {
  width: 1.25rem;
  height: 1.25rem;
}

.preference-fieldset .errorlist {
  margin: 0.65rem 0 0;
}

.form-field {
  display: grid;
  max-width: 30rem;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.profile-layout {
  display: grid;
  grid-template-columns: minmax(17rem, 22rem) minmax(0, 1fr);
  align-items: start;
  gap: 2.5rem;
}

.profile-layout > section {
  min-width: 0;
  margin-top: 0;
}

.profile-preference-list {
  display: grid;
  gap: 1rem;
}

.workspace-preference {
  padding: 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.workspace-preference-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--line);
}

.workspace-preference-heading h3 {
  margin: 0;
  font-size: 1.05rem;
}

.workspace-preference-heading span {
  color: var(--muted);
  font-size: 0.8rem;
}

.invite-link-section {
  display: grid;
  gap: 1rem;
  margin-top: 2.5rem;
}

.invite-link-section .two-column {
  align-items: stretch;
  gap: 1rem;
}

.invite-link-result {
  display: grid;
  min-height: 15rem;
  align-content: center;
  gap: 0.65rem;
  padding: 1.25rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.invite-link-result h3,
.invite-link-result p {
  margin: 0;
}

.invite-link-placeholder-icon {
  width: 2rem;
  height: 2rem;
  color: var(--accent);
}

.copy-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 2.5rem;
  gap: 0.5rem;
}

.copy-field input {
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.8rem;
}

.copy-field .icon-button {
  width: 2.5rem;
  height: 2.5rem;
  color: var(--text);
  background: var(--surface);
}

.form-stack small {
  color: var(--muted);
  font-size: 0.75rem;
}
@media (max-width: 68rem) {
  .site-header {
    gap: 0.75rem;
  }

  .primary-nav {
    gap: 0.75rem;
  }

  .media-view-switcher {
    max-width: 28vw;
  }

  .media-view-option {
    padding-inline: 0.5rem;
  }

  .workspace-summary-copy {
    max-width: 12rem;
  }

  .catalog-filters {
    grid-template-columns: minmax(14rem, 2fr) repeat(2, minmax(9rem, 1fr)) auto auto auto;
  }

  .catalog-filters label:nth-of-type(3) {
    display: none;
  }

  .media-detail-intro {
    grid-template-columns: 12rem minmax(0, 1fr);
  }

  .detail-title-block h1 {
    font-size: 2.75rem;
  }
}

@media (max-width: 48rem) {
  :root {
    --header-height: 3.5rem;
    --page-gutter: 1rem;
  }

  body.has-primary-nav {
    padding-bottom: calc(4rem + env(safe-area-inset-bottom));
  }

  .site-header {
    position: sticky;
    min-height: var(--header-height);
    flex-wrap: nowrap;
    gap: 0.35rem;
    padding: 0 0.7rem;
  }

  .brand {
    margin-right: auto;
    font-size: 1.05rem;
  }

  .primary-nav {
    position: fixed;
    z-index: 75;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    height: calc(4rem + env(safe-area-inset-bottom));
    align-items: stretch;
    gap: 0;
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid var(--line);
    background: var(--surface);
    box-shadow: 0 -5px 16px rgba(0, 0, 0, 0.08);
  }

  .primary-nav a {
    display: flex;
    min-width: 0;
    height: 4rem;
    flex: 1 1 0;
    flex-direction: column;
    justify-content: center;
    gap: 0.2rem;
    border: 0;
    color: var(--muted);
    font-size: 0.68rem;
  }

  .primary-nav a .icon {
    width: 1.25rem;
    height: 1.25rem;
  }

  .primary-nav a:hover,
  .primary-nav a[aria-current="page"] {
    border: 0;
    color: var(--accent);
    background: var(--accent-soft);
  }

  .header-tools {
    gap: 0.15rem;
    margin-left: 0;
  }

  .media-view-switcher {
    max-width: none;
    flex: 1 1 auto;
  }

  .media-view-option {
    min-width: 2.15rem;
    padding-inline: 0.5rem;
  }

  .media-view-option:not(.is-active) span {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .workspace-switcher > summary {
    min-height: 2.35rem;
    grid-template-columns: 0.95rem minmax(0, auto) 0.75rem;
    gap: 0.35rem;
    padding-inline: 0.4rem;
  }

  .workspace-summary-copy {
    max-width: 8rem;
  }

  .workspace-summary-copy small {
    display: none;
  }

  .workspace-menu,
  .account-menu > nav {
    position: fixed;
    top: calc(var(--header-height) + 0.4rem);
    right: 0.5rem;
    max-height: calc(100vh - var(--header-height) - 5rem);
    overflow-y: auto;
  }

  .catalog-filters {
    top: var(--header-height);
    grid-template-columns: minmax(0, 1fr) minmax(7rem, 0.55fr) auto;
    padding: 0.65rem var(--page-gutter);
  }

  .catalog-filters label:nth-of-type(2),
  .catalog-filters label:nth-of-type(3),
  .catalog-filters .filter-submit,
  .catalog-filters .filter-reset {
    display: none;
  }

  .more-filters > div {
    right: -3.1rem;
    grid-template-columns: 1fr;
  }
  .type-filter-menu {
    position: fixed;
    top: calc(var(--header-height) + 4.4rem);
    right: 1rem;
    left: 1rem;
    width: auto;
    max-height: calc(100svh - var(--header-height) - 6rem);
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .hierarchy-options {
    padding-top: 0.8rem !important;
    padding-left: 0 !important;
    border-top: 1px solid var(--line) !important;
    border-left: 0 !important;
  }

  h1 {
    font-size: 2.1rem;
  }

  .media-showcase {
    height: calc(100svh - 6.5rem);
    min-height: 29rem;
  }

  .media-showcase-content {
    bottom: 5.8rem;
    width: calc(100% - (2 * var(--page-gutter)));
  }

  .media-showcase h1 {
    font-size: 2.25rem;
  }

  .media-showcase .hero-tagline {
    display: none;
  }

  .media-showcase .hero-summary {
    -webkit-line-clamp: 2;
  }

  .media-showcase .hero-actions {
    margin-top: 0.85rem;
  }

  .media-showcase-controls {
    bottom: 0.7rem;
    gap: 0.3rem;
  }

  .media-showcase-pick {
    width: 3rem;
    min-height: 2.75rem;
    flex-basis: 3rem;
    grid-template-columns: 1fr;
    justify-items: center;
    padding: 0.45rem;
  }

  .media-showcase-pick-title {
    display: none;
  }

  .media-hero {
    min-height: 22rem;
    height: min(52vh, 26rem);
  }

  .media-hero.image-missing {
    min-height: 18rem;
    height: min(40vh, 21rem);
  }

  .media-hero h1 {
    font-size: 2.25rem;
  }

  .media-hero-content {
    margin-bottom: 2rem;
  }

  .hero-summary {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
  }

  .shelf-heading p {
    display: none;
  }

  .media-card,
  .media-card-more {
    width: 8.8rem;
  }

  .media-card-wide,
  .media-card-more-wide {
    width: 14rem;
  }

  .media-card-ranked .media-card {
    width: 7.6rem;
  }

  .media-rank {
    font-size: 4rem;
    margin-right: -0.8rem;
  }

  .shelf-skeletons {
    grid-auto-columns: 8.8rem;
  }

  .catalog-grid {
    grid-template-columns: repeat(auto-fill, minmax(8.8rem, 1fr));
    gap: 0.85rem 0.65rem;
  }

  .media-detail-hero {
    min-height: 0;
  }

  .media-detail-hero.image-missing {
    min-height: 31rem;
  }

  .detail-breadcrumbs {
    top: 0.8rem;
  }

  .media-detail-intro {
    grid-template-columns: 8.5rem minmax(0, 1fr);
    align-items: end;
    gap: 1rem;
    margin-top: 13rem;
    margin-bottom: 2rem;
  }

  .detail-title-block h1 {
    font-size: 2rem;
  }

  .detail-tagline,
  .detail-summary,
  .detail-title-block .tag-list {
    display: none;
  }

  .detail-facts {
    gap: 0.35rem 0.65rem;
  }

  .detail-actions {
    margin-top: 0.7rem;
  }

  .personal-progress {
    grid-column: 1 / -1;
  }

  .detail-split,
  .two-column,
  .curation-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .profile-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .interest-grid {
    grid-template-columns: repeat(2, minmax(8.5rem, 1fr));
  }

  .onboarding-shell {
    margin-block: 1.5rem;
  }

  .invite-link-section .two-column {
    gap: 1rem;
  }

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

  .credit-list > div {
    grid-template-columns: 4.8rem minmax(0, 1fr);
  }

  .credit-list > div > span:last-child {
    grid-column: 2;
  }

  .workflow-panel fieldset {
    grid-template-columns: 1fr;
  }

  .workflow-panel fieldset label {
    grid-column: 1;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .settings-row {
    grid-template-columns: 2.5rem minmax(0, 1fr) auto;
    gap: 0.7rem;
  }

  .settings-row > .status {
    grid-column: 2;
    grid-row: 2;
  }

  .settings-row-actions {
    grid-column: 3;
    grid-row: 1 / span 2;
  }

  .auth-panel {
    padding: 1.2rem;
  }
}

@media (max-width: 30rem) {
  [data-layout-toggle] {
    display: none;
  }

  .brand span {
    display: none;
  }

  .brand .icon {
    display: block;
  }

  .workspace-switcher > summary {
    grid-template-columns: 0.95rem 0.75rem;
  }

  .workspace-summary-copy {
    display: none;
  }

  .media-view-option.is-active span {
    max-width: 5rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .catalog-filters {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .catalog-filters label:nth-of-type(2) {
    display: none;
  }

  .type-filter > summary {
    min-width: 0;
  }

  .type-filter .filter-label > span,
  .type-filter .summary-chevron {
    display: none;
  }

  .media-detail-intro {
    grid-template-columns: 6.8rem minmax(0, 1fr);
  }

  .detail-title-block h1 {
    font-size: 1.7rem;
  }

  .detail-actions .button-link {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ---------- Request center ---------- */
.requests-shell {
  width: min(var(--content-width), calc(100% - (2 * var(--page-gutter))));
  margin: 0 auto;
  padding: calc(var(--header-height) + 2rem) 0 5rem;
  display: grid;
  gap: 2.4rem;
}

.requests-heading h1 {
  margin: 0.3rem 0 0;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  letter-spacing: -0.01em;
}

.request-search-panel {
  display: grid;
  gap: 1.2rem;
}

.request-search-input {
  min-height: 3.2rem;
  padding: 0.8rem 1.1rem;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  font-size: 1.05rem;
}

.request-search-input:focus-visible {
  border-color: var(--accent);
}

.request-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 0.8rem;
}

.request-result {
  display: grid;
  grid-template-columns: 5.2rem minmax(0, 1fr);
  gap: 0.8rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.request-result-art {
  display: grid;
  aspect-ratio: 2 / 3;
  place-items: center;
  overflow: hidden;
  border-radius: 6px;
  color: var(--accent);
  background: var(--surface-2);
}

.request-result-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.request-result-body {
  display: grid;
  align-content: start;
  gap: 0.3rem;
  min-width: 0;
}

.request-result-body strong {
  font-size: 0.95rem;
  line-height: 1.3;
}

.request-result-meta {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 650;
}

.request-result-body p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.request-result-body form {
  margin-top: 0.2rem;
}

.request-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  width: fit-content;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 750;
}

.request-chip .icon {
  width: 0.8rem;
  height: 0.8rem;
}

.chip-available {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.chip-progress {
  border-color: var(--amber);
  color: var(--amber);
  background: var(--amber-soft);
}

.chip-pending {
  color: var(--muted);
}

.chip-parent {
  border-color: color-mix(in srgb, var(--amber) 70%, transparent);
  color: var(--amber);
  background: var(--amber-soft);
}

.request-safeguard {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.35rem 0 0;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  font-size: 0.78rem;
}

.request-safeguard .icon {
  width: 0.9rem;
  height: 0.9rem;
  flex-shrink: 0;
}

.request-safeguard.is-allow {
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  color: var(--accent);
}

.request-safeguard.is-needs_parent {
  border-color: color-mix(in srgb, var(--amber) 70%, transparent);
  color: var(--amber);
}

.request-safeguard.is-block {
  border-color: var(--danger);
  color: var(--danger);
}

.audience-form {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.audience-form input[type="number"] {
  width: 4.2rem;
  padding: 0.25rem 0.45rem;
  font-size: 0.82rem;
}

.chip-declined {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-soft);
}

.request-error {
  margin: 0;
  color: var(--amber);
  font-size: 0.85rem;
}

.request-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.8rem 0;
}

.request-filter {
  min-height: 2.1rem;
  padding: 0.3rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font-size: 0.8rem;
  font-weight: 700;
}

.request-filter:hover {
  border-color: var(--text);
  color: var(--text);
  background: transparent;
}

.request-filter.is-active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.request-rows {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.request-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.8rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}

.request-row-main {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.request-row-main strong {
  overflow: hidden;
  font-size: 0.92rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.request-row-meta {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.request-row-actions {
  display: flex;
  gap: 0.4rem;
}

.request-row-actions button {
  min-height: 2rem;
  padding: 0.3rem 0.7rem;
  font-size: 0.76rem;
}

/* Delivery pipeline: funnel summary + per-request stepper. */
.pipeline-funnel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.4rem;
}

.pipeline-funnel-stage {
  display: grid;
  min-width: 5.6rem;
  justify-items: center;
  gap: 0.1rem;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.pipeline-funnel-stage strong {
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}

.pipeline-funnel-stage span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pipeline-funnel-stage.is-empty strong {
  color: var(--faint, var(--muted));
}

.pipeline-funnel-stage.stage-delivered {
  border-color: var(--accent);
}

.pipeline-funnel-stage.stage-delivered strong {
  color: var(--accent);
}

.pipeline-funnel-arrow {
  color: var(--muted);
  font-size: 1.1rem;
}

.pipeline-rows {
  display: grid;
  gap: 0.7rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pipeline-row {
  display: grid;
  gap: 0.7rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.pipeline-row.stage-delivered {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}

.pipeline-row-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.pipeline-steps {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
}

.pipeline-step {
  display: flex;
  flex: 1 1 0;
  min-width: 5rem;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  position: relative;
}

.pipeline-step:not(:first-child)::before {
  position: absolute;
  top: 0.42rem;
  right: 50%;
  left: -50%;
  height: 2px;
  background: var(--line-strong);
  content: "";
}

.pipeline-step.is-done:not(:first-child)::before,
.pipeline-step.is-active:not(:first-child)::before {
  background: var(--accent);
}

.pipeline-step-dot {
  z-index: 1;
  width: 0.9rem;
  height: 0.9rem;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
}

.pipeline-step.is-done .pipeline-step-dot {
  border-color: var(--accent);
  background: var(--accent);
}

.pipeline-step.is-active .pipeline-step-dot {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent);
}

.pipeline-step.is-failed .pipeline-step-dot {
  border-color: var(--danger);
  background: var(--danger);
}

.pipeline-step-label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.pipeline-step.is-active .pipeline-step-label,
.pipeline-step.is-done .pipeline-step-label {
  color: var(--text);
}

.pipeline-download {
  display: grid;
  gap: 0.25rem;
}

.pipeline-download progress {
  width: 100%;
  height: 0.5rem;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-3);
  accent-color: var(--accent);
}

.pipeline-download-meta {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.pipeline-download-title {
  overflow: hidden;
  color: var(--faint, var(--muted));
  font-size: 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 48rem) {
  .request-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .request-row-actions {
    justify-content: flex-start;
  }
}

/* Request center: source toggles and YouTube results. */
.request-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.request-source {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.request-source:has(input:checked) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.request-source input {
  width: auto;
  min-height: 0;
  margin: 0;
  accent-color: var(--accent);
}

.request-source-heading {
  margin: 1.4rem 0 0.6rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.request-result-art-wide {
  aspect-ratio: 16 / 9;
  align-self: start;
}

.request-result-youtube {
  grid-template-columns: 8.4rem minmax(0, 1fr);
}

.pipeline-row.download-error {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--line));
}

/* Request enrichment: ratings, posters, external lookups. */
.request-rating {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  color: var(--amber, #f2b85b);
}

.request-rating .icon {
  width: 0.75rem;
  height: 0.75rem;
  fill: currentColor;
}

.request-result-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 0.15rem;
}

.request-result-links a {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
}

.request-result-links a:hover {
  color: var(--accent);
}

.request-row {
  grid-template-columns: 3.4rem minmax(0, 1fr) auto auto;
}

.request-row-poster {
  display: grid;
  width: 3.4rem;
  aspect-ratio: 2 / 3;
  place-items: center;
  overflow: hidden;
  border-radius: 5px;
  color: var(--muted);
  background: var(--surface-2);
}

.request-row-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.request-row-main strong {
  white-space: normal;
}

.request-row-overview {
  display: -webkit-box;
  overflow: hidden;
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

@media (max-width: 48rem) {
  .request-row {
    grid-template-columns: 3.4rem minmax(0, 1fr);
  }
}

/* Request detail: expandable panel with the delivery flow diagram. */
.request-row-expand {
  display: grid;
  width: 2.2rem;
  height: 2.2rem;
  min-height: 0;
  place-items: center;
  align-self: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  transition: border-color 160ms ease, color 160ms ease, transform 200ms ease;
}

.request-row-expand:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: transparent;
}

.request-row:has(.request-row-detail:not(:empty)) .request-row-expand {
  color: var(--accent);
  border-color: var(--accent);
  transform: rotate(180deg);
}

.request-row {
  grid-template-columns: 2.2rem 3.4rem minmax(0, 1fr) auto;
}

.request-row-detail {
  grid-column: 1 / -1;
}

.request-row-detail:not(:empty) {
  margin-top: 0.8rem;
}

.request-detail {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
}

.request-detail-backdrop {
  position: absolute;
  inset: 0;
  background-position: center 22%;
  background-size: cover;
  opacity: 0.2;
  -webkit-mask-image: linear-gradient(180deg, #000, transparent 85%);
  mask-image: linear-gradient(180deg, #000, transparent 85%);
  pointer-events: none;
}

.request-detail-body {
  position: relative;
  display: grid;
  grid-template-columns: 6.4rem minmax(0, 1fr);
  gap: 1.1rem;
  padding: 1.2rem 1.3rem 0.6rem;
}

.request-detail-poster {
  display: grid;
  aspect-ratio: 2 / 3;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-2);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}

.request-detail-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.request-detail-main {
  display: grid;
  align-content: start;
  gap: 0.35rem;
  min-width: 0;
}

.request-detail-main h3 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.request-detail-meta,
.request-detail-requester {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 650;
}

.request-detail-overview {
  display: -webkit-box;
  overflow: hidden;
  margin: 0.25rem 0 0;
  color: var(--text);
  font-size: 0.86rem;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

/* The delivery flow diagram. */
.flow {
  position: relative;
  display: flex;
  align-items: flex-start;
  padding: 1.4rem 1.3rem 1.1rem;
  overflow-x: auto;
}

.flow-stage {
  display: flex;
  flex: 0 0 auto;
  min-width: 5.4rem;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.flow-node {
  position: relative;
  display: grid;
  width: 2.8rem;
  height: 2.8rem;
  place-items: center;
}

.flow-node-icon {
  display: grid;
  width: 2.3rem;
  height: 2.3rem;
  place-items: center;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  color: var(--muted);
  background: var(--surface-2);
  transition: border-color 200ms ease, color 200ms ease, background 200ms ease;
}

.flow-node-icon .icon {
  width: 1rem;
  height: 1rem;
}

.flow-stage.is-done .flow-node-icon {
  border-color: var(--accent);
  color: var(--surface);
  background: var(--accent);
}

.flow-stage.is-active .flow-node-icon {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 18%, transparent);
  animation: flow-pulse 2.2s ease-in-out infinite;
}

.flow-stage.is-failed .flow-node-icon {
  border-color: var(--danger);
  color: #ffffff;
  background: var(--danger);
}

@keyframes flow-pulse {
  50% { box-shadow: 0 0 0 9px color-mix(in srgb, var(--accent) 8%, transparent); }
}

.flow-ring {
  position: absolute;
  inset: -0.25rem;
  border-radius: 50%;
  background: conic-gradient(
    var(--accent) calc(var(--flow-progress, 0) * 1%),
    color-mix(in srgb, var(--accent) 18%, transparent) 0
  );
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
}

.flow-label {
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.flow-stage.is-todo .flow-label {
  color: var(--faint, var(--muted));
  font-weight: 650;
}

.flow-sublabel {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.flow-link {
  color: var(--accent);
}

.flow-connector {
  position: relative;
  flex: 1 1 2.5rem;
  min-width: 1.6rem;
  height: 2px;
  margin-top: 1.4rem;
  overflow: hidden;
  background: var(--line);
  border-radius: 2px;
}

.flow-connector.is-done {
  background: var(--accent);
}

.flow-connector.is-active::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--accent) 40%, transparent 60%);
  background-size: 200% 100%;
  content: "";
  animation: flow-march 1.4s linear infinite;
}

@keyframes flow-march {
  from { background-position: 200% 0; }
  to { background-position: 0% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .flow-stage.is-active .flow-node-icon,
  .flow-connector.is-active::after {
    animation: none;
  }
}

.request-detail-download-title {
  margin: -0.4rem 0 0;
  padding: 0 1.3rem 1rem;
  color: var(--faint, var(--muted));
  font-size: 0.72rem;
}

.deep-search-container {
  display: grid;
  gap: 0.6rem;
}

.deep-search-trigger {
  width: fit-content;
}

.deep-search-summary {
  margin: 0;
  font-size: 0.85rem;
}

.deep-search-results {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.deep-search-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
}

.deep-search-row.is-grabbed {
  border-color: var(--accent);
}

.deep-search-main {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.deep-search-meta {
  color: var(--muted);
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.request-detail-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0 1.3rem 1.2rem;
}

.request-detail-actions button {
  min-height: 2.2rem;
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
}

@media (max-width: 48rem) {
  .request-row {
    grid-template-columns: 2.2rem 3.4rem minmax(0, 1fr);
  }

  .request-detail-body {
    grid-template-columns: 4.8rem minmax(0, 1fr);
    padding: 1rem 1rem 0.5rem;
  }
}
