/* JellyAshy for TVs — designed for 1920x1080 (1rem = 16px there) and scaled
   with the viewport. Old TV browsers (Chromium 53–56): no flex `gap`,
   :focus-within, inset, aspect-ratio or position: sticky.
   Performance budget: no blurred shadows at rest, transitions only on
   transform/opacity, backdrop-filter only in the "real" glass mode. */

/* ---- palettes (ui/theme.ts sets html[data-palette]) ---------------------- */

:root {
  --bg: #07080c;
  --bg-2: #0f1118;
  --bg-3: #171a23;
  --fg: #f3f4f7;
  --fg-2: rgba(243, 244, 247, 0.78);
  --muted: rgba(243, 244, 247, 0.56);
  --faint: rgba(243, 244, 247, 0.34);
  --line: rgba(255, 255, 255, 0.10);
  --glass: rgba(255, 255, 255, 0.07);
  --glass-hi: rgba(255, 255, 255, 0.13);
  --accent: #e7c27d;
  --accent-2: #f3dcae;
  --on-accent: #1a1408;
  --danger: #ff6b6b;
  --ok: #4cc38a;
  --radius: 1.1rem;
  --radius-sm: 0.7rem;
}
html[data-palette="aurora"] { --bg: #050a10; --bg-2: #0a121b; --bg-3: #111c28; --accent: #5ee6cf; --accent-2: #9fb4ff; --on-accent: #04201b; }
html[data-palette="ember"] { --bg: #0b0708; --bg-2: #141011; --bg-3: #1e1718; --accent: #ff7a63; --accent-2: #ffb38a; --on-accent: #2a0b05; }
html[data-palette="graphite"] { --bg: #08080a; --bg-2: #111114; --bg-3: #1a1a1f; --accent: #f2f2f4; --accent-2: #c9c9d1; --on-accent: #0b0b0d; }

/* ---- base ------------------------------------------------------------------ */

html {
  font-size: 0.8333vw; /* 16px at 1920 wide */
  background: var(--bg);
}
html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  color: var(--fg);
  font-family: "Inter", "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body { background: var(--bg); }
body.video-playing, html.video-playing { background: transparent; }
body.video-playing #ambient, body.video-playing .ambient-veil { display: none; }
/* Android: ExoPlayer draws behind the WebView (src/player/exo.ts). */
html.video-native, html.video-native body, html.video-native .player { background: transparent; }
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.02em; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 1.1rem; }
.pad { padding: 0 4.5rem; }
.spacer { -webkit-box-flex: 1; flex: 1; }
.icon { width: 1.6rem; height: 1.6rem; flex: none; fill: currentColor; }

/* Start-up splash: drawn before any script runs. */
#boot {
  position: fixed; left: 0; top: 0; width: 100%; height: 100%; z-index: 100;
  background: #07080c url("icons/splash.jpg") center / cover no-repeat;
  transition: opacity 0.4s;
}
#boot.gone { opacity: 0; }

/* ---- ambient (glass "light") -------------------------------------------- */

/* A tiny pre-blurred backdrop (the server blurs it) stretched by the GPU. */
#ambient {
  position: fixed; left: -3rem; top: -3rem; width: 126rem; height: 73.5rem;
  background-size: cover; background-position: center;
  opacity: 0.5; transition: opacity 0.5s;
  z-index: 0;
}
.ambient-veil {
  position: fixed; left: 0; top: 0; width: 100%; height: 100%; z-index: 0;
  background: radial-gradient(120% 90% at 70% 0%, rgba(0, 0, 0, 0) 0%, var(--bg) 78%);
}
html[data-glass="off"] #ambient, html[data-glass="off"] .ambient-veil { display: none; }

