/* [local] "Theater" theme: Apple TV-style look (design A for browsing, design C's
   bigger, calmer player controls). Loaded after each page's own <style>, so it only
   overrides; delete the <link> lines to go back to the stock look. Kept in its own
   file so upstream updates rarely conflict with it. */

:root {
  --bg: #000;
  --bg-raised: #121214;
  --fg: #f5f5f7;
  --fg2: rgba(235, 235, 245, .64);
  --fg3: rgba(235, 235, 245, .38);
  --line: rgba(255, 255, 255, .10);
  --glass: rgba(118, 118, 128, .26);
  --glass-strong: rgba(44, 44, 48, .86);
  --glass-hover: rgba(160, 160, 170, .34);
  --blur: saturate(180%) blur(28px);
  --accent: #fff;
  --accent-ink: #000;
  --progress: #fff;
  --r-card: 16px;
  --r-pill: 999px;
  --gutter: clamp(20px, 4.2vw, 72px);
  --tap: 56px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

html { background: var(--bg); }
body {
  background: var(--bg) !important;
  color: var(--fg) !important;
  font-family: var(--font) !important;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font-family: var(--font); }

/* ---------- Brand wordmark (replaces the remote logo image) ---------- */
.brandLink { gap: 10px; font-size: 22px; font-weight: 700; letter-spacing: -.02em; color: var(--fg) !important; }
.brandLink:hover, .brandLink:focus-visible { text-decoration: none !important; opacity: .85; }
.theaterMark {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  background: linear-gradient(145deg, #fff, #c9c9d1);
  display: inline-flex; align-items: center; justify-content: center;
}
.theaterMark::after {
  content: ''; width: 0; height: 0; margin-left: 3px;
  border-left: 10px solid #000; border-top: 6.5px solid transparent; border-bottom: 6.5px solid transparent;
}

/* ---------- Browse page ---------- */
body.theaterBrowse { padding: 0 var(--gutter) 48px !important; }
body.theaterBrowse .pageHeader {
  position: sticky; top: 0; z-index: 20; margin: 0 calc(-1 * var(--gutter)) 0 !important;
  padding: 18px var(--gutter) 14px;
  background: linear-gradient(to bottom, rgba(0,0,0,.78), rgba(0,0,0,.45) 60%, rgba(0,0,0,0));
}
body.theaterBrowse .headerRight { gap: 14px; }

/* Tabs: a soft pill segmented control, like the TV app's top bar. */
.toolbar { margin: 4px 0 22px !important; gap: 14px !important; }
.libraries {
  gap: 4px !important; padding: 5px; border-radius: var(--r-pill);
  background: var(--glass); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
.libraries button, .categories button {
  background: transparent !important; border: 0 !important; color: var(--fg2) !important;
  border-radius: var(--r-pill) !important; min-height: 46px; padding: 0 22px !important;
  font-size: 17px !important; font-weight: 600; transition: background .2s, color .2s;
}
.libraries button.active, .categories button.active { background: var(--fg) !important; color: #000 !important; }
.categories { gap: 8px !important; margin-bottom: 22px !important; }
.categories button { background: var(--glass) !important; color: var(--fg) !important; }

#searchForm { gap: 0 !important; }
#searchInput {
  width: clamp(200px, 22vw, 340px) !important; min-height: 50px;
  background: var(--glass) !important; border: 0 !important; color: var(--fg) !important;
  border-radius: var(--r-pill) 0 0 var(--r-pill) !important; padding: 0 20px !important; font-size: 17px !important;
}
#searchInput::placeholder { color: var(--fg3); }
#searchForm button {
  min-height: 50px; padding: 0 20px !important; border: 0 !important; font-size: 16px !important; font-weight: 600;
  background: rgba(118,118,128,.38) !important; color: var(--fg) !important;
  border-radius: 0 var(--r-pill) var(--r-pill) 0 !important;
}

/* Round glass buttons (fullscreen, back). */
#fullscreenBtn, #back, #detailBack {
  min-height: 50px; padding: 0 20px !important; border: 0 !important; border-radius: var(--r-pill) !important;
  background: var(--glass) !important; color: var(--fg) !important; font-size: 16px !important; font-weight: 600;
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  display: inline-flex !important; align-items: center; gap: 8px;
}
/* #back is hidden by browse.html's own CSS until it sets display:inline-block; respect that. */
#back { display: none !important; }
#back[style*="inline-block"] { display: inline-flex !important; }
#fullscreenBtn[style*="display: none"], #fullscreenBtn[style*="display:none"] { display: none !important; }

/* Profile badge: a single round avatar, like Apple's profile switcher. */
#userBadgeMount > div {
  background: transparent !important; border: 0 !important; border-radius: var(--r-pill) !important;
}
#userBadge { padding: 0 !important; min-height: 0 !important; border-radius: 50% !important; gap: 0 !important; }
#userBadge > :first-child {
  width: 46px !important; height: 46px !important; font-size: 19px !important;
  box-shadow: 0 0 0 2px rgba(255,255,255,.85), 0 4px 14px rgba(0,0,0,.5);
}
#userBadge .userBadgeName { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Section titles. */
#continueSection h2, #recentSection h2 {
  font-size: 23px !important; font-weight: 700 !important; color: var(--fg) !important;
  letter-spacing: -.01em; margin: 0 0 14px !important;
}
#continueSection, #recentSection { margin-bottom: 38px !important; }

