/* HDHub4u site: dark by default, light when the device asks for it. Layout follows movy.sx: a featured hero,
   poster rails (Continue watching, Top 10), then the latest releases grid. */
:root {
  --bg: #0f0f12; --bg-2: #17171c; --card: #1d1d23; --line: rgba(255,255,255,.08); --fg: #f4f4f6; --muted: #a8a8b3;
  --soft: #7d7d88; --accent: #ffdd95; --accent-ink: #141414; --red: #e50914; --glass: rgba(15,15,18,.72);
  --shadow: 0 12px 32px rgba(0,0,0,.45); --radius: 12px; --pad: clamp(16px, 4vw, 56px);
  --logo-filter: none;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f5f7; --bg-2: #ffffff; --card: #ffffff; --line: rgba(0,0,0,.09); --fg: #141418; --muted: #4c4c57;
    --soft: #6e6e79; --accent: #b45309; --accent-ink: #fff; --glass: rgba(245,245,247,.8); --shadow: 0 10px 28px rgba(0,0,0,.12);
    /* the logo's white letters need an outline on a light page */
    --logo-filter: drop-shadow(0 0 1px rgba(0,0,0,.9)) drop-shadow(0 1px 2px rgba(0,0,0,.4));
    color-scheme: light;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { overflow-x: clip; margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 Inter, "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
img { max-width: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

/* ---------------------------------------------------------------- top bar */
.topbar { position: sticky; top: 0; z-index: 50; background: var(--glass); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 1440px; margin: auto; padding: 10px var(--pad); display: flex; align-items: center; gap: 18px; }
.logo { display: block; line-height: 0; flex: none; }
.logo img { width: clamp(108px, 22vw, 150px); height: auto; filter: var(--logo-filter); }
.logo.small img { width: 110px; }
.links { display: flex; gap: 4px; }
.links a { padding: 7px 12px; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: 14px; }
.links a:hover, .links a[aria-current="page"] { color: var(--fg); background: var(--line); }
.search { margin-left: auto; position: relative; flex: 0 1 340px; min-width: 0; }
.search svg { position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); fill: var(--soft); pointer-events: none; }
.search input { width: 100%; height: 40px; padding: 0 14px 0 38px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-2); outline: none; }
.search input:focus { border-color: var(--accent); }
@media (max-width: 640px) { .links { display: none; } .topbar-in { gap: 10px; } }

main { max-width: 1440px; margin: auto; padding: 0 0 40px; min-height: 60vh; }

/* ---------------------------------------------------------------- status (loading / empty / error) */
.status { display: none; flex-direction: column; align-items: center; gap: 12px; padding: 64px var(--pad); color: var(--muted); text-align: center; }
main[data-view="loading"] .status, main[data-view="empty"] .status, main[data-view="error"] .status { display: flex; }
.status p { margin: 0; max-width: 52ch; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .9s linear infinite; }
main:not([data-view="loading"]) .spinner { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn, .status button, .pages a, .pages span, .pages button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-weight: 700; cursor: pointer; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.glass { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.22); backdrop-filter: blur(8px); }
.btn svg { width: 18px; height: 18px; fill: currentColor; }
.btn:hover { filter: brightness(1.08); }

/* ---------------------------------------------------------------- hero (featured, rotating) */
.hero { position: relative; height: clamp(420px, 62vh, 640px); overflow: hidden; color: #fff; margin-bottom: 8px; }
.hero .slide { position: absolute; inset: 0; opacity: 0; transition: opacity .7s ease; display: flex; align-items: flex-end; }
.hero .slide.on { opacity: 1; z-index: 1; }
.hero .bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 25%; transform: scale(1.04); }
.hero .bg.blur { filter: blur(26px) brightness(.7); transform: scale(1.2); }
.hero .shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0,0,0,.88) 0%, rgba(0,0,0,.55) 45%, rgba(0,0,0,.1) 100%), linear-gradient(0deg, var(--bg) 0%, transparent 38%); }
.hero .body { position: relative; z-index: 1; padding: 0 var(--pad) clamp(46px, 8vh, 76px); display: flex; gap: 28px; align-items: flex-end; width: 100%; }
.hero .poster { width: clamp(118px, 15vw, 200px); aspect-ratio: 2/3; border-radius: var(--radius); object-fit: cover; box-shadow: var(--shadow); flex: none; background: #222; }
.hero .text { max-width: 640px; }
.hero .rank { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; margin-bottom: 10px; }
.hero .rank b { background: var(--red); color: #fff; padding: 2px 7px; border-radius: 5px; }
.hero h1 { font-size: clamp(28px, 4.4vw, 54px); font-weight: 800; margin-bottom: 10px; text-shadow: 0 2px 18px rgba(0,0,0,.5); }
.meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; color: rgba(255,255,255,.85); font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.meta .star { color: #ffd166; }
.chip { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 800; letter-spacing: .02em; background: rgba(255,255,255,.16); color: #fff; }
.chip.q { background: var(--accent); color: #141414; }
.hero p.story { margin: 0 0 18px; color: rgba(255,255,255,.86); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; max-width: 60ch; }
.hero .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.dots { position: absolute; z-index: 2; right: var(--pad); bottom: 22px; display: flex; gap: 6px; }
.dots button { width: 8px; height: 8px; padding: 0; border-radius: 99px; border: 0; background: rgba(255,255,255,.4); cursor: pointer; transition: width .3s; }
.dots button[aria-current="true"] { width: 24px; background: #fff; }
@media (max-width: 640px) { .hero .poster { display: none; } .hero { height: 480px; } .dots { left: var(--pad); right: auto; } }

/* ---------------------------------------------------------------- rails and cards */
.row, .listing { padding: 18px 0 6px; }
.row-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 var(--pad); margin-bottom: 12px; }
.row-head h2 { font-size: clamp(18px, 2.1vw, 24px); font-weight: 800; }
.rail-nav { display: flex; gap: 6px; }
.rail-nav button { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-size: 18px; line-height: 1; }
@media (hover: none) { .rail-nav { display: none; } }
.rail { display: grid; grid-auto-flow: column; grid-auto-columns: clamp(124px, 15vw, 190px); gap: 14px; overflow-x: auto; padding: 4px var(--pad) 12px; scroll-snap-type: x mandatory; scroll-padding: 0 var(--pad); scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.rail > * { scroll-snap-align: start; }
.rail.top { grid-auto-columns: clamp(190px, 24vw, 300px); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(130px, 15vw, 186px), 1fr)); gap: 22px 14px; padding: 0 var(--pad); }

.card { display: block; position: relative; min-width: 0; }
.card .art { position: relative; aspect-ratio: 2/3; border-radius: var(--radius); overflow: hidden; background: var(--card); box-shadow: 0 1px 0 var(--line) inset; transition: transform .25s ease, box-shadow .25s ease; }
.card .art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card:hover .art, .card:focus-visible .art { transform: translateY(-4px) scale(1.02); box-shadow: var(--shadow); }
.card .art.noart { display: grid; place-items: center; background: linear-gradient(160deg, #2a2a33, #15151a); }
.card .art.noart img { display: none; }
.card .art.noart::after { content: attr(data-name); padding: 14px; text-align: center; font-weight: 800; font-size: 15px; line-height: 1.3; color: #e8e8ee; }
img[data-art="none"].poster { visibility: hidden; }
.card .badges { position: absolute; left: 8px; top: 8px; display: flex; gap: 4px; flex-wrap: wrap; }
.card .badges .chip { height: 20px; font-size: 11px; background: rgba(0,0,0,.66); }
.card .badges .chip.q { background: var(--accent); color: #141414; }
.card .name { margin-top: 8px; font-weight: 700; font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .sub { color: var(--soft); font-size: 12.5px; margin-top: 2px; }
.card .bar { position: absolute; left: 8px; right: 8px; bottom: 8px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.3); overflow: hidden; }
.card .bar i { display: block; height: 100%; background: var(--red); }
/* Top 10, Netflix style: a huge number as tall as the poster, dark with a grey outline, its bottom on the poster's
   bottom edge and the poster overlapping its right side. Every card lines up the same, whatever its title length. */
.rail.top .card { display: grid; grid-template-columns: 50% 50%; align-content: start; align-items: end; container-type: inline-size; }
.rail.top .num { grid-column: 1; grid-row: 1; align-self: end; justify-self: end; z-index: 0; margin-right: -18%;
  font-family: "Arial Black", "Helvetica Neue", Inter, system-ui, sans-serif; font-weight: 900; font-size: clamp(170px, 22vw, 280px);
  font-size: 92cqw; line-height: .74; letter-spacing: -.06em; color: var(--bg); -webkit-text-stroke: 4px #595959; paint-order: stroke fill;
  transform: translateY(1%); user-select: none; pointer-events: none; }
.rail.top .num.two { font-size: 74cqw; letter-spacing: -.12em; margin-right: -14%; }
.rail.top .art { grid-column: 2; grid-row: 1; z-index: 1; }
.rail.top .name, .rail.top .sub { grid-column: 2; }
/* Placeholders while the row loads: the same numbers, with shimmering posters and text lines. */
.rail.top .skeleton .art, .rail.top .skeleton .name, .rail.top .skeleton .sub { background: linear-gradient(100deg, var(--card) 30%, var(--line) 50%, var(--card) 70%) 0 0 / 300% 100%; animation: shimmer 1.3s linear infinite; }
.rail.top .skeleton .name { height: 14px; width: 80%; border-radius: 6px; }
.rail.top .skeleton .sub { height: 11px; width: 45%; border-radius: 6px; margin-top: 8px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -50% 0; } }

/* ---------------------------------------------------------------- pagination */
.pages { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 30px var(--pad) 0; }
.pages a, .pages span { min-width: 42px; padding: 0 12px; font-weight: 700; }
.pages .current { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.pages .gap { border: 0; background: none; min-width: auto; padding: 0 4px; }
.pages form { display: flex; gap: 6px; }
.pages input { width: 86px; height: 42px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-2); padding: 0 14px; }

/* ---------------------------------------------------------------- title page */
.title-hero { position: relative; overflow: hidden; color: #fff; }
.title-hero .bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 30%; }
.title-hero .bg.blur { filter: blur(28px) brightness(.65); transform: scale(1.2); }
.title-hero .shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0,0,0,.9), rgba(0,0,0,.55) 60%, rgba(0,0,0,.35)), linear-gradient(0deg, var(--bg) 0%, transparent 45%); }
.title-hero .body { position: relative; display: flex; gap: clamp(18px, 3vw, 36px); align-items: flex-end; padding: clamp(28px, 6vw, 72px) var(--pad) 34px; }
.title-hero .poster { width: clamp(120px, 18vw, 240px); aspect-ratio: 2/3; border-radius: var(--radius); object-fit: cover; box-shadow: var(--shadow); flex: none; background: #222; }
.title-hero h1 { font-size: clamp(26px, 4vw, 48px); font-weight: 800; margin-bottom: 10px; }
.title-hero .full { color: rgba(255,255,255,.66); font-size: 13px; margin: -2px 0 12px; max-width: 70ch; overflow-wrap: anywhere; }
.title-hero p.story { margin: 0 0 18px; color: rgba(255,255,255,.88); max-width: 70ch; }
.hero .actions .btn { height: 40px; padding: 0 16px; font-size: 14px; }
.hero .actions .btn svg { width: 16px; height: 16px; }
@media (max-width: 640px) { .title-hero .body { flex-direction: column; align-items: flex-start; } .title-hero .poster { width: 120px; } }

.section { padding: 26px var(--pad) 0; scroll-margin-top: 72px; }
.section > h2 { font-size: clamp(18px, 2.1vw, 24px); font-weight: 800; margin-bottom: 14px; }
.player-box { position: relative; width: 100%; aspect-ratio: 16/9; background: #000; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.player-box iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.episodes { display: flex; gap: 8px; overflow-x: auto; padding: 0 0 12px; scrollbar-width: thin; }
.episodes button { flex: none; height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-weight: 700; cursor: pointer; }
.episodes button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

.info { display: grid; grid-template-columns: max-content 1fr; gap: 8px 22px; margin: 0; padding: 16px 18px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); }
.info dt { color: var(--soft); font-weight: 600; }
.info dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.summary { color: var(--muted); max-width: 90ch; margin: 14px 0 0; }

.trailer { position: relative; aspect-ratio: 16/9; border-radius: var(--radius); overflow: hidden; background: #000; max-width: 920px; }
.trailer iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(160px, 22vw, 280px), 1fr)); gap: 10px; }
.shots a { display: block; border-radius: 10px; overflow: hidden; background: var(--card); }
.shots img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; transition: transform .3s; }
.shots a:hover img { transform: scale(1.04); }

.dl { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.dl > li { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.dl .line { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.dl .what { min-width: 0; }
.dl .what b { display: block; font-weight: 700; overflow-wrap: anywhere; }
.dl .what small { color: var(--soft); }
.dl .tag { display: inline-block; font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 999px; background: var(--line); margin-left: 6px; vertical-align: 2px; }
.dl .get { flex: none; height: 38px; padding: 0 16px; border-radius: 999px; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 800; cursor: pointer; }
.dl > li[data-state="loading"] .get { opacity: .65; cursor: progress; }
.dl > li[data-state="ready"] .get, .dl > li[data-state="empty"] .get { background: var(--line); color: var(--fg); }
.dl ul { list-style: none; padding: 10px 0 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.dl ul a { display: inline-flex; align-items: center; height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); font-size: 13.5px; font-weight: 600; }
.dl ul a:hover { border-color: var(--accent); }
.dl .note { color: var(--soft); font-size: 13.5px; }
.hint { color: var(--soft); margin: -6px 0 14px; font-size: 14px; }

/* ---------------------------------------------------------------- footer */
.footer { border-top: 1px solid var(--line); margin-top: 40px; }
.footer-in { max-width: 1440px; margin: auto; padding: 28px var(--pad) 40px; display: grid; gap: 12px; }
.footer nav { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-weight: 600; }
.footer nav a:hover { color: var(--fg); }
.fine { margin: 0; color: var(--soft); font-size: 13px; max-width: 80ch; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* Ads: centred, never wider than the screen. */
.ad { display: flex; justify-content: center; align-items: center; width: 100%; margin: 22px auto 0; padding: 0 var(--pad); box-sizing: border-box; overflow: hidden; text-align: center; }
.ad iframe { display: block; border: 0; max-width: 100%; background: transparent; }
.ad-native { padding-top: 6px; }
.ad-native > div { width: 100%; max-width: 1100px; margin: 0 auto; }
#adLatest .ad { margin: 0 auto 18px; padding: 0; }

/* Menu button and the drawer that slides in from the right. */
.menu-btn { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-2); color: var(--fg); cursor: pointer; }
.menu-btn svg, .drawer-close svg { width: 22px; height: 22px; fill: currentColor; }
.menu-btn:hover, .menu-btn:focus-visible { border-color: var(--accent); }
html.menu-open { overflow: hidden; }
.drawer { position: fixed; inset: 0 0 0 auto; width: min(340px, 86vw); max-width: none; height: 100%; max-height: none; margin: 0; padding: 0; border: 0;
  border-left: 1px solid var(--line); background: var(--bg-2); color: var(--fg); box-shadow: -18px 0 40px rgba(0,0,0,.35); overflow: hidden; }
.drawer[open] { animation: drawer-in .22s ease-out; }
.drawer::backdrop { background: rgba(0,0,0,.55); backdrop-filter: blur(2px); }
@keyframes drawer-in { from { transform: translateX(100%); } to { transform: none; } }
.drawer-in { height: 100%; overflow-y: auto; overscroll-behavior: contain; padding: 14px 0 calc(24px + env(safe-area-inset-bottom)); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 0 16px 12px; font-weight: 800; font-size: 18px; }
.drawer-close { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 999px; background: var(--line); color: var(--fg); cursor: pointer; }
.drawer-search { padding: 0 16px 12px; }
.drawer-search input { width: 100%; height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); outline: none; box-sizing: border-box; }
.drawer-search input:focus { border-color: var(--accent); }
.drawer-list, .drawer-list ul { list-style: none; margin: 0; padding: 0; }
.drawer-list > li { border-top: 1px solid var(--line); }
.drawer-list a, .drawer-list summary { display: flex; align-items: center; justify-content: space-between; min-height: 50px; padding: 0 18px; font-size: 16px; font-weight: 600; color: var(--fg); cursor: pointer; }
.drawer-list summary { list-style: none; }
.drawer-list summary::-webkit-details-marker { display: none; }
.drawer-list summary::after { content: "▾"; color: var(--muted); transition: transform .2s; }
.drawer-list details[open] > summary::after { transform: rotate(180deg); }
.drawer-list ul a { min-height: 44px; padding-left: 32px; font-weight: 500; font-size: 15px; color: var(--muted); }
.drawer-list a:hover, .drawer-list summary:hover { background: var(--line); }
.drawer-list a[aria-current="page"] { color: var(--accent); }
.drawer-list a:focus-visible, .drawer-list summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (prefers-reduced-motion: reduce) { .drawer[open] { animation: none; } }

/* Watch section while /api/play is asked, and when an episode has nothing to stream */
.player-wait { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; color: rgba(255,255,255,.75); font-weight: 600; }
#main .player-wait .spinner { display: block; }
.player-wait p { margin: 0; }
.player-none { margin: 0; padding: 18px; border-radius: var(--radius); background: var(--card); color: var(--muted); font-weight: 600; }

/* Floating Telegram channel button: bottom-right, above the floating ad */
.tg-float { position: fixed; right: 16px; bottom: calc(132px + env(safe-area-inset-bottom)); z-index: 10000; display: flex; align-items: center; gap: 8px;
  height: 48px; padding: 0 16px 0 12px; border-radius: 999px; background: #229ed9; color: #fff; font-weight: 700; font-size: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.35); text-decoration: none; transition: transform .15s; }
.tg-float:hover, .tg-float:focus-visible { transform: translateY(-2px); color: #fff; }
.tg-float svg { width: 24px; height: 24px; fill: #fff; }
@media (max-width: 480px) { .tg-float { width: 52px; height: 52px; padding: 0; justify-content: center; } .tg-float span { display: none; } .tg-float svg { width: 26px; height: 26px; margin-left: -2px; } }
