/* ============================================================================
 * Mantle TV — Neo-Bauhaus / Swiss Minimalist Industrial Design Tokens
 * Strictly enforces PROJECT_RULES.md Section 5 (Mandatory Three-State Color System)
 * ZERO arbitrary hex colors, ZERO 1px borders, ZERO heavy drop shadows.
 * ============================================================================ */

:root,
body.theme-light {
  /* Main Theme — Daylight Browse (`theme-light`) */
  --bg-canvas: #FFFFFB;
  --ink-primary: #000000;
  --accent-red: #DF1515;
  --surface-1: #EEEDE9;
  --surface-2: #EEEDE9;
  --surface-3: rgba(0, 0, 0, 0.56);
  --surface-4: rgba(0, 0, 0, 0.42);

  /* Editorial Palette (`palette-editorial` — strictly restricted to curated covers/badges/posters) */
  --ed-red: #DF1515;
  --ed-black: #000000;
  --ed-sage: #A4C2B6;
  --ed-camel: #B2966F;
  --ed-silver: #B2B2B2;
  --ed-orange: #FF6400;
  --ed-olive: #738F66;
  --ed-mustard: #EDEC80;

  /* Geometry & Radii */
  --radius-card-lg: 24px;
  --radius-card-md: 18px;
  --radius-pill: 999px;
}

body.theme-theater {
  /* Theater Theme — Dark Cinema (`theme-theater` — zero light bleed) */
  --bg-canvas: #000000;
  --ink-primary: #FFFFFB;
  --accent-red: #DF1515;
  --surface-1: #EEEDE9;
  --surface-2: #EEEDE9;
  --surface-3: rgba(255, 255, 251, 0.65);
  --surface-4: rgba(255, 255, 251, 0.48);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-canvas);
  color: var(--ink-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Inter", "PingFang SC", "Hiragino Sans GB", sans-serif;
  min-height: 100vh;
  transition: background-color 0.36s cubic-bezier(0.22, 1, 0.36, 1),
              color 0.36s cubic-bezier(0.22, 1, 0.36, 1);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* App Shell Layout */
.app-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px 40px 88px;
}

/* Top Navigation Chrome */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 36px;
  flex-wrap: wrap;
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
}

/* Semicircle Dome Brand Mark */
.brand-dome {
  width: 40px;
  height: 20px;
  background-color: var(--accent-red);
  border-radius: 40px 40px 0 0;
  flex-shrink: 0;
}

.brand-name {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.045em;
  line-height: 1;
}

.brand-tagline {
  font-size: 12px;
  font-weight: 700;
  color: var(--surface-3);
  margin-top: 3px;
}

/* Pillar Navigation Pills */
.pillar-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--surface-1);
  padding: 6px;
  border-radius: var(--radius-pill);
}

body.theme-theater .pillar-tabs {
  background-color: #EEEDE9;
}

.pillar-tab {
  border: none;
  background: transparent;
  color: #000000;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.01em;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.pillar-tab.active {
  background-color: var(--accent-red);
  color: #FFFFFB;
}

/* Search & Guest Status Right Cluster */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-box {
  display: flex;
  align-items: center;
  background-color: var(--surface-1);
  border-radius: var(--radius-pill);
  padding: 4px 6px 4px 16px;
  min-width: 280px;
}

.search-box input {
  border: none;
  background: transparent;
  color: #000000;
  font-size: 13px;
  font-weight: 700;
  width: 100%;
  outline: none;
}

.search-box input::placeholder {
  color: rgba(0, 0, 0, 0.45);
}

.btn-pill {
  border: none;
  border-radius: var(--radius-pill);
  padding: 9px 16px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -0.01em;
  cursor: pointer;
  background-color: var(--ink-primary);
  color: var(--bg-canvas);
  white-space: nowrap;
}

.btn-pill.accent {
  background-color: var(--accent-red);
  color: #FFFFFB;
}

.btn-pill.stone {
  background-color: var(--surface-2);
  color: #000000;
}

/* Section Headers */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 36px 0 18px;
  gap: 16px;
}

.section-title {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.035em;
}

.section-subtitle {
  font-size: 13px;
  font-weight: 700;
  color: var(--surface-3);
}