/* Rows of big landscape cards. */
#continueRow, #recentRow {
  gap: 22px !important; padding: 6px 4px 8px; margin: -6px -4px 0;
  scroll-padding-left: 4px;
}
.continueCard { width: clamp(280px, 25vw, 440px) !important; }
.continueCard.movie, .recentCard.movie, .recentCard.show, .recentCard.season { width: clamp(160px, 13vw, 230px) !important; }
.recentCard.episode { width: clamp(280px, 25vw, 440px) !important; }
.continueCard .thumbWrap, .recentCard .thumbWrap, .card .thumbWrap {
  border-radius: var(--r-card) !important; background: var(--bg-raised) !important;
  box-shadow: 0 10px 28px rgba(0,0,0,.55);
  transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s;
}
.continueCard:active .thumbWrap, .recentCard:active .thumbWrap, .card:active .thumbWrap { transform: scale(.97); }
@media (hover: hover) {
  .continueCard:hover .thumbWrap, .recentCard:hover .thumbWrap, .card:hover .thumbWrap {
    transform: scale(1.035); box-shadow: 0 0 0 3px rgba(255,255,255,.9), 0 18px 40px rgba(0,0,0,.7);
  }
}
.continueCard .title, .recentCard .title, .card .title {
  font-size: 16px !important; font-weight: 600; color: var(--fg); margin-top: 10px !important;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.continueCard .meta, .recentCard .meta, .card .meta {
  font-size: 14px !important; color: var(--fg2) !important; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Progress: a thin white bar inside the art, inset like the TV app. */
.progressBar {
  left: 14px !important; right: 14px !important; bottom: 12px !important; height: 5px !important;
  border-radius: 3px; background: rgba(255,255,255,.28) !important; overflow: hidden;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.progressBar .fill { background: var(--progress) !important; border-radius: 3px; }

/* Carousel arrows: round glass discs. */
.carouselBtn {
  width: 52px !important; height: 52px !important; top: 42% !important;
  background: var(--glass-strong) !important; border: 0 !important; color: var(--fg) !important;
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: 0 6px 18px rgba(0,0,0,.5);
}
.carouselBtn.prev { left: -18px !important; }
.carouselBtn.next { right: -18px !important; }

/* Library grid. */
.grid { gap: 30px 22px !important; }
#loading { color: var(--fg2) !important; font-size: 17px; }
.loadErrorAction {
  min-height: 52px !important; padding: 0 26px !important; border: 0 !important; border-radius: var(--r-pill) !important;
  background: var(--fg) !important; color: #000 !important; font-weight: 600 !important; font-size: 17px !important;
}
#insecureNotice {
  background: rgba(255, 159, 10, .16) !important; color: #ffd60a !important; border: 0 !important;
  border-radius: 14px !important; padding: 14px 18px !important; font-size: 15px !important;
}

/* ---------- Show / season header: backdrop as the hero ---------- */
#detailHeader { margin: 0 calc(-1 * var(--gutter)) 18px !important; min-height: min(62vh, 620px); }
#detailBackdrop { filter: none !important; background-position: center 20% !important; }
#detailBackdropFade {
  background:
    linear-gradient(to top, #000 4%, rgba(0,0,0,.55) 42%, rgba(0,0,0,.08) 72%, rgba(0,0,0,.45)),
    linear-gradient(to right, rgba(0,0,0,.82), rgba(0,0,0,.25) 55%, rgba(0,0,0,0)) !important;
}
#detailBack { margin: 22px var(--gutter) 0 !important; }
#detailContent {
  padding: clamp(80px, 22vh, 230px) var(--gutter) 10px !important; gap: 30px !important; align-items: flex-end;
}
#detailPoster { width: clamp(130px, 12vw, 200px) !important; border-radius: 14px !important; box-shadow: 0 18px 50px rgba(0,0,0,.7) !important; }
#detailTitle { font-size: clamp(34px, 4.4vw, 64px) !important; font-weight: 800 !important; letter-spacing: -.025em; line-height: 1.02; margin-bottom: 10px !important; }
#detailSubtitle { font-size: 18px !important; color: var(--fg2) !important; }
#detailMeta { font-size: 15px !important; color: var(--fg2) !important; gap: 10px !important; }
#detailMeta .badge { border-color: var(--fg3) !important; border-radius: 5px !important; color: var(--fg2); }
#detailGenres { font-size: 15px !important; color: var(--fg2) !important; }
#detailSummary { font-size: 17px !important; line-height: 1.5 !important; color: rgba(245,245,247,.86) !important; max-width: 760px !important; }
/* Pages that put the backdrop behind cards keep cards readable. */
#grid .card .title, #grid .card .meta { text-shadow: 0 1px 6px rgba(0,0,0,.6); }

/* ---------- Home hero (Continue Watching #1) ---------- */
#heroSection {
  position: relative; margin: -86px calc(-1 * var(--gutter)) 34px; min-height: min(64vh, 640px);
  display: flex; align-items: flex-end; overflow: hidden; isolation: isolate;
}
#heroSection[hidden], #heroSection [hidden] { display: none !important; }
#heroArt {
  position: absolute; inset: 0; z-index: -2; background-size: cover; background-position: center 25%;
  background-color: var(--bg-raised); transition: opacity .6s ease;
}
#heroSection::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(to top, #000 2%, rgba(0,0,0,.45) 38%, rgba(0,0,0,0) 65%),
    linear-gradient(to right, rgba(0,0,0,.85), rgba(0,0,0,.3) 50%, rgba(0,0,0,0) 75%);
}
#heroInner { padding: 0 var(--gutter) clamp(28px, 4vh, 48px); max-width: min(900px, 70vw); }
#heroKicker { font-size: 14px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--fg2); }
#heroTitle { margin: 8px 0 8px; font-size: clamp(38px, 5vw, 76px); font-weight: 800; letter-spacing: -.03em; line-height: 1; }
#heroSub { font-size: 19px; font-weight: 600; color: var(--fg); }
#heroSummary {
  margin-top: 10px; font-size: 17px; line-height: 1.45; color: rgba(245,245,247,.8);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
