:root {
  --bg: #000; --panel: #141417; --panel2: #1d1d22; --line: #2a2140;
  --text: #f2f2f0; --muted: #9a9a96; --purple: #8030F8; --soft: #b99cff;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; color: var(--text);
  font-family: Arial, Helvetica, sans-serif; }
html { background: var(--bg); }
body { background: transparent; }
body { overflow: hidden; display: flex; flex-direction: column; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }

/* top bar */
#top { display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px; flex: 0 0 auto; }
#logo { height: 44px; cursor: pointer; margin: 13px 0; }
#top { position: relative; }
#badge { height: 62px; width: 62px; object-fit: contain; margin-left: auto; }
#badge[hidden] { display: none; }
#burger { display: flex; flex-direction: column; gap: 5px; padding: 16px;
  border-radius: 12px; margin-left: auto; }
#badge:not([hidden]) + #burger { margin-left: 12px; }
#burger span { width: 24px; height: 2px; background: #f2f2f0; border-radius: 1px; }
#menu { position: absolute; top: 76px; right: 24px; background: #18181b;
  border-radius: 12px; padding: 4px 0; min-width: 180px; z-index: 50; }
#menu[hidden] { display: none; }
#menu a { display: block; padding: 14px 18px; color: #f2f2f0; font-size: 15px;
  border-bottom: 1px solid rgba(255,255,255,0.08); }
#menu a:last-child { border-bottom: 0; }
#menu #mout { color: #ff6b6b; }
.devs { max-width: 760px; margin: 10px auto; padding: 0 20px 40px; height: 100%;
  overflow-y: auto; }
.devs h1 { font-size: 26px; margin: 0 0 6px; }
.devs > p { color: var(--muted); margin: 0 0 20px; font-size: 14px; }
.dev { display: flex; align-items: center; gap: 16px; background: var(--panel);
  border-radius: 16px; padding: 16px 18px; margin-bottom: 10px; }
.dev .ic { width: 44px; height: 44px; border-radius: 22px; flex: 0 0 44px;
  background: rgba(128,48,248,0.22); display: flex; align-items: center;
  justify-content: center; font-size: 20px; }