.panel {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
html[data-glass="off"] .panel { background: var(--bg-2); }
html[data-glass="real"] .panel {
  background: rgba(255, 255, 255, 0.06);
  -webkit-backdrop-filter: blur(1.5rem) saturate(140%);
  backdrop-filter: blur(1.5rem) saturate(140%);
}

/* ---- shell ------------------------------------------------------------------ */

#app, .app, .shell { position: relative; width: 100%; height: 100%; z-index: 1; }
.content { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
.screen { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
.screen.hidden { visibility: hidden; }
.app.playing .shell { visibility: hidden; }

.page { position: absolute; left: 0; top: 0; width: 100%; height: 100%; box-sizing: border-box; display: flex; flex-direction: column; }
/* Root pages leave room on the left for the side menu; Browse pages run
   their pictures under it. */
/* Pages opened on top (a grid from "See all") have no menu but the same top air. */
.library-page, .mylist-page, .settings-page, .search-page { padding-top: 4rem; }
.with-side .page { padding-top: 4rem; padding-left: 4.5rem; }
.with-side .browse-page { padding: 0; }
.page-header { display: flex; align-items: center; padding: 0 4.5rem 1.5rem; flex: none; }
.page-header h1 { font-size: 2.6rem; }
.page-header .count { margin-left: 1rem; color: var(--muted); font-size: 1.4rem; }
.page-header .btn { margin-left: 1rem; }
/* Movies / Series: filters by genre and theme between the title and the grid. */
.genre-chips { flex: none; padding: 0.6rem 0 1rem 4.5rem; margin-top: -0.8rem; }
.genre-chips .cat-card { margin-right: 1rem; }
/* Category cards: a title's picture, the category's colour over it, its name. */
.cat-card { width: 24rem; height: 13.5rem; margin-right: 1.6rem; border-radius: 1rem; overflow: hidden; transition: transform 0.15s; }
.cat-card .cat-pic { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }
.cat-card .cat-tint { position: absolute; top: 0; left: 0; right: 0; bottom: 0; }
.cat-card .cat-label { position: absolute; left: 1.2rem; right: 1.2rem; top: 50%; transform: translateY(-50%); text-align: center; font-size: 2.1rem; font-weight: 800; line-height: 1.05; letter-spacing: 0.03em; text-transform: uppercase; color: #fff; }
.cat-card.small { width: 16.5rem; height: 9.3rem; border-radius: 0.8rem; }
.cat-card.small .cat-label { font-size: 1.4rem; left: 0.8rem; right: 0.8rem; }
.cat-card:focus { transform: scale(1.07); box-shadow: 0 0 0 0.25rem var(--accent); }
/* The filter in use: a white frame (the focused one keeps the accent). */
.cat-card.active { box-shadow: 0 0 0 0.25rem #fff; }
.cat-card.active:focus { box-shadow: 0 0 0 0.25rem var(--accent); }
.kind-category .rail-empty { height: 13.5rem; }
.detail-page .page-header, .person-page { padding-top: 0; }
.page-center { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.narrow-page { padding: 5rem 0 3rem; align-items: center; }
.narrow-page .page-header { width: 50rem; padding: 0 0 1.5rem; box-sizing: border-box; }
.list-body { width: 50rem; max-height: 52rem; padding: 0.5rem; box-sizing: border-box; }

/* ---- focus, buttons -------------------------------------------------------- */

.focusable:focus { outline: none; }
.btn {
  display: inline-flex; align-items: center; flex: none;
  height: 4rem; padding: 0 1.9rem; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--glass-hi); color: var(--fg);
  font-size: 1.4rem; font-weight: 600; white-space: nowrap;
  transition: transform 0.14s ease;
}
.btn .icon { margin-right: 0.7rem; width: 1.7rem; height: 1.7rem; }
.btn.primary { background: var(--fg); color: var(--bg); }
.btn.active .icon { color: var(--accent); }
.btn:focus { background: var(--accent); color: var(--on-accent); transform: scale(1.06); }
.btn:focus .icon { color: var(--on-accent); }
.btn.chip { height: 3.2rem; padding: 0 1.3rem; font-size: 1.2rem; border-radius: var(--radius-sm); }
.btn.chip.active { background: var(--fg); color: var(--bg); }
.btn.chip.active:focus, .btn.chip:focus { background: var(--accent); color: var(--on-accent); }
.btn.chip .icon:last-child:not(:first-child) { margin: 0 0 0 0.5rem; }
.btn.flat { background: transparent; }
.actions { display: flex; align-items: center; margin-top: 2rem; }
.actions .btn { margin-right: 1rem; }

/* ---- form fields and rows ------------------------------------------------ */

.field { display: block; margin-top: 1.4rem; }
.field-label { display: block; font-size: 1.15rem; color: var(--muted); margin-bottom: 0.5rem; }
.input {
  display: block; width: 100%; box-sizing: border-box; height: 4.2rem; padding: 0 1.4rem;
  border: 2px solid var(--line); border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.25); color: var(--fg); font: inherit; font-size: 1.5rem;
}
.input::placeholder { color: var(--faint); }
.input:focus { border-color: var(--accent); }
.input-box { display: block; position: relative; }
/* Room for the password's eye. */
.input-box .input:not(:last-child) { padding-right: 5rem; }
.input-eye {
  position: absolute; top: 0.4rem; right: 0.4rem; width: 3.4rem; height: 3.4rem; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: var(--radius-sm); background: none; color: var(--muted); cursor: pointer;
}
.input-eye .icon { width: 2.2rem; height: 2.2rem; }
.input-eye:hover { color: var(--fg); }
.input-eye:focus { background: var(--fg); color: var(--bg); }

.row {
  display: flex; align-items: center; width: 100%; box-sizing: border-box; min-height: 4.4rem;
  padding: 0.7rem 1.3rem; border: 0; border-radius: var(--radius-sm); background: transparent;
  text-align: left; cursor: pointer; font-size: 1.35rem;
}
.row > .icon { margin-right: 1.1rem; color: var(--muted); }
.row-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.row-title { font-weight: 550; }
.row-hint { font-size: 1.1rem; color: var(--muted); margin-top: 0.2rem; }
.row-value { color: var(--accent); font-weight: 600; margin-left: 1rem; white-space: nowrap; }
.row.active .row-title { color: var(--accent); }
.row.active:focus .row-title { color: var(--bg); }
.row:focus { background: var(--fg); color: var(--bg); }
.row:focus .row-hint, .row:focus > .icon { color: rgba(0, 0, 0, 0.6); }
.row:focus .row-value { color: var(--bg); }
.switch { width: 3.4rem; height: 1.9rem; border-radius: 999px; background: var(--glass-hi); position: relative; flex: none; margin-left: 1rem; }
.knob { position: absolute; left: 0.2rem; top: 0.2rem; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--fg); transition: transform 0.15s; }
.toggle.on .switch { background: var(--accent); }
.toggle.on .knob { transform: translateX(1.5rem); background: var(--on-accent); }
.toggle:focus .switch { background: rgba(0, 0, 0, 0.2); }
.toggle.on:focus .switch { background: var(--accent); }

/* ---- misc --------------------------------------------------------------------- */

.spinner {
  width: 3.4rem; height: 3.4rem; border-radius: 50%; box-sizing: border-box;
  border: 0.32rem solid rgba(255, 255, 255, 0.15); border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
.spinner.small { width: 1.6rem; height: 1.6rem; border-width: 0.2rem; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 5rem 4.5rem; color: var(--muted); flex: 1; }
.empty .icon { color: var(--faint); margin-bottom: 1.2rem; }
.empty h2 { color: var(--fg); font-size: 1.9rem; margin-bottom: 0.6rem; }
.empty p { font-size: 1.3rem; max-width: 50rem; }
.error-text { color: var(--danger); font-size: 1.3rem; margin-top: 1.2rem; line-height: 1.4; }
.img-fallback, .img-pending { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.eyebrow { font-size: 1.1rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent); font-weight: 650; }
.chip { border: 1px solid var(--line); border-radius: 0.45rem; padding: 0.1rem 0.6rem; font-size: 1.1rem; }

/* ---- transform scrolling (ui/nav.ts) ---------------------------------- */

.tscroll { position: relative; overflow: hidden; }
.tscroll-inner {
  position: relative;
  transition: transform 0.28s cubic-bezier(0.2, 0.7, 0.2, 1);
  will-change: transform;
}
.tscroll-inner.row-x { display: flex; width: -webkit-max-content; width: max-content; }
.vgrid { flex: 1; }
.vgrid-inner { position: relative; }
.vcell { position: absolute; box-sizing: border-box; }

/* ---- cards ---------------------------------------------------------------------- */

.card { position: relative; flex: none; border: 0; padding: 0; background: transparent; cursor: pointer; text-align: left; display: block; }
.poster-card { width: 13.75rem; margin-right: 1.6rem; }
.poster, .thumb, .person-photo {
  position: relative; display: block; overflow: hidden; border-radius: 0.9rem; background: var(--bg-3);
  transition: transform 0.16s ease;
}
.poster { width: 13.75rem; height: 20.6rem; }
.poster img, .thumb img, .person-photo img, .avatar img, .hero-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.fallback-text { padding: 1rem; text-align: center; font-size: 1.2rem; color: var(--muted); font-weight: 600; }
.card-title { display: block; margin-top: 0.7rem; font-size: 1.2rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--fg-2); }
.card-title.marquee { text-overflow: clip; }
.card-title .mq { display: inline-block; }
.card-sub { display: block; font-size: 1.05rem; color: var(--faint); margin-top: 0.15rem; height: 1.3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card:focus .poster, .card:focus .thumb, .card:focus .person-photo { transform: scale(1.07); }
/* The frame is drawn over the picture's edge, inside the same box: a shadow
   around it is rasterised apart, and WebKit (the Linux app) rounded the two
   differently once scaled, leaving the frame thicker on one side. */
.card:focus .poster::after, .card:focus .thumb::after, .card:focus .person-photo::after {
  content: ""; position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: 3;
  border: 0.25rem solid var(--accent); border-radius: inherit; pointer-events: none;
}
.card:focus .card-title { color: var(--fg); }
/* The grown picture reaches 0.7rem lower: its title steps down with it. */
.card-title, .card-sub { transition: transform 0.16s ease; }
.card:focus .card-title, .card:focus .card-sub { transform: translateY(0.75rem); }
.continue-card:focus .card-title, .continue-card:focus .card-sub { transform: translateY(0.55rem); }
.placeholder .poster { background: var(--bg-2); }
.badge {
  position: absolute; left: 0.6rem; top: 0.6rem; min-width: 2rem; height: 2rem; padding: 0 0.4rem; box-sizing: border-box;
  border-radius: 1rem; display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.65); color: var(--fg); font-size: 1rem; font-weight: 700;
}
.badge.played { background: var(--accent); color: var(--on-accent); }
.badge .icon { width: 1.3rem; height: 1.3rem; }
.progress { position: absolute; left: 0.8rem; right: 0.8rem; bottom: 0.8rem; height: 0.32rem; border-radius: 0.3rem; background: rgba(255, 255, 255, 0.25); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); }

.wide-card { width: 26.25rem; margin-right: 1.6rem; }
.thumb { width: 26.25rem; height: 14.75rem; }
.thumb-shade { position: absolute; left: 0; right: 0; bottom: 0; height: 60%; background: linear-gradient(0deg, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0)); }
.thumb-text { position: absolute; left: 1rem; right: 1rem; bottom: 1.6rem; display: flex; flex-direction: column; }
.thumb-title { font-size: 1.3rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb-sub { font-size: 1.05rem; color: rgba(255, 255, 255, 0.75); margin-top: 0.2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* "See all": a quiet glass card with a big round "+"; focused, it lifts
   with the accent ring and the circle fills with the accent. */
.more-card {
  width: 13.75rem; height: 20.6rem; margin-right: 1.6rem; border-radius: 0.9rem; box-sizing: border-box;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03));
  border: 1px solid var(--line); color: var(--fg-2);
  transition: transform 0.16s ease;
}
.more-icon {
  width: 5.2rem; height: 5.2rem; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  border: 0.18rem solid rgba(255, 255, 255, 0.55); transition: transform 0.16s ease;
}
.more-icon .icon { width: 2.8rem; height: 2.8rem; }
.more-label { margin-top: 1.1rem; font-size: 1.35rem; font-weight: 650; letter-spacing: -0.01em; }
.more-card:focus { transform: scale(1.07); box-shadow: 0 0 0 0.25rem var(--accent); color: var(--fg); background: linear-gradient(160deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.06)); }
.more-card:focus .more-icon { background: var(--accent); border-color: var(--accent); color: var(--on-accent); transform: scale(1.08); }

.person-card { width: 11rem; margin-right: 1.4rem; }
.person-photo { width: 11rem; height: 11rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 2.6rem; font-weight: 700; color: var(--muted); }
.person-photo.big { width: 18rem; height: 18rem; font-size: 5rem; flex: none; }

/* ---- rails -------------------------------------------------------------------- */

.rail { margin-bottom: 2.2rem; }
.rail-title { margin: 0 0 1rem 4.5rem; font-size: 1.6rem; font-weight: 650; letter-spacing: -0.01em; }
/* Room for the focus zoom and ring above, below and at the ends. */
.rail-scroll { padding: 1.5rem 0 1.5rem 4.5rem; margin-top: -1.5rem; margin-bottom: -0.6rem; }
.rail-wait { padding: 4rem 2rem; }
/* Room after the last card for its focus zoom and ring. */
.rail-scroll .tscroll-inner.row-x { padding-right: 6rem; }

/* ---- hero ---------------------------------------------------------------------- */