#heroProgress { display: flex; align-items: center; gap: 12px; margin-top: 16px; font-size: 15px; color: var(--fg2); }
#heroProgress .track { width: 180px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.25); overflow: hidden; }
#heroProgress .track > div { height: 100%; background: #fff; border-radius: 3px; }
#heroActions { display: flex; align-items: center; gap: 14px; margin-top: 22px; }
#heroPlay {
  display: inline-flex; align-items: center; gap: 10px; min-height: 60px; padding: 0 34px;
  border: 0; border-radius: var(--r-pill); background: #fff; color: #000;
  font: 700 19px var(--font); cursor: pointer; box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
#heroPlay:active { transform: scale(.97); background: #e5e5ea; }
#heroPlay svg { width: 20px; height: 20px; }
#heroDots { display: flex; gap: 8px; margin-left: 10px; }
#heroDots button {
  width: 10px; height: 10px; padding: 0; border: 0; border-radius: 5px;
  background: rgba(255,255,255,.35); cursor: pointer; transition: width .3s, background .3s;
}
#heroDots button[aria-current="true"] { width: 28px; background: #fff; }
/* Bigger hit area without bigger dots. */
#heroDots button { position: relative; }
#heroDots button::after { content: ''; position: absolute; inset: -14px -6px; }

/* ---------- Movie detail page (detail.html) ---------- */
body.theaterDetail #playBtn, body.theaterDetail #watchedBtn, body.theaterDetail #unwatchedBtn,
body.theaterDetail .actions button, body.theaterDetail .actions a {
  min-height: 56px !important; border: 0 !important; border-radius: var(--r-pill) !important;
  padding: 0 28px !important; font: 600 18px var(--font) !important;
  background: var(--glass) !important; color: var(--fg) !important;
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
body.theaterDetail #playBtn { background: #fff !important; color: #000 !important; font-weight: 700 !important; }

/* ---------- Player (canvas2.html): design C controls ---------- */
body.theaterPlayer #controls {
  display: grid !important;
  grid-template-columns: auto 1fr auto auto auto 1fr auto auto auto auto;
  grid-template-areas:
    "seek seek seek seek seek seek seek seek seek seek"
    "time .    b30  play f30  .    fill cc   dim  set";
  align-items: center; column-gap: 18px; row-gap: 12px;
  padding: 40px var(--gutter) max(26px, env(safe-area-inset-bottom)) !important;
  background: linear-gradient(to top, rgba(0,0,0,.88), rgba(0,0,0,.5) 55%, rgba(0,0,0,0)) !important;
}
body.theaterPlayer #seekBar { grid-area: seek; width: 100%; }
body.theaterPlayer #timeLabel { grid-area: time; }
body.theaterPlayer #back30 { grid-area: b30; }
body.theaterPlayer #playPauseBtn { grid-area: play; }
body.theaterPlayer #fwd30 { grid-area: f30; }
body.theaterPlayer #ccBtn { grid-area: cc; }
body.theaterPlayer #dimBtn { grid-area: dim; }
body.theaterPlayer #settingsBtn { grid-area: set; margin-left: 0 !important; }