/* Neo-Bauhaus Solid Color-Block Skeleton Loader (Rule 6.2) */
@keyframes pulseSurface {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.skeleton-block {
  background-color: var(--surface-1);
  border-radius: var(--radius-card-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulseSurface 1.5s ease-in-out infinite;
}

.skeleton-block.poster-skeleton {
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-card-md);
}

/* Editorial Curated Collection Cards (Poster Collage + Title Below) */
.editorial-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

@media (max-width: 960px) {
  .editorial-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .editorial-grid {
    grid-template-columns: 1fr;
  }
}

.collage-strips {
  aspect-ratio: 16 / 10;
  width: 100%;
  display: flex;
  overflow: hidden;
  position: relative;
  background-color: var(--surface-2);
}

.collage-strip {
  flex: 1;
  min-width: 0;
  height: 100%;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: 6px 4px;
}

.collage-strip img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  z-index: 2;
}

.collage-strip-fallback {
  position: relative;
  z-index: 1;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.15;
  color: #000000;
  writing-mode: vertical-rl;
  letter-spacing: 0.04em;
  opacity: 0.72;
}

.editorial-card {
  border-radius: var(--radius-card-lg);
  padding: 26px;
  min-height: 224px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.22s ease;
}

.editorial-card:hover {
  transform: translateY(-4px);
}

.editorial-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: -0.01em;
  position: relative;
  z-index: 2;
  padding-top: 12px;
}

.editorial-card.stacked-folder::before {
  content: "";
  position: absolute;
  top: 0;
  right: 28px;
  width: 88px;
  height: 14px;
  background-color: #000000;
  border-radius: 0 0 12px 12px;
}

.editorial-card.semicircle-dome::after {
  content: "";
  position: absolute;
  bottom: -36px;
  right: -18px;
  width: 96px;
  height: 96px;
  background-color: var(--accent-red);
  border-radius: 96px;
  opacity: 0.9;
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background-color: #000000;
  color: #FFFFFB;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  width: fit-content;
  margin-bottom: 14px;
}

.badge-pill.red {
  background-color: var(--accent-red);
  color: #FFFFFB;
}

.editorial-title {
  font-size: 21px;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.22;
  margin-bottom: 10px;
}

.editorial-lead {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 18px;
}

.editorial-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  position: relative;
  z-index: 2;
}

.editorial-chip {
  border: none;
  border-radius: var(--radius-pill);
  padding: 7px 13px;
  background-color: #000000;
  color: #FFFFFB;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.editorial-chip:hover {
  background-color: var(--accent-red);
}

/* Poster Cards Grid (5-column desktop sweet spot + responsive fallback) */
.poster-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 20px;
}

@media (max-width: 1100px) {
  .poster-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .poster-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 540px) {
  .poster-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.poster-card {
  background-color: var(--surface-1);
  color: #000000;
  border-radius: var(--radius-card-md);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease;
  display: flex;
  flex-direction: column;
}

.poster-card:hover {
  transform: translateY(-4px);
}

.poster-visual {
  aspect-ratio: 2 / 3;
  width: 100%;
  background-color: var(--surface-1);
  background-size: cover;
  background-position: center;
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.poster-fallback-logo {
  width: 48%;
  max-width: 112px;
  height: auto;
  color: var(--ed-silver);
  pointer-events: none;
  position: relative;
  z-index: 1;
  display: block;
}

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

.poster-info {
  padding: 12px 14px 16px;
  position: relative;
  background-color: var(--surface-1);
  background-image: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.11) 0%,
    rgba(0, 0, 0, 0.11) var(--watch-progress, 0%),
    transparent var(--watch-progress, 0%),
    transparent 100%
  );
  transition: background-color 0.2s ease, color 0.2s ease;
}

.poster-info::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  height: 3px;
  width: var(--watch-progress, 0%);
  background-color: var(--accent-red);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.poster-info.no-progress {
  background-image: none;
}

.poster-info.no-progress::before {
  display: none;
}

.poster-card:hover .poster-info::before {
  opacity: 1;
}

/* Up-Next Poster Grid: always show watch progress bar without hover */
.up-next-poster-grid .poster-info::before {
  opacity: 1;
}

/* Quick Watch Management Pill (Swiss Minimalist Pill, Appears on Hover) */
.quick-watch-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 6;
  height: 26px;
  padding: 0 11px;
  border-radius: var(--radius-pill);
  border: none;
  background-color: #000000;
  color: #FFFFFB;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 0.18s ease, transform 0.18s ease, background-color 0.18s ease;
}

