:root {
  --bg: #f6f3ec;
  --surface: #ffffff;
  --surface-2: #efeae0;
  --ink: #1b2320;
  --muted: #4c5752;
  --line: #e3ddd0;
  --accent: #0f6b5c;
  --accent-strong: #0b5649;
  --accent-soft: #dcefe9;
  --on-accent: #ffffff;
  --gold: #a8802f;
  --pill-ar-bg: #e3f1ec; --pill-ar-ink: #0d5e50;
  --pill-en-bg: #e5ecf8; --pill-en-ink: #2b4f8a;
  --kids-a: #2b78c5;
  --kids-b: #ffcf5a;
  --kids-bg: #fdf7e8;
  --shadow: 0 1px 2px rgb(20 30 25 / .06), 0 4px 16px rgb(20 30 25 / .06);
  --radius: 14px;
  --font: 'Inter', 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111614; --surface: #19201d; --surface-2: #222b27; --ink: #e9eeeb; --muted: #9aa8a2; --line: #2b3531;
    --accent: #3fb59d; --accent-strong: #5cc9b2; --accent-soft: #183a33; --on-accent: #06221c; --gold: #d6b066;
    --pill-ar-bg: #183a33; --pill-ar-ink: #7fd8c4; --pill-en-bg: #1d2a42; --pill-en-ink: #9dbcf0;
    --kids-a: #6aaef0; --kids-b: #f2c552; --kids-bg: #17191a;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 4px 16px rgb(0 0 0 / .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111614; --surface: #19201d; --surface-2: #222b27; --ink: #e9eeeb; --muted: #9aa8a2; --line: #2b3531;
  --accent: #3fb59d; --accent-strong: #5cc9b2; --accent-soft: #183a33; --on-accent: #06221c; --gold: #d6b066;
  --pill-ar-bg: #183a33; --pill-ar-ink: #7fd8c4; --pill-en-bg: #1d2a42; --pill-en-ink: #9dbcf0;
  --kids-a: #6aaef0; --kids-b: #f2c552; --kids-bg: #17191a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font);
  min-height: 100vh; display: flex; flex-direction: column;
}
[dir="rtl"] body { font-family: 'IBM Plex Sans Arabic', 'Inter', system-ui, sans-serif; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { margin: 0; line-height: 1.25; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 10px max(16px, calc((100vw - 1240px) / 2)); background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.brand img { border-radius: 8px; }
.sections { display: flex; gap: 4px; margin-inline-start: auto; }
.sections a { padding: 8px 14px; border-radius: 999px; font-weight: 600; color: var(--muted); }
.sections a:hover { color: var(--ink); background: var(--surface-2); }
.sections a.on { color: var(--on-accent); background: var(--accent); }
.kids-mode .sections a[data-nav="kids"].on { background: var(--kids-a); color: #fff; }
.lang-toggle {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 14px;
  font-weight: 600; cursor: pointer; font-family: 'IBM Plex Sans Arabic', 'Inter', sans-serif;
}
.lang-toggle:hover { border-color: var(--accent); }

main { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 24px 16px 48px; }
main:focus { outline: none; }
.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 16px 32px; border-top: 1px solid var(--line); }
.foot p { margin: 0; }
.empty { color: var(--muted); text-align: center; padding: 48px 0; }

/* ---------- home ---------- */
.hero { padding: 24px 0 8px; max-width: 720px; }
.hero h1 { font-size: clamp(28px, 4.5vw, 44px); letter-spacing: -.02em; }
.hero p { color: var(--muted); font-size: 17px; margin: 12px 0 0; }
.row { margin-top: 36px; }
.row-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.row-head h2 { font-size: 20px; }
.row-head a { color: var(--accent); font-weight: 600; }

/* ---------- page heads, tabs, chips ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-bottom: 16px; }
.page-head h1 { font-size: clamp(24px, 3.5vw, 32px); letter-spacing: -.015em; }
.page-head .count { flex-basis: 100%; margin: -6px 0 0; }
.count { color: var(--muted); margin: 0 0 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.count a { color: var(--accent); font-weight: 600; }
.back { display: inline-block; color: var(--muted); font-weight: 600; margin-bottom: 12px; }
[dir="rtl"] .back { unicode-bidi: plaintext; }
.back:hover { color: var(--accent); }
.search {
  position: relative; flex: 1 1 320px; max-width: 460px; display: flex; align-items: center;
}
.search svg { position: absolute; inset-inline-start: 14px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; padding: 11px 16px; padding-inline-start: 42px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 16px;
}
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 10px 16px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.on { color: var(--accent); border-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.chip {
  padding: 6px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  font-size: 13.5px; font-weight: 600; color: var(--muted);
}
.chip:hover { color: var(--ink); border-color: var(--accent); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.series-chips .chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 22px 16px; }
.grid-big { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px 20px; }
.card { display: block; min-width: 0; }
.thumb { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.card:hover .thumb img { transform: scale(1.03); }
.dur {
  position: absolute; inset-block-end: 6px; inset-inline-end: 6px; padding: 1px 6px; border-radius: 6px;
  background: rgb(0 0 0 / .78); color: #fff; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
}

.meta { padding: 10px 2px 0; }
.meta h3 {
  font-size: 15px; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  overflow-wrap: anywhere;
}
.meta p { margin: 6px 0 0; display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; min-width: 0; }
.meta .by { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.dot { opacity: .6; }
.meta p > span:not(.by) { white-space: nowrap; flex: none; }
.pill {
  flex: none; display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: .03em;
  font-family: 'IBM Plex Sans Arabic', 'Inter', sans-serif; line-height: 18px;
}
.pill-ar { background: var(--pill-ar-bg); color: var(--pill-ar-ink); }
.pill-en { background: var(--pill-en-bg); color: var(--pill-en-ink); }
.more { display: flex; justify-content: center; margin-top: 28px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 999px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer;
}
.btn svg { width: 18px; height: 18px; fill: currentColor; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-strong); }
.btn.ghost { background: var(--surface); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--accent); }

/* shaykh cards */
.grid-people { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.person {
  display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
}
.person:hover { border-color: var(--accent); }
.person img { width: 72px; height: 54px; object-fit: cover; border-radius: 10px; flex: none; }
.person span { display: flex; flex-direction: column; min-width: 0; }
.person strong { font-size: 14.5px; line-height: 1.3; }
.person em { font-style: normal; color: var(--muted); font-size: 13px; }

/* series episode list */
.episodes { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.episodes a { display: grid; grid-template-columns: 36px 260px 1fr; gap: 20px; align-items: center; padding: 10px; border-radius: 14px; }
.episodes a:hover { background: var(--surface); }
.ep-n { color: var(--muted); font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.ep-thumb { position: relative; aspect-ratio: 16/9; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.ep-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ep-n { font-size: 17px; }
.ep-t { font-weight: 600; font-size: 18px; line-height: 1.5; overflow-wrap: anywhere; }
/* Titles sit next to their picture, whatever their own language (Arabic would otherwise drift to the far side). */
.ep-t { text-align: left; }
:root[dir="rtl"] .ep-t { text-align: right; }
@media (max-width: 900px) {
  .episodes a { grid-template-columns: 32px 200px 1fr; gap: 16px; }
  .ep-t { font-size: 16px; }
}

/* ---------- kids ---------- */
.kids-mode { --accent: var(--kids-a); --accent-soft: color-mix(in srgb, var(--kids-a) 18%, transparent); --on-accent: #fff; background: var(--kids-bg); }
.kids-mode .topbar { background: color-mix(in srgb, var(--kids-bg) 88%, transparent); }
.kids-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
  padding: 24px; margin-bottom: 20px; border-radius: 24px;
  background: radial-gradient(circle at 90% 10%, color-mix(in srgb, var(--kids-b) 70%, transparent) 0 60px, transparent 61px),
              linear-gradient(135deg, color-mix(in srgb, var(--kids-a) 18%, var(--surface)), var(--surface));
  border: 1px solid var(--line);
}
[dir="rtl"] .kids-head { background: radial-gradient(circle at 10% 10%, color-mix(in srgb, var(--kids-b) 70%, transparent) 0 60px, transparent 61px),
              linear-gradient(225deg, color-mix(in srgb, var(--kids-a) 18%, var(--surface)), var(--surface)); }
.kids-head h1 { font-size: clamp(26px, 4vw, 36px); }
.kids-head p { margin: 4px 0 0; color: var(--muted); font-size: 17px; }
.kids-mode .thumb { border-radius: 18px; }
.kids-mode .card-big .meta h3 { font-size: 16px; }

/* ---------- watch ---------- */
.watch { display: grid; gap: 24px; }
@media (min-width: 1000px) { .watch { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } }
.watching main { max-width: 1680px; }
.watching .topbar { padding-inline: max(16px, calc((100vw - 1680px) / 2)); }
h2.sub { font-size: 18px; margin: 32px 0 14px; }
/* As big as the window allows, while the whole player (picture + controls) stays on screen. */
.watch-main .player { max-width: calc((100vh - 150px) * 16 / 9); margin-inline: auto; }
.watch-title { font-size: clamp(18px, 2.4vw, 22px); margin-top: 16px; overflow-wrap: anywhere; }
.watch-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); margin: 8px 0 14px; font-size: 14px; }
.watch-side { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.watch-side h2 { font-size: 15px; padding: 14px 16px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.watch-side h2 a:hover { color: var(--accent); }
.queue { list-style: none; margin: 0; padding: 6px; max-height: min(70vh, 640px); overflow-y: auto; }
.queue a { display: grid; grid-template-columns: 128px 1fr; gap: 10px; padding: 6px; border-radius: 10px; align-items: start; }
.queue a:hover { background: var(--surface-2); }
.queue .now a { background: var(--accent-soft); }
.q-thumb { position: relative; aspect-ratio: 16/9; border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.q-thumb img { width: 100%; height: 100%; object-fit: cover; }
.q-thumb .dur { font-size: 11px; inset-block-end: 4px; inset-inline-end: 4px; }
.q-t { font-size: 13.5px; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }

/* ---------- player ---------- */
.player {
  display: flex; flex-direction: column; background: #000; border-radius: var(--radius); overflow: hidden;
  color: #fff; user-select: none; -webkit-user-select: none; outline: none;
}
.stage { position: relative; aspect-ratio: 16 / 9; overflow: hidden; }
.player.pseudo-fs { position: fixed; inset: 0; z-index: 100; border-radius: 0; max-width: none; }
.player:fullscreen { border-radius: 0; max-width: none; }
.player.pseudo-fs .stage, .player:fullscreen .stage { flex: 1; aspect-ratio: auto; }
.yt-host, .yt-host iframe, .yt-target { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
/* The shield: nothing inside YouTube's iframe is ever clickable. */
.shield { position: absolute; inset: 0; z-index: 2; cursor: pointer; }
.player[data-state="idle"] .shield { cursor: default; }
/* Fallback when a phone refuses scripted playback: leave only the centre (YouTube's play button) open. */
.player.tap-through .shield { background: transparent; pointer-events: none; }
.player.tap-through .stage::before, .player.tap-through .stage::after {
  content: ''; position: absolute; inset-inline: 0; z-index: 3; background: #000;
}
.player.tap-through .stage::before { top: 0; height: 26%; }
.player.tap-through .stage::after { bottom: 0; height: 26%; }

.cover { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; border: 0; padding: 0; background: #000; color: #fff; }
.cover[hidden] { display: none; }
.cover > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover-start { cursor: pointer; }
.cover-start > img { opacity: .9; }
.cover-pause > img { filter: blur(14px) brightness(.45); transform: scale(1.1); }
.cover-label { position: absolute; inset-block-start: 16px; inset-inline-start: 18px; font-weight: 600; font-size: 14px; opacity: .85; }
.big-play {
  position: relative; display: grid; place-items: center; width: 76px; height: 76px; border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 92%, transparent); color: #fff; border: 0; cursor: pointer;
  box-shadow: 0 6px 30px rgb(0 0 0 / .35); transition: transform .15s;
}
.big-play svg { width: 34px; height: 34px; fill: currentColor; margin-inline-start: 4px; }
[dir="rtl"] .big-play svg { margin-inline-start: 0; margin-inline-end: 4px; }
.cover-start:hover .big-play, .big-play:hover { transform: scale(1.07); }

.cover-end { background: radial-gradient(ellipse at center, #1d2723, #0b0f0d); }
.end-inner { width: min(92%, 520px); display: grid; gap: 14px; justify-items: center; text-align: center; }
.end-title { margin: 0; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; opacity: .7; font-weight: 700; }
.end-next {
  display: grid; grid-template-columns: 42% 1fr; gap: 14px; align-items: center; width: 100%; text-align: start;
  padding: 10px; border-radius: 14px; background: rgb(255 255 255 / .08); border: 1px solid rgb(255 255 255 / .12);
}
.end-next:hover { background: rgb(255 255 255 / .14); }
.end-next img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 10px; }
.end-next span { display: grid; gap: 3px; min-width: 0; }
.end-next small { font-size: 12px; opacity: .7; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.end-next strong { font-size: 15px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.end-next em { font-style: normal; font-size: 13px; opacity: .7; }
.end-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.cover-end .btn.ghost { background: rgb(255 255 255 / .1); border-color: rgb(255 255 255 / .2); color: #fff; }
@media (max-width: 560px) {
  .end-next { grid-template-columns: 1fr; padding: 8px; }
  .end-next img { display: none; }
  .end-inner { gap: 10px; }
  .end-title { display: none; }
  .btn { padding: 8px 14px; }
}

.controls {
  display: flex; align-items: center; gap: 6px; padding: 4px 8px; background: #121614;
  border-top: 1px solid rgb(255 255 255 / .06);
}
.player[data-state="idle"] .controls { opacity: .55; }
.ctl { display: grid; place-items: center; min-width: 40px; height: 40px; border: 0; background: none; border-radius: 8px; cursor: pointer; color: #fff; padding: 0 6px; }
.ctl:hover { background: rgb(255 255 255 / .14); }
.ctl svg { width: 24px; height: 24px; fill: currentColor; }
.ctl.speed { font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.time { font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; padding: 0 4px; opacity: .92; }
.seek {
  --p: 0%; flex: 1; min-width: 60px; height: 22px; margin: 0 6px; background: none; cursor: pointer; -webkit-appearance: none; appearance: none;
}
.seek::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--accent) var(--p), rgb(255 255 255 / .3) var(--p)); }
.seek::-moz-range-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--accent) var(--p), rgb(255 255 255 / .3) var(--p)); }
.seek::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: #fff; border: 0; }
.seek::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 0; }
@media (max-width: 480px) { .time { font-size: 12px; } .ctl { min-width: 36px; } [data-act="mute"] { display: none; } }

.toast {
  position: absolute; z-index: 6; inset-block-start: 14px; left: 50%; transform: translate(-50%, -8px);
  padding: 7px 14px; border-radius: 999px; background: rgb(0 0 0 / .75); font-size: 13px; font-weight: 600;
  opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; white-space: nowrap;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 640px) {
  .topbar { gap: 8px; }
  .brand span { display: none; }
  .sections a { padding: 7px 11px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 18px 12px; }
  .grid-big { grid-template-columns: 1fr; }
  .episodes a { grid-template-columns: 24px 136px 1fr; gap: 12px; padding: 8px 4px; }
  .ep-n { font-size: 15px; }
  .ep-t { font-size: 15px; }
  .watching main { padding-top: 0; padding-inline: 0; }
  .watching .player { border-radius: 0; }
  .watching .watch-main > :not(.player-host), .watching .watch-side { margin-inline: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* watch progress (stored in this browser) */
.prog { position: absolute; inset-inline: 0; bottom: 0; height: 4px; background: rgb(255 255 255 / .35); }
.prog i { display: block; height: 100%; background: var(--accent); }
.watched {
  position: absolute; inset-block-start: 6px; inset-inline-start: 6px; padding: 1px 7px; border-radius: 6px;
  background: rgb(0 0 0 / .72); color: #fff; font-size: 11.5px; font-weight: 700;
}
.q-thumb .watched { font-size: 10px; padding: 0 5px; }
.page-head > .btn { flex: none; }

/* global search in the top bar */
.top-search { position: relative; flex: 0 1 360px; margin-inline-start: auto; display: flex; align-items: center; }
.top-search svg { position: absolute; inset-inline-start: 12px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.top-search input {
  width: 100%; padding: 8px 14px; padding-inline-start: 36px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 14.5px;
}
.top-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.top-search + .top-search-icon + .sections { margin-inline-start: 0; }
.top-search-icon { display: none; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: var(--muted); margin-inline-start: auto; }
.top-search-icon svg { width: 20px; height: 20px; }
.on-search .top-search, .on-search .top-search-icon { visibility: hidden; }
@media (max-width: 760px) {
  .top-search { display: none; }
  .top-search-icon { display: grid; }
}

/* topic chips on the watch page */
.chip-topic { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip-topic:hover { border-color: var(--accent); color: var(--accent); }

/* tester fixes */
.skip { position: absolute; inset-inline-start: 8px; top: -60px; z-index: 50; padding: 8px 14px; border-radius: 8px; background: var(--accent); color: var(--on-accent); font-weight: 600; }
.skip:focus { top: 8px; }
.count, .page-head h1 { overflow-wrap: anywhere; min-width: 0; }
.person strong { overflow-wrap: anywhere; }
.back, .row-head a { display: inline-block; padding: 8px 4px; }
.seek { height: 30px; }
.cover-error { background: radial-gradient(ellipse at center, #2a2320, #0e0b0a); }
.cover-error .err-msg { margin: 0; font-size: 16px; font-weight: 600; text-align: center; line-height: 1.5; }
@media (max-width: 420px) { .grid-people { grid-template-columns: 1fr; } }
@media (max-width: 380px) {
  .controls { gap: 2px; padding: 4px; }
  .ctl.speed, [data-act="mute"] { display: none; }
  .time { font-size: 11px; padding: 0 2px; }
  .seek { min-width: 40px; margin: 0 4px; }
}

/* ---------- about & statistics ---------- */
.foot-link { color: var(--accent); font-weight: 600; display: inline-block; padding: 6px 4px; }
.lead { font-size: 17px; color: var(--muted); max-width: 70ch; margin: 0 0 24px; line-height: 1.6; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 2px; }
.tile strong { font-size: clamp(24px, 3.2vw, 32px); font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--ink); }
.tile span { color: var(--muted); font-size: 14px; }
.updated { color: var(--muted); font-size: 13.5px; margin: 10px 0 24px; }
.about-grid { display: grid; gap: 16px; }
@media (min-width: 900px) { .about-grid { grid-template-columns: 1fr 1fr; align-items: start; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.panel h2 { font-size: 17px; margin-bottom: 12px; }
.panel .panel-sub { margin-top: 20px; }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 30%) 1fr var(--val-w, 9em); gap: 12px; align-items: center; padding: 3px 4px; border-radius: 8px; }
.bar-row:hover { background: var(--surface-2); }
.bar-label { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.bar-label:hover { color: var(--accent); }
.bar-track { height: 10px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bar-track i { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; min-width: 2px; }
[dir="rtl"] .bar-track i { border-radius: 4px 0 0 4px; }
.bar-val { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; text-align: end; }
.prose { max-width: 72ch; margin-top: 8px; }
.prose h2 { font-size: 19px; margin: 24px 0 8px; }
.prose ul { margin: 0; padding-inline-start: 20px; display: grid; gap: 8px; line-height: 1.6; }
[dir="rtl"] .bar-label { text-align: right; }
@media (max-width: 600px) {
  /* stacked: name, full-width bar, numbers */
  .bars { gap: 10px; }
  .bar-row { grid-template-columns: 1fr; row-gap: 4px; }
  .bar-label { white-space: normal; }
  .bar-val { text-align: start; font-size: 12.5px; }
}

.watch-shaykh { margin: 6px 0 0; font-size: 16px; font-weight: 600; }
.watch-shaykh .via { font-weight: 400; font-size: 14px; color: var(--muted); }
.watch-shaykh .via a:hover { color: var(--accent); }
.watch-shaykh a:hover { color: var(--accent); }
.hon { font-family: 'IBM Plex Sans Arabic', sans-serif; font-weight: 500; color: var(--muted); font-size: .85em; }

/* machine-translated titles */
.mt { display: inline-grid; place-items: center; width: 1.15em; height: 1.15em; margin-inline-end: 5px; vertical-align: -0.15em; color: var(--accent); opacity: .8; }
.mt svg { width: 100%; height: 100%; }
.orig-title { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.orig-title bdi { font-family: 'IBM Plex Sans Arabic', sans-serif; }
select.lang-toggle { appearance: none; -webkit-appearance: none; padding-inline-end: 28px; max-width: 46vw;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 15px) 55%, calc(100% - 10px) 55%; background-size: 5px 5px; background-repeat: no-repeat; color: var(--ink); }
[dir="rtl"] select.lang-toggle { padding-inline-end: 14px; padding-inline-start: 28px; background-position: 15px 55%, 10px 55%; }
.sub-n { color: var(--muted); font-weight: 500; font-size: .8em; margin-inline-start: 6px; }
.search-people { margin-bottom: 8px; }
.searching { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }

/* playlists: a stack of cards peeking out above the thumbnail + a badge */
.stack-wrap { position: relative; padding-top: 11px; }
.stack-wrap::before, .stack-wrap::after {
  content: ''; position: absolute; top: 0; height: 16px; border-radius: 10px 10px 0 0;
  background: color-mix(in srgb, var(--ink) 30%, var(--bg)); inset-inline: 8%;
}
.stack-wrap::after { top: 5px; inset-inline: 4%; background: color-mix(in srgb, var(--ink) 55%, var(--bg)); }
.stack-wrap > .stack { position: relative; z-index: 1; }
.pl-badge {
  position: absolute; inset-block-end: 6px; inset-inline-end: 6px; display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 6px; background: rgb(0 0 0 / .78); color: #fff; font-size: 12px; font-weight: 600;
}
.pl-badge svg { width: 15px; height: 15px; }
.q-thumb .pl-badge { font-size: 10.5px; padding: 1px 5px; inset-block-end: 4px; inset-inline-end: 4px; }
.q-thumb .pl-badge svg { width: 12px; height: 12px; }
.watch-side .stack-wrap { padding-top: 6px; }
.watch-side .stack-wrap::before { height: 8px; }
.watch-side .stack-wrap::after { top: 3px; height: 8px; }

/* playlist auto-advance countdown */
.end-countdown { margin: 0; font-size: 15px; font-weight: 600; min-height: 1.4em; font-variant-numeric: tabular-nums; }
.player.counting .cover-end .btn.primary { position: relative; overflow: hidden; }
.player.counting .cover-end .btn.primary::after {
  content: ''; position: absolute; inset-block-end: 0; inset-inline-start: 0; height: 3px; width: 100%;
  background: rgb(255 255 255 / .85); transform-origin: left; animation: countdown 5s linear forwards;
}
[dir="rtl"] .player.counting .cover-end .btn.primary::after { transform-origin: right; }
@keyframes countdown { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* share */
.watch-actions { display: flex; gap: 8px; margin: 10px 0 0; }
.share-btn { padding: 7px 14px; }
.share-btn svg { width: 18px; height: 18px; fill: none; }
.share-dialog { border: 1px solid var(--line); border-radius: 18px; padding: 0; background: var(--surface); color: var(--ink); width: min(92vw, 480px); }
.share-dialog::backdrop { background: rgb(0 0 0 / .45); }
.share-dialog form { padding: 20px 22px; display: grid; gap: 12px; }
.share-dialog h2 { font-size: 18px; }
.share-title { margin: -4px 0 0; color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.share-field input { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; font-size: 14px; }
.share-start { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14.5px; }
.share-start input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.share-start input[type="text"] { width: 7.5em; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; font-variant-numeric: tabular-nums; }
.share-start input.invalid { border-color: #c2410c; }
.share-note { margin: -4px 0 0; color: #c2410c; font-size: 13px; min-height: 1em; }
.share-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.share-actions svg { width: 18px; height: 18px; fill: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.watch-actions { flex-wrap: wrap; }
.first-part { min-width: 0; max-width: 100%; padding: 7px 14px; flex-wrap: wrap; white-space: normal; }
.first-part svg { width: 18px; height: 18px; fill: none; flex: none; }
[dir="rtl"] .first-part svg { transform: scaleX(-1); }
.first-part-name { font-weight: 700; min-width: 0; max-width: 100%; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* On the video page there's room: show titles in full (cards elsewhere stay at two lines). */
.watch-side .q-t, .end-next strong, .first-part-name { display: block; -webkit-line-clamp: unset; overflow: visible; }
.watch-title { overflow-wrap: anywhere; }

/* phone fixes */
.brand, .brand img { flex: none; }
@media (max-width: 420px) {
  .topbar { gap: 6px; padding-inline: 10px; }
  select.lang-toggle { max-width: 104px; padding-block: 8px; font-size: 13.5px; text-overflow: ellipsis; }
  .sections a { padding: 7px 9px; font-size: 14px; }
  .top-search-icon { width: 40px; height: 40px; }
  .meta .by { white-space: normal; overflow: visible; }
  .meta p { flex-wrap: wrap; }
}
@media (max-width: 380px) {
  .ctl.speed { display: grid; }
  .sections a { padding: 7px 7px; }
}
/* compact end screen on phones: countdown + buttons always fit, "Play next" first */
@media (max-width: 600px) {
  .cover-end .end-next, .cover-end .end-title { display: none; }
  .end-inner { gap: 8px; }
  .end-actions { gap: 6px; }
  .end-actions .btn { padding: 7px 12px; font-size: 13.5px; }
  .end-actions .btn.primary { order: -1; }
  .end-countdown { font-size: 14px; }
}
.share-start input[type="checkbox"] { width: 22px; height: 22px; }
.share-start input[type="text"]:disabled { opacity: .45; }
.watch-shaykh a, .watch-shaykh .via a { display: inline-block; padding-block: 6px; }
@media (max-width: 600px) {
  .first-part .first-part-name { display: none; }
  .first-part .long { display: none; }
}
.first-part { border-radius: 12px; }
.first-part .short { display: none; }
@media (max-width: 600px) { .first-part .short { display: inline; } }

.cover-pause { cursor: pointer; }
/* language picker arrow: a simple chevron that also works right-to-left */
select.lang-toggle { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-size: 11px 8px; background-position: right 11px center; }
[dir="rtl"] select.lang-toggle { background-position: left 11px center; }

/* language picker: globe + name on wide screens, just the globe on phones (the select stays tappable) */
.lang-pick { position: relative; display: inline-flex; align-items: center; gap: 2px; flex: none;
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding-inline-start: 10px; color: var(--ink); }
.lang-pick:hover, .lang-pick:focus-within { border-color: var(--accent); }
.lang-pick > svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.lang-pick select.lang-toggle { border: 0; background-color: transparent; padding-inline-start: 6px; max-width: none; }
.lang-pick select.lang-toggle:focus { outline: none; }
@media (max-width: 520px) {
  .lang-pick { width: 40px; height: 40px; padding: 0; justify-content: center; }
  .lang-pick > svg { width: 21px; height: 21px; color: var(--ink); }
  .lang-pick select.lang-toggle { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; max-width: none; }
}
