/* KusiTube — mobile-first, no framework. */

/* Palette: true black + orange primary + sky-blue secondary.
   Orange carries brand and "you are here" (logo, active pill, current page,
   rank, primary button). Sky blue carries movement — hover, focus, links —
   so the two never compete for the same job. */
:root {
  --bg:        #0a0a0c;
  --surface:   #141418;
  --surface-2: #1d1d23;
  --surface-3: #27272f;
  --line:      #2b2b34;
  --text:      #f3f4f6;
  --muted:     #9b9ba6;

  --accent:    #ff9000;   /* orange — primary */
  --accent-2:  #e07a00;   /* orange, pressed/darker */
  --accent-ink:#12100a;   /* near-black text on orange: 8.9:1 */

  --sky:       #3fbfff;   /* sky blue — secondary / interactive */
  --sky-2:     #12a5ee;
  --sky-ink:   #04121c;

  --shadow:    0 10px 30px rgb(0 0 0 / .55);
  --radius:    12px;
  --radius-sm: 8px;
  --gap:       12px;
  --wrap:      1320px;
  --ease:      cubic-bezier(.2, .7, .3, 1);
}

/* Light theme: system preference, unless the toggle set an explicit choice. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #ffffff; --surface: #f4f5f7; --surface-2: #e9ebef; --surface-3: #dcdfe5;
    --line: #e0e3e9; --text: #101215; --muted: #5b626e;
    /* Dark ink on orange, not white: white on #f57c00 is 2.70:1 and fails AA.
       Sky darkened to #0369a1 so small stats text clears 4.5:1 on white. */
    --accent: #f57c00; --accent-2: #dd6b00; --accent-ink: #1a1205;
    --sky: #0369a1; --sky-2: #04618f; --sky-ink: #ffffff;
    --shadow: 0 10px 30px rgb(15 20 30 / .12);
  }
}
:root[data-theme="light"] {
  --bg: #ffffff; --surface: #f4f5f7; --surface-2: #e9ebef; --surface-3: #dcdfe5;
  --line: #e0e3e9; --text: #101215; --muted: #5b626e;
  --accent: #f57c00; --accent-2: #dd6b00; --accent-ink: #1a1205;
  --sky: #0369a1; --sky-2: #04618f; --sky-ink: #ffffff;
  --shadow: 0 10px 30px rgb(15 20 30 / .12);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.65 "Cairo", system-ui, -apple-system, "Segoe UI", Roboto,
        "Noto Naskh Arabic", "Helvetica Neue", Arial, sans-serif;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--sky); outline-offset: 2px; border-radius: 4px;
}

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 14px; }

.skip-link {
  position: absolute; inset-inline-start: -9999px; top: 8px; z-index: 100;
  padding: 10px 16px; background: var(--accent); color: var(--accent-ink);
  border-radius: var(--radius-sm); font-weight: 600;
}
.skip-link:focus { inset-inline-start: 14px; }

/* ------------------------------------------------------------- icons */

.icon { flex: 0 0 auto; vertical-align: -.15em; }

/* ------------------------------------------------------------- header */

.site-head {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--line);
}
.head-inner {
  display: flex; align-items: center; gap: 10px;
  min-height: 60px; padding-block: 9px;
}

.logo { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.logo-mark { border-radius: 9px; flex: 0 0 auto; }
.logo-text {
  font-size: 17.5px; font-weight: 800; letter-spacing: -.025em;
}
@media (max-width: 430px) { .logo-text { display: none; } }

/* min-width:0 is required: without it the input's intrinsic size (its default
   `size` attribute plus padding) becomes a floor and pushes the page wide. */
.search {
  display: flex; flex: 1 1 auto; position: relative;
  min-width: 0; max-width: 620px;
}
.search-icon {
  position: absolute; inset-inline-start: 13px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none; display: flex;
}
.search input {
  flex: 1; min-width: 0;
  padding-block: 10px;
  padding-inline: 38px 14px;
  font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--line);
  border-inline-end: 0;
  border-start-start-radius: 999px; border-end-start-radius: 999px;
  outline-offset: -2px; transition: border-color .15s var(--ease), background .15s var(--ease);
}
.search input::placeholder { color: var(--muted); }
.search input:focus { background: var(--surface-2); }
.search input::-webkit-search-cancel-button { filter: grayscale(1) opacity(.6); }
.search button {
  display: grid; place-items: center;
  width: 48px; cursor: pointer; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--line);
  border-start-end-radius: 999px; border-end-end-radius: 999px;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.search button:hover { background: var(--sky); color: var(--sky-ink); border-color: var(--sky); }