body.theaterPlayer #controls > button {
  width: 64px !important; height: 64px !important; border-radius: 50% !important;
  background: rgba(255,255,255,.14) !important; color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .15s, background .2s;
}
body.theaterPlayer #controls > button:active { transform: scale(.92); background: rgba(255,255,255,.3) !important; }
body.theaterPlayer #controls .ico { width: 30px !important; height: 30px !important; }
body.theaterPlayer #controls > #playPauseBtn {
  width: 92px !important; height: 92px !important; background: #fff !important; color: #000 !important;
  box-shadow: 0 8px 26px rgba(0,0,0,.45);
}
body.theaterPlayer #controls > #playPauseBtn .ico { width: 40px !important; height: 40px !important; }
body.theaterPlayer #playPauseBtn .spinner { border-color: rgba(0,0,0,.2) !important; border-top-color: #000 !important; width: 30px !important; height: 30px !important; }
body.theaterPlayer #ccBtn[aria-pressed="true"] { background: #fff !important; color: #000 !important; }
body.theaterPlayer #dimBtn[aria-expanded="true"], body.theaterPlayer #ccBtn[aria-expanded="true"] { background: rgba(255,255,255,.34) !important; }

/* The scrubber: a thin white line with a round knob; taller hit area for touch. */
body.theaterPlayer #seekBar {
  -webkit-appearance: none; appearance: none; height: 36px !important; background: transparent; margin: 0;
  accent-color: #fff;
}
body.theaterPlayer #seekBar::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: rgba(255,255,255,.3); }
body.theaterPlayer #seekBar::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.5);
}
body.theaterPlayer #seekBar::-moz-range-track { height: 6px; border-radius: 3px; background: rgba(255,255,255,.3); }
body.theaterPlayer #seekBar::-moz-range-progress { height: 6px; border-radius: 3px; background: #fff; }
body.theaterPlayer #seekBar::-moz-range-thumb { width: 22px; height: 22px; border: 0; border-radius: 50%; background: #fff; }
body.theaterPlayer #timeLabel {
  font-family: var(--font) !important; font-size: 24px !important; font-weight: 600 !important;
  letter-spacing: 0 !important; font-variant-numeric: tabular-nums; color: #fff;
}
body.theaterPlayer #timeLabel.live-indicator { font-size: 18px !important; border-radius: var(--r-pill) !important; }