.poster-card:hover .quick-watch-btn {
  opacity: 1;
  transform: translateY(0);
}

.quick-watch-btn:hover {
  background-color: var(--accent-red);
}

.quick-watch-btn.is-watched {
  background-color: var(--accent-red);
  color: #FFFFFB;
}

.poster-info.is-watched {
  background-color: #000000;
  background-image: none;
  color: #FFFFFB;
}

.poster-info.is-watched .poster-meta-row {
  color: rgba(255, 255, 251, 0.72);
}

.poster-name {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: -0.025em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.poster-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: var(--surface-3);
}

/* Pillar 2: Unified Title Detail Hub (Follows active Daylight / Theater theme) */
.detail-hub {
  background-color: var(--bg-canvas);
  color: var(--ink-primary);
  border-radius: var(--radius-card-lg);
  padding: 20px 0;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 36px;
  align-items: stretch;
}

.detail-left-col {
  position: relative;
  min-width: 0;
}

.detail-left-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.detail-right-col {
  min-width: 0;
  min-height: 540px;
  display: flex;
  flex-direction: column;
}

.detail-awards-box {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
  padding: 16px 18px;
  border-radius: 18px;
  background: #EEEDE9;
  color: #000000;
  overflow: hidden;
}

.detail-awards-scroll {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.detail-collections-section {
  grid-column: 1 / -1;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

body.theme-theater .detail-collections-section {
  border-top-color: rgba(255, 255, 251, 0.14);
}

@media (max-width: 820px) {
  .detail-hub {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .detail-left-inner {
    position: static;
  }
  .detail-right-col {
    min-height: 0;
  }
  .detail-awards-scroll {
    max-height: 240px;
  }
}

.seg-switch {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: var(--radius-pill);
  background-color: var(--surface-1);
  gap: 2px;
  flex-shrink: 0;
}

.seg-switch-btn {
  border: none;
  border-radius: var(--radius-pill);
  padding: 5px 13px;
  background-color: transparent;
  color: #000000;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease;
  white-space: nowrap;
}

.seg-switch-btn.active {
  background-color: #000000;
  color: #FFFFFB;
}

.detail-ratings-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 18px 0;
}

.rating-card {
  background-color: var(--surface-1);
  color: #000000;
  padding: 12px 18px;
  border-radius: var(--radius-card-md);
  min-width: 110px;
}

.rating-source {
  font-size: 11px;
  font-weight: 800;
  color: rgba(0, 0, 0, 0.56);
}

.rating-number {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.04em;
  margin-top: 2px;
}

/* Decision Zone: Step 1 Select Edition -> Step 2 Play */
.decision-zone {
  background-color: var(--surface-1);
  color: #000000;
  border-radius: var(--radius-card-lg);
  padding: 24px;
  margin-top: 22px;
}

.edition-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0 18px;
}

.edition-pill {
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  background-color: #FFFFFB;
  color: #000000;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.edition-pill.active {
  background-color: #000000;
  color: #FFFFFB;
}

/* Pillar 3: Immersive Player Surface (Pure Cinema Black) */
.player-stage {
  background-color: #000000;
  color: #FFFFFB;
  border-radius: var(--radius-card-lg);
  min-height: 540px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 28px 32px;
  position: relative;
}

.player-viewport {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px 20px;
  gap: 16px;
}

.player-pipeline-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.player-pipeline-pills {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.player-video-el {
  width: 100%;
  max-height: 400px;
  border-radius: var(--radius-card-md);
  background-color: #000000;
  display: none;
}

.player-video-el.active {
  display: block;
}

html.native-video-active,
body.native-video-active {
  background-color: transparent !important;
  transition: none !important;
}

body.player-immersive-mode .top-nav,
body.player-immersive-mode .player-top-title-group,
body.player-immersive-mode #player-pipeline-strip,
body.player-immersive-mode #custom-stream-bar {
  display: none !important;
}

body.player-immersive-mode .app-shell {
  max-width: 100%;
  padding: 12px 20px 14px;
}

body.player-immersive-mode .player-stage {
  position: relative;
  height: calc(100vh - 26px);
  min-height: calc(100vh - 26px);
  padding: 0;
  overflow: hidden;
}

body.player-immersive-mode .player-viewport {
  width: 100%;
  height: 100%;
  min-height: 100%;
}

body.player-immersive-mode .player-top-bar {
  position: absolute;
  top: 14px;
  left: 18px;
  right: 18px;
  z-index: 30;
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.28s ease;
}

body.player-immersive-mode .player-top-bar button {
  pointer-events: auto;
}

body.player-immersive-mode .player-controls-dock {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 14px;
  z-index: 30;
  transition: opacity 0.28s ease, transform 0.28s ease;
}

body.native-video-active .app-shell {
  max-width: 100%;
  padding: 12px 20px 14px;
}

body.native-video-active .top-nav {
  margin-bottom: 12px;
}

body.native-video-active .player-stage {
  background-color: transparent;
  padding: 0;
  height: calc(100vh - 26px);
  min-height: calc(100vh - 26px);
}

body.native-video-active .player-viewport {
  background-color: transparent;
  flex: 1;
  min-height: 0;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-card-md);
  box-shadow: 0 0 0 9999px #000000;
  position: relative;
  z-index: 1;
  justify-content: center;
  padding-bottom: 0;
}

