@font-face {
  font-family: "Open Sans";
  font-style: normal;
  font-weight: 300 800;
  font-stretch: 100%;
  font-display: swap;
  src: url("/fonts/opensans-latin.woff2") format("woff2");
}

:root {
  --bg: #1f1f1f;
  --top: #141414;
  --rail: #191919;
  --surface: #282828;
  --press: #3a3a3a;
  --line: rgba(255, 255, 255, 0.08);
  --text: #eee;
  --hi: #fff;
  --muted: #a3a3a3;
  --faint: #6f6f6f;
  --amber: #e5a00d;
  --amber-press: #c98b08;
  --r: 6px;
  --t: 120ms;
  --pad: 36px;
  --tap: 72px;
  --pw: 200px;
  --rail-w: 112px;
  --top-h: 96px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body {
  font-family: "Open Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 20px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
svg.ic { width: 28px; height: 28px; flex: none; }
a { color: inherit; text-decoration: none; }

.top {
  background: var(--top);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  min-height: var(--top-h);
  box-shadow: 0 1px 0 var(--line);
}
.tbtn {
  height: var(--tap);
  min-width: var(--tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border-radius: var(--r);
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}
.tbtn:active { background: var(--press); }
.tbtn.icon { padding: 0; width: var(--tap); }
.tbtn.hub { background: #232323; box-shadow: inset 0 0 0 1px var(--line); }
.plexlogo { height: 32px; width: auto; display: block; }
.ttl {
  font-size: 26px;
  font-weight: 700;
  color: var(--hi);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  padding-left: 14px;
  border-left: 1px solid rgba(255, 255, 255, 0.14);
}
.grow { flex: 1; }
.spill {
  height: var(--tap);
  width: 300px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  border-radius: 999px;
  background: #2a2a2a;
  color: var(--muted);
  font-size: 18px;
}
.spill:active { background: var(--press); }
body[data-screen="search"] .spill { visibility: hidden; }
.kids {
  height: var(--tap);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px 0 8px;
  border-radius: 999px;
  font-size: 18px;
  font-weight: 700;
}
.kids:active { background: var(--press); }
.avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, #ffcf4a, #f08a2c);
  box-shadow: 0 0 0 2px var(--amber);
}
.avatar svg { width: 36px; height: 36px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.avatar .letter { font-weight: 700; color: #1a1a1a; font-size: 22px; line-height: 1; }
.avatar.alt { background: linear-gradient(140deg, #8ec5ff, #3a6ea5); }

[hidden] { display: none !important; }
#gate { min-height: 100vh; display: flex; flex-direction: column; }
body[data-screen="home"] #gate,
body[data-screen="library"] #gate,
body[data-screen="detail"] #gate,
body[data-screen="search"] #gate,
body[data-screen="player"] #gate { display: none; }
.gate-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 28px 24px 48px;
  text-align: center;
}
.wordmark { height: 48px; width: auto; }
#gateHeading { margin: 0; font-size: 40px; font-weight: 700; color: var(--hi); }
.help { margin: 0; max-width: 720px; color: var(--muted); font-size: 20px; }
.code {
  margin: 0;
  font-size: 72px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--amber);
}
.choice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.choice > .play,
.choice > .tbtn {
  box-sizing: border-box;
  height: 72px;
  min-height: 72px;
  max-height: 72px;
  padding: 0 22px;
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
}
.play {
  height: var(--tap);
  min-height: var(--tap);
  padding: 0 28px;
  border-radius: var(--r);
  background: var(--amber);
  color: #1a1a1a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}
.play:active { background: var(--amber-press); }
.profiles { display: flex; flex-wrap: wrap; gap: 28px; justify-content: center; align-items: stretch; }
.profile {
  width: 200px;
  height: 248px;
  padding: 12px 12px 16px;
  border-radius: 16px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--hi);
}
.profile:active { background: var(--press); }
.pin-slot { height: 28px; display: flex; align-items: center; justify-content: center; color: var(--amber); }
.pin-slot svg { width: 22px; height: 22px; display: block; }
.profile .avatar { width: 96px; height: 96px; margin-top: 8px; flex: none; }
.profile .letter { font-size: 40px; }
.pname {
  margin-top: 14px;
  height: 52px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  text-align: center;
  line-height: 1.2;
}
#pinForm { display: flex; flex-direction: column; align-items: center; gap: 16px; width: min(420px, 100%); }
.pin-dots { margin: 0; min-height: 36px; font-size: 28px; letter-spacing: 0.3em; color: var(--hi); font-weight: 700; }
.keypad { display: grid; grid-template-columns: repeat(3, 88px); gap: 12px; }
.key {
  height: 72px;
  min-height: 72px;
  border-radius: 14px;
  background: #2a2a2a;
  color: var(--hi);
  font-size: 28px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.key.go { background: var(--amber); color: #1a1a1a; }
.key:active { background: var(--press); }
.key.go:active { background: var(--amber-press); }
#pinInput {
  width: 100%;
  height: 72px;
  border: 0;
  border-radius: 12px;
  background: #2a2a2a;
  color: var(--hi);
  font: inherit;
  font-size: 28px;
  text-align: center;
  letter-spacing: 0.2em;
}
.error { margin: 0; color: #ffb4a8; font-size: 18px; }

.app {
  height: 100vh;
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  grid-template-rows: var(--top-h) minmax(0, 1fr);
  grid-template-areas: "top top" "rail main";
}
.app > .top { grid-area: top; }
.rail {
  grid-area: rail;
  background: var(--rail);
  display: flex;
  flex-direction: column;
  padding: 12px 0;
  gap: 4px;
  box-shadow: 1px 0 0 var(--line);
}
.ritem {
  height: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  position: relative;
}
.ritem svg { width: 32px; height: 32px; }
.ritem:active { background: var(--press); }
.ritem.on { color: var(--amber); }
.ritem.on::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18px;
  bottom: 18px;
  width: 4px;
  border-radius: 0 3px 3px 0;
  background: var(--amber);
}
main { grid-area: main; overflow: auto; scrollbar-width: none; }
main::-webkit-scrollbar { display: none; }
.screen { display: none; }
.screen.on { display: block; }

.hub { margin: 26px 0 4px; }
.hub-h { display: flex; align-items: center; gap: 10px; padding: 0 var(--pad); margin-bottom: 10px; }
.hub-h h2 { margin: 0; font-size: 22px; font-weight: 700; color: var(--hi); }
.seeall {
  height: 64px;
  padding: 0 14px;
  margin-left: auto;
  border-radius: var(--r);
  font-size: 16px;
  font-weight: 600;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.seeall:active { background: var(--press); color: var(--text); }
.row {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  padding: 6px var(--pad);
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.row::-webkit-scrollbar { display: none; }
.card {
  flex: none;
  width: var(--pw);
  text-align: left;
  scroll-snap-align: start;
  border-radius: var(--r);
}
.card:active { transform: scale(0.97); }
.pimg {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}
.pimg svg, .pimg img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 14px;
  background: linear-gradient(165deg, #3a3a3a, #1c1c1c);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}
.ph span { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ethumb .ph { align-items: center; font-size: 16px; }
.prog { position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: rgba(0, 0, 0, 0.6); }
.prog i { display: block; height: 100%; background: var(--amber); }
.cap { padding: 10px 2px 0; }
.cap b {
  display: block;
  font-size: 18px;
  font-weight: 600;
  color: var(--hi);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cap span {
  display: block;
  font-size: 16px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ltool { display: flex; align-items: center; gap: 10px; padding: 22px var(--pad) 18px; }
.lcount { margin-left: auto; color: var(--muted); font-size: 18px; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--pw), 1fr));
  gap: 26px 22px;
  padding: 0 var(--pad) 28px;
}
.grid .card { width: auto; }

.pp { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 36px; padding: 30px var(--pad) 0; }
.dtitle { margin: 0; font-size: 40px; line-height: 1.15; font-weight: 700; color: var(--hi); }
.meta { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; font-size: 18px; color: var(--muted); }
.acts { display: flex; align-items: center; gap: 16px; margin: 22px 0 18px; flex-wrap: wrap; }
.summary { margin: 0; font-size: 19px; line-height: 1.5; color: #d6d6d6; max-width: 760px; }
.eps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 22px 20px;
  padding: 20px var(--pad) 28px;
}
.ep { text-align: left; border-radius: var(--r); }
.ep:active { transform: scale(0.97); }
.ethumb {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--surface);
}
.ethumb svg, .ethumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.empty { padding: 30px var(--pad); color: var(--muted); }

#s-player {
  position: fixed;
  inset: 0;
  z-index: 30;
  width: 100dvw;
  height: 100dvh;
  margin: 0;
  padding: 0;
  background: #000;
  display: none;
}
body[data-screen="player"] #s-player { display: block; }
body[data-screen="player"] .app { display: none; }
.frame { position: absolute; inset: 0; width: 100%; height: 100%; }
.frame svg { width: 100%; height: 100%; display: block; object-fit: contain; background: #000; }
#video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  background: #000;
  object-fit: contain;
}
body.shot #video { opacity: 0; }
.ov {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(rgba(0, 0, 0, 0.75), transparent 22%, transparent 50%, rgba(0, 0, 0, 0.9));
  transition: opacity 300ms;
}
#s-player.hidectl .ov { opacity: 0; }
.ptop { display: flex; align-items: center; gap: 18px; padding: 16px 24px; }
.ptitle b { display: block; font-size: 24px; font-weight: 700; color: var(--hi); }
.ptitle span { display: block; font-size: 18px; color: #cfcfcf; }
.hint { margin-left: auto; font-size: 14px; color: rgba(255, 255, 255, 0.55); max-width: 280px; text-align: right; }
.pbottom { display: flex; flex-direction: column; }
.upnext {
  align-self: flex-end;
  margin: 0 24px 18px;
  width: min(620px, calc(100% - 48px));
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 12px;
  border-radius: 8px;
  background: rgba(31, 31, 31, 0.92);
}
.upnext .ethumb { width: 160px; flex: none; }
.upnext .ut { flex: 1; min-width: 0; text-align: left; }
.upnext small { display: block; font-size: 15px; font-weight: 700; color: var(--amber); }
.upnext b { display: block; font-size: 19px; font-weight: 600; color: var(--hi); }
.upnext span { display: block; font-size: 16px; color: var(--muted); }
.pbar { background: rgba(20, 20, 20, 0.88); padding: 6px 24px 14px; }
.scrub { display: flex; align-items: center; gap: 18px; }
.time { font-size: 17px; font-variant-numeric: tabular-nums; color: #e6e6e6; min-width: 58px; }
.time:last-child { text-align: right; }
.track { flex: 1; height: 44px; display: flex; align-items: center; }
#scrub { width: 100%; height: 44px; accent-color: var(--amber); }
.ctl { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.ctl .mid { display: flex; align-items: center; gap: 28px; }
.ctl .right { justify-self: end; }
.pb {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--hi);
}
.pb svg { width: 48px; height: 48px; }
.pb.main { width: 96px; height: 96px; background: var(--amber); color: #1a1a1a; }
.pb.main svg { width: 44px; height: 44px; }
.pb:active { background: rgba(255, 255, 255, 0.14); }
.pb.main:active { background: var(--amber-press); }
.retry, .unmute {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
}
.unmute { top: 62%; }
.sound-hint {
  position: absolute;
  left: 24px;
  right: 24px;
  top: 120px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 12px;
  background: rgba(20, 20, 20, 0.92);
  color: #fff;
  font-size: 18px;
}
.sound-hint button {
  height: 72px;
  min-width: 72px;
  padding: 0 18px;
  border-radius: 10px;
  background: #2a2a2a;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
}
.sfield {
  margin: 26px var(--pad) 8px;
  height: 88px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 10px 0 26px;
  border-radius: 999px;
  background: #2a2a2a;
  box-shadow: inset 0 0 0 2px var(--amber);
}
.sfield svg { width: 32px; height: 32px; color: var(--muted); }
.sfield input {
  flex: 1;
  min-width: 0;
  height: 100%;
  background: none;
  border: 0;
  outline: 0;
  color: var(--hi);
  font: inherit;
  font-size: 30px;
  font-weight: 600;
}
.sfield input::placeholder { color: var(--faint); font-weight: 400; }
.clr { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; }
.clr:active { background: var(--press); }
.shint { padding: 4px calc(var(--pad) + 10px) 0; color: var(--muted); font-size: 18px; }

@media (orientation: portrait) {
  :root { --pad: 28px; --rail-w: 0px; }
  .app {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: var(--top-h) 76px minmax(0, 1fr);
    grid-template-areas: "top" "rail" "main";
  }
  .rail { flex-direction: row; padding: 0 16px; gap: 8px; box-shadow: 0 1px 0 var(--line); }
  .ritem { height: 76px; flex-direction: row; padding: 0 22px; font-size: 18px; gap: 10px; }
  .ritem.on::before { left: 16px; right: 16px; top: auto; bottom: 0; width: auto; height: 4px; }
  .spill { width: var(--tap); padding: 0; justify-content: center; }
  .spill span { display: none; }
  .pp { grid-template-columns: 180px minmax(0, 1fr); gap: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