/* Top bar: no glass over the moving picture, just a scrim and small solid chips. */
body.theaterPlayer #topBar {
  top: 0 !important; left: 0 !important; right: 0 !important;
  padding: max(20px, env(safe-area-inset-top)) var(--gutter) 40px;
  background: linear-gradient(to bottom, rgba(0,0,0,.78), rgba(0,0,0,0));
  align-items: center !important; gap: 14px;
}
body.theaterPlayer #backLink {
  width: 56px; height: 56px; padding: 0 !important; border-radius: 50% !important;
  display: inline-flex !important; align-items: center; justify-content: center;
  background: rgba(255,255,255,.14) !important; font-size: 22px !important;
}
body.theaterPlayer #backLink .label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
body.theaterPlayer #titleDisplay {
  text-align: left !important; font-size: 21px !important; font-weight: 700 !important; text-shadow: none !important; padding: 0 6px !important;
}
body.theaterPlayer #topBarRight { gap: 10px !important; }
body.theaterPlayer #topBarRight button, body.theaterPlayer #watchedControls button, body.theaterPlayer #quotaLabel, #qualityBadge {
  min-height: 48px; padding: 0 18px !important; border-radius: var(--r-pill) !important;
  background: rgba(255,255,255,.14) !important; color: #fff !important; font: 600 15px var(--font) !important;
  display: inline-flex !important; align-items: center; gap: 6px; border: 0 !important;
}
body.theaterPlayer #quotaLabel:empty { display: none !important; }
body.theaterPlayer #fullscreenBtn[style*="display: none"], body.theaterPlayer #fullscreenBtn[style*="display:none"],
body.theaterPlayer #watchedControls button[hidden], body.theaterPlayer #watchedControls button[style*="display: none"] { display: none !important; }
#qualityBadge { color: rgba(255,255,255,.88) !important; white-space: nowrap; }
#qualityBadge[hidden] { display: none !important; }
#qualityBadge::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #30d158; }
#qualityBadge[data-tier="medium"]::before { background: #ffd60a; }
#qualityBadge[data-tier="low"]::before { background: #ff9f0a; }

/* Notes ("Connection improved — switching to High", "Resuming at…"): a frosted toast at the bottom. */
body.theaterPlayer #resumeBanner {
  top: auto !important; bottom: 210px; padding: 14px 24px !important; border-radius: var(--r-pill) !important;
  background: rgba(30,30,34,.82) !important; color: #fff !important;
  font: 600 17px var(--font) !important; box-shadow: 0 10px 30px rgba(0,0,0,.5);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}