.hero { position: relative; width: 100%; height: 47.5rem; flex: none; }
.hero-img {
  position: absolute; right: 0; top: 0; width: 100%; height: 47.5rem;
  /* Fades into whatever is behind (the ambient picture or the plain
     background) instead of painting the background color over it. */
  -webkit-mask-image: linear-gradient(180deg, #000 55%, rgba(0, 0, 0, 0) 100%);
  mask-image: linear-gradient(180deg, #000 55%, rgba(0, 0, 0, 0) 100%);
}
.hero-img img { object-position: center top; }
/* Darkens the left side so the text reads on any picture. */
.hero-fade {
  position: absolute; left: 0; top: 0; width: 100%; height: 47.5rem;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.82) 0%, rgba(0, 0, 0, 0.55) 35%, rgba(0, 0, 0, 0) 68%);
  -webkit-mask-image: linear-gradient(180deg, #000 55%, rgba(0, 0, 0, 0) 100%);
  mask-image: linear-gradient(180deg, #000 55%, rgba(0, 0, 0, 0) 100%);
}
.hero-info { position: absolute; left: 4.5rem; top: 12.5rem; width: 50rem; transition: transform 0.3s ease; }
.hero-title { font-size: 4.6rem; line-height: 1.04; font-weight: 750; letter-spacing: -0.035em; margin: 0.8rem 0 1.1rem; }
.hero-logo { height: 8rem; width: 32rem; margin: 1rem 0 1.2rem; }
.hero-logo img { display: block; max-width: 100%; max-height: 100%; }
.hero-logo .img-fallback { justify-content: flex-start; }
.meta { display: flex; align-items: center; font-size: 1.35rem; color: var(--fg-2); flex-wrap: wrap; }
.meta > span { margin-right: 1.1rem; display: inline-flex; align-items: center; }
.star { color: var(--accent); font-weight: 650; }
.star .icon { width: 1.4rem; height: 1.4rem; margin-right: 0.3rem; }
.hero-plot {
  font-size: 1.35rem; line-height: 1.5; color: var(--fg-2); margin-top: 1.1rem; max-height: 4.05rem; overflow: hidden;
  transition: opacity 0.25s;
}
.hero-episode { margin: 0.4rem 0 0.8rem; font-size: 1.8rem; font-weight: 700; }
.hero-actions { position: absolute; left: 4.5rem; top: 35.5rem; display: flex; z-index: 2; transition: opacity 0.25s; }
.hero-actions .btn { margin-right: 1rem; }
.empty-hero { height: 30rem; }


/* ---- details ------------------------------------------------------------------ */

.detail-scroll { flex: 1; }
.detail-page .hero { height: 42rem; }
.detail-page .hero-img, .detail-page .hero-fade { height: 42rem; }
.detail-page .hero-info { top: 9rem; }
.detail-actions { position: relative; left: 0; top: 0; margin: -6.5rem 0 2.4rem 4.5rem; }
.tagline { padding: 0 4.5rem; font-size: 1.4rem; font-style: italic; color: var(--fg-2); margin-bottom: 1.2rem; }
.overview { padding: 0 4.5rem; margin: 0 0 1.4rem; max-width: 72rem; font-size: 1.35rem; line-height: 1.55; color: var(--fg-2); }
.facts { padding: 0 4.5rem; margin-bottom: 2.4rem; }
.fact { font-size: 1.25rem; margin-bottom: 0.4rem; }
.fact-k { color: var(--muted); margin-right: 0.8rem; }
.episodes { margin-bottom: 2.4rem; }
/* Room under the tabs: a focused episode grows up towards them. */
.season-tabs { padding: 0.5rem 0 0.5rem 4.5rem; margin-bottom: 1.4rem; }
.season-tabs .btn { margin-right: 0.8rem; }
.episode-card { width: 26.25rem; margin-right: 1.6rem; }
.ep-title { display: block; margin-top: 0.8rem; font-size: 1.3rem; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ep-sub { display: block; font-size: 1.05rem; color: var(--faint); margin-top: 0.2rem; }
.ep-sub .star .icon { width: 1.1rem; height: 1.1rem; margin-right: 0.2rem; vertical-align: -0.15rem; }
.ep-plot { display: block; font-size: 1.1rem; color: var(--muted); margin-top: 0.4rem; line-height: 1.4; height: 4.6rem; overflow: hidden; }

.person-head { display: flex; align-items: center; padding: 10rem 4.5rem 3rem; }
.person-text { margin-left: 3rem; max-width: 80rem; }
.person-text h1 { font-size: 3.4rem; margin-bottom: 0.6rem; }
.person-bio { font-size: 1.3rem; line-height: 1.5; color: var(--fg-2); margin-top: 1rem; max-height: 11.7rem; overflow: hidden; }
/* In the flow, unlike .hero-actions: here the button sits under the biography. */
.person-actions { display: flex; margin-top: 1.4rem; }
.person-actions .btn { margin-right: 1rem; }

/* ---- library grid ------------------------------------------------------------ */

.poster-grid { margin: 0 3.7rem; padding: 0 0.8rem; }
.poster-grid .poster-card { margin: 0 auto; }

/* ---- search -------------------------------------------------------------------- */

.search-bar { display: flex; align-items: center; padding: 0 4.5rem 1.5rem; }
.search-bar .field { width: 60rem; margin: 0 1.5rem 0 0; }
.search-results { flex: 1; position: relative; overflow: hidden; }

/* ---- settings ------------------------------------------------------------------ */

.settings-body { flex: 1; padding: 0 4.5rem; }
.settings-body .tscroll-inner { width: 70rem; padding-bottom: 4rem; }
.settings-section { margin-bottom: 2.2rem; }
.settings-section h2 { font-size: 1.3rem; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: 0.12em; margin: 0 0 0.8rem 0.4rem; }
.settings-group { padding: 0.5rem; }
.profile-row { display: flex; align-items: center; padding: 0.9rem 1.3rem; font-size: 1.35rem; }
.profile-row .avatar { margin-right: 1.2rem; }
.about { padding: 1rem 1.3rem; font-size: 1.3rem; line-height: 1.6; }
/* TVs have no browser: the support link is a QR for the phone. */
.about-support { display: flex; align-items: center; padding: 1rem 1.3rem 1.3rem; font-size: 1.25rem; line-height: 1.55; }
.about-support .qr { width: 10rem; height: 10rem; flex: none; margin-right: 1.6rem; border-radius: 0.8rem; }
.about-support-title { font-weight: 700; font-size: 1.45rem; margin-bottom: 0.3rem; color: var(--accent); }

/* ---- avatars -------------------------------------------------------------------- */

.avatar {
  display: flex; align-items: center; justify-content: center; overflow: hidden; flex: none;
  width: 12.5rem; height: 12.5rem; border-radius: 50%;
  font-size: 5rem; font-weight: 700; color: #fff;
}
.avatar.small { width: 3.3rem; height: 3.3rem; font-size: 1.4rem; }
.avatar.c0 { background: linear-gradient(135deg, #7b5cff, #ff7ab6); }
.avatar.c1 { background: linear-gradient(135deg, #ffb36b, #ff5f6d); }
.avatar.c2 { background: linear-gradient(135deg, #38d9a9, #3b82f6); }
.avatar.c3 { background: linear-gradient(135deg, #ffd43b, #69db7c); }
.avatar.c4 { background: linear-gradient(135deg, #4facfe, #00f2fe); }
.avatar.c5 { background: linear-gradient(135deg, #f093fb, #f5576c); }
.avatar.c6 { background: linear-gradient(135deg, #a18cd1, #fbc2eb); }
.avatar.c7 { background: linear-gradient(135deg, #43e97b, #38f9d7); }
.add-avatar { background: var(--glass); border: 2px dashed var(--line); color: var(--muted); box-sizing: border-box; }
.add-avatar .icon { width: 4rem; height: 4rem; }

/* ---- gate: server, sign-in, profiles ---------------------------------------- */

.gate-page { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gate-card { width: 56rem; padding: 3.5rem 4rem; box-sizing: border-box; }
.gate-title { font-size: 3rem; line-height: 1.1; margin: 0.9rem 0 1rem; }
.gate-text { font-size: 1.35rem; line-height: 1.5; color: var(--fg-2); }
.known { margin-top: 2.4rem; border-top: 1px solid var(--line); padding-top: 1.4rem; }
.known-title { font-size: 1.1rem; color: var(--muted); margin-bottom: 0.6rem; }

.gate-card.pair { width: 77.5rem; padding: 0; display: flex; }
.pair-left { flex: 1; padding: 4rem 4rem 3rem; }
.pair-right { width: 26rem; display: flex; flex-direction: column; align-items: center; justify-content: center; border-left: 1px solid var(--line); padding: 2rem; text-align: center; }
.pair-right .muted { margin-top: 1.2rem; }
.step { display: flex; margin-top: 1.4rem; font-size: 1.4rem; color: var(--fg-2); line-height: 1.45; }
.step b { flex: none; width: 2.5rem; height: 2.5rem; border-radius: 50%; background: var(--glass-hi); color: var(--fg); display: flex; align-items: center; justify-content: center; margin-right: 1.1rem; font-size: 1.2rem; }
.code { font-size: 5.6rem; font-weight: 750; letter-spacing: 0.12em; font-variant-numeric: tabular-nums; margin-top: 2.2rem; color: var(--accent); }
.code-wait { display: flex; align-items: center; height: 8.5rem; margin-top: 2rem; color: var(--muted); font-size: 1.3rem; }
.code-wait .spinner { margin-right: 1.2rem; }
.server-line { font-size: 1.15rem; color: var(--faint); margin-top: 2rem; }
.qr { width: 16rem; height: 16rem; border-radius: 1rem; background: #fff; display: block; }
.qr-empty { background: var(--glass); }

.profiles-title { font-size: 3.4rem; letter-spacing: -0.025em; }
.profiles-sub { font-size: 1.5rem; color: var(--muted); margin-top: 0.7rem; }
.profiles { display: flex; justify-content: center; margin-top: 4.5rem; }
.profile { width: 14rem; margin: 0 1.6rem; border: 0; padding: 0; background: transparent; cursor: pointer; display: flex; flex-direction: column; align-items: center; transition: transform 0.18s ease; }
.profile .avatar { border: 0.2rem solid transparent; }
.profile-name { margin-top: 1.4rem; font-size: 1.6rem; color: var(--muted); }
.profile-note { margin-top: 0.4rem; font-size: 1.1rem; color: var(--faint); height: 1.4rem; display: flex; align-items: center; }
.profile-note .icon { width: 1.1rem; height: 1.1rem; margin-right: 0.3rem; }
.profile:focus { transform: scale(1.1); }
.profile:focus .avatar { border-color: var(--accent); box-shadow: 0 0 0 0.5rem rgba(255, 255, 255, 0.06); }
.profile:focus .profile-name { color: var(--fg); }
.profile.busy .avatar { opacity: 0.5; }
/* "Kids profile" in the new-profile card: its own block, text and switch
   clear of the edges. */
.toggle-wrap { margin-top: 1.6rem; border-radius: var(--radius-sm); background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); }
.toggle-wrap .row { padding: 1.1rem 1.6rem; min-height: 5rem; }
.toggle-wrap .row-hint { margin-top: 0.35rem; }
.toggle-wrap .switch { margin-left: 2rem; }
.profiles-foot { position: absolute; bottom: 4.4rem; width: 100%; text-align: center; font-size: 1.2rem; color: var(--faint); }

/* ---- side menu (ui/Sidebar.tsx) ------------------------------------------ */

.sidebar { position: absolute; left: 0; top: 0; bottom: 0; width: 6.5rem; z-index: 10; display: flex; flex-direction: column; padding: 2.6rem 0 2.4rem; box-sizing: border-box; }
/* Closed: a shade behind the icons, so posters scrolling under them don't
   hide them. Open: the glass panel. */
.side-panel {
  position: absolute; left: 0; top: 0; bottom: 0; width: 10rem;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.6) 55%, rgba(0, 0, 0, 0) 100%);
}
.sidebar.open { width: 24rem; }
.sidebar.open .side-panel {
  width: 24rem; border-right: 1px solid var(--line);
  background: rgba(10, 11, 16, 0.94);
}
html[data-glass="light"] .sidebar.open .side-panel { background: rgba(14, 16, 22, 0.88); }
html[data-glass="real"] .sidebar.open .side-panel {
  background: rgba(14, 16, 22, 0.55);
  -webkit-backdrop-filter: blur(2rem) saturate(150%); backdrop-filter: blur(2rem) saturate(150%);
}
.side-brand { position: relative; display: flex; align-items: center; height: 3.4rem; padding-left: 1.7rem; margin-bottom: 3rem; }
.side-logo { width: 3.1rem; height: 3.1rem; flex: none; border-radius: 0.8rem; background: url("icons/icon.svg") center / contain no-repeat; }
.side-brand .side-label { display: block; white-space: nowrap; font-size: 1.7rem; font-weight: 750; letter-spacing: -0.03em; }
.side-brand .side-label b { color: var(--accent); font-weight: 750; }
.side-items { position: relative; flex: 1; display: flex; flex-direction: column; justify-content: center; }
.side-item {
  position: relative; display: flex; align-items: center; height: 4rem; margin: 0.25rem 0.9rem; padding: 0 0.95rem;
  border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; text-align: left;
  font-size: 1.4rem; font-weight: 600; white-space: nowrap; overflow: hidden;
}
.side-item .icon { width: 2.1rem; height: 2.1rem; }
.side-item.active { color: var(--fg); }
.side-item.active .icon { color: var(--accent); }
.side-label { margin-left: 1.3rem; opacity: 0; transition: opacity 0.15s; display: flex; flex-direction: column; }
.side-label small { font-size: 1.05rem; color: var(--muted); font-weight: 500; }
.sidebar.open .side-label { opacity: 1; }
.side-item:focus { background: var(--fg); color: var(--bg); }
.side-item:focus .icon { color: var(--bg); }
.side-item:focus .side-label small { color: rgba(0, 0, 0, 0.55); }
.side-profile { position: relative; height: 4.6rem; padding-left: 0.5rem; }
.side-profile .avatar { width: 3.4rem; height: 3.4rem; font-size: 1.4rem; }
.side-profile:focus .avatar { box-shadow: 0 0 0 0.18rem var(--bg); }

/* ---- browse pages: carousel and rails (ui/pages/BrowsePage.tsx) ------------- */

.browse-scroll { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
.browse-scroll > .tscroll-inner { padding-bottom: 6rem; }
.hero-block { position: relative; height: 54rem; }
.hero-block.short { height: 9rem; }
/* The whole stage (picture and shade) fades out at the bottom into the
   ambient background: no band where it ends. */
.stage {
  position: absolute; left: 0; top: 0; width: 120rem; height: 67.5rem; transition: opacity 0.45s;
  -webkit-mask-image: linear-gradient(180deg, #000 62%, rgba(0, 0, 0, 0) 100%);
  mask-image: linear-gradient(180deg, #000 62%, rgba(0, 0, 0, 0) 100%);
}
.stage-img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; animation: fadein 0.6s ease; }
.stage-img img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.stage-shade {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.45) 32%, rgba(0, 0, 0, 0) 62%),
              linear-gradient(0deg, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0) 45%);
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.browse-page.browsing .stage { opacity: 0.18; }
.carousel-info { position: absolute; left: 9rem; bottom: 15rem; width: 54rem; animation: fadein 0.5s ease; }
.badge-pill { display: inline-block; padding: 0.35rem 1.1rem; border: 1px solid rgba(255, 255, 255, 0.55); border-radius: 999px; background: rgba(0, 0, 0, 0.25); font-size: 1.15rem; font-weight: 650; }
.carousel-logo { height: 10rem; width: 36rem; margin: 1.3rem 0 1.2rem; display: flex; align-items: flex-end; }
.carousel-logo img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; object-position: left bottom; }
.carousel-logo .img-fallback, .carousel-logo .img-pending { justify-content: flex-start; align-items: flex-end; }
.carousel-title { font-size: 4.4rem; line-height: 1.04; letter-spacing: -0.035em; margin: 1rem 0; }
.carousel-plot { font-size: 1.4rem; line-height: 1.5; color: var(--fg-2); margin-top: 1rem; max-height: 4.2rem; overflow: hidden; width: 48rem; }
.carousel-actions { position: absolute; left: 9rem; top: 40.5rem; display: flex; align-items: center; }
.carousel-actions .btn { margin-right: 1.1rem; }
.round {
  width: 4rem; height: 4rem; margin-right: 1.1rem; border: 0; border-radius: 50%; cursor: pointer; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.16); color: var(--fg); transition: transform 0.14s ease;
}
.round .icon { width: 1.9rem; height: 1.9rem; }
.round.on { color: var(--accent); }
.round:focus { background: var(--fg); color: var(--bg); transform: scale(1.1); }
.dots { position: absolute; left: 0; width: 120rem; top: 48rem; text-align: center; }
.dot { display: inline-block; width: 0.55rem; height: 0.55rem; margin: 0 0.3rem; border-radius: 0.3rem; background: rgba(255, 255, 255, 0.4); vertical-align: middle; transition: width 0.25s; }
.dot.on { width: 1.8rem; background: #fff; }

.browse-page .rail { position: relative; margin-bottom: 1.6rem; }
.browse-page .rail-title { margin-left: 9rem; }
.browse-page .rail-scroll { padding-left: 9rem; }
.rail-empty { display: block; }
.kind-poster .rail-empty { height: 26.7rem; }
.kind-continue .rail-empty { height: 21.7rem; }
.kind-rank .rail-empty { height: 23.6rem; }
.kind-big .rail-empty { height: 42rem; }

/* A card's ⋮ (cardMenu.tsx): always on a phone, on the focused card with a
   remote (the sign that a long OK has more), under a mouse. */
.card-more { display: none; position: absolute; right: 0.7rem; top: 0.7rem; z-index: 2; width: 2.6rem; height: 2.6rem; box-sizing: border-box; border-radius: 50%; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.22); border: 0.1rem solid rgba(255, 255, 255, 0.28); color: rgba(255, 255, 255, 0.92); cursor: pointer; }
.card-more .icon { width: 1.8rem; height: 1.8rem; }
.card:focus .card-more, html.touch .card-more, html.pointer .card:hover .card-more { display: flex; }
.card-more:active { background: rgba(255, 255, 255, 0.3); }
.continue-card { width: 26.25rem; margin-right: 1.6rem; }
.continue-card .thumb { width: 26.25rem; height: 14.75rem; }
.rank-card { display: flex; align-items: flex-end; width: 23.5rem; margin-right: 1.2rem; }
.rank-num {
  flex: none; width: 9.5rem; margin-right: -1.2rem; text-align: right;
  font-size: 15rem; line-height: 0.8; font-weight: 800; letter-spacing: -0.08em;
  color: var(--bg); -webkit-text-stroke: 0.22rem rgba(255, 255, 255, 0.55);
}
.rank-card:focus .rank-num { -webkit-text-stroke-color: var(--accent); }
.rank-card .poster { position: relative; }
.big-card { width: 26rem; margin-right: 1.8rem; }
/* "See all" takes the size of the cards before it. */
.kind-continue .more-card { width: 26.25rem; height: 14.75rem; }
.kind-big .more-card { width: 26rem; height: 39rem; border-radius: 1.2rem; }
.kind-big .more-icon { width: 7rem; height: 7rem; }
.kind-big .more-icon .icon { width: 3.6rem; height: 3.6rem; }
.kind-big .more-label { font-size: 1.6rem; }
.card.big-card:focus .poster, .kind-big .more-card:focus { transform: scale(1.035); }
.kind-rank .more-card { height: 20.6rem; }
.big-card .poster { width: 26rem; height: 39rem; border-radius: 1.2rem; }

/* ---- avatar gallery (ui/AvatarPicker.tsx) ---------------------------------- */

.avatar-picker { position: fixed; left: 0; top: 0; width: 100%; height: 100%; z-index: 40; background: rgba(0, 0, 0, 0.72); display: flex; align-items: center; justify-content: center; }
.avatar-picker-box { width: 108rem; height: 60rem; padding: 2.4rem 2.4rem 0; box-sizing: border-box; display: flex; flex-direction: column; background: var(--bg-2); }
.avatar-picker-box h2 { font-size: 2rem; margin: 0 0 0.6rem 0.4rem; }
.avatar-grid { flex: 1; }
.avatar-choice { display: block; width: 10.2rem; height: 10.2rem; margin: 0 auto; padding: 0; border: 0; border-radius: 50%; overflow: hidden; cursor: pointer; background: var(--bg-3); transition: transform 0.15s ease; }
.avatar-choice img { display: block; width: 100%; height: 100%; object-fit: cover; }
.avatar-choice.current { box-shadow: 0 0 0 0.25rem var(--fg); }
.avatar-choice:focus { transform: scale(1.1); box-shadow: 0 0 0 0.3rem var(--accent); }
.avatar-edit { display: flex; align-items: center; margin-top: 1.6rem; }
.avatar-edit .avatar { width: 8rem; height: 8rem; font-size: 3rem; margin-right: 1.6rem; }

/* ---- dialogs and toasts ----------------------------------------------------- */

.dialog-backdrop { position: fixed; left: 0; top: 0; width: 100%; height: 100%; z-index: 50; background: rgba(0, 0, 0, 0.62); display: flex; align-items: center; justify-content: center; }
.dialog { min-width: 34rem; max-width: 56rem; padding: 2.6rem 3rem; border-radius: var(--radius); background: var(--bg-3); border: 1px solid var(--line); }
.dialog h2 { font-size: 1.9rem; margin-bottom: 0.8rem; }
.dialog p { font-size: 1.3rem; color: var(--fg-2); line-height: 1.45; }
.dialog-buttons { display: flex; justify-content: flex-end; margin-top: 2rem; }
.dialog-buttons .btn { margin-left: 1rem; }
.dialog-menu { display: flex; flex-direction: column; margin-top: 1.4rem; }
.dialog-menu .btn { margin-bottom: 0.6rem; justify-content: flex-start; border-radius: var(--radius-sm); }
.dialog-menu .btn:focus { transform: none; }
.pin { margin-top: 1.4rem; }
.pin-dots { display: flex; justify-content: center; margin-bottom: 1.6rem; }
.pin-dot { width: 1.3rem; height: 1.3rem; border-radius: 50%; background: var(--glass-hi); margin: 0 0.6rem; }
.pin-dot.on { background: var(--accent); }
.pin-pad { display: flex; flex-wrap: wrap; justify-content: center; width: 20rem; margin: 0 auto; }
.pin-pad .btn { width: 5rem; height: 4rem; margin: 0.3rem; justify-content: center; padding: 0; }

.toast {
  position: fixed; left: 50%; bottom: 3.5rem; z-index: 60; transform: translateX(-50%);
  padding: 1rem 1.8rem; border-radius: 999px; background: var(--bg-3); border: 1px solid var(--line);
  font-size: 1.3rem; display: flex; align-items: center; white-space: nowrap;
}

/* ---- player ------------------------------------------------------------------- */

.player { position: fixed; left: 0; top: 0; width: 100%; height: 100%; z-index: 20; background: #000; color: #f3f4f7; }
.video-layer, .video { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
.video { object-fit: contain; background: #000; }
.player-center { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.cue {
  position: absolute; left: 10%; right: 10%; bottom: 7%; text-align: center; white-space: pre-line;
  font-size: 2.4rem; line-height: 1.3; font-weight: 600; color: #fff;
  text-shadow: 0 0 0.25rem #000, 0 0 0.25rem #000, 0.12rem 0.12rem 0.1rem #000;
  transition: transform 0.2s;
}
.cue.size-small { font-size: 1.9rem; }
.cue.size-large { font-size: 3.1rem; }
.cue:empty { display: none; }
.with-panel .cue { transform: translateY(-11rem); }
.player-error { position: absolute; left: 50%; top: 50%; width: 60rem; margin-left: -30rem; transform: translateY(-50%); padding: 3rem; box-sizing: border-box; text-align: center; background: rgba(15, 17, 24, 0.92); }
.player-error h2 { font-size: 1.9rem; margin: 1rem 0 0.6rem; }
.player-error .actions { justify-content: center; }

.osd { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
.osd-top {
  position: absolute; left: 0; right: 0; top: 0; padding: 3rem 4.5rem 10rem; display: flex; align-items: flex-start;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.35) 50%, rgba(0, 0, 0, 0) 100%);
}
.osd-title { flex: 1; }
.osd-title h2 { font-size: 2.4rem; }
.osd-title .muted { font-size: 1.35rem; margin-top: 0.3rem; color: rgba(255, 255, 255, 0.7); }
.osd-right { display: flex; align-items: center; }
.quality-chip { margin-right: 1.2rem; padding: 0.2rem 0.7rem; border: 1px solid rgba(255, 255, 255, 0.5); border-radius: 0.45rem; font-size: 1.1rem; font-weight: 700; letter-spacing: 0.03em; color: rgba(255, 255, 255, 0.9); }
.osd-clock { font-size: 1.5rem; color: rgba(255, 255, 255, 0.75); font-variant-numeric: tabular-nums; }
.osd-bottom {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 12rem 4.5rem 3rem;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.5) 45%, rgba(0, 0, 0, 0) 100%);
}
.seekbar { display: block; width: 100%; border: 0; background: transparent; padding: 0.8rem 0; cursor: pointer; }
.bar { display: block; position: relative; height: 0.4rem; border-radius: 0.3rem; background: rgba(255, 255, 255, 0.25); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); }
.seekbar:focus .bar { height: 0.7rem; box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.35); }
.times { display: flex; justify-content: space-between; font-size: 1.2rem; color: rgba(255, 255, 255, 0.75); margin-top: 0.5rem; font-variant-numeric: tabular-nums; }
.osd-buttons { display: flex; align-items: center; margin-top: 1.4rem; }
.osd-buttons .btn { margin-left: 1rem; background: rgba(255, 255, 255, 0.14); color: #fff; }
.osd-buttons .btn:focus { background: var(--accent); color: var(--on-accent); }
.osd-buttons .round { margin-right: 1rem; background: rgba(255, 255, 255, 0.14); color: #fff; }
.osd-buttons .round.big { width: 5rem; height: 5rem; }
.osd-buttons .round.big .icon { width: 2.6rem; height: 2.6rem; }
.osd-buttons .round:focus { background: #fff; color: #111; }
.osd-buttons > .round:last-child { margin: 0 0 0 1rem; }
.osd-note { font-size: 1.1rem; color: rgba(255, 255, 255, 0.55); margin-top: 0.8rem; }

/* ←/→ seeking: where the video will jump, with the speed while held. */
.osd-prog { position: relative; }
.bar.seek { overflow: visible; }
.bar.seek > span { border-radius: 0.3rem; }
.seek-mark { position: absolute; top: 50%; width: 1.3rem; height: 1.3rem; margin: -0.65rem 0 0 -0.65rem; border-radius: 50%; background: #fff; box-shadow: 0 0 0 0.25rem var(--accent); }
.seek-bubble {
  position: absolute; bottom: 4.2rem; transform: translateX(-50%); white-space: nowrap;
  padding: 0.5rem 1rem; border-radius: 0.7rem; background: rgba(15, 17, 24, 0.92); border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 1.4rem; font-variant-numeric: tabular-nums; text-align: center;
}
.seek-bubble b { display: block; color: var(--accent); font-size: 1.15rem; }

/* Skip intro / recap / credits: bottom right, over the video. */
.skip-btn {
  position: absolute; right: 4.5rem; bottom: 8rem; display: flex; align-items: center;
  height: 4.4rem; padding: 0 2rem; border: 2px solid rgba(255, 255, 255, 0.85); border-radius: 0.6rem;
  background: rgba(0, 0, 0, 0.55); color: #fff; font: inherit; font-size: 1.45rem; font-weight: 650; cursor: pointer;
}
.skip-btn .icon { margin-right: 0.8rem; }
.with-panel .skip-btn { bottom: 18rem; }

/* Menus over the video: audio & subtitles side by side, speed, episodes. */
.player-menu-box { position: absolute; right: 4.5rem; bottom: 16rem; max-height: 46rem; padding: 1.4rem; display: flex; background: rgba(15, 17, 24, 0.94); }
.menu-col { width: 28rem; display: flex; flex-direction: column; }
.menu-col + .menu-col { margin-left: 1.6rem; padding-left: 1.6rem; border-left: 1px solid rgba(255, 255, 255, 0.12); }
.menu-col h3 { font-size: 1.3rem; color: rgba(255, 255, 255, 0.6); font-weight: 650; text-transform: uppercase; letter-spacing: 0.1em; margin: 0 0 0.8rem 0.6rem; }
.player-menu { max-height: 38rem; }
.player-menu .btn { display: flex; width: 100%; margin-bottom: 0.4rem; border-radius: var(--radius-sm); background: transparent; color: #fff; justify-content: flex-start; }
.player-menu .btn.selected { color: var(--accent); }
.player-menu .btn:focus { background: #fff; color: #111; transform: none; }
.player-menu .btn:focus .icon { color: #111; }
.episodes-box .menu-col { width: 44rem; }
.ep-row { display: flex; align-items: center; width: 100%; padding: 0.6rem; margin-bottom: 0.4rem; border: 0; border-radius: var(--radius-sm); background: transparent; color: #fff; cursor: pointer; text-align: left; font: inherit; }
.ep-row-thumb { width: 12rem; height: 6.75rem; flex: none; border-radius: 0.5rem; overflow: hidden; background: rgba(255, 255, 255, 0.08); }
.ep-row-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ep-row-text { display: flex; flex-direction: column; margin-left: 1.2rem; min-width: 0; }
.ep-row-title { font-size: 1.3rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ep-row-sub { font-size: 1.05rem; color: rgba(255, 255, 255, 0.55); margin-top: 0.3rem; }
.ep-row.current .ep-row-title { color: var(--accent); }
.ep-row:focus { background: #fff; color: #111; }
.ep-row:focus .ep-row-title { color: #111; }
.ep-row:focus .ep-row-sub { color: rgba(0, 0, 0, 0.6); }

/* "Are you still watching?" after a few episodes in a row untouched. */
.still { position: absolute; left: 50%; top: 50%; width: 64rem; margin-left: -32rem; transform: translateY(-50%); padding: 3rem; box-sizing: border-box; text-align: center; background: rgba(15, 17, 24, 0.94); }
.still h2 { font-size: 2.2rem; line-height: 1.25; }
.still .actions { justify-content: center; }

/* Next episode, near the credits. */
.upnext { position: absolute; right: 4.5rem; bottom: 6rem; display: flex; align-items: center; padding: 1.4rem; background: rgba(15, 17, 24, 0.94); }
.upnext-thumb { width: 22rem; height: 12.4rem; border-radius: 0.7rem; overflow: hidden; flex: none; background: rgba(255, 255, 255, 0.08); }
.upnext-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.upnext-text { margin-left: 1.6rem; width: 30rem; }
.upnext-title { font-size: 1.6rem; font-weight: 700; margin-top: 0.4rem; }
.upnext .actions { margin-top: 1.2rem; }

/* ---- touch: phones and tablets (html.touch, Android in touch mode) ------------
   The same screens as on the TV, sized for a hand-held screen: 1rem follows
   the shorter side, the side menu becomes a bar at the bottom, insets shrink,
   and the focus look of the remote stays off (a tap is not a focus move). */

html.touch { font-size: calc(6px + 1.2vmin); }
/* The lists scroll natively under a finger (nav.ts): the system's own
   scrolling and fling, no transform moving them. */
html.touch .tscroll, html.platform-linux .tscroll, html.desktop .tscroll {
  overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain; scrollbar-width: none;
}
/* Sideways only: an up or down drag on a rail goes on to the page. */
html.touch .tscroll.tscroll-x, html.platform-linux .tscroll.tscroll-x, html.desktop .tscroll.tscroll-x { overflow-x: auto; overflow-y: hidden; overscroll-behavior-y: auto; overscroll-behavior-x: contain; }
html.touch .tscroll::-webkit-scrollbar, html.platform-linux .tscroll::-webkit-scrollbar, html.desktop .tscroll::-webkit-scrollbar { display: none; }
html.touch .tscroll > .tscroll-inner, html.platform-linux .tscroll > .tscroll-inner, html.desktop .tscroll > .tscroll-inner { transition: none; will-change: auto; }
html.touch .focusable { -webkit-tap-highlight-color: transparent; }
html.touch .btn .spinner.small { margin-right: 0.7rem; }

/* The menu: a bar at the bottom (upright) or a slim column on the left
   (lying down), icons only, never opening over the page. */
html.touch .side-panel, html.touch .side-brand, html.touch .side-label { display: none; }
html.touch .sidebar.open { width: 6rem; }
html.touch .side-item .icon { width: 2.5rem; height: 2.5rem; }
html.touch .side-item:focus { background: transparent; color: var(--muted); }
html.touch .side-item:focus .icon { color: inherit; }
html.touch .side-item.active, html.touch .side-item.active:focus { color: var(--fg); }
html.touch .side-item.active .icon { color: var(--accent); }
html.touch .side-profile:focus .avatar { box-shadow: none; }
html.touch .sidebar { width: 6rem; padding: 0.6rem 0; background: rgba(8, 9, 13, 0.97); border-right: 1px solid var(--line); }
html.touch .side-item { justify-content: center; margin: 0; padding: 0; border-radius: 0; height: 4.6rem; }
html.touch .side-profile { height: 5rem; padding: 0; }

/* Pages: narrow insets, room for the bar. */
html.touch .with-side .page { padding: 1.6rem 0 0 6rem; }
html.touch .with-side .browse-page { padding: 0; }
html.touch .with-side .browse-scroll { left: 6rem; width: auto; right: 0; }
html.touch .library-page, html.touch .mylist-page, html.touch .settings-page, html.touch .search-page { padding-top: 1.6rem; }
html.touch .page-header { padding: 0 1.6rem 1.2rem; flex-wrap: wrap; }
html.touch .page-header h1 { font-size: 2.3rem; }
html.touch .page-header .btn { margin: 0.4rem 0.6rem 0.4rem 0; }
html.touch .genre-chips { padding-left: 1.6rem; margin-top: -0.4rem; }
html.touch .cat-card { width: 15rem; height: 8.4rem; margin-right: 0.8rem; }
html.touch .cat-card .cat-label { font-size: 1.3rem; left: 0.6rem; right: 0.6rem; }
html.touch .cat-card.small { width: 11.5rem; height: 6.5rem; }
html.touch .cat-card.small .cat-label { font-size: 1.05rem; }
html.touch .cat-card:focus { transform: none; box-shadow: none; }
html.touch .cat-card.active, html.touch .cat-card.active:focus { box-shadow: 0 0 0 0.2rem #fff; }
html.touch .kind-category .rail-empty { height: 8.4rem; }
html.touch .page-header h1 + .count, html.touch .page-header .count { margin-right: auto; }
html.touch .pad, html.touch .tagline, html.touch .overview, html.touch .facts { padding: 0 1.6rem; }
html.touch .rail-title, html.touch .browse-page .rail-title { margin-left: 1.6rem; }
html.touch .rail-scroll, html.touch .browse-page .rail-scroll { padding-left: 1.6rem; }
html.touch .rail-scroll .tscroll-inner.row-x { padding-right: 1.6rem; }
html.touch .browse-scroll > .tscroll-inner { padding-bottom: 9rem; }
html.touch .season-tabs { padding-left: 1.6rem; }
html.touch .poster-grid { margin: 0 0.8rem; padding: 0; }
html.touch .settings-body { padding: 0 1.6rem; }
html.touch .settings-body .tscroll-inner { width: auto; max-width: 70rem; padding-bottom: 8rem; }
html.touch .search-bar { padding: 0 1.6rem 1.2rem; }
html.touch .search-bar .field { width: auto; flex: 1; margin-right: 1rem; }
html.touch .narrow-page { padding: 2rem 0; }
html.touch .narrow-page .page-header { width: 100%; padding: 0 1.6rem 1.2rem; }
html.touch .list-body { width: calc(100% - 3.2rem); max-height: none; flex: 1; }
html.touch .empty { padding: 3rem 1.6rem; }
html.touch .person-head { padding: 3rem 1.6rem 2rem; flex-wrap: wrap; }
html.touch .person-photo.big { width: 12rem; height: 12rem; }
html.touch .person-text { margin: 1.4rem 0 0; }

/* Gate: sign-in, pairing, profiles, new profile. */
/* Phones: the card from the top (the keyboard covers the lower half) and the
   page as tall as what the keyboard leaves (--vvh, nav.ts), scrolling. */
html.touch .gate-page {
  padding: 1.6rem; box-sizing: border-box; height: var(--vvh, 100%);
  justify-content: flex-start; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding-top: calc(env(safe-area-inset-top) + 6vh); padding-bottom: calc(env(safe-area-inset-bottom) + 2rem);
}
html.touch .gate-page > * { flex: none; }
/* No field there: centred while it fits. */
html.touch .profiles-page > * { margin-top: auto; margin-bottom: auto; }
/* Under 16px Safari zooms into the field when it is tapped. */
html.touch .input { font-size: max(16px, 1.5rem); }
html.touch .gate-card { width: 100%; max-width: 56rem; padding: 2.4rem 2rem; }
html.touch .gate-title { font-size: 2.5rem; }
html.touch .gate-card.pair { flex-direction: column; max-width: 56rem; }
html.touch .pair-left { padding: 2.4rem 2rem 2rem; }
html.touch .pair-right { width: auto; border-left: 0; border-top: 1px solid var(--line); padding: 2rem; }
html.touch .code { font-size: 4.4rem; margin-top: 1.6rem; }
html.touch .actions { flex-wrap: wrap; }
html.touch .actions .btn { margin-bottom: 0.8rem; }
html.touch .profiles { flex-wrap: wrap; margin-top: 3rem; }
html.touch .profile { width: 11rem; margin: 0 1rem 2rem; }
html.touch .profile .avatar { width: 9.5rem; height: 9.5rem; font-size: 3.8rem; }
html.touch .profile:focus { transform: none; }
html.touch .profile:focus .avatar { border-color: transparent; box-shadow: none; }
html.touch .profile:focus .profile-name { color: var(--muted); }
html.touch .profiles-title { font-size: 2.6rem; text-align: center; }
html.touch .profiles-foot { position: static; margin-top: 2rem; }
html.touch .connect-card { width: calc(100% - 3.2rem); }

/* Dialogs, avatar gallery, toasts. */
html.touch .dialog { min-width: 0; width: calc(100% - 3.2rem); max-width: 50rem; box-sizing: border-box; padding: 2.2rem 2rem; }
html.touch .dialog-buttons { flex-wrap: wrap; }
html.touch .avatar-picker-box { width: 100%; height: 100%; border-radius: 0; padding: 2rem 1.6rem 0; }
html.touch .toast { bottom: 8rem; white-space: normal; max-width: calc(100% - 3.2rem); box-sizing: border-box; }

/* Detail page. */
html.touch .detail-page .hero, html.touch .detail-page .hero-img, html.touch .detail-page .hero-fade { height: 36rem; }
html.touch .hero-info, html.touch .detail-page .hero-info { left: 1.6rem; top: auto; bottom: 7rem; width: calc(100% - 3.2rem); }
html.touch .hero-title { font-size: 3.2rem; }
html.touch .hero-logo { height: 6rem; width: 24rem; }
html.touch .hero-plot { display: none; }
/* As streaming apps on a phone: one wide Play, the rest as icons with a
   word under them (side by side they wrapped into two cramped rows). */
html.touch .detail-actions { margin: -5.5rem 1.6rem 2rem; flex-wrap: wrap; }
html.touch .detail-actions .btn { flex: 1 1 0; flex-direction: column; justify-content: flex-start; height: auto; min-width: 0; margin: 0; padding: 0.6rem 0.2rem; background: transparent; font-size: 1.1rem; font-weight: 500; color: var(--fg-2); white-space: normal; text-align: center; }
html.touch .detail-actions .btn .icon { margin: 0 0 0.5rem; width: 2.4rem; height: 2.4rem; }
html.touch .detail-actions .btn.active .icon { color: var(--accent); }
html.touch .detail-actions .btn.primary { flex: 1 1 100%; flex-direction: row; justify-content: center; height: 4.6rem; margin-bottom: 1.4rem; border-radius: var(--radius-sm); background: var(--fg); color: var(--bg); font-size: 1.5rem; font-weight: 700; }
html.touch .detail-actions .btn.primary .icon { margin: 0 0.8rem 0 0; }
html.touch .detail-actions .btn:focus { background: transparent; color: var(--fg-2); }
html.touch .detail-actions .btn.primary:focus { background: var(--fg); color: var(--bg); }

/* Focus looks of the remote, off for a finger (the press feedback stays). */
html.touch .btn:focus { background: var(--glass-hi); color: var(--fg); transform: none; }
html.touch .btn.primary:focus { background: var(--fg); color: var(--bg); }
html.touch .btn:focus .icon { color: inherit; }
html.touch .btn.chip.active:focus { background: var(--fg); color: var(--bg); }
html.touch .btn:active, html.touch .round:active, html.touch .row:active { transform: scale(0.96); }
html.touch .round:focus { background: rgba(255, 255, 255, 0.16); color: var(--fg); transform: none; }
html.touch .round.on:focus { color: var(--accent); }
html.touch .row:focus { background: transparent; color: var(--fg); }
html.touch .row:focus .row-hint, html.touch .row:focus > .icon { color: var(--muted); }
html.touch .row:focus .row-value { color: var(--accent); }
html.touch .row.active:focus .row-title { color: var(--accent); }
html.touch .row:active { background: var(--glass); }
html.touch .toggle:focus .switch { background: var(--glass-hi); }
html.touch .toggle.on:focus .switch { background: var(--accent); }
html.touch .card:focus .poster, html.touch .card:focus .thumb, html.touch .card:focus .person-photo { transform: none; box-shadow: none; }
html.touch .card:focus .poster::after, html.touch .card:focus .thumb::after, html.touch .card:focus .person-photo::after { content: none; }
html.touch .card:focus .card-title { color: var(--fg-2); }
html.touch .card:focus .card-title, html.touch .card:focus .card-sub { transform: none; }
html.touch .card:active .poster, html.touch .card:active .thumb { transform: scale(0.97); }
html.touch .rank-card:focus .rank-num { -webkit-text-stroke-color: rgba(255, 255, 255, 0.55); }
html.touch .more-card:focus { transform: none; box-shadow: none; color: var(--fg-2); background: linear-gradient(160deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03)); }
html.touch .more-card:focus .more-icon { background: transparent; border-color: rgba(255, 255, 255, 0.55); color: inherit; transform: none; }
html.touch .avatar-choice:focus { transform: none; box-shadow: none; }
html.touch .avatar-choice.current:focus { box-shadow: 0 0 0 0.25rem var(--fg); }
html.touch .input:focus { border-color: var(--accent); }

/* The on-screen Back (BackArrow): pushed screens and the player. */
.back-fab {
  position: absolute; left: 1.2rem; top: 1.2rem; z-index: 15; width: 4.4rem; height: 4.4rem; padding: 0;
  border: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.55); color: #fff; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.back-fab .icon { width: 2.4rem; height: 2.4rem; }
.back-fab:active { transform: scale(0.92); }
html.touch .pushed .page-header, html.touch .pushed .narrow-page .page-header { padding-left: 7rem; min-height: 4.4rem; }
html.touch .osd-top .back-fab, html.platform-linux .osd-top .back-fab, html.desktop .osd-top .back-fab { position: relative; left: 0; top: 0; flex: none; margin-right: 1.4rem; }

/* Player: smaller insets, icon-only buttons. */
html.touch .osd-top { padding: 2rem 2rem 8rem; }
html.touch .osd-bottom { padding: 8rem 2rem 2rem; }
html.touch .osd-title h2 { font-size: 2rem; }
html.touch .seekbar { padding: 1.4rem 0; }
html.touch .bar, html.touch .seekbar:focus .bar { height: 0.6rem; box-shadow: none; }
html.touch .osd-buttons { flex-wrap: wrap; }
html.touch .osd-buttons .btn { font-size: 0; padding: 0 1.3rem; margin-left: 0.8rem; }
html.touch .osd-buttons .btn .icon { margin: 0; width: 2.2rem; height: 2.2rem; }
html.touch .osd-buttons .btn:focus { background: rgba(255, 255, 255, 0.14); color: #fff; }
html.touch .osd-buttons .round:focus { background: rgba(255, 255, 255, 0.14); color: #fff; }
html.touch .player-menu-box { left: 1.6rem; right: 1.6rem; bottom: 2rem; top: 2rem; max-height: none; flex-direction: column; overflow: hidden; }
html.touch .menu-col, html.touch .episodes-box .menu-col { width: auto; flex: 1; min-height: 0; }
html.touch .menu-col + .menu-col { margin: 1.2rem 0 0; padding: 1.2rem 0 0; border-left: 0; border-top: 1px solid rgba(255, 255, 255, 0.12); }
html.touch .player-menu { max-height: none; flex: 1; }
html.touch .player-menu .btn:focus { background: transparent; color: #fff; }
html.touch .player-menu .btn.selected:focus { color: var(--accent); }
html.touch .ep-row:focus { background: transparent; color: #fff; }
html.touch .ep-row:focus .ep-row-title { color: #fff; }
html.touch .ep-row.current .ep-row-title { color: var(--accent); }
html.touch .skip-btn { right: 2rem; bottom: 6rem; }
html.touch .upnext { right: 1.6rem; bottom: 2rem; left: 1.6rem; }
html.touch .upnext-thumb { width: 14rem; height: 7.9rem; }
html.touch .upnext-text { width: auto; flex: 1; }
/* A phone on its side has the room for the TV's card, at the right: the picture stays in view. */
@media (orientation: landscape) {
  html.touch .upnext { left: auto; max-width: 62%; }
  html.touch .upnext-text { flex: 0 1 auto; }
}
html.touch .still, html.touch .player-error { width: calc(100% - 3.2rem); left: 1.6rem; margin-left: 0; }

/* Home carousel, phone held upright: the picture on top, the text and
   buttons under it. */
@media (orientation: portrait) {
  html.touch .sidebar, html.touch .sidebar.open {
    left: 0; right: 0; top: auto; bottom: 0; width: auto; height: 6rem; padding: 0; flex-direction: row;
    border-right: 0; border-top: 1px solid var(--line);
  }
  html.touch .side-items { flex-direction: row; align-items: center; justify-content: space-around; }
  html.touch .side-item { flex: 1; height: 6rem; margin: 0; }
  html.touch .side-profile { flex: none; width: 6rem; height: 6rem; }
  html.touch .with-side .page { padding: 1.6rem 0 6rem; }
  html.touch .with-side .browse-scroll { left: 0; }
  html.touch .hero-block { height: auto; }
  html.touch .hero-block.short { height: 2rem; }
  html.touch .carousel { position: relative; }
  html.touch .stage { width: 100%; height: 62vw; }
  html.touch .stage-shade { background: linear-gradient(0deg, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0) 50%); }
  html.touch .carousel-info { position: relative; left: 0; bottom: auto; width: auto; padding: 44vw 1.6rem 0; }
  html.touch .carousel-logo { height: 6.5rem; width: 26rem; margin: 1rem 0; }
  html.touch .carousel-title { font-size: 3rem; }
  html.touch .carousel-plot { display: none; }
  html.touch .carousel-actions { position: relative; left: 0; top: 0; padding: 1.6rem 1.6rem 0; }
  html.touch .dots { position: relative; top: 0; width: 100%; padding: 1.6rem 0 2rem; }
  html.touch .hero-info { bottom: 6rem; }
}

/* Lying down: the TV layout, shorter. */
@media (orientation: landscape) {
  html.touch .hero-block { height: 32rem; }
  html.touch .stage { width: 100%; height: 34rem; }
  html.touch .carousel-info { left: 3rem; bottom: 8rem; width: 46rem; }
  html.touch .carousel-logo { height: 6rem; width: 24rem; margin: 0.8rem 0; }
  html.touch .carousel-title { font-size: 3rem; }
  html.touch .carousel-plot { display: none; }
  html.touch .carousel-actions { left: 3rem; top: 24.5rem; }
  html.touch .dots { width: 100%; top: 30rem; }
}

/* ---- Chromecast (Android phones) ------------------------------------------- */

.cast-btn {
  width: 4.4rem; height: 4.4rem; padding: 0; border: 0; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  background: rgba(0, 0, 0, 0.45); color: #fff; -webkit-tap-highlight-color: transparent;
}
.cast-btn .icon { width: 2.4rem; height: 2.4rem; }
.cast-btn.on { color: var(--accent); }
.cast-btn.busy { opacity: 0.6; }
.osd-right .cast-btn { margin-right: 1.2rem; }
.cast-corner { position: absolute; right: 1.4rem; top: 1.4rem; z-index: 6; }
/* The Linux window draws its own buttons in that corner (full screen, minimise, maximise, close): below them. */
html.platform-linux .cast-corner { top: 5rem; right: 1.8rem; }
.cast-screen { position: absolute; left: 0; top: 0; width: 100%; height: 100%; background: #000; }
.cast-screen .img-fallback, .cast-screen img { opacity: 0.35; }
.cast-screen img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cast-text {
  position: absolute; left: 0; right: 0; top: 38%; display: flex; flex-direction: column; align-items: center;
  text-align: center; font-size: 1.8rem; font-weight: 650; color: #fff; padding: 0 2rem;
}
.cast-text .icon { color: var(--accent); margin-bottom: 1rem; }

/* ---- the Linux app (jellyashy-desktop) ----------------------------------------
   A translucent window: the page lets the window's own tinted background
   through. Its title bar is drawn over the page (window buttons at the top
   right, ~40 px): the logo sits on that line, and what is clickable at the
   top keeps clear of it. */
html.platform-linux, html.platform-linux body { background: transparent; }
html.platform-linux .ambient-veil { background: radial-gradient(120% 90% at 70% 0%, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.35) 78%); }
html.platform-linux .sidebar { padding-top: 0.4rem; }
html.platform-linux .side-brand { margin-bottom: 5.2rem; }
/* The back arrow sits on the title bar's line, at its left end (the window
   leaves that corner free of its drag area, window.py). */
html.platform-linux .back-fab { top: 3px; left: 12px; width: 32px; height: 32px; }
html.platform-linux .back-fab .icon { width: 20px; height: 20px; }
html.platform-linux .osd-top { padding-right: calc(4.5rem + 150px); }
html.platform-linux .osd-top .back-fab { top: 0; left: 0; width: 4.4rem; height: 4.4rem; }
html.platform-linux .osd-top .back-fab .icon { width: 2.4rem; height: 2.4rem; }

/* Settings → Hidden titles: a small poster (64 px tall at 1920) beside each name. */
.hidden-thumb {
  flex: none; width: 2.67rem; height: 4rem; margin-right: 1.1rem; border-radius: 0.35rem;
  overflow: hidden; background: rgba(255, 255, 255, 0.08);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; font-weight: 700; color: var(--muted);
}
.hidden-thumb img, .hidden-thumb .img-fallback, .hidden-thumb .img-pending { width: 100%; height: 100%; object-fit: cover; }
.hidden-thumb .img-fallback { display: flex; align-items: center; justify-content: center; }