body.native-video-active #player-subtitle-box {
  display: none !important;
}

body.native-video-active .player-controls-bar {
  flex-shrink: 0;
  padding: 12px 18px;
  gap: 8px;
}

body.theater-window-fullscreen .top-nav,
body.theater-window-fullscreen .player-stage > :first-child,
body.theater-window-fullscreen #player-pipeline-strip,
body.theater-window-fullscreen #custom-stream-bar {
  display: none !important;
}

body.theater-window-fullscreen .app-shell {
  padding: 0 !important;
  max-width: 100% !important;
}

body.theater-window-fullscreen .player-stage {
  padding: 0 !important;
  height: 100vh !important;
  min-height: 100vh !important;
  border-radius: 0 !important;
}

body.theater-window-fullscreen .player-viewport {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  min-height: 100vh !important;
  border-radius: 0 !important;
  padding-bottom: 0 !important;
}

body.theater-window-fullscreen .player-controls-dock {
  position: fixed !important;
  left: 24px;
  right: 24px;
  bottom: 18px;
  z-index: 30 !important;
  transition: opacity 0.28s ease, transform 0.28s ease;
}

body.player-immersive-mode.theater-controls-hidden,
body.theater-window-fullscreen.theater-controls-hidden {
  cursor: none;
}

body.player-immersive-mode.theater-controls-hidden .player-top-bar {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px);
}

body.player-immersive-mode.theater-controls-hidden .player-top-bar button {
  pointer-events: none;
}

body.player-immersive-mode.theater-controls-hidden .player-controls-dock,
body.theater-window-fullscreen.theater-controls-hidden .player-controls-dock {
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px);
}

body.native-video-active .top-nav,
body.native-video-active .player-stage > :not(.player-viewport):not(.player-controls-dock):not(.player-top-bar) {
  position: relative;
  z-index: 2;
}

body.native-video-active .player-controls-dock {
  position: absolute;
  z-index: 30;
}

.player-seek-toast {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  background: rgba(16, 16, 16, 0.84);
  color: #FFFFFB;
  border: 1px solid rgba(255, 255, 251, 0.16);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 35;
  white-space: nowrap;
}

.player-seek-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.player-subtitle-box {
  padding: 12px 20px;
  border-radius: var(--radius-card-md);
  background-color: rgba(255, 255, 251, 0.06);
  max-width: 760px;
}

.player-subtitle-box.size-standard .sub-zh { font-size: 18px; }
.player-subtitle-box.size-standard .sub-en { font-size: 13px; }
.player-subtitle-box.size-large .sub-zh { font-size: 22px; }
.player-subtitle-box.size-large .sub-en { font-size: 15px; }
.player-subtitle-box.size-xlarge .sub-zh { font-size: 26px; }
.player-subtitle-box.size-xlarge .sub-en { font-size: 17px; }

.sub-zh {
  font-weight: 800;
  color: #FFFFFB;
  line-height: 1.4;
}

.sub-en {
  font-weight: 600;
  color: #EEEDE9;
  margin-top: 4px;
  line-height: 1.4;
}

.player-error-card {
  background-color: #EEEDE9;
  color: #000000;
  border-radius: var(--radius-card-md);
  padding: 22px 26px;
  max-width: 540px;
  text-align: left;
}

.volume-slider {
  width: 84px;
  accent-color: var(--accent-red);
  cursor: pointer;
}