.theme-toggle {
  display: grid; place-items: center; flex: 0 0 auto;
  width: 40px; height: 40px; cursor: pointer; color: var(--muted);
  background: var(--surface); border: 1px solid var(--line); border-radius: 50%;
  transition: color .15s var(--ease), background .15s var(--ease);
}
.theme-toggle:hover { color: var(--text); background: var(--surface-2); }
.theme-sun, .theme-moon { display: none; }
:root[data-theme="light"] .theme-moon { display: flex; }
:root[data-theme="dark"]  .theme-sun  { display: flex; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-sun { display: flex; }
  :root:not([data-theme="light"]) .theme-moon { display: none; }
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-moon { display: flex; }
  :root:not([data-theme="dark"]) .theme-sun { display: none; }
}

/* live suggestions */
.suggest {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 60;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.suggest:empty { display: none; }
.suggest a { display: flex; gap: 11px; align-items: center; padding: 9px 11px; }
.suggest a:hover, .suggest a.is-active { background: var(--surface-2); }
.suggest img { width: 68px; height: 38px; object-fit: cover; border-radius: 5px; flex: 0 0 auto; }
.suggest span { font-size: 13px; line-height: 1.35; }

/* -------------------------------------------------------------- pills */

.pills { position: relative; margin: 16px 0 6px; }
.pills-track {
  display: flex; gap: 8px; overflow-x: auto;
  padding-bottom: 6px; scrollbar-width: none;
  -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity;
  scroll-behavior: smooth;
}
.pills-track::-webkit-scrollbar { display: none; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 8px 14px; font-size: 13px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; scroll-snap-align: start;
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
.pill:hover { background: var(--surface-2); }
.pill.is-active {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
}
.pill-n { font-size: 11px; opacity: .6; font-weight: 500; }

/* desktop arrows for the pill rail */
.pills-nav {
  display: none; position: absolute; top: 0; z-index: 2;
  width: 34px; height: 38px; place-items: center; cursor: pointer;
  color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 999px;
}
.pills-nav:hover { background: var(--surface-2); }
.pills-nav.prev { inset-inline-start: -6px; }
.pills-nav.next { inset-inline-end: -6px; }
.pills-nav[hidden] { display: none !important; }
@media (min-width: 900px) and (pointer: fine) { .pills-nav { display: grid; } }

/* ---------------------------------------------------------- section */

.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin: 18px 0 14px;
}
.section-head > div { min-width: 0; }
.section-head h1, .section-head h2 {
  margin: 0; font-size: 20px; letter-spacing: -.02em; line-height: 1.25;
  overflow-wrap: anywhere;
}
.sub { margin: 5px 0 0; color: var(--muted); font-size: 13px; }

/* sort tabs — scroll rather than push the page wide on narrow phones */
.tabs {
  display: flex; gap: 4px; padding: 3px;
  flex: 0 1 auto; min-width: 0; max-width: 100%;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 6px 13px; font-size: 12.5px; font-weight: 600; color: var(--muted);
  border-radius: 999px; transition: background .15s var(--ease), color .15s var(--ease);
}
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab.is-active { color: var(--accent-ink); background: var(--accent); }

/* ------------------------------------------------------------- grid */

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));   /* mobile: 2 columns */
  gap: var(--gap) 10px;
}
@media (min-width: 700px)  { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px 16px; } }
@media (min-width: 1000px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1500px) { .grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.card { min-width: 0; }
.card-thumb {
  position: relative; display: block;
  aspect-ratio: 16 / 9; overflow: hidden;
  background: var(--surface-2); border-radius: var(--radius);
}
.card-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .35s var(--ease), filter .2s var(--ease);
}
.card:hover .card-thumb img { transform: scale(1.06); filter: brightness(.85); }

.thumb-fallback {
  display: none; position: absolute; inset: 0;
  place-items: center; color: var(--muted);
  background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
}
.card-thumb.is-broken .thumb-fallback { display: grid; }