/* Menus: solid dark glass (blurring over video every frame costs the car's browser). */
body.theaterPlayer #dimPanel, body.theaterPlayer #ccPanel {
  right: var(--gutter) !important; bottom: calc(100% - 22px) !important; border: 0 !important;
  border-radius: 22px !important; padding: 16px 18px !important; background: var(--glass-strong) !important;
  box-shadow: 0 18px 50px rgba(0,0,0,.6);
}
body.theaterPlayer #controls #dimPanel button, body.theaterPlayer #controls #ccPanel button {
  border-radius: 14px !important; min-height: 52px !important; font: 600 16px var(--font) !important;
  background: rgba(255,255,255,.1) !important;
}
body.theaterPlayer #controls #ccPanel button[aria-checked="true"], body.theaterPlayer #controls #dimPanel button[aria-pressed="true"] {
  background: #fff !important; color: #000 !important;
}
body.theaterPlayer #dimPanel input { accent-color: #fff !important; height: 40px !important; }
body.theaterPlayer .pictureRow label, body.theaterPlayer .pictureValue { font-size: 16px !important; }

body.theaterPlayer #playbackSettings {
  background: #1c1c1e !important; border: 0 !important; border-radius: 26px !important;
  padding: 30px !important; width: min(520px, calc(100vw - 32px)) !important; box-shadow: 0 30px 80px rgba(0,0,0,.7);
}
body.theaterPlayer #playbackSettings h2 { font-size: 26px !important; letter-spacing: -.01em; }
body.theaterPlayer #playbackSettings select {
  min-height: 54px; border: 0 !important; border-radius: 14px !important; background: #2c2c2e !important; font-size: 18px !important;
}
body.theaterPlayer .settingsActions button, body.theaterPlayer #soundSection button {
  min-height: 54px !important; padding: 0 26px !important; border-radius: var(--r-pill) !important;
  background: #3a3a3c !important; font: 600 17px var(--font) !important;
}
body.theaterPlayer #applyPlayback { background: #fff !important; color: #000 !important; }
body.theaterPlayer #playbackSettings .field { border-top-color: rgba(255,255,255,.1) !important; }

body.theaterPlayer #nextActions { right: var(--gutter) !important; bottom: 220px !important; }
body.theaterPlayer #nextActions button { min-height: 60px !important; border-radius: var(--r-pill) !important; padding: 0 28px !important; font: 700 18px var(--font) !important; }
body.theaterPlayer #playNextBtn { background: #fff !important; color: #000 !important; }
body.theaterPlayer #cancelNextBtn { background: rgba(60,60,66,.9) !important; color: #fff !important; }
body.theaterPlayer #audioUnlockBtn {
  background: #fff !important; color: #000 !important; border-radius: var(--r-pill) !important;
  padding: 22px 38px !important; font: 700 21px var(--font) !important;
}

/* Small screens (phones): keep it usable. */
@media (max-width: 700px) {
  :root { --gutter: 14px; }
  #heroSection { margin-top: -70px; min-height: 52vh; }
  #heroInner { max-width: 100%; }
  #heroSummary { display: none; }
  .continueCard, .recentCard.episode { width: 78vw !important; }
  body.theaterPlayer #controls { column-gap: 8px; grid-template-areas: "seek seek seek seek seek seek seek seek seek seek" "time . b30 play f30 . fill cc dim set"; }
  body.theaterPlayer #controls > button { width: 48px !important; height: 48px !important; }
  body.theaterPlayer #playPauseBtn { width: 66px !important; height: 66px !important; }
  body.theaterPlayer #timeLabel { font-size: 15px !important; }
  body.theaterPlayer #qualityBadge { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- One top bar: brand | tabs + search | avatar (theme.js moves the toolbar in) ---------- */
body.theaterBrowse .pageHeader { gap: 24px; margin-bottom: 0 !important; }
body.theaterBrowse .pageHeader .toolbar {
  flex: 1; min-width: 0; margin: 0 !important; flex-wrap: nowrap !important; justify-content: center;
}
body.theaterBrowse .pageHeader .libraries { flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
body.theaterBrowse .pageHeader .libraries::-webkit-scrollbar { display: none; }
body.theaterBrowse .pageHeader .libraries button { white-space: nowrap; }
body.theaterBrowse .pageHeader #searchForm { margin-left: auto !important; flex: none; }
body.theaterBrowse #grid, body.theaterBrowse #loading { margin-top: 18px; }
.grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)) !important; }
@media (max-width: 900px) {
  body.theaterBrowse .pageHeader { flex-wrap: wrap; }
  body.theaterBrowse .pageHeader .toolbar { order: 3; flex-basis: 100%; flex-wrap: wrap !important; }
  body.theaterBrowse .pageHeader #searchForm { margin-left: 0 !important; width: 100%; }
  body.theaterBrowse .pageHeader #searchInput { flex: 1; width: auto !important; }
  #heroSection { margin-top: 0; }
}