.dev .inf { flex: 1; min-width: 0; }
.dev .nm2 { font-size: 16px; font-weight: 600; }
.dev .me { color: var(--soft); font-size: 12px; font-weight: 600; margin-left: 8px; }
.dev .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.dev .btn { padding: 9px 16px; font-size: 14px; background: rgba(255,107,107,0.14);
  color: #ff8b7a; }
body:not(.pghome) #burger, body.play #top { display: none; }
#view { flex: 1 1 auto; overflow: hidden; position: relative; }

/* focus: same purple ring as the TV app */
[data-f] { outline: none; cursor: pointer; }
body.kbd [data-f]:focus { box-shadow: inset 0 0 0 3px var(--purple); }
body.kbd .card:focus { box-shadow: none; }
body.kbd .card:focus .art { box-shadow: inset 0 0 0 3px var(--purple); }

/* login */
.login-box { max-width: 420px; margin: 40px auto; background: var(--panel);
  border-radius: 16px; padding: 30px; }
.login-box h1 { margin: 0 0 6px; font-size: 26px; }
.login-box p { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.field { width: 100%; background: var(--panel2); border: 0; border-radius: 12px;
  padding: 14px; margin-bottom: 12px; font-size: 16px; }
.btn { display: inline-block; background: var(--purple); color: #fff; border: 0;
  border-radius: 16px; padding: 12px 22px; font-size: 15px; font-weight: 600; }
.btn.ghost { background: rgba(255,255,255,0.1); }
.err { color: #ff8b7a; font-size: 14px; min-height: 20px; margin-top: 10px; }
.note { color: var(--muted); font-size: 12px; margin-top: 16px; }
.btn.wide { display: block; text-align: center; margin-top: 12px; }
.login-box.pair { max-width: 860px; display: flex; gap: 36px; align-items: center; }
.pair .qr { width: 300px; flex: 0 0 300px; background: #fff; border-radius: 12px;
  padding: 10px; min-height: 300px; display: flex; align-items: center;
  justify-content: center; }
.pair .qr svg { width: 100%; height: auto; display: block; }
.pair .qr .spin { color: #555; }
.pair ol { color: #c9c9c5; padding-left: 20px; line-height: 1.8; margin: 0 0 14px; }
.pcode { font-size: 40px; font-weight: 700; letter-spacing: 8px; margin: 4px 0 6px; }
@media (max-width: 760px) {
  .login-box.pair { flex-direction: column; margin: 10px 14px; gap: 18px; }
  .pair .qr { width: 220px; flex: 0 0 auto; min-height: 220px; }
}

/* home */
.home { display: flex; gap: 18px; justify-content: center; align-items: center;
  align-content: center; height: 100%; padding: 0 40px 60px; flex-wrap: wrap; }
.home .tile .lb { display: none; }
.home .tile.noimg { background: linear-gradient(135deg, #2a1650, #120a24); }
.home .tile.noimg .lb { display: inline; }
.home .tile { width: 360px; aspect-ratio: 3 / 1; border-radius: 16px;
  display: flex; align-items: center;
  justify-content: center; font-size: 28px; font-weight: 700; overflow: hidden;
  position: relative; }
.home .tile img { position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; }
.home .tile:focus { transform: scale(1.04); }
@media (min-width: 761px) {
  body.pghome { background: #000 url(img/wallpaper.png) center / cover no-repeat; }
  body.pghome #view, body.pghome #top { background: transparent; }
}
/* home carousel (PC / wide screens) */
.carousel { display: none; }
.carousel .stage { position: absolute; left: 0; right: 0; top: 0; bottom: 70px; }
.citem { position: absolute; left: 50%; top: 50%; width: min(44vw, 760px);
  border-radius: 20px; transition: transform .45s ease, opacity .45s ease;
  will-change: transform; }
.citem img { width: 100%; display: block; border-radius: 20px; }
.citem .lb { display: none; }
.citem.noimg { aspect-ratio: 3 / 1; background: linear-gradient(135deg,
  #2a1650, #120a24); display: flex; align-items: center; justify-content: center;
  font-size: 40px; font-weight: 700; }
.citem.noimg .lb { display: inline; }
body.kbd .citem.on:focus { box-shadow: none; outline: 3px solid var(--purple);
  outline-offset: 6px; }
.carr { position: absolute; top: calc(50% - 35px); transform: translateY(-50%);
  width: 52px; height: 52px; border-radius: 26px; background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center; font-size: 34px;
  line-height: 1; z-index: 5; color: #fff; }
.carr.l { left: 2.5%; } .carr.r { right: 2.5%; }
.cdots { position: absolute; bottom: 62px; width: 100%; display: flex; gap: 10px;
  justify-content: center; }
.cdots span { width: 9px; height: 9px; border-radius: 5px;
  background: rgba(255,255,255,0.3); }
.cdots span.on { background: var(--purple); width: 26px; }
@media (min-width: 761px) {
  .home { display: none; }
  .carousel { display: block; position: absolute; inset: 0; }
}
.expiry { position: absolute; bottom: 16px; width: 100%; text-align: center;
  color: #6B5B95; font-size: 13px; }

/* browse */
.browse { display: flex; height: 100%; }
.cats { width: 250px; flex: 0 0 250px; overflow-y: auto; padding: 0 10px 30px 20px; }
.cat { display: block; padding: 10px 14px; border-radius: 12px; color: #d8d8d5;
  font-size: 14px; margin-bottom: 2px; }
.cat.on { background: rgba(128,48,248,0.25); color: #fff; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0;
  min-height: 0; }
.search { margin: 0 24px 12px 10px; width: auto; }
.grid { flex: 1; overflow-y: auto; padding: 6px 24px 40px 10px; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 18px;
  align-content: start; }
.grid.live { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.card { position: relative; border-radius: 16px; }
.card .art { width: 100%; aspect-ratio: 2 / 3; border-radius: 16px;
  background: var(--panel); overflow: hidden; display: flex; align-items: center;
  justify-content: center; }
.live .card .art { aspect-ratio: 1; padding: 14px; }
.card img { width: 100%; height: 100%; object-fit: cover; }
.live .card img { object-fit: contain; }
.card .fb { color: #6a6a66; font-size: 22px; font-weight: 700; }
.art img + .fb { display: none; }
.card .nm { font-size: 13px; color: #d8d8d5; margin-top: 7px; text-align: center;
  height: 32px; overflow: hidden; }
.card .star { position: absolute; top: 6px; right: 8px; font-size: 20px;
  color: #ffd257; text-shadow: 0 1px 3px #000; display: none; }
.card.fav .star { display: block; }
.live .card:hover .star { display: block; }
.live .card:not(.fav) .star { color: rgba(255,255,255,0.6); }
.empty { color: var(--muted); padding: 30px 10px; grid-column: 1 / -1; }
.spin { color: var(--muted); padding: 40px; text-align: center; }

/* detail pages */
.detail { height: 100%; overflow-y: auto; }
.detail .bg { position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background-size: cover; background-position: center top; z-index: -1; }
.detail .bg::after { content: ""; position: absolute; inset: 0; background:
  linear-gradient(90deg, rgba(0,0,0,0.88) 0%, rgba(0,0,0,0.62) 45%,
  rgba(0,0,0,0.35) 100%),
  linear-gradient(180deg, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0) 22%); }
.detail .wrap { display: flex; gap: 32px; padding: 10px 40px 40px; }
.detail .poster { width: 220px; flex: 0 0 220px; aspect-ratio: 2 / 3;
  border-radius: 12px; background: var(--panel); object-fit: cover; }
.detail h1 { margin: 0; font-size: 32px; }
.meta { color: #c9c9c5; margin-top: 8px; }
.resume { color: var(--soft); margin-top: 10px; }
.btns { display: flex; gap: 12px; margin: 18px 0; }
.plot { color: #e2e2de; line-height: 1.6; max-width: 820px; }
.small { color: #c9c9c5; font-size: 14px; margin-top: 8px; }
.small b { color: #8f8f8a; }
.seasons { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0 14px; }
.chip { padding: 9px 16px; border-radius: 20px; background: rgba(24,24,27,0.85);
  font-size: 14px; }
.chip.on { background: #f2f2f0; color: #0c0c0e; }
.ep { display: flex; gap: 14px; align-items: center; padding: 13px 16px;
  border-radius: 16px; background: rgba(24,24,27,0.8); margin-bottom: 8px;
  max-width: 820px; }
.ep .n { color: #8f8f8a; width: 28px; }

/* player */
.player { position: absolute; inset: 0; background: #000; }
.player video { width: 100%; height: 100%; background: #000; }
.ptitle { position: absolute; top: 18px; left: 24px; font-size: 18px;
  text-shadow: 0 1px 4px #000; transition: opacity .4s; }
.pbar { position: absolute; top: 12px; right: 18px; display: flex; gap: 10px;
  transition: opacity .4s; }
.player.idle .ptitle, .player.idle .pbar { opacity: 0; }
.ask { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  background: rgba(20,20,23,0.95); border-radius: 16px; padding: 26px 30px;
  text-align: center; }
.ask .btns { justify-content: center; margin-bottom: 0; }
.perr { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  text-align: center; max-width: 520px; }

#toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  background: rgba(30,30,34,0.95); padding: 12px 22px; border-radius: 16px;
  font-size: 15px; opacity: 0; transition: opacity .3s; pointer-events: none; }
#toast.show { opacity: 1; }

@media (max-width: 760px) {
  #top { padding: 10px 6px 10px 16px; flex-wrap: wrap; gap: 6px; }
  #logo { height: 34px; margin: 10px 0; }
  #badge { height: 50px; width: 50px; }
  #menu { top: 64px; right: 14px; }
  .home { gap: 10px; padding: 0 16px 50px; }
  .browse { flex-direction: column; }
  .cats { width: auto; flex: 0 0 auto; display: flex; overflow-x: auto;
    overflow-y: hidden; padding: 0 14px 10px; scrollbar-width: none; }
  .grid { -webkit-overflow-scrolling: touch; }
  .cat { white-space: nowrap; }
  .search { margin: 0 14px 10px; }
  .grid { padding: 4px 14px 30px;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 12px; }
  .grid.live { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .detail .wrap { flex-direction: column; padding: 10px 16px 30px; gap: 18px; }
  .detail .poster { width: 150px; flex: 0 0 auto; }
  .home .tile { width: 100%; }
}