.play-overlay {
  position: absolute; inset: 0; margin: auto;
  width: 46px; height: 46px; display: grid; place-items: center;
  color: #fff; background: color-mix(in srgb, var(--accent-2) 88%, transparent);
  border-radius: 50%; box-shadow: 0 4px 16px rgb(0 0 0 / .4);
  opacity: 0; transform: scale(.75);
  transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.play-overlay .icon { margin-inline-start: 2px; }
.card:hover .play-overlay, .card-thumb:focus-visible .play-overlay {
  opacity: 1; transform: scale(1);
}
@media (pointer: coarse) { .play-overlay { display: none; } }

.badge {
  position: absolute; inset-inline-end: 6px; bottom: 6px;
  padding: 2.5px 6px; font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: #fff; background: rgb(0 0 0 / .82); border-radius: 5px;
  backdrop-filter: blur(2px);
}
.card-title {
  margin: 9px 0 3px; font-size: 13.5px; line-height: 1.35; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color .15s var(--ease);
}
.card:hover .card-title { color: var(--sky); }
.card-meta {
  display: flex; align-items: center; gap: 5px;
  margin: 0; font-size: 12px; color: var(--muted);
}

/* ------------------------------------------------------------ watch */

.watch { margin-top: 14px; }
.player {
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  background: #000; border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow);
}
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* full-bleed player on small screens */
@media (max-width: 640px) {
  .player { margin-inline: -14px; width: 100vw; border-radius: 0; box-shadow: none; }
}

.watch-title { margin: 16px 0 8px; font-size: 19px; line-height: 1.32; letter-spacing: -.015em; }
.watch-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.watch-meta {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 0; color: var(--muted); font-size: 13px;
}
.watch-meta span { display: inline-flex; align-items: center; gap: 5px; }

.tag-list {
  display: flex; flex-wrap: wrap; gap: 8px; list-style: none;
  margin: 14px 0 0; padding: 0;
}
.tag-list a {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; font-size: 12.5px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.tag-list a:hover { background: var(--sky); border-color: var(--sky); color: var(--sky-ink); }
.related { margin-top: 30px; }

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

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 15px; font: inherit; font-size: 13px; font-weight: 600;
  color: var(--text); cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.is-done { color: #29c467; border-color: #29c467; }

/* -------------------------------------------------------------- ads */

/* A live ad gets spacing and a width guard, nothing else: no dashed frame to
   sit around it, and no `overflow: hidden`, which clips units that size
   themselves after their script runs. */
.ad {
  display: block;
  margin: 16px 0;
  max-width: 100%;
  min-width: 0;
}
.ad > * { max-width: 100%; }
.ad-banner { min-height: 92px; text-align: center; }
.ad-native { margin: 0; }

/* The dashed box is the placeholder's look — ADS_PREVIEW=1 only. */
.ad.is-placeholder {
  display: flex; align-items: center; justify-content: center;
  padding: 20px 10px; overflow: hidden;
  background: var(--surface); border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted); font-size: 11.5px; letter-spacing: .02em; text-align: center;
}
.ad-banner.is-placeholder { min-height: 92px; }
.ad-native.is-placeholder { min-height: 100%; flex-direction: column; }

/* ------------------------------------------------------------ empty */

.empty {
  display: grid; justify-items: center; gap: 6px;
  padding: 56px 20px; text-align: center; color: var(--muted);
}
.empty .icon { opacity: .55; margin-bottom: 6px; }
.empty-title { margin: 0; font-size: 17px; font-weight: 700; color: var(--text); }
.empty-hint { margin: 0; font-size: 13.5px; max-width: 42ch; }
.empty-hint code, .empty code {
  background: var(--surface-2); padding: 2px 6px; border-radius: 5px;
  font-size: .92em;
}
.empty-action { display: flex; justify-content: center; margin: 0 0 40px; }

/* -------------------------------------------------------- pagination */

.pagination {
  display: flex; flex-wrap: wrap; gap: 6px; justify-content: center;
  margin: 30px 0 8px;
}
.page-btn {
  display: grid; place-items: center;
  min-width: 40px; height: 40px; padding: 0 13px;
  font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.page-btn:hover { background: var(--surface-2); }
.page-btn.is-arrow { padding: 0; width: 40px; }
.page-btn.is-current { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.page-btn.is-disabled { opacity: .35; pointer-events: none; }
.page-gap { display: grid; place-items: center; height: 40px; padding: 0 2px; color: var(--muted); }

/* ------------------------------------------------------------ footer */

.site-foot {
  margin-top: 48px; padding: 24px 0 36px;
  border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px;
}
.foot-inner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.foot-inner p { margin: 0; }
.logo-sm .logo-mark { width: 24px; height: 24px; }
.logo-sm .logo-text { font-size: 15px; display: inline; }

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

/* ------------------------------------------------------------ RTL + featured */

/* Chevrons point the wrong way once the writing direction flips. */
[dir="rtl"] .pills-nav .icon,
[dir="rtl"] .pagination .icon,
[dir="rtl"] .empty-action .icon { transform: scaleX(-1); }

/* The duration badge is a bare time; isolate it so bidi cannot reorder it.
   The meta line is left to natural bidi so it stays on the inline-start edge
   with the title, rather than being flung to the opposite side. */
[dir="rtl"] .badge { direction: ltr; }

/* Arabic renders taller — a touch more room in the two-line title clamp. */
[dir="rtl"] .card-title { line-height: 1.45; }

/* ---- featured "best videos" strip ---- */

.featured { margin-top: 6px; }
.featured .section-head h2 {
  display: inline-flex; align-items: center; gap: 8px;
}
.featured .section-head h2 .icon { color: var(--accent); }

/* One denser row on desktop so the best videos read as a distinct shelf. */
@media (min-width: 1000px) {
  .grid-featured { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1500px) {
  .grid-featured { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.featured .card-thumb { box-shadow: 0 0 0 1px var(--line); }
.featured .card:hover .card-thumb { box-shadow: 0 0 0 2px var(--sky); }

/* Rank chip on featured cards. */
.rank {
  position: absolute; inset-inline-start: 6px; top: 6px;
  min-width: 24px; height: 24px; padding: 0 6px;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums;
  color: var(--accent-ink); background: var(--accent-2);
  border-radius: 7px; box-shadow: 0 2px 8px rgb(0 0 0 / .4);
}

/* The featured strip sits above the main feed; separate them clearly. */
.featured + .section-head {
  margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line);
}

/* -------------------------------------------------- orange / sky accents */

/* Orange hairline under the sticky header — the one bit of chrome that says
   "this is the brand" without tinting every surface. */
.site-head { border-bottom-color: color-mix(in srgb, var(--accent) 22%, var(--line)); }

/* Play overlay in brand orange rather than neutral white. */
.play-overlay { background: color-mix(in srgb, var(--accent) 92%, transparent); color: var(--accent-ink); }
.card:hover .play-overlay { background: var(--accent); }

/* Duration badge: keep it legible on any thumbnail, tinted toward sky. */
.badge { background: rgb(4 12 20 / .82); color: #eaf6ff; }

/* Pills: sky on hover, orange when active. */
.pill:hover { border-color: color-mix(in srgb, var(--sky) 55%, var(--line)); color: var(--sky); }
.pill.is-active:hover { color: var(--accent-ink); border-color: var(--accent); }

/* Sort tabs: sky hover, orange active (matches the pills). */
.tab:hover { color: var(--sky); }
.tab.is-active:hover { color: var(--accent-ink); }

/* Pagination + buttons follow the same split. */
.page-btn:hover { border-color: color-mix(in srgb, var(--sky) 55%, var(--line)); color: var(--sky); }
.page-btn.is-current:hover { color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.copy-link:hover { border-color: var(--sky); color: var(--sky); }

/* Footer links pick up sky on hover. */
.site-foot a:hover .logo-text { color: var(--sky); }

/* Suggestion rows: sky rail on the active/hovered item. */
.suggest a:hover, .suggest a.is-active {
  box-shadow: inset 3px 0 0 var(--sky);
}
[dir="rtl"] .suggest a:hover, [dir="rtl"] .suggest a.is-active {
  box-shadow: inset -3px 0 0 var(--sky);
}

/* Featured shelf: warm the divider so the "best videos" band reads apart. */
.featured + .section-head {
  border-top-color: color-mix(in srgb, var(--accent) 26%, var(--line));
}

/* Sky blue needs a resting role, not just hover, or the palette reads as
   two colours. Counts and stats are its job: present on every card, and a
   different kind of information from brand-orange. */
.card-meta { color: var(--sky); opacity: .92; }
.card-meta .icon { color: var(--sky); opacity: .75; }
.watch-meta span .icon { color: var(--sky); }
.pill-n { color: var(--sky); opacity: .85; font-weight: 600; }
.pill.is-active .pill-n { color: var(--accent-ink); opacity: .6; }
.section-head .sub { color: var(--muted); }
.featured .section-head .sub { color: var(--sky); opacity: .85; }

/* ------------------------------------------------ static pages & forms */

.page { margin-top: 8px; }
.page-narrow { max-width: 760px; margin-inline: auto; }

/* ---- notices ---- */

.notice {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; margin: 16px 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius);
}
.notice h1 { margin: 0 0 4px; font-size: 19px; }
.notice p, .notice ul { margin: 0; color: var(--muted); font-size: 14px; }
.notice ul { padding-inline-start: 18px; }
.notice .icon { margin-top: 2px; }
.notice-ok   { border-color: color-mix(in srgb, var(--sky) 45%, var(--line)); }
.notice-ok .icon { color: var(--sky); }
.notice-warn { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.notice-warn .icon { color: var(--accent); }
.notice-err  { border-color: #e5484d; }
.notice-err .icon { color: #e5484d; }
.notice-err strong { display: block; margin-bottom: 4px; }

/* ---- form ---- */

.form { display: grid; gap: 16px; margin: 20px 0 8px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 13.5px; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 13px;
  font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.field textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus {
  background: var(--surface-2); border-color: var(--sky);
}
.field select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
:root:not([dir="rtl"]) .field select { background-position: right 16px center, right 10px center; }
[dir="rtl"] .field select { background-position: left 10px center, left 16px center; }

/* Honeypot — hidden from people, still submitted by bots.
   Clip rather than offset: `left: -9999px` in an RTL document extends the
   overflow area and pushes the initial scroll position off the content,
   which renders the whole page blank. */
.hp {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap; border: 0;
}

.btn-lg { padding: 12px 22px; font-size: 15px; justify-self: start; }
.fineprint { margin-top: 22px; font-size: 12.5px; color: var(--muted); }

/* ---- legal / terms ---- */

.legal .toc {
  padding: 14px 18px; margin: 18px 0 26px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius);
}
.legal .toc ol { margin: 0; padding-inline-start: 18px; columns: 2; column-gap: 26px; }
@media (max-width: 620px) { .legal .toc ol { columns: 1; } }
.legal .toc li { margin: 3px 0; font-size: 13.5px; }
.legal .toc a { color: var(--muted); }
.legal .toc a:hover { color: var(--sky); }

.legal-section { scroll-margin-top: 78px; margin: 26px 0; }
.legal-section h2 {
  margin: 0 0 8px; font-size: 16.5px; letter-spacing: -.01em;
  color: var(--accent);
}
.legal-section p { margin: 0; line-height: 1.85; color: var(--text); opacity: .92; }
.legal-section ul, .legal-section ol { margin: 10px 0 0; padding-inline-start: 20px; line-height: 1.8; }
.legal-section li { margin: 4px 0; }
.legal-section a { color: var(--sky); text-decoration: underline; text-underline-offset: 3px; }

/* ---- footer layout with nav ---- */

.foot-inner { display: grid; gap: 14px; }
.foot-brand { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.foot-brand p { margin: 0; }
.foot-nav { display: flex; flex-wrap: wrap; gap: 18px; }
.foot-nav a { font-size: 13.5px; font-weight: 600; }
.foot-nav a:hover { color: var(--sky); }
.foot-age {
  margin: 0; padding-top: 12px; border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--muted);
}

/* ------------------------------------------------ hover preview (flipbook) */

/* While previewing, hide the play badge so it does not sit over the frames. */
.card-thumb.is-previewing .play-overlay { opacity: 0; }
.card-thumb.is-previewing img { transform: none; }

/* Segment bar: one tick per still, the current one lit in orange.
   Same visual language the big tubes use for scrub position. */
.preview-bar {
  position: absolute; inset-inline: 6px; bottom: 6px;
  display: flex; gap: 2px; height: 3px;
  opacity: 0; transition: opacity .18s var(--ease);
  pointer-events: none;
}
.card-thumb.is-previewing .preview-bar { opacity: 1; }
.preview-bar i {
  flex: 1; border-radius: 2px;
  background: rgb(255 255 255 / .3);
  transition: background .15s linear;
}
.preview-bar i.on { background: var(--accent); }

/* The duration badge would collide with the bar — lift it while previewing. */
.card-thumb.is-previewing .badge { bottom: 14px; }

/* ------------------------------------------------------ category shelves */

.shelf { margin: 30px 0; }
.shelf-head { margin-bottom: 12px; align-items: center; }
.shelf-head h2 {
  display: inline-flex; align-items: center; gap: 8px; font-size: 18px;
}
.shelf-head h2 .icon { color: var(--accent); }
.shelf-head .sub { margin-top: 2px; }

/* "See all" reuses the tab pill so the page keeps one control vocabulary. */
.shelf-all { white-space: nowrap; }
.shelf-all:hover { color: var(--sky); border-color: var(--sky); }

/* Separator between shelves, warm so it matches the featured divider. */
.shelf + .shelf { border-top: 1px solid var(--line); padding-top: 12px; }

.shelf-ad { margin: 26px 0; }

.browse-all { display: flex; justify-content: center; margin: 36px 0 8px; }
.browse-all .btn { justify-self: center; }

/* ------------------------------------------------ age gate / geo block ---- */
/* Shown by the <head> script (html.age-pending / html.geo-blocked) before
   first paint; dismissed in app.js. */
.age-gate, .geo-block {
  position: fixed; inset: 0; z-index: 1000;
  display: none; align-items: center; justify-content: center;
  padding: 20px;
  background: rgb(0 0 0 / .82);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
html.age-pending .age-gate { display: flex; }
html.geo-blocked .geo-block { display: flex; }
html.geo-blocked .age-gate { display: none; }
html.age-pending body, html.geo-blocked body { overflow: hidden; }
/* A blocked visitor gets nothing else on the page. */
html.geo-blocked .site-head, html.geo-blocked main, html.geo-blocked .site-foot,
html.geo-blocked .skip-link { display: none !important; }

.age-panel {
  width: 100%; max-width: 460px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 28px 24px; text-align: center;
}
.age-panel h2 { margin: 6px 0 10px; font-size: 22px; line-height: 1.35; }
.age-panel h2 + .age-text + h2 { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.age-text { margin: 0 0 20px; color: var(--muted); line-height: 1.75; font-size: 14.5px; }
.age-badge {
  display: inline-grid; place-items: center;
  width: 64px; height: 64px; margin: 0 auto 4px;
  border-radius: 50%; border: 3px solid var(--accent);
  color: var(--accent); font-weight: 800; font-size: 20px;
}
.age-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.age-actions .btn { justify-self: auto; flex: 1 1 160px; justify-content: center; }

/* ------------------------------------------------- animated round logo --- */
.logo-video {
  position: relative; flex: 0 0 auto;
  width: 40px; height: 40px; border-radius: 50%; overflow: hidden;
  background: #0a0a0c;
  box-shadow: 0 0 0 2px var(--accent), 0 0 14px rgb(255 144 0 / .35);
}
.logo-video video { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.logo:hover .logo-video { box-shadow: 0 0 0 2px var(--sky), 0 0 14px rgb(63 191 255 / .35); }
@media (max-width: 430px) { .logo-video { width: 36px; height: 36px; } }

/* ===================================================== engagement UI ===== */

/* ---- header nav (desktop) ---- */
.head-nav { display: none; gap: 2px; flex: 0 0 auto; }
.head-nav a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 11px; border-radius: 999px;
  font-size: 13.5px; font-weight: 700; color: var(--muted);
  transition: color .15s var(--ease), background .15s var(--ease);
}
.head-nav a:hover { color: var(--text); background: var(--surface); }
.head-nav .icon { color: var(--accent); }
@media (min-width: 900px) { .head-nav { display: flex; } }

/* ---- bottom nav (phones) ---- */
.bottom-nav { display: none; }
@media (max-width: 760px) {
  .bottom-nav {
    position: fixed; inset-inline: 0; bottom: 0; z-index: 70;
    display: grid; grid-template-columns: repeat(4, 1fr);
    padding: 6px 6px max(6px, env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    -webkit-backdrop-filter: saturate(1.6) blur(14px); backdrop-filter: saturate(1.6) blur(14px);
    border-top: 1px solid var(--line);
  }
  .bottom-nav a {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 5px 0; border-radius: 10px;
    font-size: 11px; font-weight: 700; color: var(--muted);
    -webkit-tap-highlight-color: transparent;
  }
  .bottom-nav a[aria-current="page"] { color: var(--accent); }
  .bottom-nav a:active { background: var(--surface); }
  /* keep the last row of content clear of the bar */
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .site-foot { padding-bottom: 8px; }
}

/* ---- back to top ---- */
.to-top {
  position: fixed; inset-inline-end: 16px; bottom: 20px; z-index: 65;
  display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: 50%; cursor: pointer;
  color: var(--accent-ink); background: var(--accent); border: 0;
  box-shadow: 0 6px 18px rgb(0 0 0 / .4);
  transition: transform .15s var(--ease), background .15s var(--ease);
}
.to-top .icon { transform: rotate(-90deg); }
[dir="rtl"] .to-top .icon { transform: rotate(-90deg); }
.to-top:hover { background: var(--accent-2); transform: translateY(-2px); }
.to-top[hidden] { display: none; }
@media (max-width: 760px) { .to-top { bottom: calc(76px + env(safe-area-inset-bottom)); width: 40px; height: 40px; } }

/* ---- card meta: views · age ---- */
.card-meta .dot { opacity: .55; margin-inline: 1px; }
.card-age { white-space: nowrap; }

/* ---- card badges ---- */
.badge-new, .badge-watched {
  position: absolute; z-index: 2;
  padding: 2px 7px; border-radius: 5px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .01em; line-height: 1.6;
  pointer-events: none;
}
.badge-new {
  inset-inline-end: 6px; top: 6px;
  color: var(--sky-ink); background: var(--sky);
  box-shadow: 0 2px 8px rgb(0 0 0 / .35);
}
.badge-watched {
  inset-inline-start: 6px; bottom: 6px;
  color: #fff; background: rgb(0 0 0 / .72);
}
.card.is-watched .card-thumb img { opacity: .62; }
.card.is-watched:hover .card-thumb img { opacity: 1; }
.card-thumb.is-previewing .badge-new,
.card-thumb.is-previewing .badge-watched { opacity: 0; }

/* ---- popular searches in the suggestion box ---- */
.suggest-popular { padding: 12px 12px 14px; }
.suggest-popular p { margin: 0 0 8px; font-size: 12px; font-weight: 700; color: var(--muted); }
.suggest-popular div { display: flex; flex-wrap: wrap; gap: 6px; }
.suggest .chip {
  display: inline-flex; padding: 6px 12px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--line);
}
.suggest .chip:hover, .suggest .chip.is-active { background: var(--sky); border-color: var(--sky); color: var(--sky-ink); }

/* ---- "all categories" pill at the end of the rail ---- */
.pill-all { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.pill-all:hover { background: var(--accent); color: var(--accent-ink); }

/* ---- home rows ---- */
.history-row, .latest-row { margin: 26px 0; }
.history-row[hidden] { display: none; }
.history-clear { cursor: pointer; border: 1px solid var(--line); background: var(--surface); font: inherit; font-size: 12.5px; }
.history-clear:hover { color: var(--text); }

/* ---- breadcrumbs ---- */
.crumbs {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin: 14px 0 0; font-size: 12.5px; color: var(--muted);
}
.crumbs a { font-weight: 600; }
.crumbs a:hover { color: var(--sky); }
.crumb-sep { display: inline-flex; opacity: .6; }
.crumbs + .watch-layout .watch { margin-top: 10px; }

/* ---- watch page: player + "up next" column ---- */
.watch-layout { display: block; }
.up-next { margin-top: 30px; }
.up-next .section-head h2 { display: inline-flex; align-items: center; gap: 8px; font-size: 18px; }
.up-next .section-head h2 .icon { color: var(--accent); }
.more-tag {
  display: flex; justify-content: center; gap: 6px;
  width: 100%; margin-top: 16px; font-weight: 700;
}
.more-tag:hover { border-color: var(--sky); color: var(--sky); }
.report-line { margin: 16px 0 0; }
.report-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--muted);
}
.report-link:hover { color: var(--sky); }

@media (min-width: 1100px) {
  .watch-layout {
    display: grid; grid-template-columns: minmax(0, 1fr) 360px;
    gap: 26px; align-items: start;
  }
  .up-next { margin-top: 14px; }
  .up-next .section-head { margin-top: 0; }
  /* compact rows: thumbnail beside the title */
  .grid-up-next { grid-template-columns: 1fr; gap: 12px; }
  .grid-up-next .card {
    display: grid; grid-template-columns: 158px minmax(0, 1fr);
    grid-template-rows: auto 1fr; column-gap: 11px; align-items: start;
  }
  .grid-up-next .card-thumb { grid-row: 1 / span 2; border-radius: var(--radius-sm); }
  .grid-up-next .card-title { margin: 1px 0 4px; font-size: 13px; }
  .grid-up-next .card-meta { font-size: 11.5px; flex-wrap: wrap; }
  .grid-up-next .play-overlay { width: 34px; height: 34px; }
  .grid-up-next .ad { grid-column: 1 / -1; }
}

/* ---- categories page ---- */
.cat-grid {
  display: grid; gap: 14px 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 30px;
}
@media (min-width: 700px)  { .cat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 16px; } }
@media (min-width: 1000px) { .cat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1500px) { .cat-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.cat-tile {
  position: relative; display: block; overflow: hidden;
  aspect-ratio: 16 / 10; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
  isolation: isolate;
}
.cat-thumb, .cat-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; }
.cat-thumb img { object-fit: cover; transition: transform .35s var(--ease); }
.cat-tile::after {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(to top, rgb(0 0 0 / .85) 0%, rgb(0 0 0 / .25) 55%, rgb(0 0 0 / 0) 100%);
}
.cat-info {
  position: absolute; inset-inline: 12px; bottom: 10px; z-index: 2;
  display: flex; flex-direction: column; gap: 1px; color: #fff;
}
.cat-info strong { font-size: 16px; line-height: 1.3; text-shadow: 0 1px 6px rgb(0 0 0 / .6); }
.cat-info span { font-size: 12px; opacity: .8; }
.cat-tile:hover .cat-thumb img { transform: scale(1.06); }
.cat-tile:hover { box-shadow: 0 0 0 2px var(--accent); }

/* ======================================================== player shell === */
/* Our frame around the third-party embed: ambient glow + control bar. */

.player-shell { position: relative; isolation: isolate; }

/* Ambient glow: the thumbnail, blurred, bleeding out behind the player. */
.player-ambient {
  position: absolute; inset: -6% -4% 0; z-index: -1;
  background-size: cover; background-position: center;
  filter: blur(48px) saturate(1.5); opacity: .45;
  transform: scale(1.04); pointer-events: none;
}
:root[data-theme="light"] .player-ambient { opacity: .3; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .player-ambient { opacity: .3; } }

/* Player and bar read as one unit. */
.player-shell .player { border-end-start-radius: 0; border-end-end-radius: 0; box-shadow: none; }
.player-bar {
  display: flex; align-items: center; gap: 12px;
  min-height: 46px; padding: 6px 8px 6px 12px;
  background: color-mix(in srgb, var(--surface) 92%, #000);
  border: 1px solid var(--line); border-top: 0;
  border-end-start-radius: var(--radius); border-end-end-radius: var(--radius);
  box-shadow: var(--shadow);
}
[dir="rtl"] .player-bar { padding: 6px 12px 6px 8px; }

.player-brand { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; }
.player-brand b { font-weight: 800; letter-spacing: -.02em; }
.player-brand-mark {
  width: 22px; height: 22px; border-radius: 50%; object-fit: cover;
  box-shadow: 0 0 0 1.5px var(--accent);
}
.player-brand .logo-mark { width: 22px; height: 22px; }
.player-dur {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums;
}
[dir="rtl"] .player-dur { direction: ltr; }

.player-actions { display: inline-flex; align-items: center; gap: 4px; margin-inline-start: auto; }
.pbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 36px; height: 34px; padding: 0 9px;
  font: inherit; font-size: 12.5px; font-weight: 700; color: var(--text);
  background: transparent; border: 1px solid transparent; border-radius: 9px; cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.pbtn:hover { background: var(--surface-2); }
.pbtn-next { color: var(--accent-ink); background: var(--accent); padding: 0 12px; }
.pbtn-next:hover { background: var(--accent-2); }
[dir="rtl"] .pbtn-next .icon { transform: scaleX(-1); }
.pbtn[aria-pressed="true"] { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.pbtn[hidden] { display: none; }

/* Phones: full-bleed like the player, no glow (it would sit off-screen). */
@media (max-width: 640px) {
  .player-ambient { display: none; }
  .player-bar { margin-inline: -14px; border-radius: 0; border-inline: 0; box-shadow: none; }
  .pbtn-theater { display: none; }
}

/* Theater mode (desktop): player spans the page, "up next" drops below as a grid. */
.pbtn-theater { display: none; }
@media (min-width: 1100px) {
  .pbtn-theater { display: inline-flex; }
  html.theater .watch-layout { grid-template-columns: minmax(0, 1fr); }
  html.theater .grid-up-next { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px 16px; }
  html.theater .grid-up-next .card { display: block; }
  html.theater .grid-up-next .card-title { margin: 9px 0 3px; font-size: 13.5px; }
  html.theater .more-tag { width: auto; display: inline-flex; }
}
@media (min-width: 1500px) {
  html.theater .grid-up-next { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

/* Native ad units hold several ads side by side — give them the whole row. */
.grid > .ad-native { grid-column: 1 / -1; }

/* ---- display banners: space reserved before the ad loads (no layout jump) ---- */
.ad-display { display: flex; justify-content: center; margin: 18px 0; }
.ad-frame {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: var(--ad-h-m, 50px);
}
@media (min-width: 760px) { .ad-frame { min-height: var(--ad-h-d, 90px); } }
.ad-frame iframe { display: block; border: 0; max-width: 100%; }
.up-next > .ad-display { margin: 0 0 16px; }
