/* Nebula TV — dark, glassy, animated. Sized in rem so it scales from phones to 4K TVs. */
:root {
  --bg: #07060f;
  --bg2: #0e0c1d;
  --panel: rgba(255, 255, 255, .045);
  --panel-2: rgba(255, 255, 255, .08);
  --line: rgba(255, 255, 255, .09);
  --text: #f5f3ff;
  --muted: #a29fc0;
  --dim: #6d6a8c;
  --violet: #8b5cf6;
  --pink: #ec4899;
  --cyan: #22d3ee;
  --green: #34d399;
  --red: #f43f5e;
  --grad: linear-gradient(135deg, #8b5cf6 0%, #ec4899 55%, #22d3ee 100%);
  --grad-soft: linear-gradient(135deg, rgba(139, 92, 246, .35), rgba(236, 72, 153, .25) 55%, rgba(34, 211, 238, .25));
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --r: 16px;
  --rail-w: 5.6rem;
  --rail-open: 15rem;
  --focus-ring: 0 0 0 3px #fff, 0 0 0 6px rgba(139, 92, 246, .55), 0 18px 50px -12px rgba(236, 72, 153, .7);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: clamp(14px, calc(.55vw + 8px), 21px); background: var(--bg); }
/* TVs are watched from across the room: everything (text, icons, posters) is laid out in rem, so one bigger base
   size scales the whole app — 24px on a 1080p screen instead of 18.6px (about 30% larger). */
html.lite { font-size: clamp(16px, 1.305vw, 27px); } /* 25px on 1080p: +35% */
/* At that size the Live TV preview panel would squeeze the channel names: narrower side panels, wider channel list. */
html.lite .live { grid-template-columns: 13rem minmax(0, 1fr) minmax(0, 23rem); gap: 1rem; }
html.lite .preview-info h3 { font-size: 1.2rem; }
html.lite #regionBtn > em { display: none; } /* the "861 cat." badge no longer fits beside the label */
html.lite #regionBtn .rb-t small { font-size: .6rem; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body {
  font-family: 'Outfit', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
input { font: inherit; color: inherit; user-select: text; -webkit-user-select: text; }
svg { width: 1.25em; height: 1.25em; flex: none; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus { outline: none; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: .85em; word-break: break-all; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------------------------------------------ aurora backdrop */
.aurora { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; background: radial-gradient(120% 90% at 50% 120%, #1a0f3a 0%, var(--bg) 60%); }
.aurora i { position: absolute; width: 75vmax; height: 75vmax; border-radius: 50%; opacity: .55; will-change: transform; }
.aurora i:nth-child(1) { background: radial-gradient(circle, rgba(139, 92, 246, .55) 0%, transparent 62%); top: -35vmax; left: -20vmax; animation: drift1 26s ease-in-out infinite alternate; }
.aurora i:nth-child(2) { background: radial-gradient(circle, rgba(236, 72, 153, .38) 0%, transparent 62%); bottom: -40vmax; right: -25vmax; animation: drift2 32s ease-in-out infinite alternate; }
.aurora i:nth-child(3) { background: radial-gradient(circle, rgba(34, 211, 238, .26) 0%, transparent 60%); top: 20vh; left: 35vw; width: 55vmax; height: 55vmax; animation: drift3 38s ease-in-out infinite alternate; }
.aurora .grain { position: absolute; inset: 0; opacity: .06; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
@keyframes drift1 { to { transform: translate(18vw, 14vh) rotate(40deg) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-20vw, -12vh) rotate(-30deg) scale(1.1); } }
@keyframes drift3 { 0% { transform: translate(0, 0) scale(.9); } 50% { transform: translate(-25vw, 10vh) scale(1.2); } 100% { transform: translate(10vw, -18vh) scale(1); } }
body.player-full .aurora i { animation-play-state: paused; }

/* ------------------------------------------------------------------ logo */
.logo-mark { width: 5rem; height: 5rem; border-radius: 28%; background: var(--grad); display: grid; place-items: center; color: #fff; box-shadow: 0 20px 60px -15px rgba(236, 72, 153, .8), inset 0 1px 0 rgba(255, 255, 255, .4); position: relative; }
.logo-mark svg { width: 46%; height: 46%; margin-left: 8%; }
.logo-mark.sm { width: 3.2rem; height: 3.2rem; }
.logo-mark.xs { width: 2.4rem; height: 2.4rem; border-radius: 30%; }

/* ------------------------------------------------------------------ splash */
#splash { position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; justify-items: center; gap: 1.6rem; background: var(--bg); transition: opacity .7s var(--ease), transform .7s var(--ease); }
#splash.gone { opacity: 0; transform: scale(1.08); pointer-events: none; }
.splash-logo { position: relative; animation: popIn .9s var(--spring) both; }
.splash-logo .logo-mark { width: 6.5rem; height: 6.5rem; z-index: 1; }
.splash-ring { position: absolute; inset: -12px; border-radius: 34%; border: 2px solid rgba(236, 72, 153, .6); animation: ring 1.8s var(--ease) infinite; }
.splash-ring.r2 { animation-delay: .6s; border-color: rgba(34, 211, 238, .5); }
.splash-name { font-size: 2rem; font-weight: 700; letter-spacing: .02em; animation: rise .9s .25s var(--ease) both; }
@keyframes ring { from { transform: scale(.9); opacity: 1; } to { transform: scale(1.7); opacity: 0; } }
@keyframes popIn { from { transform: scale(.4) rotate(-20deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes rise { from { transform: translateY(18px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ------------------------------------------------------------------ screens */
.screen { position: fixed; inset: 0; z-index: 1; opacity: 0; transition: opacity .6s var(--ease); }
.screen.in { opacity: 1; }

/* ------------------------------------------------------------------ login */
#login { display: grid; place-items: center; padding: 1.5rem; overflow-y: auto; }
.login-card {
  width: min(30rem, 100%); padding: 2.4rem 2.2rem 2rem; border-radius: 28px;
  background: linear-gradient(160deg, rgba(255, 255, 255, .09), rgba(255, 255, 255, .025));
  border: 1px solid var(--line); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 40px 120px -30px rgba(0, 0, 0, .8), inset 0 1px 0 rgba(255, 255, 255, .08);
  display: grid; gap: 1rem; position: relative;
  animation: cardFloat .9s .1s var(--spring) both;
}
.login-card::before { content: ''; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; background: var(--grad); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; opacity: .5; pointer-events: none; }
.login-card.shake { animation: shake .5s var(--ease); }
.login-card.leaving { animation: leave .65s var(--ease) forwards; }
@keyframes cardFloat { from { transform: translateY(40px) scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes shake { 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }
@keyframes leave { to { transform: scale(1.1); opacity: 0; filter: blur(8px); } }
.login-head { display: flex; align-items: center; gap: 1rem; margin-bottom: .6rem; }
.login-head h1 { margin: 0; font-size: 1.7rem; font-weight: 700; }
.login-head p { margin: .15rem 0 0; color: var(--muted); }
.field { display: flex; align-items: center; gap: .8rem; padding: 0 1rem; height: 3.6rem; border-radius: 16px; background: rgba(0, 0, 0, .28); border: 1px solid var(--line); transition: border-color .25s, box-shadow .25s, transform .25s var(--spring); }
.field > svg { color: var(--dim); transition: color .25s; }
.field input { flex: 1; min-width: 0; height: 100%; background: none; border: 0; font-size: 1.05rem; }
.field input::placeholder { color: var(--dim); }
.field:focus-within { border-color: rgba(139, 92, 246, .8); box-shadow: 0 0 0 4px rgba(139, 92, 246, .22), 0 10px 30px -10px rgba(139, 92, 246, .6); transform: translateY(-1px) scale(1.01); }
.field:focus-within > svg { color: var(--violet); }
.field-btn { width: 2.4rem; height: 2.4rem; display: grid; place-items: center; border-radius: 10px; color: var(--muted); }
.field-btn:focus, .field-btn:hover { background: var(--panel-2); color: #fff; }
.saved-box { display: grid; gap: .7rem; animation: rise .5s var(--ease) both; }
.saved-head { display: flex; justify-content: space-between; align-items: baseline; }
.saved-head b { font-size: 1.05rem; }
.saved-head .muted { font-size: .82rem; }
.saved-list { display: grid; gap: .5rem; }
.saved-row { display: flex; gap: .45rem; align-items: stretch; animation: rise .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms); }
.saved-card { position: relative; overflow: hidden; flex: 1; min-width: 0; display: flex; align-items: center; gap: .8rem; padding: .7rem .9rem; border-radius: 16px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); transition: transform .3s var(--spring), background .25s, box-shadow .3s, border-color .25s; }
.saved-card.active { border-color: rgba(139, 92, 246, .55); background: linear-gradient(135deg, rgba(139, 92, 246, .18), rgba(236, 72, 153, .1)); }
.saved-card:hover { background: rgba(255, 255, 255, .09); }
.kbd .saved-card:focus { transform: scale(1.025); box-shadow: var(--focus-ring); background: rgba(255, 255, 255, .1); }
.saved-ico { width: 2.6rem; height: 2.6rem; border-radius: 12px; display: grid; place-items: center; flex: none; background: linear-gradient(150deg, #7c3aed, #4c1d95); }
.saved-ico.m3u { background: linear-gradient(150deg, #0891b2, #164e63); }
.saved-text { flex: 1; min-width: 0; display: grid; }
.saved-text b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saved-text small { color: var(--muted); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saved-go { color: var(--dim); transition: transform .3s var(--spring), color .2s; }
.kbd .saved-card:focus .saved-go, .saved-card:hover .saved-go { transform: translateX(4px); color: #fff; }
.saved-card .spinner { display: none; }
.saved-card.busy .spinner { display: block; }
.saved-card.busy .saved-go, .saved-card.busy .switch-tag { display: none; }
.switch-tag { font-size: .75rem; font-weight: 600; color: var(--cyan); }
.icon-btn { flex: none; width: 2.9rem; border-radius: 14px; display: grid; place-items: center; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); color: var(--muted); transition: transform .3s var(--spring), background .2s, color .2s; }
.icon-btn svg { width: 1.1rem; height: 1.1rem; }
.icon-btn:hover { color: #fff; background: rgba(255, 255, 255, .1); }
.icon-btn.danger:hover, .kbd .icon-btn.danger:focus { color: #fda4af; }
.kbd .icon-btn:focus { transform: scale(1.08); box-shadow: 0 0 0 2px #fff; color: #fff; }
.saved-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.saved-actions .btn { height: 2.6rem; font-size: .9rem; }
.login-card.has-saved:not(.adding) .login-new { display: none; }
.login-new { display: grid; gap: 1rem; }
.login-card.has-saved.adding .login-new { animation: rise .45s var(--ease) both; padding-top: .9rem; border-top: 1px solid var(--line); }
.remember { display: flex; align-items: center; gap: .7rem; color: var(--muted); font-size: .88rem; padding: .3rem .2rem; border-radius: 12px; text-align: left; }
.remember .toggle { display: inline-block; flex: none; transform: scale(.82); transform-origin: left center; }
.remember.on { color: #e9e6f8; }
.kbd .remember:focus { box-shadow: 0 0 0 2px #fff; }
.set-card.playlists .saved-list { margin: .4rem 0 1rem; }
.muted.small { font-size: .85rem; margin: -.3rem 0 0; }
.dialog .modal-panel { width: min(28rem, 100%); }
.dialog-body { padding: 1.8rem 1.8rem 1.5rem; display: grid; gap: .9rem; }
.dialog-body h3 { margin: 0; font-size: 1.3rem; }
.dialog-body p { margin: 0; color: var(--muted); line-height: 1.5; }
.dialog-err { color: #fda4af; font-size: .9rem; min-height: 0; }
.dialog-err:empty { display: none; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .6rem; }
.btn.danger-solid { background: linear-gradient(135deg, #f43f5e, #be123c); border: 0; color: #fff; }
.login-tabs { display: flex; width: 100%; margin-bottom: .2rem; }
.login-tabs button { flex: 1; text-align: center; padding: .65rem .5rem; }
.login-pane { display: grid; gap: 1rem; animation: rise .45s var(--ease) both; }
.or { display: flex; align-items: center; gap: .8rem; color: var(--dim); font-size: .85rem; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.upload-btn { width: 100%; height: 3.4rem; border-style: dashed; color: var(--muted); }
.upload-btn.has-file { border-style: solid; border-color: rgba(52, 211, 153, .5); color: #fff; }
.upload-btn span { overflow: hidden; text-overflow: ellipsis; }
.file-x { display: grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: 50%; background: rgba(255, 255, 255, .1); margin-left: auto; }
.file-x svg { width: .9rem; height: .9rem; }
.hint { margin: -.3rem 0 0; color: var(--dim); font-size: .82rem; text-align: center; }
.login-error { color: #fda4af; font-size: .95rem; max-height: 0; opacity: 0; overflow: hidden; transition: max-height .3s, opacity .3s; }
.login-error.show { max-height: 6rem; opacity: 1; }
.login-foot { margin: .4rem 0 0; color: var(--dim); font-size: .85rem; text-align: center; line-height: 1.5; }

/* ------------------------------------------------------------------ buttons */
.btn { position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: .55rem; height: 2.9rem; padding: 0 1.3rem; border-radius: 14px; font-weight: 600; background: var(--panel-2); border: 1px solid var(--line); transition: transform .3s var(--spring), box-shadow .3s, background .3s; white-space: nowrap; }
.btn.big { height: 3.5rem; padding: 0 1.8rem; font-size: 1.05rem; border-radius: 16px; }
.btn.primary { background: var(--grad); background-size: 200% 200%; border: 0; color: #fff; box-shadow: 0 12px 30px -10px rgba(236, 72, 153, .7); animation: gradShift 6s ease infinite; }
.btn.primary::after { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .35) 50%, transparent 70%); transform: translateX(-120%); }
.btn.primary:hover::after, .kbd .btn.primary:focus::after { animation: sweep 1s var(--ease); }
.btn.ghost.on { color: #fde68a; }
.btn.danger { color: #fda4af; }
.btn:hover { transform: translateY(-2px); background: rgba(255, 255, 255, .12); }
.btn.primary:hover { background: var(--grad); background-size: 200% 200%; }
.kbd .btn:focus { transform: scale(1.06); box-shadow: var(--focus-ring); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn.pulse svg { animation: starPop .6s var(--spring); }
@keyframes gradShift { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes sweep { to { transform: translateX(120%); } }
@keyframes starPop { 40% { transform: scale(1.6) rotate(25deg); } }
.spinner { display: none; width: 1.3rem; height: 1.3rem; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: spin .8s linear infinite; }
#loginBtn.busy span { opacity: .6; }
#loginBtn.busy .spinner { display: block; }
#loginBtn.ok { animation: okPop .6s var(--spring); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes okPop { 50% { transform: scale(1.08); box-shadow: 0 0 0 10px rgba(52, 211, 153, .25); } }

.ripple { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .28); transform: scale(0); animation: ripple .65s var(--ease) forwards; pointer-events: none; z-index: 5; }
@keyframes ripple { to { transform: scale(1); opacity: 0; } }

/* ------------------------------------------------------------------ rail */
#app { display: block; }
#rail {
  position: fixed; z-index: 30; top: 0; bottom: 0; left: 0; width: var(--rail-w);
  padding: 1.4rem .8rem; display: flex; flex-direction: column; gap: 1.2rem;
  background: linear-gradient(90deg, rgba(7, 6, 15, .92), rgba(7, 6, 15, .7));
  border-right: 1px solid var(--line); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  transition: width .45s var(--ease), box-shadow .45s;
  overflow: hidden;
}
#rail:focus-within, #rail:hover { width: var(--rail-open); box-shadow: 30px 0 80px -20px rgba(0, 0, 0, .8); }
.rail-logo { display: flex; align-items: center; gap: .8rem; padding: 0 .75rem; font-weight: 700; font-size: 1.1rem; white-space: nowrap; }
.rail-logo .logo-mark { flex: none; }
.rail-logo span { opacity: 0; transition: opacity .3s; }
#rail:focus-within .rail-logo span, #rail:hover .rail-logo span { opacity: 1; }
.rail-items { position: relative; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.rail-pill { position: absolute; top: 0; left: 0; border-radius: 14px; background: var(--grad-soft); border: 1px solid rgba(255, 255, 255, .12); transition: transform .5s var(--spring), width .45s var(--ease), height .3s; pointer-events: none; }
.rail-btn { position: relative; display: flex; align-items: center; gap: 1rem; height: 3.1rem; padding: 0 1.05rem; border-radius: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; transition: color .25s, background .25s, transform .3s var(--spring); }
.rail-btn svg { width: 1.45rem; height: 1.45rem; transition: transform .35s var(--spring); }
.rail-btn span { opacity: 0; transform: translateX(-8px); transition: opacity .3s, transform .4s var(--ease); font-weight: 500; }
#rail:focus-within .rail-btn span, #rail:hover .rail-btn span { opacity: 1; transform: none; }
.rail-btn.active { color: #fff; }
.rail-btn:hover { color: #fff; background: rgba(255, 255, 255, .05); }
.kbd .rail-btn:focus { color: #fff; background: rgba(255, 255, 255, .1); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .85); }
.kbd .rail-btn:focus svg, .rail-btn:hover svg { transform: scale(1.18); }
.rail-btn.install { color: var(--cyan); flex: none; }
.rail-clock { text-align: center; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

#views { position: fixed; inset: 0 0 0 var(--rail-w); z-index: 2; }

/* ------------------------------------------------------------------ views */
.view { position: absolute; inset: 0; animation: viewIn .55s var(--ease) both; }
.view.leaving { animation: viewOut .35s var(--ease) forwards; pointer-events: none; }
@keyframes viewIn { from { opacity: 0; transform: translateY(24px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes viewOut { to { opacity: 0; transform: translateY(-12px) scale(.99); } }
.scroll { height: 100%; overflow-y: auto; overflow-x: hidden; padding: 2rem 2.4rem 4rem; scroll-padding: 6rem 0; scroll-behavior: smooth; }
.view-title { display: flex; align-items: center; gap: .7rem; margin: 0; font-size: 2rem; font-weight: 700; letter-spacing: -.01em; }
.view-title svg { width: 1.6rem; height: 1.6rem; color: var(--pink); }
.view-title em { font-style: normal; font-size: .9rem; font-weight: 500; color: var(--muted); background: var(--panel-2); padding: .2rem .6rem; border-radius: 99px; }
.view-title.pad { margin-bottom: 1.6rem; }
.stagger > * { animation: rise .7s var(--ease) both; animation-delay: calc(var(--i, 0) * 80ms + 80ms); }

/* ------------------------------------------------------------------ home */
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr); gap: 2.4rem; align-items: center; margin-bottom: 2.2rem; }
.eyebrow { margin: 0; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .14em; font-size: .85rem; }
.hero h1 { font-size: clamp(2rem, 3.2vw, 3.4rem); line-height: 1.05; margin: .5rem 0 .9rem; font-weight: 800; letter-spacing: -.02em; }
.grad { background: var(--grad); background-size: 200% 200%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: gradShift 6s ease infinite; }
.sub { display: flex; align-items: center; gap: .5rem; color: var(--muted); margin: 0; }
.hero-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.1rem; }
.tile {
  position: relative; overflow: hidden; aspect-ratio: 1 / 1.05; border-radius: 24px; padding: 1.3rem; display: flex; flex-direction: column; justify-content: flex-end; gap: .2rem;
  border: 1px solid rgba(255, 255, 255, .14); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2);
  transition: transform .45s var(--spring), box-shadow .4s; animation: tileIn .8s var(--spring) both; animation-delay: calc(var(--i) * 110ms + 150ms);
}
.tile.t-live { background: linear-gradient(150deg, #7c3aed, #4c1d95 70%); }
.tile.t-movie { background: linear-gradient(150deg, #db2777, #831843 70%); }
.tile.t-series { background: linear-gradient(150deg, #0891b2, #164e63 70%); }
.tile > svg { position: absolute; top: 1.2rem; left: 1.2rem; width: 2.4rem; height: 2.4rem; opacity: .95; transition: transform .5s var(--spring); }
.tile::before { content: ''; position: absolute; width: 140%; aspect-ratio: 1; right: -60%; top: -70%; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .28), transparent 60%); transition: transform .8s var(--ease); }
.tile b { font-size: 2.2rem; font-weight: 800; font-variant-numeric: tabular-nums; position: relative; }
.tile span { color: rgba(255, 255, 255, .8); font-weight: 500; position: relative; }
.tile-shine, .shine { position: absolute; inset: 0; background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .35) 50%, transparent 65%); transform: translateX(-130%); pointer-events: none; z-index: 3; }
.tile:hover, .kbd .tile:focus { transform: translateY(-6px) scale(1.05); box-shadow: var(--focus-ring); }
.tile:hover > svg, .kbd .tile:focus > svg { transform: scale(1.2) rotate(-8deg); }
.tile:hover::before, .kbd .tile:focus::before { transform: translate(-20%, 20%); }
.tile:hover .tile-shine, .kbd .tile:focus .tile-shine,
.card:hover .shine, .kbd .card:focus .shine, .kbd .tile-ch:focus .shine, .tile-ch:hover .shine { animation: sweep .9s var(--ease); }
@keyframes tileIn { from { transform: translateY(40px) scale(.85) rotate(3deg); opacity: 0; } to { transform: none; opacity: 1; } }

.row { margin-top: 1.4rem; animation: rise .6s var(--ease) both; }
.row h3 { margin: 0 0 .2rem; font-size: 1.3rem; font-weight: 600; }
.row-track { display: flex; gap: 1.1rem; overflow-x: auto; overflow-y: hidden; padding: 1rem .6rem 1.4rem; margin: 0 -.6rem; scroll-padding: 0 3rem; scrollbar-width: none; scroll-behavior: smooth; }
.row-track::-webkit-scrollbar { display: none; }

/* ------------------------------------------------------------------ cards */
.card { position: relative; flex: none; width: 10.5rem; display: flex; flex-direction: column; gap: .45rem; border-radius: var(--r); transition: transform .4s var(--spring); animation: cardIn .6s var(--spring) both; animation-delay: calc(var(--i, 0) * 45ms); }
.card.wide { width: 17.5rem; }
@keyframes cardIn { from { opacity: 0; transform: translateY(26px) scale(.9); } to { opacity: 1; transform: none; } }
.poster { position: relative; overflow: hidden; aspect-ratio: 2 / 3; border-radius: var(--r); background: linear-gradient(150deg, #241d45, #120f24); box-shadow: 0 10px 30px -14px rgba(0, 0, 0, .9); transition: box-shadow .35s; }
.card.wide .poster { aspect-ratio: 16 / 9; }
.poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; animation: fadeIn .5s ease both; }
.ph { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: 1.6rem; color: rgba(255, 255, 255, .35); letter-spacing: .04em; background: var(--grad-soft); }
@keyframes fadeIn { from { opacity: 0; } }
.badge { position: absolute; z-index: 2; top: .5rem; left: .5rem; display: flex; align-items: center; gap: .2rem; padding: .15rem .45rem; border-radius: 8px; background: rgba(0, 0, 0, .65); backdrop-filter: blur(6px); font-size: .8rem; font-weight: 600; }
.badge svg { width: .85rem; height: .85rem; color: #fbbf24; }
.fav-dot { position: absolute; z-index: 2; top: .5rem; right: .5rem; width: 1.7rem; height: 1.7rem; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .6); color: #fbbf24; animation: popIn .5s var(--spring); }
.fav-dot svg { width: .9rem; height: .9rem; }
.pbar { position: absolute; z-index: 2; left: .6rem; right: .6rem; bottom: .55rem; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .25); overflow: hidden; }
.pbar i { display: block; height: 100%; background: var(--grad); border-radius: inherit; }
.play-ico { position: absolute; z-index: 2; inset: 0; margin: auto; width: 3.2rem; height: 3.2rem; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .5); backdrop-filter: blur(6px); opacity: 0; transform: scale(.6); transition: opacity .3s, transform .4s var(--spring); }
.play-ico svg { margin-left: 3px; }
.card-title { font-weight: 600; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 .15rem; transition: color .3s; }
.card-sub { color: var(--muted); font-size: .8rem; margin-top: -.25rem; padding: 0 .15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card:hover, .kbd .card:focus { transform: translateY(-6px) scale(1.07); z-index: 2; }
.kbd .card:focus .poster { box-shadow: var(--focus-ring); }
.card:hover .poster { box-shadow: 0 0 0 2px rgba(255, 255, 255, .6), 0 20px 40px -12px rgba(139, 92, 246, .7); }
.card:hover .play-ico, .kbd .card:focus .play-ico, .ep:hover .play-ico, .kbd .ep:focus .play-ico { opacity: 1; transform: none; }
.kbd .card:focus .card-title { color: #fff; }

.tile-ch { position: relative; flex: none; width: 9.5rem; display: flex; flex-direction: column; gap: .5rem; transition: transform .4s var(--spring); animation: cardIn .6s var(--spring) both; animation-delay: calc(var(--i, 0) * 45ms); }
.logo-box { position: relative; overflow: hidden; aspect-ratio: 16 / 11; border-radius: var(--r); background: linear-gradient(150deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, .03)); border: 1px solid var(--line); transition: box-shadow .35s; }
.logo-box img { position: absolute; inset: 16%; width: 68%; height: 68%; object-fit: contain; z-index: 1; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .5)); }
.tc-name { font-size: .9rem; font-weight: 500; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-ch:hover, .kbd .tile-ch:focus { transform: translateY(-5px) scale(1.07); }
.kbd .tile-ch:focus .logo-box, .tile-ch:hover .logo-box { box-shadow: var(--focus-ring); }

/* ------------------------------------------------------------------ skeletons / states */
.sk { position: relative; overflow: hidden; background: rgba(255, 255, 255, .06); border-radius: 12px; animation: rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms); }
.sk::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .08), transparent); transform: translateX(-100%); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-line { display: block; height: 1rem; margin: .7rem 0; }
.sk-line.short { width: 60%; }
.sk-ch { height: 3.6rem; margin-bottom: .45rem; }
.sk-chip { display: inline-block; width: 7rem; height: 2.5rem; border-radius: 99px; margin-right: .6rem; }
.sk-card { aspect-ratio: 2 / 3; border-radius: var(--r); }
.sk-row { height: 14rem; margin: 1.5rem 0; }
.state { display: grid; justify-items: center; gap: .4rem; text-align: center; padding: 3rem 1rem; color: var(--muted); animation: rise .6s var(--ease) both; grid-column: 1 / -1; }
.state > svg { width: 3.2rem; height: 3.2rem; color: var(--violet); opacity: .8; margin-bottom: .4rem; animation: floaty 3s ease-in-out infinite; }
.state h3 { margin: 0; color: var(--text); font-size: 1.3rem; }
.state p { margin: 0 0 .6rem; max-width: 26rem; }
@keyframes floaty { 50% { transform: translateY(-8px); } }

/* ------------------------------------------------------------------ live tv */
.live { height: 100%; display: grid; grid-template-columns: 15.5rem minmax(0, 1fr) minmax(0, 33rem); gap: 1.2rem; padding: 1.4rem 1.4rem 1.4rem 1.6rem; }
.live-cats, .live-channels, .live-preview { min-height: 0; display: flex; flex-direction: column; }
.live-cats { background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 1rem .7rem; }
.pane-title { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .14em; font-weight: 600; padding: 0 .6rem .6rem; }
.cat-list { flex: 1; overflow-y: auto; scroll-padding: 2rem 0; padding: .2rem; }
.cat { position: relative; width: 100%; display: flex; align-items: center; gap: .6rem; padding: .7rem .8rem; border-radius: 12px; color: var(--muted); transition: background .25s, color .25s, transform .3s var(--spring); animation: slideIn .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 25ms); }
.cat svg { width: 1.1rem; height: 1.1rem; }
.cat span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat em { font-style: normal; font-size: .75rem; color: var(--dim); background: rgba(255, 255, 255, .06); padding: .1rem .45rem; border-radius: 99px; }
.cat.active { color: #fff; background: var(--grad-soft); }
.cat.active em { color: #fff; background: rgba(255, 255, 255, .15); }
.cat:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.kbd .cat:focus { color: #fff; background: rgba(255, 255, 255, .12); box-shadow: inset 0 0 0 2px #fff; transform: translateX(4px); }
@keyframes slideIn { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }

.pane-head { display: flex; align-items: center; gap: 1rem; justify-content: space-between; margin-bottom: .8rem; }
.pane-head h2 { margin: 0; font-size: 1.5rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; animation: rise .4s var(--ease); }
.search-mini { display: flex; align-items: center; gap: .5rem; height: 2.7rem; padding: 0 .9rem; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); color: var(--dim); transition: border-color .25s, box-shadow .25s, width .4s var(--ease); width: 14rem; flex: none; }
.search-mini input { flex: 1; min-width: 0; background: none; border: 0; }
.search-mini:focus-within { width: 18rem; border-color: var(--violet); box-shadow: 0 0 0 4px rgba(139, 92, 246, .2); color: var(--violet); }
input[type=search]::-webkit-search-cancel-button { filter: invert(1) opacity(.5); }

.ch-list { flex: 1; overflow-y: auto; padding: .3rem .5rem .3rem .2rem; scroll-padding: 4rem 0; }
.ch-list.swap > .ch { animation-name: chIn; }
.ch {
  position: relative; width: 100%; display: grid; grid-template-columns: 2.8rem 3.4rem minmax(0, 1fr) auto auto auto; align-items: center; gap: .8rem;
  height: 3.7rem; padding: 0 .9rem 0 .6rem; margin-bottom: .4rem; border-radius: 14px; background: rgba(255, 255, 255, .025); border: 1px solid transparent;
  transition: transform .35s var(--spring), background .25s, border-color .25s, box-shadow .3s; animation: chIn .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 22ms);
}
@keyframes chIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.ch::before { content: ''; position: absolute; left: 0; top: 18%; bottom: 18%; width: 4px; border-radius: 4px; background: var(--grad); transform: scaleY(0); transition: transform .35s var(--spring); }
.ch-num { color: var(--dim); font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; font-size: .9rem; }
.ch-logo { position: relative; height: 2.6rem; border-radius: 10px; overflow: hidden; background: rgba(255, 255, 255, .06); }
.ch-logo img { position: absolute; inset: 10%; width: 80%; height: 80%; object-fit: contain; z-index: 1; }
.ch-logo .ph { font-size: .8rem; }
.ch-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.ch-tag { font-size: .65rem; font-weight: 700; letter-spacing: .06em; color: var(--cyan); border: 1px solid rgba(34, 211, 238, .4); padding: .1rem .4rem; border-radius: 6px; }
.ch-fav { color: #fbbf24; opacity: 0; transform: scale(.4); transition: opacity .3s, transform .4s var(--spring); }
.ch-fav.on { opacity: 1; transform: none; }
.ch-fav svg { width: 1rem; height: 1rem; }
.eq { display: none; align-items: flex-end; gap: 2px; height: 1rem; }
/* Bars bounce with scaleY (GPU), not height: a height animation re-laid out the whole channel list every frame (~120ms/frame on an LG TV). */
.eq i { width: 3px; height: 100%; background: var(--pink); border-radius: 2px; transform-origin: 50% 100%; animation: eq 1s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.4s; background: var(--violet); }
.eq i:nth-child(3) { animation-delay: -.7s; background: var(--cyan); }
@keyframes eq { 0%, 100% { transform: scaleY(.25); } 50% { transform: scaleY(1); } }
.ch.playing .eq { display: flex; }
.ch.playing { background: rgba(139, 92, 246, .14); border-color: rgba(139, 92, 246, .35); }
.ch.playing .ch-name { color: #fff; }
.ch.playing::before { transform: scaleY(1); }
.ch:hover { background: rgba(255, 255, 255, .07); }
.kbd .ch:focus { background: linear-gradient(90deg, rgba(139, 92, 246, .35), rgba(236, 72, 153, .18)); border-color: rgba(255, 255, 255, .7); transform: translateX(8px) scale(1.015); box-shadow: 0 14px 40px -14px rgba(139, 92, 246, .9); }
.kbd .ch:focus::before { transform: scaleY(1); }
.kbd .ch:focus .ch-num { color: #fff; }

.live-preview { gap: 1rem; }
.preview-slot { position: relative; aspect-ratio: 16 / 9; border-radius: 18px; background: #000; overflow: hidden; border: 1px solid var(--line); box-shadow: 0 30px 80px -30px rgba(139, 92, 246, .6); cursor: pointer; flex: none; }
.preview-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: .6rem; color: var(--dim); background: radial-gradient(circle at 50% 40%, rgba(139, 92, 246, .18), transparent 70%); }
.preview-empty svg { width: 2.8rem; height: 2.8rem; animation: floaty 3s ease-in-out infinite; }
.preview-info { flex: 1; min-height: 0; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 1.2rem 1.3rem; }
.preview-info:empty { display: none; }
.preview-info.pop > * { animation: rise .4s var(--ease) both; }
.preview-info.pop > :nth-child(2) { animation-delay: .06s; }
.preview-info.pop > :nth-child(3) { animation-delay: .12s; }
.pi-head { display: flex; align-items: center; gap: 1rem; }
.pi-logo { position: relative; width: 4.2rem; height: 3rem; border-radius: 12px; overflow: hidden; background: rgba(255, 255, 255, .07); flex: none; }
.pi-logo img { position: absolute; inset: 10%; width: 80%; height: 80%; object-fit: contain; z-index: 1; }
.pi-kicker { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; }
.pi-head h3 { margin: .15rem 0 0; font-size: 1.35rem; line-height: 1.2; }
.pi-epg { margin: 1rem 0; }
.prog { display: grid; grid-template-columns: 3.6rem 1fr; gap: .8rem; padding: .55rem 0; border-top: 1px solid var(--line); animation: rise .4s var(--ease) both; animation-delay: calc(var(--i) * 60ms); }
.prog:first-child { border-top: 0; }
.prog .pt { color: var(--dim); font-variant-numeric: tabular-nums; font-size: .9rem; padding-top: .1rem; }
.prog b { font-weight: 500; color: var(--muted); }
.prog.now b { color: #fff; font-weight: 600; }
.prog.now .pt { color: var(--pink); font-weight: 600; }
.prog p { margin: .3rem 0 0; color: var(--muted); font-size: .85rem; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.epg-bar { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .15); overflow: hidden; margin-top: .5rem; }
.epg-bar i { display: block; height: 100%; background: var(--grad); border-radius: inherit; animation: grow 1s var(--ease) both; transform-origin: left; }
@keyframes grow { from { transform: scaleX(0); } }
.pi-actions { display: flex; gap: .7rem; flex-wrap: wrap; }

.num-bubble { position: fixed; z-index: 70; top: 2rem; right: 2.5rem; font-size: 4rem; font-weight: 800; padding: .3rem 1.4rem; border-radius: 20px; background: rgba(0, 0, 0, .7); border: 1px solid var(--line); backdrop-filter: blur(10px); opacity: 0; transform: scale(.7); transition: opacity .25s, transform .35s var(--spring); pointer-events: none; font-variant-numeric: tabular-nums; }
.num-bubble.show { opacity: 1; transform: none; }

/* ------------------------------------------------------------------ movies / series */
.vod { height: 100%; display: flex; flex-direction: column; }
.vod-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 1.8rem 2.4rem .6rem; }
.vod-tools { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.seg { display: inline-flex; padding: .25rem; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); gap: .2rem; flex: none; }
.seg button { position: relative; overflow: hidden; padding: .5rem 1rem; border-radius: 99px; color: var(--muted); font-weight: 500; font-size: .92rem; transition: background .3s, color .3s, transform .3s var(--spring); white-space: nowrap; }
.seg button.active { background: var(--grad); color: #fff; box-shadow: 0 6px 18px -6px rgba(236, 72, 153, .7); }
.seg button:hover { color: #fff; }
.kbd .seg button:focus { box-shadow: 0 0 0 2px #fff; color: #fff; transform: scale(1.06); }
.chips { display: flex; gap: .6rem; overflow-x: auto; padding: .8rem 2.4rem 1rem; scrollbar-width: none; flex: none; scroll-padding: 0 4rem; }
.chips::-webkit-scrollbar { display: none; }
.chip { position: relative; overflow: hidden; flex: none; display: inline-flex; align-items: center; gap: .4rem; height: 2.5rem; padding: 0 1.1rem; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); font-weight: 500; white-space: nowrap; transition: transform .35s var(--spring), background .3s, color .3s, box-shadow .3s; animation: rise .45s var(--ease) both; }
.chip svg { width: 1rem; height: 1rem; color: #fbbf24; }
.chip em { font-style: normal; font-size: .75rem; opacity: .6; }
.chip.active { background: #fff; color: #110d22; border-color: #fff; }
.chip:hover { color: #fff; border-color: rgba(255, 255, 255, .3); }
.chip.active:hover { color: #110d22; }
.kbd .chip:focus { transform: scale(1.08); box-shadow: var(--focus-ring); color: #fff; }
.kbd .chip.active:focus { color: #110d22; }
.grid-wrap { flex: 1; padding-top: .4rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 1.6rem 1.2rem; padding: .6rem .4rem; }
.grid .card { width: auto; }
.grid.swap .card { animation-name: cardIn; }
.sentinel { height: 1px; grid-column: 1 / -1; }

/* ------------------------------------------------------------------ modal / detail */
#modalRoot .modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 2rem; }
.modal-scrim { position: absolute; inset: 0; background: rgba(5, 4, 12, .72); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); opacity: 0; transition: opacity .4s var(--ease); }
.modal-panel { position: relative; width: min(76rem, 100%); max-height: 100%; overflow-y: auto; overflow-x: hidden; border-radius: 28px; background: linear-gradient(180deg, #151129, #0b0918); border: 1px solid var(--line); box-shadow: 0 50px 140px -30px rgba(0, 0, 0, .95); opacity: 0; transform: translateY(40px) scale(.94); transition: opacity .45s var(--ease), transform .55s var(--spring); scroll-padding: 3rem 0; }
.modal.in .modal-scrim { opacity: 1; }
.modal.in .modal-panel { opacity: 1; transform: none; }
.modal.out .modal-panel { transform: translateY(20px) scale(.97); transition-duration: .3s; }
.modal-close { position: absolute; z-index: 5; top: 1.1rem; right: 1.1rem; width: 2.8rem; height: 2.8rem; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .45); backdrop-filter: blur(8px); transition: transform .35s var(--spring), background .3s; }
.modal-close:hover, .kbd .modal-close:focus { transform: rotate(90deg) scale(1.1); background: rgba(255, 255, 255, .2); box-shadow: 0 0 0 2px #fff; }
.detail-bg { position: absolute; inset: 0 0 auto 0; height: 34rem; background-size: cover; background-position: center 20%; opacity: 0; transition: opacity 1s var(--ease); -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, .9) 0%, rgba(0, 0, 0, .5) 50%, transparent 100%); mask-image: linear-gradient(180deg, rgba(0, 0, 0, .9) 0%, rgba(0, 0, 0, .5) 50%, transparent 100%); }
.detail-bg.loaded { opacity: .55; animation: kenburns 24s ease-in-out infinite alternate; }
@keyframes kenburns { to { transform: scale(1.12) translate(-2%, 1%); } }
.detail-body { position: relative; display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 2.4rem; padding: 3.4rem 3rem 2rem; align-items: end; }
.detail-poster { position: relative; aspect-ratio: 2 / 3; border-radius: 20px; overflow: hidden; background: linear-gradient(150deg, #241d45, #120f24); box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .9), 0 0 0 1px rgba(255, 255, 255, .1); animation: posterIn .8s var(--spring) both; }
.detail-poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
@keyframes posterIn { from { opacity: 0; transform: translateY(30px) rotate(-4deg) scale(.9); } to { opacity: 1; transform: none; } }
.detail-kicker { color: var(--muted); font-weight: 500; }
.detail-kicker i { font-style: normal; color: var(--dim); margin: 0 .2rem; }
.detail-info h1 { margin: .3rem 0 .5rem; font-size: clamp(1.8rem, 3vw, 3rem); line-height: 1.05; font-weight: 800; letter-spacing: -.02em; }
.detail-rating { display: flex; align-items: center; gap: .3rem; font-weight: 700; font-size: 1.1rem; min-height: 1.4rem; }
.detail-rating svg { color: #fbbf24; }
.detail-rating small { color: var(--muted); font-weight: 400; }
.detail-plot { color: #d6d3ea; line-height: 1.6; max-width: 46rem; margin: .9rem 0; }
.detail-plot .sk { width: 100%; }
.detail-meta { display: grid; gap: .35rem; color: var(--muted); font-size: .92rem; max-width: 46rem; }
.detail-meta span { color: var(--dim); display: inline-block; min-width: 5.5rem; }
.detail-meta div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detail-actions { display: flex; gap: .8rem; margin-top: 1.4rem; flex-wrap: wrap; }
.seasons { display: flex; gap: .6rem; overflow-x: auto; padding: .6rem 3rem 1rem; scrollbar-width: none; }
.seasons::-webkit-scrollbar { display: none; }
.episodes { display: grid; grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); gap: 1rem; padding: 0 3rem 3rem; }
.episodes.swap .ep { animation-name: cardIn; }
.ep { position: relative; overflow: hidden; display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: .9rem; padding: .6rem; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); transition: transform .35s var(--spring), background .3s, box-shadow .3s; animation: cardIn .5s var(--spring) both; animation-delay: calc(var(--i) * 40ms); }
.ep-thumb { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: linear-gradient(150deg, #241d45, #120f24); align-self: start; }
.ep-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.ep-thumb .ph { font-size: 1.1rem; }
.ep-thumb .play-ico { width: 2.4rem; height: 2.4rem; }
.ep-text b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ep-text small { color: var(--muted); }
.ep-text p { margin: .3rem 0 0; color: var(--muted); font-size: .82rem; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ep:hover { background: rgba(255, 255, 255, .08); }
.kbd .ep:focus { transform: scale(1.03); background: rgba(139, 92, 246, .2); box-shadow: var(--focus-ring); }

/* ------------------------------------------------------------------ MKV note */
.mkv-note { display: flex; gap: .6rem; align-items: flex-start; max-width: 40rem; margin: .9rem 0 0; padding: .7rem .9rem; border-radius: 14px; background: rgba(244, 63, 94, .1); border: 1px solid rgba(244, 63, 94, .3); color: #fde2e7; font-size: .9rem; line-height: 1.45; }
.mkv-note > svg { width: 1.1rem; height: 1.1rem; flex: none; margin-top: .1rem; color: #fda4af; }

/* ------------------------------------------------------------------ playback report */
.rep-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: .4rem 0 .9rem; }
.rep-stats div { display: grid; padding: .6rem .7rem; border-radius: 12px; background: rgba(255, 255, 255, .05); }
.rep-stats b { font-size: 1.3rem; }
.rep-stats small { color: var(--muted); font-size: .75rem; }
.rep-list { display: grid; gap: .35rem; margin-bottom: 1rem; max-height: 22rem; overflow-y: auto; }
.rep-row { display: flex; gap: .6rem; align-items: flex-start; padding: .5rem .6rem; border-radius: 10px; background: rgba(255, 255, 255, .03); }
.rep-row > svg { width: 1rem; height: 1rem; margin-top: .15rem; flex: none; }
.rep-row.ok > svg { color: var(--green); }
.rep-row.bad > svg { color: #fda4af; }
.rep-row span { display: grid; min-width: 0; }
.rep-row b { font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rep-row small { color: var(--muted); font-size: .75rem; line-height: 1.35; word-break: break-word; }

/* ------------------------------------------------------------------ TV guide */
.guide { height: 100%; display: flex; flex-direction: column; }
.g-top { display: flex; align-items: center; gap: 1rem 1.4rem; flex-wrap: wrap; padding: 1.4rem 2rem .8rem; flex: none; }
.g-top .view-title { font-size: 1.7rem; }
.g-days { display: flex; gap: .45rem; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; padding: .3rem; }
.g-days::-webkit-scrollbar { display: none; }
.g-days .chip svg { color: var(--cyan); width: .9rem; height: .9rem; }
.g-tools { display: flex; gap: .5rem; flex-wrap: wrap; }
.g-pick { display: inline-flex; align-items: center; gap: .5rem; height: 2.6rem; padding: 0 .9rem; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); max-width: 16rem; transition: transform .3s var(--spring), box-shadow .3s, background .2s; }
.g-pick span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-pick em { font-style: normal; font-size: .72rem; color: var(--muted); background: rgba(255, 255, 255, .08); padding: .05rem .4rem; border-radius: 99px; }
.g-pick > svg:last-child { width: .9rem; height: .9rem; color: var(--dim); }
.g-pick .flag { width: 1.5rem; height: 1.1rem; }
.g-pick:hover { background: rgba(255, 255, 255, .1); }
.kbd .g-pick:focus { transform: scale(1.05); box-shadow: var(--focus-ring); }
.g-body { flex: 1; min-height: 0; overflow: auto; position: relative; margin: 0 1rem 1rem 1.6rem; border-radius: 18px; border: 1px solid var(--line); background: rgba(255, 255, 255, .02); scrollbar-width: thin; }
.g-canvas { position: relative; min-height: 100%; }
.g-ruler { position: sticky; top: 0; z-index: 4; background: rgba(12, 10, 26, .97); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); }
.g-ruler span { position: absolute; top: 0; bottom: 0; display: flex; align-items: center; padding-left: .5rem; font-size: .78rem; color: var(--muted); border-left: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.g-corner { position: sticky; left: 0; z-index: 2; height: 100%; display: flex; align-items: center; padding: 0 .9rem; font-weight: 600; font-size: .85rem; background: rgba(12, 10, 26, .99); border-right: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-nowline { position: absolute; top: 0; z-index: 3; width: 2px; background: var(--pink); box-shadow: 0 0 12px var(--pink); pointer-events: none; }
.g-nowline::before { content: 'NOW'; position: sticky; top: .5rem; display: block; transform: translateX(-50%); width: max-content; font-size: .6rem; font-weight: 800; letter-spacing: .08em; padding: .1rem .35rem; border-radius: 5px; background: var(--pink); }
.g-row { position: absolute; left: 0; border-bottom: 1px solid rgba(255, 255, 255, .05); animation: fadeIn .3s ease both; }
.g-ch { position: sticky; left: 0; z-index: 3; height: 100%; display: flex; align-items: center; gap: .6rem; padding: 0 .7rem; background: rgba(14, 12, 30, .98); border-right: 1px solid var(--line); text-align: left; transition: background .2s, box-shadow .2s; }
.g-num { color: var(--dim); font-size: .78rem; min-width: 1.8rem; text-align: right; font-variant-numeric: tabular-nums; }
.g-logo { position: relative; width: 2.6rem; height: 2rem; border-radius: 8px; overflow: hidden; background: rgba(255, 255, 255, .06); flex: none; }
.g-logo img { position: absolute; inset: 8%; width: 84%; height: 84%; object-fit: contain; z-index: 1; }
.g-logo .ph { font-size: .7rem; }
.g-name { flex: 1; min-width: 0; font-size: .88rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: .3rem; }
.g-cu svg { width: .85rem; height: .85rem; color: var(--cyan); }
.g-ch:hover { background: rgba(30, 26, 56, .98); }
.kbd .g-ch:focus { background: linear-gradient(90deg, rgba(139, 92, 246, .45), rgba(30, 26, 56, .98)); box-shadow: inset 0 0 0 2px #fff; }
.g-progs { position: absolute; top: 0; bottom: 0; right: 0; }
.g-loading { position: absolute; inset: .4rem .3rem; border-radius: 10px; background: linear-gradient(90deg, rgba(255, 255, 255, .03), rgba(255, 255, 255, .07), rgba(255, 255, 255, .03)); background-size: 200% 100%; animation: shimmerBg 1.4s linear infinite; }
@keyframes shimmerBg { to { background-position: -200% 0; } }
.g-prog { position: absolute; top: .3rem; bottom: .3rem; overflow: hidden; display: flex; flex-direction: column; justify-content: center; gap: .1rem; padding: 0 .7rem; border-radius: 10px; background: rgba(255, 255, 255, .055); border: 1px solid rgba(255, 255, 255, .06); text-align: left; transition: background .2s, box-shadow .25s, transform .25s var(--spring); }
.g-prog b { font-size: .86rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; display: flex; align-items: center; gap: .3rem; }
.g-prog b svg { width: .85rem; height: .85rem; color: var(--cyan); flex: none; }
.g-prog small { color: var(--muted); font-size: .72rem; white-space: nowrap; overflow: hidden; position: relative; }
.g-prog.past { background: rgba(255, 255, 255, .025); }
.g-prog.past b { color: var(--muted); }
.g-prog.rep.past b { color: #cfe9f3; }
.g-prog.now { background: rgba(139, 92, 246, .16); border-color: rgba(139, 92, 246, .45); }
.g-fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, rgba(139, 92, 246, .28), rgba(236, 72, 153, .2)); }
.g-prog.empty { background: transparent; border-style: dashed; }
.g-prog.empty b { color: var(--dim); font-weight: 500; }
.g-prog:hover { background: rgba(255, 255, 255, .1); }
.kbd .g-prog:focus { z-index: 2; background: var(--grad); border-color: transparent; box-shadow: 0 0 0 2px #fff, 0 12px 30px -10px rgba(236, 72, 153, .8); }
.kbd .g-prog:focus b, .kbd .g-prog:focus small, .kbd .g-prog:focus b svg { color: #fff; }
.kbd .g-prog:focus .g-fill { display: none; }
.prog-modal .modal-panel { width: min(40rem, 100%); }
.prog-detail { padding: 2rem; display: grid; gap: .7rem; }
.pd-head { display: flex; align-items: center; gap: .8rem; }
.pd-head div { display: grid; gap: .25rem; justify-items: start; }
.pd-head small { color: var(--muted); }
.pd-logo { position: relative; width: 3.6rem; height: 2.7rem; border-radius: 10px; overflow: hidden; background: rgba(255, 255, 255, .07); }
.pd-logo img { position: absolute; inset: 8%; width: 84%; height: 84%; object-fit: contain; z-index: 1; }
.prog-detail h2 { margin: .3rem 0 0; font-size: 1.7rem; line-height: 1.15; }
.pd-when { margin: 0; color: var(--muted); }
.pd-desc { margin: .2rem 0; color: #d6d3ea; line-height: 1.55; }
.tag.cu { background: linear-gradient(135deg, #0891b2, #0e7490); }
.pick-list { display: grid; gap: .35rem; max-height: 60vh; overflow-y: auto; padding: .2rem; }
.pick-row { display: flex; align-items: center; gap: .7rem; padding: .65rem .8rem; border-radius: 12px; background: rgba(255, 255, 255, .04); text-align: left; transition: background .2s, transform .25s var(--spring); }
.pick-row span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-row em { font-style: normal; font-size: .75rem; color: var(--muted); }
.pick-row.active { background: rgba(139, 92, 246, .22); }
.kbd .pick-row:focus { background: var(--grad); transform: scale(1.02); }
.kbd .pick-row:focus em { color: #fff; }
@media (max-width: 760px) {
  .g-top { padding: 1rem 1rem .5rem; }
  .g-body { margin: 0 .5rem .5rem; }
  .g-num { display: none; }
  .g-logo { width: 2rem; height: 1.6rem; }
  .g-name { font-size: .78rem; }
}

/* ------------------------------------------------------------------ skip intro / next episode */
.skip-btn { position: absolute; z-index: 5; right: 2.4rem; bottom: 8.5rem; display: none; align-items: center; gap: .5rem; padding: .8rem 1.2rem; border-radius: 14px; font-weight: 700; font-size: 1.05rem; background: rgba(255, 255, 255, .92); color: #0b0918; box-shadow: 0 16px 40px -10px #000; transition: transform .3s var(--spring); }
.skip-btn small { font-size: .65rem; font-weight: 800; padding: .1rem .35rem; border-radius: 5px; background: rgba(0, 0, 0, .12); }
.stage[data-mode="full"].skip-on .skip-btn { display: inline-flex; animation: sheetUp .4s var(--spring) both; }
.stage.osd-on .skip-btn { bottom: 11rem; }
.skip-btn:hover, .skip-btn:focus { transform: scale(1.06); background: #fff; box-shadow: 0 0 0 3px rgba(236, 72, 153, .6), 0 16px 40px -10px #000; }
.next-card { position: absolute; z-index: 6; right: 2.4rem; bottom: 8.5rem; display: none; gap: 1rem; align-items: center; width: min(30rem, calc(100% - 2rem)); padding: .9rem; border-radius: 20px; background: rgba(16, 13, 34, .95); border: 1px solid rgba(255, 255, 255, .14); backdrop-filter: blur(14px); box-shadow: 0 30px 80px -20px #000; }
.stage[data-mode="full"].next-on .next-card { display: flex; animation: sheetUp .45s var(--spring) both; }
.stage.osd-on .next-card { bottom: 11rem; }
.nc-thumb { position: relative; width: 9rem; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #000; flex: none; display: grid; place-items: center; }
.nc-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .6; }
.nc-ring { position: relative; width: 3rem; height: 3rem; transform: rotate(-90deg); }
.nc-ring circle { fill: none; stroke: rgba(255, 255, 255, .25); stroke-width: 3; }
.nc-ring .nc-prog { stroke: #fff; stroke-dasharray: 107; stroke-dashoffset: 0; animation: ncRing 10s linear forwards; }
@keyframes ncRing { to { stroke-dashoffset: 107; } }
.nc-num { position: absolute; font-size: 1.2rem; font-weight: 800; }
.nc-text { display: grid; gap: .3rem; min-width: 0; }
.nc-text small { color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-size: .7rem; }
.nc-text b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nc-btns { display: flex; gap: .5rem; margin-top: .3rem; }
.nc-btns .btn { height: 2.5rem; padding: 0 1rem; }
@media (max-width: 760px) { .skip-btn, .next-card { right: 1rem; bottom: 7rem; } .nc-thumb { width: 6rem; } }

/* ------------------------------------------------------------------ country / language */
.region-btn { position: relative; overflow: hidden; display: flex; align-items: center; gap: .7rem; width: 100%; padding: .65rem .75rem; margin-bottom: .8rem; border-radius: 16px; background: rgba(255, 255, 255, .06); border: 1px solid var(--line); text-align: left; transition: transform .3s var(--spring), background .25s, box-shadow .3s, border-color .25s; flex: none; }
.region-btn.set { border-color: rgba(139, 92, 246, .55); background: linear-gradient(135deg, rgba(139, 92, 246, .2), rgba(236, 72, 153, .1)); }
.region-btn:hover { background: rgba(255, 255, 255, .1); }
.kbd .region-btn:focus { transform: scale(1.03); box-shadow: var(--focus-ring); }
.rb-t { flex: 1; min-width: 0; display: grid; }
.rb-t small { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; }
.rb-t b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.region-btn em { font-style: normal; font-size: .72rem; color: var(--muted); background: rgba(255, 255, 255, .08); padding: .1rem .45rem; border-radius: 99px; }
.rb-chev { width: 1rem; height: 1rem; color: var(--dim); }
.flag { width: 2rem; height: 1.5rem; flex: none; display: grid; place-items: center; border-radius: 6px; overflow: hidden; }
.flag img { width: 100%; height: 100%; object-fit: contain; }
.flag.glyph { font-size: 1.3rem; }
.flag.txt { background: rgba(255, 255, 255, .12); font-size: .7rem; font-weight: 800; letter-spacing: .04em; }
.flag.big { width: 3.4rem; height: 2.6rem; border-radius: 10px; }
.flag.big.glyph { font-size: 2.2rem; }
.flag.big.txt { font-size: 1rem; }
.region-modal .modal-panel { width: min(64rem, 100%); }
.region-picker { padding: 1.8rem; }
.rp-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.rp-head h3 { margin: 0; font-size: 1.5rem; }
.rp-head p { margin: .2rem 0 0; }
.rp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: .8rem; }
.region-tile { position: relative; display: grid; justify-items: center; gap: .35rem; padding: 1.1rem .7rem .9rem; border-radius: 18px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); text-align: center; transition: transform .35s var(--spring), background .25s, box-shadow .3s; animation: cardIn .45s var(--spring) both; }
.region-tile b { font-size: .95rem; line-height: 1.2; }
.region-tile small { color: var(--muted); font-size: .78rem; }
.region-tile.active { border-color: rgba(139, 92, 246, .6); background: linear-gradient(150deg, rgba(139, 92, 246, .25), rgba(236, 72, 153, .12)); }
.region-tile:hover { background: rgba(255, 255, 255, .1); }
.kbd .region-tile:focus { transform: scale(1.06); box-shadow: var(--focus-ring); background: rgba(255, 255, 255, .12); }
.rt-tag { position: absolute; top: .45rem; right: .45rem; font-size: .62rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: .15rem .4rem; border-radius: 6px; background: var(--grad); }
@media (max-width: 760px) {
  .region-btn { margin-bottom: .5rem; }
  .rp-grid { grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr)); }
  .region-picker { padding: 1.2rem; }
}

/* ------------------------------------------------------------------ previews */
.detail-preview { position: absolute; inset: 0 0 auto 0; height: 34rem; overflow: hidden; pointer-events: none; opacity: 0; transition: opacity 1.2s var(--ease); -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, .75) 55%, transparent 100%); mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, .75) 55%, transparent 100%); }
.detail-preview.playing { opacity: 1; }
.detail-preview::after { content: ''; position: absolute; inset: 0; z-index: 1; background: linear-gradient(90deg, rgba(11, 9, 24, .92) 0%, rgba(11, 9, 24, .72) 45%, rgba(11, 9, 24, .35) 75%, rgba(11, 9, 24, .2) 100%), linear-gradient(0deg, rgba(11, 9, 24, .9) 0%, transparent 45%); }
.detail-preview.playing + .detail-body .detail-info, .detail-preview.playing ~ .detail-body .detail-info { text-shadow: 0 2px 14px rgba(0, 0, 0, .85); }
.modal.detail:has(.detail-preview.playing) .detail-bg { opacity: 0; }
.prev-media { position: absolute; left: 0; width: 100%; top: 50%; transform: translateY(-50%); aspect-ratio: 16 / 9; border: 0; pointer-events: none; }
.prev-media.yt { width: 136%; left: -18%; } /* crop YouTube's title bar & logo out of view */
.hp-media .prev-media.yt { width: 150%; left: -25%; }
video.prev-media { object-fit: cover; height: 100%; aspect-ratio: auto; }
.btn.icon-only { width: 3.5rem; padding: 0; }

.hover-prev { position: fixed; z-index: 45; border-radius: 20px; overflow: hidden; background: #15112a; border: 1px solid rgba(255, 255, 255, .14); box-shadow: 0 40px 100px -20px rgba(0, 0, 0, .95), 0 0 0 1px rgba(139, 92, 246, .25); pointer-events: none; opacity: 0; transform: scale(.55); transition: opacity .3s var(--ease), transform .45s var(--spring); }
.hover-prev.show { opacity: 1; transform: none; }
.hp-media { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #000; }
.hp-bg { position: absolute; inset: 0; background-size: cover; background-position: center 25%; transition: opacity .8s; animation: kenburns 18s ease-in-out infinite alternate; }
.hp-media.playing .hp-bg { opacity: 0; }
.hp-media .prev-media { opacity: 0; transition: opacity .8s; }
.hp-media.playing .prev-media { opacity: 1; }
.hp-media::after { content: ''; position: absolute; inset: auto 0 0 0; height: 40%; background: linear-gradient(0deg, #15112a, transparent); }
.hp-body { padding: .2rem 1.1rem 1rem; display: grid; gap: .4rem; }
.hp-body > b { font-size: 1.15rem; line-height: 1.2; }
.hp-meta { display: flex; flex-wrap: wrap; gap: .5rem; color: var(--muted); font-size: .8rem; align-items: center; }
.hp-r { display: inline-flex; align-items: center; gap: .2rem; color: #fff; font-weight: 700; }
.hp-r svg { width: .85rem; height: .85rem; color: #fbbf24; }
.hp-kind { border: 1px solid var(--line); padding: .05rem .45rem; border-radius: 6px; }
.hp-plot { margin: 0; color: #d6d3ea; font-size: .85rem; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; min-height: 1rem; }
.hp-plot .sk { width: 100%; height: .8rem; margin: .3rem 0; }
.hp-hint { display: flex; align-items: center; gap: .35rem; color: var(--dim); font-size: .75rem; }
.hp-hint svg { width: .8rem; height: .8rem; }

.trailer-layer { position: fixed; inset: 0; z-index: 90; background: #000; display: grid; grid-template-rows: 1fr auto; opacity: 0; transform: scale(1.04); transition: opacity .4s var(--ease), transform .5s var(--ease); }
.trailer-layer.in { opacity: 1; transform: none; }
.trailer-frame { position: relative; }
.trailer-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.trailer-bar { display: flex; align-items: center; gap: 1rem; padding: .8rem 1.4rem calc(.8rem + env(safe-area-inset-bottom, 0px)); background: #0b0918; }
.trailer-bar b { font-size: 1.1rem; }

/* ------------------------------------------------------------------ sound panel */
.audio-panel { position: absolute; z-index: 6; right: 2.2rem; bottom: 7.5rem; width: min(24rem, calc(100% - 2rem)); max-height: calc(100% - 9rem); overflow-y: auto; display: none; gap: .7rem; padding: 1.1rem; border-radius: 22px; background: linear-gradient(170deg, rgba(30, 24, 58, .97), rgba(14, 11, 30, .97)); border: 1px solid rgba(255, 255, 255, .12); box-shadow: 0 40px 100px -20px #000; }
.stage.audio-on .audio-panel { display: grid; animation: sheetUp .45s var(--spring) both; }
.ap-head { display: flex; justify-content: space-between; align-items: center; }
.ap-head b { font-size: 1.2rem; }
.ap-head .osd-btn { width: 2.4rem; height: 2.4rem; }
.ap-vol { display: flex; align-items: center; gap: .6rem; }
.ap-vol .osd-btn { width: 2.5rem; height: 2.5rem; flex: none; }
.ap-bar { position: relative; flex: 1; height: 10px; border-radius: 10px; background: rgba(255, 255, 255, .15); cursor: pointer; transition: height .2s, box-shadow .2s; }
.ap-fill { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--grad); transition: width .15s; }
.ap-bar.boost .ap-fill { background: linear-gradient(90deg, #8b5cf6, #ec4899 50%, #f59e0b); }
.ap-mark { position: absolute; left: 50%; top: -4px; bottom: -4px; width: 2px; background: rgba(255, 255, 255, .5); border-radius: 2px; }
.kbd .ap-bar:focus { height: 14px; box-shadow: 0 0 0 3px #fff, 0 0 0 6px rgba(139, 92, 246, .5); }
.ap-pct { min-width: 3.4rem; text-align: right; font-variant-numeric: tabular-nums; }
.ap-hint { margin: -.3rem 0 0; color: var(--dim); font-size: .75rem; }
.ap-opt { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem .8rem; border-radius: 14px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); text-align: left; transition: background .2s, transform .3s var(--spring), box-shadow .3s; }
.ap-opt span { display: grid; }
.ap-opt small { color: var(--muted); font-size: .78rem; line-height: 1.35; }
.ap-opt .toggle { display: inline-block; flex: none; transform: scale(.85); }
.ap-opt.on { border-color: rgba(139, 92, 246, .5); }
.kbd .ap-opt:focus { transform: scale(1.02); box-shadow: var(--focus-ring); }
.ap-note { margin: 0; color: #fbcfe8; font-size: .8rem; }
.ap-sub { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; margin: .3rem 0 .1rem; }
.ap-tracks { display: grid; gap: .35rem; }
.ap-tracks:empty { display: none; }
.ap-track { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .6rem .8rem; border-radius: 12px; background: rgba(255, 255, 255, .04); text-align: left; transition: background .2s, transform .3s var(--spring); }
.ap-track span { display: grid; }
.ap-track small { color: #fda4af; font-size: .72rem; }
.ap-track.on { background: rgba(139, 92, 246, .2); }
.ap-track svg { color: var(--green); }
.ap-track.bad { opacity: .6; }
.kbd .ap-track:focus { background: var(--grad); transform: scale(1.02); opacity: 1; }
@media (max-width: 760px) { .audio-panel { right: 1rem; bottom: 6rem; } }

/* ------------------------------------------------------------------ Dolby help */
.ap-dolby { display: flex; align-items: center; gap: .7rem; padding: .6rem .8rem; border-radius: 14px; background: rgba(255, 255, 255, .03); border: 1px dashed var(--line); }
.ap-dolby > span { width: 1.8rem; height: 1.8rem; border-radius: 50%; display: grid; place-items: center; flex: none; }
.ap-dolby > span svg { width: .95rem; height: .95rem; }
.ap-dolby .ok { background: rgba(16, 185, 129, .9); }
.ap-dolby .no { background: rgba(244, 63, 94, .8); }
.ap-dolby div { display: grid; }
.ap-dolby b { font-size: .9rem; }
.ap-dolby small { color: var(--muted); font-size: .78rem; }
.dolby-card { position: absolute; inset: 0; z-index: 7; display: none; place-items: center; padding: 1.5rem; background: rgba(5, 4, 12, .6); backdrop-filter: blur(6px); }
.stage.dolby-on .dolby-card { display: grid; animation: fadeIn .3s ease both; }
.dh-panel { width: min(30rem, 100%); max-height: 100%; overflow-y: auto; border-radius: 24px; padding: 1.3rem; background: linear-gradient(170deg, rgba(30, 24, 58, .97), rgba(14, 11, 30, .97)); border: 1px solid rgba(255, 255, 255, .12); box-shadow: 0 40px 100px -20px #000; animation: sheetUp .5s var(--spring) both; }
.dh-head { display: flex; gap: .9rem; align-items: flex-start; margin-bottom: 1rem; }
.dh-head > svg { width: 2.6rem; height: 2.6rem; padding: .6rem; border-radius: 14px; background: rgba(244, 63, 94, .2); color: #fda4af; flex: none; }
.dh-head b { display: block; font-size: 1.2rem; }
.dh-head small { color: var(--muted); line-height: 1.45; }
.dh-list { display: grid; gap: .5rem; }
.dh-btn { display: flex; align-items: center; gap: .8rem; padding: .75rem .9rem; border-radius: 16px; background: rgba(255, 255, 255, .06); border: 1px solid var(--line); text-align: left; transition: transform .3s var(--spring), background .2s, box-shadow .3s; }
.dh-btn > svg { width: 2.4rem; height: 2.4rem; padding: .55rem; border-radius: 12px; background: var(--grad); flex: none; }
.dh-btn.ghost > svg { background: rgba(255, 255, 255, .1); }
.dh-btn span { display: grid; }
.dh-btn small { color: var(--muted); font-size: .8rem; }
.dh-btn:hover { background: rgba(255, 255, 255, .1); }
.kbd .dh-btn:focus { transform: scale(1.03); box-shadow: var(--focus-ring); background: rgba(255, 255, 255, .12); }
#apExternal > svg { color: var(--dim); }

/* ------------------------------------------------------------------ watch on TV */
.cast-sheet { position: absolute; inset: 0; z-index: 6; display: none; place-items: end center; padding: 1.5rem; background: rgba(5, 4, 12, .55); backdrop-filter: blur(6px); }
.stage.cast-on .cast-sheet { display: grid; animation: fadeIn .3s ease both; }
.cast-panel { width: min(30rem, 100%); max-height: 80%; overflow-y: auto; border-radius: 24px; padding: 1.2rem; background: linear-gradient(170deg, rgba(30, 24, 58, .97), rgba(14, 11, 30, .97)); border: 1px solid rgba(255, 255, 255, .12); box-shadow: 0 40px 100px -20px #000; animation: sheetUp .5s var(--spring) both; }
@keyframes sheetUp { from { transform: translateY(40px) scale(.96); opacity: 0; } }
.cast-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; }
.cast-head b { font-size: 1.25rem; display: block; }
.cast-head small { color: var(--muted); }
.cast-list { display: grid; gap: .5rem; }
.cast-row { display: flex; align-items: center; gap: .9rem; padding: .75rem .9rem; border-radius: 16px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); transition: transform .3s var(--spring), background .2s, box-shadow .3s; animation: rise .4s var(--ease) both; }
.cast-row > svg { color: var(--dim); transition: transform .3s var(--spring); }
.cast-row:hover, .kbd .cast-row:focus { background: rgba(255, 255, 255, .1); }
.kbd .cast-row:focus { transform: scale(1.03); box-shadow: var(--focus-ring); }
.kbd .cast-row:focus > svg, .cast-row:hover > svg { transform: translateX(4px); color: #fff; }
.cast-ico { width: 2.8rem; height: 2.8rem; border-radius: 14px; display: grid; place-items: center; flex: none; background: var(--grad); }
.cast-ico.cc { background: linear-gradient(150deg, #4285f4, #1a56c4); }
.cast-ico.ap { background: linear-gradient(150deg, #6b7280, #1f2937); }
.cast-t { flex: 1; min-width: 0; display: grid; }
.cast-t small { color: var(--muted); display: flex; align-items: center; gap: .35rem; }
.dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--green); display: inline-block; animation: livePulse 2s infinite; }
.cast-empty { display: flex; align-items: center; gap: .7rem; color: var(--muted); padding: .8rem; }
.cast-empty .spinner { display: block; }
.cast-help { color: var(--dim); font-size: .82rem; line-height: 1.5; margin: .9rem .2rem 0; }
.cast-help b { color: var(--muted); }
.cast-bar { position: fixed; z-index: 70; left: 50%; bottom: calc(1.4rem + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 140%); display: flex; align-items: center; gap: .8rem; padding: .6rem .7rem .6rem .8rem; border-radius: 22px; max-width: calc(100vw - 2rem); background: rgba(22, 18, 42, .95); border: 1px solid rgba(255, 255, 255, .14); backdrop-filter: blur(14px); box-shadow: 0 24px 60px -15px #000; transition: transform .55s var(--spring); }
.cast-bar.show { transform: translate(-50%, 0); }
.cb-ico { width: 2.6rem; height: 2.6rem; border-radius: 12px; display: grid; place-items: center; background: var(--grad); flex: none; animation: tagPulse 2.4s ease-in-out infinite; }
.cb-t { display: grid; min-width: 0; }
.cb-t small { color: var(--muted); font-size: .78rem; }
.cb-t b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 16rem; }
.cast-bar .osd-btn { width: 2.7rem; height: 2.7rem; }
.cast-bar .btn { height: 2.7rem; }
.inline-ico { width: 1em; height: 1em; vertical-align: -.15em; }
.set-card h3 > svg { width: 1.1rem; height: 1.1rem; vertical-align: -.15rem; color: var(--pink); }
@media (max-width: 760px) { .cast-bar { bottom: calc(5.2rem + env(safe-area-inset-bottom, 0px)); } .cast-sheet { padding: .8rem; } }

/* ------------------------------------------------------------------ watch history */
.seen-badge { position: absolute; z-index: 2; left: .5rem; bottom: .5rem; display: flex; align-items: center; gap: .25rem; padding: .18rem .5rem .18rem .35rem; border-radius: 8px; background: rgba(16, 185, 129, .9); color: #fff; font-size: .72rem; font-weight: 700; box-shadow: 0 4px 14px -4px rgba(0, 0, 0, .7); animation: popIn .45s var(--spring) both; }
.seen-badge svg { width: .85rem; height: .85rem; }
.seen-badge.last { background: rgba(10, 8, 22, .82); backdrop-filter: blur(6px); border: 1px solid rgba(255, 255, 255, .15); }
.seen-badge.last svg { color: var(--green); }
.corner-tag { position: absolute; z-index: 3; top: .5rem; left: .5rem; padding: .2rem .5rem; border-radius: 7px; font-size: .68rem; font-weight: 800; letter-spacing: .08em; background: var(--grad); color: #fff; box-shadow: 0 6px 18px -6px rgba(236, 72, 153, .8); animation: tagPulse 2.4s ease-in-out infinite; }
@keyframes tagPulse { 50% { box-shadow: 0 0 0 4px rgba(236, 72, 153, .25), 0 6px 18px -6px rgba(236, 72, 153, .8); } }
.resume-line { margin: .2rem 0 .2rem; max-width: 34rem; padding: .7rem .9rem; border-radius: 14px; background: rgba(255, 255, 255, .06); border: 1px solid var(--line); color: #dcd9ef; font-size: .92rem; animation: rise .5s var(--ease) both; }
.resume-line > svg { width: 1rem; height: 1rem; color: var(--pink); vertical-align: -.15rem; margin-right: .4rem; }
.resume-line b { color: #fff; }
.resume-bar { height: 5px; border-radius: 5px; background: rgba(255, 255, 255, .14); overflow: hidden; margin-top: .55rem; }
.resume-bar i { display: block; height: 100%; border-radius: inherit; background: var(--grad); transform-origin: left; animation: grow 1.1s var(--ease) both; }
.chip.complete { border-color: rgba(52, 211, 153, .45); }
.chip.complete > svg { color: var(--green); }
.chip.active.complete > svg { color: #059669; }
.ep-status { display: flex; align-items: center; gap: .3rem; font-size: .8rem; color: #fbcfe8; margin-top: .1rem; }
.ep-status svg { width: .85rem; height: .85rem; }
.ep-status.ok { color: #6ee7b7; }
.ep-check { position: absolute; z-index: 2; top: .35rem; right: .35rem; width: 1.5rem; height: 1.5rem; border-radius: 50%; display: grid; place-items: center; background: rgba(16, 185, 129, .95); color: #fff; box-shadow: 0 3px 10px rgba(0, 0, 0, .5); }
.ep-check svg { width: .85rem; height: .85rem; }
.ep.is-watched .ep-thumb img { filter: saturate(.55) brightness(.75); }
.ep.is-watched .ep-text b { color: var(--muted); }
.ep.is-target { border-color: rgba(236, 72, 153, .55); background: linear-gradient(135deg, rgba(139, 92, 246, .16), rgba(236, 72, 153, .1)); }

/* ------------------------------------------------------------------ search */
.search-view { height: 100%; display: grid; grid-template-columns: minmax(0, 25rem) minmax(0, 1fr); gap: 1rem; }
.search-left { padding: 2rem 0 2rem 2.4rem; display: flex; flex-direction: column; gap: 1.2rem; }
.search-big { display: flex; align-items: center; gap: .8rem; height: 3.6rem; padding: 0 1.1rem; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); color: var(--dim); transition: border-color .3s, box-shadow .3s; }
.search-big input { flex: 1; min-width: 0; background: none; border: 0; font-size: 1.15rem; }
.search-big:focus-within { border-color: var(--violet); box-shadow: 0 0 0 4px rgba(139, 92, 246, .2); color: var(--violet); }
.osk { display: grid; grid-template-columns: repeat(6, 1fr); gap: .45rem; }
.key { position: relative; overflow: hidden; height: 2.9rem; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); display: grid; place-items: center; font-weight: 600; text-transform: uppercase; transition: transform .25s var(--spring), background .2s, box-shadow .2s; }
.key.wide { grid-column: span 4; text-transform: none; font-weight: 500; color: var(--muted); }
.key:hover { background: rgba(255, 255, 255, .1); }
.kbd .key:focus { background: var(--grad); border-color: transparent; transform: scale(1.12); box-shadow: 0 10px 25px -8px rgba(236, 72, 153, .8); z-index: 1; color: #fff; }
.search-results { padding-top: 2rem; }
.state.soft > svg { color: var(--dim); }

/* ------------------------------------------------------------------ settings */
.set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr)); gap: 1.2rem; align-items: start; }
.set-card { background: var(--panel); border: 1px solid var(--line); border-radius: 24px; padding: 1.5rem; }
.set-card h3 { margin: 0 0 .8rem; font-size: 1.15rem; }
.set-card h3.mt { margin-top: 1.4rem; }
.acc-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.acc-head h3 { margin: 0; }
.avatar { width: 3.4rem; height: 3.4rem; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--grad); box-shadow: 0 10px 30px -10px rgba(236, 72, 153, .8); }
.status { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.status.ok { color: var(--green); }
.status.ok::before { content: ''; display: inline-block; width: .5rem; height: .5rem; border-radius: 50%; background: var(--green); margin-right: .4rem; box-shadow: 0 0 0 0 rgba(52, 211, 153, .6); animation: livePulse 2s infinite; }
@keyframes livePulse { 70% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); } }
dl { display: grid; grid-template-columns: auto 1fr; gap: .5rem 1rem; margin: 0 0 1.2rem; }
dt { color: var(--dim); }
dd { margin: 0; }
.set-actions { display: flex; gap: .7rem; flex-wrap: wrap; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 0; border-top: 1px solid var(--line); }
.set-row:first-of-type { border-top: 0; }
.set-row { flex-wrap: wrap; }
.set-row > div:first-child { flex: 1 1 12rem; min-width: 0; }
.set-row small { display: block; color: var(--muted); font-size: .82rem; margin-top: .15rem; line-height: 1.4; }
.toggle { position: relative; width: 3.4rem; height: 1.95rem; border-radius: 99px; background: rgba(255, 255, 255, .14); flex: none; transition: background .3s, box-shadow .3s; }
.toggle i { position: absolute; top: .22rem; left: .22rem; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: #fff; transition: transform .4s var(--spring); box-shadow: 0 2px 6px rgba(0, 0, 0, .4); }
.toggle.on { background: var(--grad); }
.toggle.on i { transform: translateX(1.45rem); }
.kbd .toggle:focus { box-shadow: var(--focus-ring); }
.keys-help { list-style: none; padding: 0; margin: 0; display: grid; gap: .45rem; color: var(--muted); }
kbd { display: inline-block; min-width: 2.2rem; text-align: center; font-family: inherit; font-size: .8rem; font-weight: 600; color: #fff; padding: .15rem .45rem; border-radius: 7px; background: rgba(255, 255, 255, .1); border: 1px solid var(--line); border-bottom-width: 2px; margin-right: .3rem; }

/* ------------------------------------------------------------------ toasts */
#toasts { position: fixed; z-index: 80; left: 50%; bottom: 2rem; transform: translateX(-50%); display: grid; gap: .5rem; justify-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: .6rem; padding: .8rem 1.3rem; border-radius: 16px; background: rgba(22, 18, 42, .92); border: 1px solid rgba(255, 255, 255, .14); backdrop-filter: blur(14px); box-shadow: 0 20px 50px -15px rgba(0, 0, 0, .9); font-weight: 500; animation: toastIn .5s var(--spring) both; }
.toast svg { color: #fbbf24; }
.toast.out { animation: toastOut .4s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(20px) scale(.9); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px) scale(.95); } }

/* ------------------------------------------------------------------ video stage */
.stage {
  position: fixed; z-index: 20; top: 0; left: 0; width: 0; height: 0; overflow: hidden; background: #000; border-radius: 18px;
  transition: top .6s var(--ease), left .6s var(--ease), width .6s var(--ease), height .6s var(--ease), border-radius .6s var(--ease), opacity .4s, transform .4s var(--ease);
}
.stage.no-anim { transition: none !important; }
.stage[data-mode="hidden"] { opacity: 0; visibility: hidden; pointer-events: none; transform: scale(.96); }
.stage[data-mode="preview"] { cursor: pointer; }
.stage[data-mode="preview"]::after { content: ''; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12); pointer-events: none; }
.stage[data-mode="full"] { z-index: 60; border-radius: 0; cursor: default; }
.stage.slot-gone { visibility: hidden; }
.stage video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
body:not(.kbd) .stage[data-mode="full"]:not(.osd-on) { cursor: none; }

.stage-loader { position: absolute; inset: 0; display: none; place-content: center; grid-auto-flow: column; gap: .5rem; pointer-events: none; }
.stage.loading .stage-loader { display: grid; }
.stage-loader i { width: .8rem; height: .8rem; border-radius: 50%; background: var(--grad); animation: bounce 1s var(--ease) infinite; }
.stage-loader i:nth-child(2) { animation-delay: .15s; }
.stage-loader i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 100% { transform: translateY(0) scale(.8); opacity: .5; } 40% { transform: translateY(-14px) scale(1.1); opacity: 1; } }
.stage-error { position: absolute; inset: 0; display: none; place-items: center; text-align: center; padding: 1rem; background: radial-gradient(circle, rgba(244, 63, 94, .15), rgba(0, 0, 0, .85) 70%); }
.stage.has-error .stage-error { display: grid; }
.stage-status { position: absolute; left: 0; right: 0; top: calc(50% + 2.2rem); text-align: center; color: #e9e6f8; font-size: .9rem; text-shadow: 0 1px 6px #000; pointer-events: none; }
.stage-status:empty, .stage:not(.loading) .stage-status { display: none; }
.stage-error .btn { margin-top: .8rem; }
.stage-error small { max-width: 30rem; line-height: 1.45; }
.stage-error div { display: grid; gap: .3rem; justify-items: center; animation: rise .5s var(--ease); }
.stage-error svg { width: 2.4rem; height: 2.4rem; color: var(--red); }
.stage-error small { color: var(--muted); }

/* OSD */
.osd { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; opacity: 0; visibility: hidden; transition: opacity .35s, visibility .35s; }
.stage[data-mode="full"].osd-on .osd { opacity: 1; visibility: visible; }
.stage[data-mode="full"].osd-on .osd-top, .stage[data-mode="full"].osd-on .osd-bottom { transform: none; }
.osd-top, .osd-bottom { pointer-events: auto; padding: 2rem 2.6rem; transition: transform .5s var(--ease); }
.osd-top { display: flex; align-items: center; gap: 1.2rem; background: linear-gradient(180deg, rgba(0, 0, 0, .85), transparent); transform: translateY(-100%); padding-bottom: 4rem; }
.osd-bottom { background: linear-gradient(0deg, rgba(0, 0, 0, .92) 20%, transparent); transform: translateY(100%); padding-top: 5rem; }
.osd-logo { height: 3rem; max-width: 6rem; object-fit: contain; }
.osd-title { flex: 1; min-width: 0; }
.osd-kicker { color: var(--muted); font-size: .9rem; text-transform: uppercase; letter-spacing: .1em; }
.osd-name { font-size: 1.7rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.osd-clock { font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.osd-epg { max-width: 52rem; margin-bottom: 1rem; }
.osd-epg:empty { display: none; }
.epg-now { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; font-size: 1.25rem; }
.epg-now em, .epg-next em { font-style: normal; color: var(--muted); font-size: .9rem; }
.epg-desc { color: #cfcce4; margin: .6rem 0 0; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.epg-next { color: var(--muted); margin-top: .6rem; display: flex; align-items: center; gap: .6rem; }
.tag { font-size: .7rem; font-weight: 800; letter-spacing: .1em; padding: .2rem .5rem; border-radius: 6px; background: var(--red); color: #fff; }
.tag.dim { background: rgba(255, 255, 255, .15); }
.osd-seek { display: none; align-items: center; gap: 1rem; margin-bottom: 1rem; font-variant-numeric: tabular-nums; color: var(--muted); }
.stage.is-vod .osd-seek { display: flex; }
.stage.is-vod .live-only, .stage.is-live .vod-only { display: none; }
.seekbar { position: relative; flex: 1; height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .2); cursor: pointer; transition: height .25s; }
.seekbar:hover, .kbd .seekbar:focus { height: 10px; }
.kbd .seekbar:focus { box-shadow: 0 0 0 3px rgba(255, 255, 255, .35); }
.seek-buf { position: absolute; inset: 0 auto 0 0; background: rgba(255, 255, 255, .25); border-radius: inherit; }
.seek-fill { position: absolute; inset: 0 auto 0 0; background: var(--grad); border-radius: inherit; }
.seek-fill i { position: absolute; right: -8px; top: 50%; width: 16px; height: 16px; margin-top: -8px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(236, 72, 153, .4); transform: scale(0); transition: transform .3s var(--spring); }
.seekbar:hover .seek-fill i, .kbd .seekbar:focus .seek-fill i { transform: scale(1); }
.osd-controls { display: flex; align-items: center; gap: .7rem; }
.osd-spacer { flex: 1; }
.osd-btn { position: relative; overflow: hidden; width: 3.2rem; height: 3.2rem; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .1); backdrop-filter: blur(8px); transition: transform .35s var(--spring), background .25s, box-shadow .25s; }
.osd-btn.big { width: 4.2rem; height: 4.2rem; background: #fff; color: #0b0918; }
.osd-btn.big svg { width: 1.6rem; height: 1.6rem; }
.osd-btn.on { color: #fbbf24; }
/* Previous / next episode: wide labelled pills beside play/pause, easy to land on with a remote */
.osd-btn.ep-btn { width: auto; min-width: 6.4rem; padding: 0 1.15rem; border-radius: 999px; grid-auto-flow: column; gap: .45rem; font-weight: 700; font-size: 1rem; }
.osd-btn.ep-btn svg { width: 1.2rem; height: 1.2rem; }
/* Captions button: text, not an icon, so its "on" colour also works on older TV browsers */
.osd-btn.cc-btn span { font-weight: 800; font-size: .8rem; letter-spacing: .03em; line-height: 1; padding: .18rem .3rem; border: 2px solid currentColor; border-radius: 5px; }
.osd-btn.cc-btn.on, .kbd .osd-btn.cc-btn.on:focus { background: #fbbf24; color: #0b0918; }
/* Captions (drawn by player.js): bottom centre, top line first; lifted above the controls while they show */
.cc-box { position: absolute; left: 50%; bottom: 7%; transform: translateX(-50%); width: max-content; max-width: 84%; text-align: center; z-index: 3; pointer-events: none; font-size: 1.9rem; line-height: 1.55; font-weight: 600; transition: bottom .3s; }
.cc-box span { background: rgba(0, 0, 0, .8); color: #fff; padding: .08em .45em; border-radius: 4px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.stage[data-mode="full"].osd-on .cc-box { bottom: 25%; }
.stage[data-mode="preview"] .cc-box { font-size: .95rem; bottom: 5%; }
.stage.prog-on .cc-box { left: 31%; max-width: 56%; } /* keep captions clear of the programme panel */
.osd-btn:hover { background: rgba(255, 255, 255, .22); transform: scale(1.08); }
.osd-btn.big:hover { background: #fff; }
.kbd .osd-btn:focus { transform: scale(1.18); box-shadow: var(--focus-ring); background: rgba(255, 255, 255, .25); }
.kbd .osd-btn.big:focus { background: #fff; }

/* zapper */
.zapper { position: absolute; z-index: 3; top: 0; bottom: 0; left: 0; width: min(26rem, 85vw); display: flex; flex-direction: column; background: linear-gradient(90deg, rgba(7, 6, 15, .96), rgba(7, 6, 15, .85)); backdrop-filter: blur(16px); border-right: 1px solid var(--line); transform: translateX(-105%); transition: transform .5s var(--ease); visibility: hidden; }
.stage.zapper-on .zapper { transform: none; visibility: visible; }
.stage:not(.zapper-on) .zapper { pointer-events: none; }
.zapper-head { padding: 1.6rem 1.4rem .8rem; font-size: 1.2rem; font-weight: 700; }
/* Programme panel: today's listings for the channel that's playing, slides in from the right over the video */
.prog-panel { position: absolute; z-index: 3; top: 0; bottom: 0; right: 0; width: min(30rem, 88vw); display: flex; flex-direction: column; background: linear-gradient(270deg, rgba(7, 6, 15, .97), rgba(7, 6, 15, .88)); backdrop-filter: blur(16px); border-left: 1px solid var(--line); transform: translateX(105%); transition: transform .5s var(--ease); visibility: hidden; }
.stage.prog-on .prog-panel { transform: none; visibility: visible; }
.stage:not(.prog-on) .prog-panel { pointer-events: none; }
.pp-head { padding: 1.5rem 1.4rem .7rem; }
.pp-head small { display: block; color: var(--muted); letter-spacing: .12em; font-size: .72rem; font-weight: 600; margin-bottom: .2rem; }
.pp-head b { font-size: 1.15rem; font-weight: 700; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-list { flex: 1; overflow-y: auto; padding: 0 .8rem 2rem; }
.pp-item { width: 100%; display: grid; grid-template-columns: 4.6rem minmax(0, 1fr) auto; align-items: center; gap: .7rem; padding: .6rem .8rem; border-radius: 12px; margin-bottom: .25rem; color: var(--muted); text-align: left; }
.pp-item b { display: block; color: #fff; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-item small { display: block; font-size: .78rem; color: var(--muted); margin-top: .1rem; }
.pp-time { font-variant-numeric: tabular-nums; font-size: .92rem; }
.pp-item.past { opacity: .6; }
.pp-item.past.rep { opacity: .9; }
.pp-item.now { background: rgba(139, 92, 246, .22); color: #fff; }
.pp-item.now .pp-time { color: #fff; }
.pp-item .tag { font-size: .66rem; padding: .18rem .45rem; }
.pp-bar { display: block; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .15); margin-top: .35rem; overflow: hidden; }
.pp-bar i { display: block; height: 100%; background: var(--grad); }
.pp-item svg { width: 1rem; height: 1rem; color: var(--cyan); }
.pp-item:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.kbd .pp-item:focus { background: rgba(255, 255, 255, .14); color: #fff; box-shadow: inset 0 0 0 2px #fff; }
.pp-msg { padding: 1rem 1.2rem; color: var(--muted); }
body.lite .prog-panel { backdrop-filter: none; background: rgba(7, 6, 15, .96); }
body.lite .pp-list { will-change: transform; }
.zapper-list { flex: 1; overflow-y: auto; padding: 0 .8rem 2rem; }
.zap-item { width: 100%; display: grid; grid-template-columns: 2.6rem 3rem minmax(0, 1fr); align-items: center; gap: .7rem; height: 3.3rem; padding: 0 .7rem; border-radius: 12px; margin-bottom: .3rem; color: var(--muted); transition: transform .3s var(--spring), background .2s; }
.zap-item img, .zi-ph { width: 3rem; height: 2.2rem; object-fit: contain; }
.zi-num { text-align: right; font-variant-numeric: tabular-nums; color: var(--dim); }
.zi-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zap-item.on { color: #fff; background: rgba(139, 92, 246, .22); }
.zap-item:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.kbd .zap-item:focus { background: var(--grad); color: #fff; transform: scale(1.03); }
.kbd .zap-item:focus .zi-num { color: #fff; }

.zap-banner { position: absolute; z-index: 4; top: 2rem; right: 2.4rem; pointer-events: none; opacity: 0; transform: translateY(-20px) scale(.95); transition: opacity .3s, transform .45s var(--spring); }
.zap-banner.show { opacity: 1; transform: none; }
.zap-card { display: flex; align-items: center; gap: 1rem; padding: .9rem 1.4rem .9rem .9rem; border-radius: 20px; background: rgba(10, 8, 22, .82); border: 1px solid rgba(255, 255, 255, .14); backdrop-filter: blur(14px); box-shadow: 0 20px 50px -15px rgba(0, 0, 0, .9); }
.zap-num { font-size: 2rem; font-weight: 800; min-width: 3.4rem; height: 3.4rem; padding: 0 .5rem; border-radius: 14px; display: grid; place-items: center; background: var(--grad); }
.zap-card img { height: 2.8rem; max-width: 5rem; object-fit: contain; }
.zap-name { font-size: 1.3rem; font-weight: 700; display: grid; }
.zap-name small { font-size: .9rem; font-weight: 400; color: var(--muted); }
.flash { font-size: 1.6rem; font-weight: 800; padding: .6rem 1.2rem; border-radius: 16px; background: rgba(10, 8, 22, .8); backdrop-filter: blur(10px); }
.num-entry { position: absolute; z-index: 5; top: 2rem; left: 50%; font-size: 4.5rem; font-weight: 800; padding: .2rem 1.6rem; border-radius: 22px; background: rgba(0, 0, 0, .7); backdrop-filter: blur(10px); font-variant-numeric: tabular-nums; opacity: 0; transform: translate(-50%, -20px) scale(.8); transition: opacity .25s, transform .35s var(--spring); pointer-events: none; }
.num-entry.show { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1250px) {
  .live { grid-template-columns: 13rem minmax(0, 1fr) minmax(0, 24rem); }
  .hero { grid-template-columns: 1fr; gap: 1.4rem; }
  .hero-tiles { max-width: 42rem; }
}
@media (max-width: 960px) {
  .live { grid-template-columns: 12rem minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .live-preview { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .preview-info { max-height: none; }
  .live-cats { grid-row: 2; }
  .live-channels { grid-row: 2; }
  .search-view { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .search-left { padding: 1.5rem 1.5rem 0; }
  .osk { display: none; }
}
@media (max-width: 760px) {
  :root { --rail-w: 0px; }
  #rail, #rail:hover, #rail:focus-within { top: auto; bottom: 0; right: 0; width: auto; height: calc(4.4rem + env(safe-area-inset-bottom, 0px)); padding: .4rem .5rem calc(.4rem + env(safe-area-inset-bottom, 0px)); flex-direction: row; border-right: 0; border-top: 1px solid var(--line); background: rgba(7, 6, 15, .9); box-shadow: none; }
  .rail-logo, .rail-clock, .rail-btn.install { display: none; }
  .rail-items { flex-direction: row; justify-content: space-around; gap: 0; }
  .rail-btn { flex-direction: column; justify-content: center; gap: .15rem; height: 100%; padding: 0 .4rem; flex: 1; font-size: .68rem; }
  .rail-btn span, #rail:hover .rail-btn span { opacity: 1; transform: none; }
  .rail-btn svg { width: 1.35rem; height: 1.35rem; }
  .rail-btn[data-view="favorites"] { display: none; }
  #views { inset: 0 0 calc(4.4rem + env(safe-area-inset-bottom, 0px)) 0; padding-top: env(safe-area-inset-top, 0px); }
  .scroll { padding: 1.2rem 1rem 3rem; }
  .vod-top { padding: 1.2rem 1rem .4rem; }
  .chips { padding: .6rem 1rem .8rem; }
  .view-title { font-size: 1.6rem; }
  .hero h1 { font-size: 2rem; }
  .hero-tiles { gap: .7rem; }
  .tile { padding: .9rem; border-radius: 18px; aspect-ratio: 1; }
  .tile > svg { width: 1.7rem; height: 1.7rem; top: .9rem; left: .9rem; }
  .tile b { font-size: 1.4rem; }
  .tile span { font-size: .8rem; }
  .card { width: 8.4rem; }
  .card.wide { width: 14rem; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(7.4rem, 1fr)); gap: 1.1rem .8rem; }
  .search-mini, .search-mini:focus-within { width: 100%; }
  .vod-tools { width: 100%; }
  .vod-tools .search-mini { flex: 1; width: auto; }

  .live { display: flex; flex-direction: column; gap: .7rem; padding: .7rem .7rem 0; }
  .live-preview { display: flex; flex-direction: column; gap: .6rem; order: -1; flex: none; }
  .preview-info { display: none; }
  .live-cats { flex: none; padding: 0; background: none; border: 0; border-radius: 0; }
  .pane-title { display: none; }
  .cat-list { display: flex; gap: .5rem; overflow-x: auto; overflow-y: hidden; padding: .1rem; scrollbar-width: none; }
  .cat-list::-webkit-scrollbar { display: none; }
  .cat { width: auto; flex: none; border-radius: 99px; padding: .5rem .9rem; background: var(--panel); border: 1px solid var(--line); }
  .cat.active { background: #fff; color: #110d22; }
  .cat.active em { color: #110d22; background: rgba(0, 0, 0, .1); }
  .sk-line { width: 6rem; flex: none; }
  .live-channels { flex: 1; min-height: 0; }
  .pane-head { flex-wrap: wrap; gap: .5rem; margin-bottom: .5rem; }
  .pane-head h2 { font-size: 1.15rem; }
  .ch { grid-template-columns: 2.2rem 2.8rem minmax(0, 1fr) auto auto auto; height: 3.3rem; gap: .6rem; }

  #modalRoot .modal { padding: 0; }
  .modal-panel { border-radius: 0; height: 100%; max-height: none; }
  .detail-body { grid-template-columns: 1fr; padding: 2rem 1.2rem 1.2rem; gap: 1.2rem; }
  .detail-poster { width: 9rem; }
  .detail-bg { height: 22rem; }
  .seasons { padding: .6rem 1.2rem 1rem; }
  .episodes { grid-template-columns: 1fr; padding: 0 1.2rem 2rem; }
  .ep { grid-template-columns: 7.5rem minmax(0, 1fr); }
  .osd-top, .osd-bottom { padding: 1rem 1.1rem calc(1rem + env(safe-area-inset-bottom, 0px)); }
  .osd-top { padding-top: calc(1rem + env(safe-area-inset-top, 0px)); padding-bottom: 3rem; }
  .osd-name { font-size: 1.2rem; }
  .osd-clock, .osd-logo { display: none; }
  .osd-btn { width: 2.7rem; height: 2.7rem; }
  .osd-btn.big { width: 3.5rem; height: 3.5rem; }
  .osd-controls { gap: .4rem; }
  .epg-now { font-size: 1rem; }
  .zap-banner { right: 1rem; left: 1rem; top: 1rem; }
  .login-card { padding: 1.8rem 1.3rem 1.5rem; border-radius: 24px; }
  #toasts { bottom: 5.5rem; }
}

/* ------------------------------------------------------------------ TV lite mode */
/* TV graphics chips struggle with blur, big shadows and moving backgrounds. */
body.lite .aurora i, body.lite .aurora .grain { display: none; }
body.lite .aurora { background: radial-gradient(120% 90% at 50% 120%, #1a0f3a 0%, var(--bg) 60%); }
body.lite *, body.lite *::before, body.lite *::after { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
body.lite .poster, body.lite .logo-box, body.lite .tile, body.lite .modal-panel, body.lite .preview-slot, body.lite .login-card { box-shadow: none !important; }
body.lite .sk::after, body.lite .shine, body.lite .tile-shine, body.lite .tile::before { display: none; }
body.lite #rail { background: #0b0918; }
body.lite .modal-scrim { background: rgba(5, 4, 12, .9); }
body.lite .detail-bg.loaded { animation: none; }
/* TVs: crisp focus ring without big blurred shadows, no entry animations or per-card transitions */
body.lite { --focus-ring: 0 0 0 3px #fff, 0 0 0 6px #8b5cf6; }
body.lite .card, body.lite .tile-ch, body.lite .ch, body.lite .chip, body.lite .tile, body.lite .poster, body.lite .logo-box { animation: none !important; transition: none !important; }
body.lite .poster img, body.lite .logo-box img { animation: none; filter: none; }
body.lite.kbd .card:focus .poster, body.lite.kbd .tile-ch:focus .logo-box, body.lite.kbd .tile:focus { box-shadow: var(--focus-ring) !important; }
body.lite .card:hover, body.lite.kbd .card:focus, body.lite .tile-ch:hover, body.lite.kbd .tile-ch:focus { transform: scale(1.05); }
body.lite .tile:hover, body.lite.kbd .tile:focus { transform: scale(1.04); }
body.lite.kbd .ch:focus { transform: none; box-shadow: none; }
body.lite .row-track { scroll-behavior: auto; }
/* Live TV on TVs: rebuilding the channel info panel used to re-lay out the whole page (~70ms -> ~9ms boxed in). */
body.lite .live-preview { contain: strict; }
body.lite .preview-info, body.lite .ch-list { contain: layout paint; }
/* Give every scrolling list its own GPU layer: old TV engines otherwise repaint the whole list on the main thread
   for every scroll step (measured on LG webOS 22: worst frames 100-600ms -> ~50-80ms). */
body.lite .scroll, body.lite .row-track, body.lite .cat-list, body.lite .ch-list, body.lite .chips, body.lite .modal-panel,
body.lite .seasons, body.lite .g-body, body.lite .pick-list, body.lite .zapper-list { will-change: transform; }

/* ------------------------------------------------------------------ older TV engines (no aspect-ratio, e.g. LG webOS 22 = Chrome 87) */
@supports not (aspect-ratio: 1 / 1) {
  .poster, .sk-card, .detail-poster { height: 0; padding-top: 150%; }
  .card.wide .poster { padding-top: 56.25%; }
  .logo-box { height: 0; padding-top: 68.75%; }
  .preview-slot, .ep-thumb, .hp-media { height: 0; padding-top: 56.25%; }
  .tile { min-height: 11rem; }
  .nc-thumb { height: 5rem; }
  .prev-media { height: 100%; }
  .grid .card .poster { width: 100%; }
  /* Chrome 87 lays out <button> flex columns with align-items:flex-start, so height-only boxes collapse to 0 width */
  .poster, .logo-box, .sk-card, .detail-poster, .preview-slot, .ep-thumb, .hp-media { width: 100%; }
  .card, .tile-ch { align-items: stretch; }
  .card-title, .card-sub, .tile-ch > * { max-width: 100%; }
}

/* ------------------------------------------------------------------ reduced motion */
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after { animation-duration: .001ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .12s !important; }
.reduce-motion .aurora i { animation: none !important; }
.reduce-motion .stage { transition-duration: .2s !important; }
.reduce-motion .stage-loader i, .reduce-motion .spinner, .reduce-motion .eq i { animation-iteration-count: infinite !important; animation-duration: 1s !important; }
