/* KinoPuk — 10-foot TV UI.
   Compatibility floor: webOS 3.x (Chromium 38). Therefore:
     - no CSS custom properties, no flex gap, no grid, no `inset`
     - animations use transform/opacity ONLY (compositor-cheap)
     - scrolling is done by JS with translate3d, never native overflow
   Sizing: 1rem == 1/108 of viewport height (10px at 1080p, 6.67px at 720p),
   so one design scales to any panel. JS uses the same constant (UI.px).

   Palette (inlined, no vars):
     bg #0b0b12 · bg2 #14141f · panel #1b1b2a · panel2 #232336
     accent #7c3aed · accent2 #a855f7 · text #f2f2f7 · muted #9a9ab0
     gold #ffd54a · green #4ade80 · red #ff6b6b */

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

html { font-size: calc(100vh / 108); }

html, body {
  width: 100%; height: 100%;
  background: #0b0b12;
  color: #f2f2f7;
  font-family: 'LG Smart UI', 'SamsungOneUI', 'Roboto', 'Segoe UI', Arial, sans-serif;
  overflow: hidden;
  -webkit-user-select: none; user-select: none;
}

button { font-family: inherit; border: none; cursor: pointer; }

/* App shell: the shared topbar sits above the router container. Screens
   without it (player, detail, login) set body.no-topbar via the Router. */
#topbar {
  position: absolute; top: 0; left: 0; right: 0;
  height: 9rem;
  z-index: 30;
}
body.no-topbar #topbar { display: none; }
#app { position: absolute; top: 9rem; left: 0; right: 0; bottom: 0; }
body.no-topbar #app { top: 0; }
.view { width: 100%; height: 100%; position: relative; }

/* --------------------------- focus highlight ---------------------------- */

.focusable {
  position: relative;
  transition: transform .18s ease-out;
  outline: none;
}
.focusable::after {
  content: '';
  position: absolute;
  top: -0.5rem; left: -0.5rem; right: -0.5rem; bottom: -0.5rem;
  border: 0.4rem solid #ffffff;
  border-radius: 1.8rem;
  opacity: 0;
  transition: opacity .15s;
  pointer-events: none;
}
.focusable.focused { transform: scale(1.06); z-index: 3; }
.focusable.focused::after { opacity: 1; }

/* ------------------------- JS-driven scrollers -------------------------- */

.vs-vp { overflow: hidden; }
.vs-content {
  position: relative;
  will-change: transform;
  transition: transform .26s cubic-bezier(.2, .6, .3, 1);
  transform: translate3d(0, 0, 0);
}

/* -------------------------------- toast --------------------------------- */

.toast {
  position: fixed; top: 4rem; right: 4.8rem;
  max-width: 70rem;
  background: rgba(20, 20, 32, .96);
  border-left: 0.6rem solid #7c3aed;
  color: #fff; padding: 1.8rem 2.6rem;
  border-radius: 1.2rem; font-size: 2.2rem;
  z-index: 1000;
  opacity: 0;
  transform: translateY(-1.2rem);
  transition: opacity .2s, transform .2s;
  pointer-events: none;
}
.toast.visible { opacity: 1; transform: translateY(0); }

/* ------------------------------- loading -------------------------------- */

.loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 100%; padding: 6rem;
}
/* full-screen contexts: спиннер по центру экрана (с поправкой на шапки);
   компактные (шит закладок) остаются как есть */