/* ---------- Sign-in page ---------- */
body.theaterLogin { background: radial-gradient(120% 80% at 50% 0%, #1c1c22 0%, #000 60%) !important; }
body.theaterLogin .card {
  background: rgba(28,28,30,.82) !important; border: 1px solid rgba(255,255,255,.08) !important;
  border-radius: 28px !important; box-shadow: 0 30px 80px rgba(0,0,0,.6) !important;
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
body.theaterLogin h1 { justify-content: center; }
body.theaterLogin .brandLink { font-size: 30px; }
body.theaterLogin .theaterMark { width: 40px; height: 40px; border-radius: 11px; }
body.theaterLogin .theaterMark::after { border-left-width: 13px; border-top-width: 8.5px; border-bottom-width: 8.5px; }
body.theaterLogin button.signIn {
  min-height: 58px !important; border: 0 !important; border-radius: var(--r-pill) !important;
  background: #fff !important; color: #000 !important; font: 700 18px var(--font) !important;
}
body.theaterLogin #linkCode, body.theaterLogin #jellyfinCode { letter-spacing: .18em; font-variant-numeric: tabular-nums; }

/* Watched / unwatched: round icon buttons (labels stay for screen readers). */
body.theaterPlayer #watchedControls button {
  width: 48px; padding: 0 !important; justify-content: center;
}
body.theaterPlayer #watchedControls button .label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 700px) {
  body.theaterPlayer #controls > #playPauseBtn { width: 66px !important; height: 66px !important; }
}

/* Fill / Fit (theme-player.js): Fill zooms the picture to cover the whole screen. */
body.theaterPlayer #fillBtn { grid-area: fill; }
body.theaterPlayer #controls > #fillBtn {
  width: auto !important; min-width: 64px; padding: 0 22px 0 18px; gap: 8px;
  border-radius: 999px !important; font: 700 17px var(--font);
}
body.theaterPlayer #controls > #fillBtn[aria-pressed="true"] { background: #fff !important; color: #000 !important; }
html.fillScreen canvas, html.fillScreen #standardVideo, html.fillScreen #stillImage { object-fit: cover !important; }

/* Full Screen: make it the clear first chip in the player's top bar, with its label. */
body.theaterPlayer #fullscreenBtn { order: -1; background: rgba(255,255,255,.22) !important; }
body.theaterPlayer #fullscreenBtn .label { position: static !important; width: auto !important; height: auto !important; clip: auto !important; }

/* "Open videos full screen" switch in the player's settings. */
.theaterSwitch { display: flex !important; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
.theaterSwitch input {
  -webkit-appearance: none; appearance: none; flex: none; margin: 0; cursor: pointer;
  width: 58px; height: 34px; border-radius: 17px; background: #3a3a3c; position: relative; transition: background .2s;
}
.theaterSwitch input::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 28px; height: 28px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.4); transition: transform .2s;
}
.theaterSwitch input:checked { background: #30d158; }
.theaterSwitch input:checked::after { transform: translateX(24px); }