.player-controls-bar {
  background-color: #EEEDE9;
  color: #000000;
  border-radius: var(--radius-card-md);
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.progress-track {
  width: 100%;
  height: 8px;
  background-color: #FFFFFB;
  border-radius: var(--radius-pill);
  overflow: hidden;
  cursor: pointer;
}

.progress-fill {
  width: 34%;
  height: 100%;
  background-color: var(--accent-red);
}

.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.controls-row::-webkit-scrollbar {
  display: none;
}

.player-controls-bar .btn-pill {
  padding: 6px 10px;
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

.player-controls-bar .volume-slider {
  width: 64px;
  flex-shrink: 0;
}

.secondary-drawer {
  background-color: var(--surface-1);
  color: #000000;
  border-radius: var(--radius-card-md);
  padding: 16px 20px;
  margin-bottom: 10px;
  display: none;
}

.secondary-drawer.open {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
}

.settings-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  align-items: start;
}

.settings-sidebar {
  background-color: var(--surface-1);
  border-radius: var(--radius-card-lg);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-nav-btn {
  border: none;
  background: transparent;
  color: #000000;
  text-align: left;
  padding: 12px 16px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.settings-nav-btn:hover {
  background-color: #FFFFFB;
}

.settings-nav-btn.active {
  background-color: #000000;
  color: #FFFFFB;
}

.settings-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-row {
  background-color: #FFFFFB;
  color: #000000;
  border-radius: var(--radius-card-md);
  padding: 16px 18px;
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.pref-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 900px) {
  .settings-layout {
    grid-template-columns: 1fr;
  }
  .settings-sidebar {
    flex-direction: row;
    overflow-x: auto;
  }
}

/* Pillar 4: Personal Cinema Telemetry & Resource Drawer (4:1 split) */
.telemetry-grid {
  display: grid;
  grid-template-columns: 4fr minmax(260px, 1fr);
  gap: 20px;
  align-items: start;
}

.telemetry-collections-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 26px;
}

.telemetry-titles-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.panel-card .poster-card,
.panel-card .poster-info {
  background-color: #FFFFFB;
}

.panel-card .poster-info.is-watched {
  background-color: #000000;
}

@media (max-width: 1100px) {
  .telemetry-grid {
    grid-template-columns: 1fr;
  }
  .telemetry-titles-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .telemetry-collections-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .telemetry-titles-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.panel-card {
  background-color: var(--surface-1);
  color: #000000;
  border-radius: var(--radius-card-lg);
  padding: 26px;
}

.timeline-item {
  background-color: #FFFFFB;
  border-radius: var(--radius-card-md);
  padding: 16px 18px;
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Modal for Lightweight Login Entry Placeholder */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  background-color: #FFFFFB;
  color: #000000;
  border-radius: var(--radius-card-lg);
  padding: 32px;
  width: 100%;
  max-width: 440px;
}

/* Milestone 6: Up-Next Progress Strip, Online Cinema Timeline & File Box */
.up-next-progress-track {
  width: 100%;
  max-width: 340px;
  height: 5px;
  background-color: rgba(0, 0, 0, 0.12);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-top: 10px;
}

.up-next-progress-fill {
  height: 100%;
  background-color: var(--accent-red);
  transition: width 0.25s ease;
}

.up-next-queue-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.timeline-date-group {
  margin-top: 18px;
}

.timeline-group-label {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: var(--surface-3);
  margin-bottom: 8px;
}

.timeline-row-card {
  background-color: var(--surface-1);
  color: #000000;
  border-radius: var(--radius-card-md);
  padding: 14px 18px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.timeline-row-main {
  min-width: 0;
  flex: 1;
  cursor: pointer;
}

.timeline-mini-track {
  width: 180px;
  max-width: 100%;
  height: 4px;
  background-color: rgba(0, 0, 0, 0.12);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-top: 6px;
}

.timeline-mini-fill {
  height: 100%;
  background-color: var(--accent-red);
}

.filebox-split-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 18px;
}

@media (max-width: 900px) {
  .filebox-split-grid {
    grid-template-columns: 1fr;
  }
}

.passcode-json-textarea {
  width: 100%;
  min-height: 92px;
  padding: 12px 14px;
  border-radius: var(--radius-card-md);
  border: none;
  background-color: #FFFFFB;
  color: #000000;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  resize: vertical;
  outline: none;
}