.detail-content .loading { min-height: 96vh; }
.cat-content .loading,
.settings-content .loading { min-height: calc(100vh - 40rem); }
.spinner {
  width: 5.4rem; height: 5.4rem;
  border: 0.5rem solid rgba(255, 255, 255, .18);
  border-top-color: #a855f7;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
.loading-label { color: #9a9ab0; font-size: 2.2rem; margin-top: 1.6rem; }
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes pulse {
  0%   { opacity: .45; }
  50%  { opacity: 1; }
  100% { opacity: .45; }
}
.skel .card-img { background: #1b1b2a; animation: pulse 1.4s ease-in-out infinite; }

/* -------------------------------- brand --------------------------------- */

.brand {
  font-size: 3rem; font-weight: 800; letter-spacing: -0.1rem;
  background: -webkit-linear-gradient(0deg, #a855f7, #f0abfc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-right: 3rem;
  flex: none;
}
.brand-big { font-size: 5rem; margin: 0 0 2rem; }

.clock { margin-left: 2.4rem; font-size: 2.4rem; color: #9a9ab0; flex: none; }

/* ------------------------------- buttons -------------------------------- */

.btn {
  background: #1b1b2a; color: #f2f2f7;
  border-radius: 1.2rem;
  padding: 1.6rem 3rem; font-size: 2.4rem;
  margin-right: 1.6rem; margin-bottom: 1.2rem;
}
.btn::after { border-radius: 1.8rem; }
.btn-play { background: #7c3aed; font-weight: 700; }
.btn-done { color: #4ade80; }

.topbtn {
  background: #1b1b2a; color: #f2f2f7;
  border-radius: 2.8rem;
  padding: 1rem 2.6rem; font-size: 2.2rem;
  margin-right: 1.4rem; flex: none;
}
.topbtn::after { border-radius: 3.2rem; }
.topbtn-dim { color: #9a9ab0; }
.topbtn-power {
  padding: 1rem 1.5rem;
  font-size: 2.4rem;
  margin-left: 2rem;
  margin-right: 0;
}

.chip {
  background: #232336; color: #f2f2f7;
  border-radius: 2.6rem;
  padding: 1rem 2.2rem; font-size: 2.1rem;
  margin: 0.5rem 1.2rem 0.5rem 0;
  white-space: nowrap;
}
.chip::after { border-radius: 3rem; }
.chip.active { background: rgba(124, 58, 237, .4); font-weight: 700; }

/* ------------------------- CSS-drawn icons ------------------------------ */
/* Emoji rendering is unreliable across webOS versions (tofu boxes on 3.x),
   so every meaning-carrying icon is drawn with borders/gradients instead. */

.icon-search {
  display: inline-block;
  width: 1.7rem; height: 1.7rem;
  border: 0.35rem solid #f2f2f7;
  border-radius: 50%;
  position: relative;
  vertical-align: -0.2rem;
  margin-right: 1rem;
}
.icon-search::after {
  content: '';
  position: absolute;
  width: 0.37rem; height: 1.1rem;
  background: #f2f2f7;
  bottom: -0.9rem; right: -0.35rem;
  -webkit-transform: rotate(-45deg); transform: rotate(-45deg);
}

.icon-power {
  display: inline-block;
  width: 2rem; height: 2rem;
  border: 0.35rem solid #9a9ab0;
  border-radius: 50%;
  position: relative;
  vertical-align: -0.4rem;
}
.icon-power::after {
  content: '';
  position: absolute;
  width: 0.37rem; height: 1.4rem;
  background: #9a9ab0;
  top: -0.75rem; left: 50%;
  margin-left: -0.19rem;
  box-shadow: 0 0 0 0.32rem #1b1b2a; /* gap in the ring, like a real ⏻ */
}

.kdot {
  display: inline-block;
  width: 1.5rem; height: 1.5rem;
  border-radius: 50%;
  vertical-align: -0.12rem;
  margin: 0 0.5rem 0 1rem;
}
.kdot-r { background: #e53935; }
.kdot-g { background: #43a047; }
.kdot-b { background: #1e88e5; }
.kdot:first-child { margin-left: 0; }

/* -------------------------------- topbar -------------------------------- */

.topbar {
  height: 9rem;
  display: flex; align-items: center;
  padding: 0 4.8rem;
}
.tabs {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  /* vertical padding keeps the focus ring inside the clip box */
  padding: 1.6rem 0.6rem;
  margin: -1.6rem 0.6rem;
}
.tabs-track {
  display: flex; align-items: center;
  will-change: transform;
  transition: transform .22s cubic-bezier(.2, .6, .3, 1);
  transform: translate3d(0, 0, 0);
}
.tab {
  background: transparent; color: #9a9ab0;
  padding: 1rem 2.2rem; font-size: 2.2rem;
  border-radius: 2.8rem;
  white-space: nowrap; flex: none;
  margin-right: 1.4rem;
}
.tab::after { border-radius: 3.2rem; }
.tab.active { color: #fff; background: rgba(124, 58, 237, .32); }

/* --------------------------------- home --------------------------------- */

.home-vp { position: absolute; top: 0; left: 0; right: 0; bottom: 0; }

.rail { margin-bottom: 0.2rem; }
.rail-title {
  font-size: 2.8rem; font-weight: 700;
  padding: 0 4.8rem;
}
/* generous vertical padding so the scaled card + focus ring never clips */
.rail-vp { overflow: hidden; padding: 2rem 4.8rem 2.4rem; margin-top: -0.6rem; }
.rail-track {
  display: flex;
  align-items: flex-start; /* rows must not stretch to the tallest sibling */
  will-change: transform;
  transition: transform .22s cubic-bezier(.2, .6, .3, 1);
  transform: translate3d(0, 0, 0);
}
.rail-empty { color: #9a9ab0; font-size: 2.2rem; padding: 2rem 0 4rem; }

/* ------------------------------ poster card ----------------------------- */

.card { width: 22rem; flex: none; margin-right: 2.2rem; }
.card-img {
  width: 22rem; height: 32rem;
  border-radius: 1.4rem;
  background-color: #1b1b2a;
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.card::after { border-radius: 1.8rem; }
.card.focused { transform: scale(1.07); }
/* Glass effect on the focused cover: a convex-looking sheen overlay plus a
   one-shot light sweep. Opacity/transform only — compositor-cheap on TVs. */
.card-img::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: -webkit-linear-gradient(335deg,
    rgba(255, 255, 255, .30) 0%, rgba(255, 255, 255, .12) 26%,
    rgba(255, 255, 255, .02) 48%, rgba(0, 0, 0, .10) 78%, rgba(0, 0, 0, .22) 100%);
  background: linear-gradient(115deg,
    rgba(255, 255, 255, .30) 0%, rgba(255, 255, 255, .12) 26%,
    rgba(255, 255, 255, .02) 48%, rgba(0, 0, 0, .10) 78%, rgba(0, 0, 0, .22) 100%);
  opacity: 0;
  transition: opacity .18s;
  z-index: 2;
  pointer-events: none;
}
.card.focused .card-img::before { opacity: 1; }

/* One-shot light sweep. The .glare class is added by JS only after focus has
   RESTED on the card for ~0.4s — while rapidly scrolling with key repeat the
   animation never even starts, so weak GPUs pay nothing during navigation. */
.card-img::after {
  content: '';
  position: absolute; top: -25%; bottom: -25%; left: 0;
  width: 46%;
  background: -webkit-linear-gradient(340deg,
    rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, .34) 50%, rgba(255, 255, 255, 0) 100%);
  background: linear-gradient(110deg,
    rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, .34) 50%, rgba(255, 255, 255, 0) 100%);
  transform: translate3d(-120%, 0, 0);
  opacity: 0;
  z-index: 2;
  pointer-events: none;
}
.card.glare .card-img::after {
  animation: glare-sweep .7s ease-out 1;
}
@keyframes glare-sweep {
  0%   { opacity: 0; transform: translate3d(-120%, 0, 0); }
  20%  { opacity: 1; }
  100% { opacity: 0; transform: translate3d(320%, 0, 0); }
}

.card-badge, .card-new { z-index: 3; }

.card-img-title {
  font-size: 2rem; color: #fff; padding: 1.2rem;
  text-align: center; opacity: .85;
}
.card-badge {
  position: absolute; top: 0.8rem; right: 0.8rem;
  background: rgba(0, 0, 0, .78); color: #ffd54a;
  font-size: 1.8rem; font-weight: 700;
  padding: 0.3rem 0.9rem; border-radius: 0.8rem;
}
.card-new {
  position: absolute; top: 0.8rem; left: 0.8rem;
  background: #7c3aed; color: #fff;
  font-size: 1.8rem; font-weight: 700;
  padding: 0.3rem 0.9rem; border-radius: 0.8rem;
}
.card-prog {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 0.6rem;
  background: rgba(255, 255, 255, .25);
}
.card-prog-fill {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  background: #a855f7;
  -webkit-transform-origin: 0 50%; transform-origin: 0 50%;
}
.card-title {
  font-size: 2rem; margin-top: 1rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-title-in { display: inline-block; max-width: 100%; }
/* while the marquee runs, soften the hard clip with an edge fade */
.card.focused .card-title,
.ep-tile.focused .card-title,
.folder-row.focused .folder-row-title {
  text-overflow: clip;
  -webkit-mask-image: -webkit-linear-gradient(left, #000 80%, transparent 97%);
  mask-image: linear-gradient(90deg, #000 80%, transparent 97%);
}
.card.focused .card-title-in,
.ep-tile.focused .card-title-in,
.folder-row.focused .card-title-in { max-width: none; }
.card-sub {
  font-size: 1.7rem; color: #9a9ab0; margin-top: 0.2rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-height: 2.2rem;
}

/* Bookmark folders: text rows — compact pills in the home rail,
   wide two-column rows on the dedicated Закладки screen. */
.folder-row {
  display: flex; align-items: center;
  width: 36rem; flex: none;
  margin-right: 2.2rem;
  background: #1b1b2a; color: #f2f2f7;
  text-align: left;
  padding: 1.9rem 2.6rem;
  border-radius: 1.2rem;
}
.folder-row::after { border-radius: 1.6rem; }
.folder-row-title {
  flex: 1; min-width: 0;
  font-size: 2.5rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-right: 1.8rem;
}
.folder-row-count { flex: none; font-size: 2.3rem; font-weight: 800; color: #a855f7; }
.cat-row .folder-row { width: 86rem; padding: 2.6rem 3.2rem; }
.cat-row .folder-row-title { font-size: 2.8rem; }
.folder-row-more, .folder-row-more .folder-row-count { color: #9a9ab0; }
.folder-row-more { color: #9a9ab0; }
.folder-row-more .folder-row-count { color: #9a9ab0; }

.card-more-img {
  background: transparent;
  border: 0.3rem dashed rgba(255, 255, 255, .28);
  flex-direction: column;
}
.card-more-arrow { font-size: 5rem; color: #9a9ab0; }
.card-more-label { font-size: 2.2rem; color: #9a9ab0; margin-top: 1rem; }

/* ------------------- subscription banner (home, top) -------------------- */

.sub-banner {
  margin: 0.6rem 4.8rem 2rem;
  padding: 1.8rem 2.6rem;
  border-radius: 1.2rem;
  background: rgba(255, 213, 74, .12);
  border-left: 0.6rem solid #ffd54a;
  color: #ffd54a;
  font-size: 2.3rem;
  line-height: 1.45;
}
.sub-banner-err {
  background: rgba(255, 107, 107, .12);
  border-left-color: #ff6b6b;
  color: #ff6b6b;
}

/* ---------------------------- outage screen ----------------------------- */

.outage { padding: 12rem 4.8rem 0; max-width: 110rem; }
.outage-title { font-size: 4.4rem; font-weight: 800; margin-bottom: 1.8rem; }
.outage-text { font-size: 2.5rem; line-height: 1.5; color: #9a9ab0; margin-bottom: 3rem; }
.outage-actions { display: flex; }

/* -------------------------------- catalog ------------------------------- */

.cat-header {
  position: absolute; top: 0; left: 0; right: 0;
  height: 10rem;
  display: flex; align-items: center;
  padding: 0 4.8rem;
  z-index: 10;
}
.cat-title { font-size: 3.4rem; font-weight: 800; margin-right: 2.4rem; }
.cat-count { font-size: 2.2rem; color: #9a9ab0; }
.cat-hint { font-size: 1.9rem; color: #6f6f85; margin-left: auto; }
.cat-vp { position: absolute; top: 10rem; left: 0; right: 0; bottom: 0; }
.cat-content { padding: 2.6rem 4.8rem; }
.cat-row { display: flex; margin-bottom: 3.4rem; }

/* -------------------------------- detail -------------------------------- */

/* Decorative poster backdrop: full height, right-aligned, black tint with a
   fade into the page background on the left and bottom. Purely a static
   layer under the UI — nothing animates, costs one paint. */
.detail-backdrop {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 64%;
  background-size: cover;
  background-position: center top;
  z-index: 0;
}
.detail-backdrop::after {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background:
    -webkit-linear-gradient(90deg, #0b0b12 0%, rgba(11, 11, 18, 0) 45%),
    -webkit-linear-gradient(0deg, #0b0b12 0%, rgba(11, 11, 18, .30) 42%, rgba(11, 11, 18, .62) 100%);
  background:
    linear-gradient(0deg, #0b0b12 0%, rgba(11, 11, 18, 0) 45%),
    linear-gradient(90deg, #0b0b12 0%, rgba(11, 11, 18, .30) 42%, rgba(11, 11, 18, .62) 100%);
}

.detail-vp { position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: 1; }
.detail-content { padding-bottom: 8rem; }
.detail-hero { display: flex; padding: 5.6rem 4.8rem 3rem; }
.detail-poster {
  width: 34rem; height: 50rem; flex: none;
  border-radius: 1.8rem;
  background-size: cover; background-position: center;
  background-color: #1b1b2a;
  margin-right: 4.6rem;
  box-shadow: 0 2rem 6rem rgba(0, 0, 0, .55);
}
.detail-info { flex: 1; min-width: 0; }
.detail-title { font-size: 4.6rem; font-weight: 800; line-height: 1.12; }
.detail-rating { font-size: 2.4rem; color: #ffd54a; margin: 1.6rem 0 0.6rem; }
.detail-meta { font-size: 2.2rem; color: #9a9ab0; margin-bottom: 2rem; }
.detail-plot {
  font-size: 2.3rem; line-height: 1.5; color: #d8d8e4;
  max-width: 110rem;
  margin-bottom: 2.8rem;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.detail-actions { display: flex; flex-wrap: wrap; align-items: center; }
.detail-noplay { color: #ff6b6b; font-size: 2.4rem; }
.detail-hint { color: #6f6f85; font-size: 1.9rem; margin-top: 1rem; }

.season-bar {
  display: flex; flex-wrap: wrap;
  padding: 0.6rem 4.8rem 1.4rem;
}
.season::after { border-radius: 3rem; }

/* Episodes as a 4-wide tile grid with 16:9 preview thumbnails. */
.episodes { padding: 0.6rem 4.8rem 4rem; }
.ep-tile-row { display: flex; margin-bottom: 2.8rem; }
.ep-tile {
  width: 42rem; flex: none; margin-right: 2.2rem;
  background: #14141f; /* opaque base: the page backdrop must not bleed through */
  border-radius: 1.4rem;
}
.ep-tile::after { border-radius: 1.8rem; }
.ep-tile.focused { transform: scale(1.04); }
.ep-thumb {
  height: 23.6rem;
  border-radius: 1.4rem 1.4rem 0 0;
  background-color: #1b1b2a;
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.ep-ph { font-size: 5rem; font-weight: 800; color: #3a3a52; }
.ep-tile-num {
  position: absolute; top: 0.8rem; left: 0.8rem;
  background: rgba(0, 0, 0, .72);
  color: #c9a2ff; font-weight: 800;
  font-size: 1.9rem;
  padding: 0.3rem 1rem;
  border-radius: 0.8rem;
}
.ep-tile-check {
  position: absolute; top: 0.8rem; right: 0.8rem;
  color: #4ade80; font-size: 2.8rem;
  text-shadow: 0 0.2rem 0.8rem #000;
}
.ep-tile-dur {
  position: absolute; bottom: 0.8rem; right: 0.8rem;
  background: rgba(0, 0, 0, .62);
  color: #e6e6f2; font-size: 1.7rem;
  padding: 0.2rem 0.9rem;
  border-radius: 0.6rem;
}
.ep-tile-title { margin: 1rem 1.6rem 1.5rem; }
/* watched: dim with an opaque veil INSIDE the tile (no transparency —
   the page backdrop must not bleed through) */
.ep-tile.watched .ep-thumb::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(11, 11, 18, .58);
}
.ep-tile.watched .ep-tile-title { color: #82829a; }

/* ---------------------- detail extras: actors, reviews ------------------ */

.actor-card { width: 16rem; }
.actor-img {
  width: 16rem; height: 16rem;
  border-radius: 50%;
  background-color: #232336;
  background-size: cover;
  background-position: center top;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  overflow: hidden;
}
.actor-initials { font-size: 4.6rem; font-weight: 700; color: #6f6f85; }
/* once a real image is applied, every placeholder inside goes away */
.has-img .actor-initials,
.has-img .card-img-title,
.has-img .ep-ph { display: none; }
.actor-name { margin-top: 1.2rem; }
.actor-card .card-title, .actor-card .card-sub { text-align: center; }
.actor-card::after { border-radius: 2rem; }

.cast-sec { padding: 1rem 0 0.6rem; }
.cast-director {
  color: #9a9ab0; font-size: 2.1rem;
  padding: 0 4.8rem;
  margin: -1rem 0 1.4rem;
}

.reviews-title { margin-top: 1.6rem; }
.review {
  margin: 1.4rem 4.8rem;
  max-width: 150rem;
  background: #14141f;
  border-left: 0.6rem solid #7c3aed;
  border-radius: 1.2rem;
  padding: 2rem 2.8rem;
}
.review::after { border-radius: 1.6rem; }
.review-author { font-size: 2.2rem; font-weight: 700; color: #ffd54a; margin-bottom: 0.8rem; }
.review-text {
  font-size: 2.1rem; line-height: 1.5; color: #c9c9dc;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-line;
}
.review.expanded .review-text {
  display: block;
  -webkit-line-clamp: none;
  max-height: none;
}

/* -------------------------------- search -------------------------------- */
/* Single column: input on top (OK opens the SYSTEM keyboard with voice),
   recent queries, then a full-width 7-column result grid. */

.search-view { display: flex; flex-direction: column; }
.search-header { flex: none; padding: 3.6rem 4.8rem 0; }
.search-input-box {
  display: flex; align-items: center;
  background: #1b1b2a;
  border-radius: 1.2rem;
  padding: 1.8rem 2.4rem;
  max-width: 110rem;
}
.search-input-box::after { border-radius: 1.6rem; }
.search-input-box .icon-search { margin: 0 0 0 1.2rem; }
.search-field {
  flex: 1; min-width: 0;
  background: transparent; border: none; outline: none;
  color: #fff; font-size: 2.6rem;
  font-family: inherit;
}
.search-field::-webkit-input-placeholder { color: #6f6f85; }
.search-recents { display: flex; flex-wrap: wrap; margin-top: 1.4rem; }
.recent-chip { max-width: 30rem; overflow: hidden; text-overflow: ellipsis; }
.search-status {
  font-size: 2.1rem; color: #9a9ab0;
  margin-top: 1rem;
  min-height: 2.8rem;
}
.search-res-vp { flex: 1; min-height: 0; }
.search-results { padding: 2.4rem 4.8rem 4rem; }

/* --------------------------------- login -------------------------------- */

.login-view {
  display: flex; align-items: center; justify-content: center;
  background: -webkit-radial-gradient(50% 0%, 120rem 70rem, #241a3d 0%, #0b0b12 60%);
  background: radial-gradient(120rem 70rem at 50% 0%, #241a3d 0%, #0b0b12 60%);
}
.login-card {
  width: 88rem;
  background: #14141f;
  border-radius: 2.4rem;
  padding: 5.6rem 7rem;
  box-shadow: 0 2rem 8rem rgba(0, 0, 0, .5);
  text-align: center;
}
.login-hint { font-size: 2.6rem; color: #9a9ab0; margin-bottom: 1.2rem; }
.login-url { font-size: 3.6rem; color: #a855f7; font-weight: 800; margin: 0.6rem 0 2.4rem; }
.login-code {
  font-size: 8.8rem; font-weight: 800; letter-spacing: 1.4rem;
  color: #fff; background: #1b1b2a;
  border-radius: 1.6rem;
  padding: 2rem;
  margin-bottom: 2rem;
}
.login-status { font-size: 2.2rem; color: #9a9ab0; min-height: 3rem; }
.login-status.error { color: #ff6b6b; }
.login-actions { margin-top: 2.6rem; display: flex; justify-content: center; }

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

.player-view { background: #000; }
.player-video {
  width: 100%; height: 100%;
  object-fit: contain;
  background: #000;
}

.player-subs {
  position: absolute; left: 8%; right: 8%; bottom: 7rem;
  text-align: center;
  font-size: 3.6rem; line-height: 1.35; font-weight: 500;
  color: #fff;
  text-shadow: 0 0.2rem 0.4rem #000, 0 0 1.6rem rgba(0, 0, 0, .9);
  white-space: pre-line;
  transition: transform .2s;
  pointer-events: none;
}
.player-subs.lift { transform: translateY(-13rem); }

.player-spinner {
  position: absolute; top: 50%; left: 50%;
  margin: -2.7rem 0 0 -2.7rem;
  z-index: 5;
}
.player-spinner.hidden { display: none; }

.player-state {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity .25s;
  pointer-events: none;
}
.player-state.flash { opacity: 1; }
/* CSS-drawn play/pause (TV fonts lack some glyphs — no text icons here) */
.pi-circle {
  display: flex; align-items: center; justify-content: center;
  width: 16rem; height: 16rem;
  border-radius: 50%;
  background: rgba(0, 0, 0, .55);
}
.pi-play {
  display: inline-block;
  width: 0; height: 0;
  border-left: 6.6rem solid #fff;
  border-top: 4rem solid transparent;
  border-bottom: 4rem solid transparent;
  margin-left: 1.4rem; /* оптический центр треугольника */
}
.pi-pause { display: flex; }
.pi-pause span {
  display: inline-block;
  width: 2.2rem; height: 8.4rem;
  background: #fff;
  border-radius: 0.4rem;
  margin: 0 0.9rem;
}

.player-error {
  position: absolute; top: 40%; left: 10%; right: 10%;
  text-align: center;
  font-size: 3rem; line-height: 1.6; color: #ff6b6b;
  white-space: pre-line;
}
.player-error.hidden { display: none; }

.player-osd {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  opacity: 0;
  transition: opacity .22s;
  pointer-events: none;
}
.player-osd.visible { opacity: 1; }

.osd-top {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 4rem 6rem 8rem;
  background: -webkit-linear-gradient(90deg, transparent, rgba(0, 0, 0, .75));
  background: linear-gradient(0deg, transparent, rgba(0, 0, 0, .75));
}
.osd-titles { min-width: 0; margin-right: 4rem; }
.osd-title { font-size: 3.6rem; font-weight: 700; }
.osd-ep { font-size: 2.4rem; color: #c9c9dc; margin-top: 0.6rem; }
.osd-right { text-align: right; flex: none; }
.osd-clock { font-size: 3.2rem; font-weight: 700; }
.osd-ends { font-size: 2rem; color: #9a9ab0; margin-top: 0.4rem; }

.osd-bottom {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 10rem 6rem 4rem;
  background: -webkit-linear-gradient(270deg, transparent, rgba(0, 0, 0, .85));
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .85));
}
.osd-badges { margin-bottom: 1.4rem; }
.osd-badge {
  display: inline-block;
  background: rgba(255, 255, 255, .14);
  color: #e6e6f2;
  font-size: 1.9rem;
  padding: 0.5rem 1.4rem;
  border-radius: 0.8rem;
  margin-right: 1.2rem;
}
.osd-badge:empty { display: none; }

.p-bar {
  position: relative;
  height: 0.8rem;
  background: rgba(255, 255, 255, .22);
  border-radius: 0.4rem;
  overflow: hidden;
}
.p-buf, .p-fill, .p-ghost {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  -webkit-transform-origin: 0 50%; transform-origin: 0 50%;
  -webkit-transform: scaleX(0); transform: scaleX(0);
}
.p-buf { background: rgba(255, 255, 255, .3); }
.p-ghost { background: rgba(168, 85, 247, .55); opacity: 0; }
.p-fill { background: #a855f7; }

.osd-times {
  display: flex; align-items: center;
  margin-top: 1.4rem;
  font-size: 2.4rem;
}
.p-cur { flex: none; min-width: 10rem; }
.p-dur { flex: none; color: #9a9ab0; }
.osd-hints {
  flex: 1;
  text-align: center;
  font-size: 1.9rem; color: #8a8aa0;
  padding: 0 2rem;
}

.seek-ind {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, .72);
  font-size: 4.6rem; font-weight: 700;
  padding: 2rem 3.6rem;
  border-radius: 1.6rem;
}
.seek-ind.hidden { display: none; }

.next-hint {
  position: absolute; top: 5rem; right: 6rem;
  background: rgba(0, 0, 0, .72);
  font-size: 2.2rem;
  padding: 1.2rem 2.2rem;
  border-radius: 1rem;
  opacity: 0;
  transition: opacity .25s;
  pointer-events: none;
}
.next-hint.visible { opacity: 1; }

.player-next {
  position: absolute; right: 6rem; bottom: 16rem;
  background: rgba(12, 12, 20, .96);
  border-radius: 1.6rem;
  padding: 2.8rem 3.6rem;
  max-width: 70rem;
}
.player-next.hidden { display: none; }
.next-label { font-size: 2rem; color: #9a9ab0; }
.next-title { font-size: 2.8rem; font-weight: 700; margin-top: 0.8rem; }
.next-count { font-size: 2.4rem; color: #a855f7; margin-top: 0.8rem; }
.next-hint2 { font-size: 1.8rem; color: #6f6f85; margin-top: 1.4rem; }

.player-panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: rgba(12, 12, 20, .97);
  padding: 3rem 6rem 3.4rem;
  transform: translateY(105%);
  transition: transform .25s cubic-bezier(.2, .6, .3, 1);
  z-index: 20;
}
.player-panel.open { transform: translateY(0); }
.pp-row { display: flex; align-items: center; margin-bottom: 1rem; }
.pp-label { width: 16rem; flex: none; font-size: 2.2rem; color: #9a9ab0; }
.pp-chips { display: flex; flex-wrap: wrap; flex: 1; min-width: 0; }

/* ------------------------- bottom sheet (bookmarks) ---------------------- */

.sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: rgba(12, 12, 20, .97);
  padding: 3rem 6rem 3.4rem;
  transform: translateY(105%);
  transition: transform .25s cubic-bezier(.2, .6, .3, 1);
  z-index: 40;
}
.sheet.open { transform: translateY(0); }
.sheet-title { font-size: 2.6rem; font-weight: 700; margin-bottom: 1.8rem; }
.sheet-chips { display: flex; flex-wrap: wrap; }
.sheet-input-row { display: flex; margin-top: 1.4rem; }
.sheet-input-row .search-input-box { flex: none; width: 70rem; }
.sheet-hint { color: #6f6f85; font-size: 1.8rem; margin-top: 1.6rem; }

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

.settings-content { padding: 2.6rem 4.8rem; }
.set-row {
  display: flex; align-items: center;
  margin-bottom: 2.2rem;
}
.set-label { width: 44rem; flex: none; font-size: 2.4rem; }
.set-note { font-size: 1.8rem; color: #6f6f85; margin-top: 0.4rem; }
.set-chips { display: flex; flex-wrap: wrap; flex: 1; min-width: 0; align-items: center; }
.set-domain-box { width: 46rem; padding: 1rem 2rem; margin: 0.5rem 0; }
.set-domain-box .search-field { font-size: 2.2rem; }
