/* Screens opened from the tabs: series page (index look), player, challenge. */

/* ---- series page ---- */
.cover { margin: 8px 16px 14px; padding: 20px; border-radius: 22px; color: #fff; display: grid; gap: 4px;
  background: var(--kufic), linear-gradient(160deg, var(--green-600), var(--green-800)); box-shadow: inset 0 -3px 0 var(--gold); }
.cover h1 { font-size: 26px; }
.cover p { color: var(--gold-soft); font-size: 14px; }
.cover-play { margin-top: 12px; justify-self: start; display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-height: 44px; padding: 0 18px;
  border-radius: 99px; background: var(--gold); color: var(--green-900); font-weight: 700; }
.cover-play span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* «عن السلسلة» under the cover: what the section is about, before its lessons */
.s-about { margin: 0 16px 14px; padding: 14px 16px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); display: grid; gap: 4px; }
.s-about h2 { font-size: 15px; color: var(--green-700); }
.s-about p { font-size: 15px; line-height: 1.85; color: var(--ink); white-space: pre-line; overflow-wrap: anywhere; }
.ep-list { list-style: none; margin: 0 16px; padding: 4px 8px; border-radius: 22px; background: var(--card); border: 1px solid var(--line); }
.ep { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 6px; border-bottom: 1px solid var(--line); }
.ep-list li:last-child .ep { border-bottom: 0; }
.ep-art { position: relative; flex: none; display: block; }
.ep .thumb { width: 54px; height: 72px; display: block; border-radius: 12px; object-fit: cover; }
.ep .thumb.square { height: 54px; }
.ep .thumb.logo-art { display: grid; }
.ep .thumb.logo-art img { opacity: .28; }
.ep-no { position: absolute; bottom: -5px; inset-inline-start: -5px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 99px;
  display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--card); color: var(--green-700); border: 1.5px solid var(--gold); }
.ep-no .ic { width: 13px; height: 13px; }
.ep.done .ep-no { background: var(--green-600); border-color: var(--green-600); color: #fff; }
.ep-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.ep-text b { font-size: 15.5px; line-height: 1.5; }
.ep-text small { font-size: 12.5px; color: var(--muted); }
.ep-text .ep-sum { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.6; color: var(--ink); opacity: .78; }
.ep-text .bar { margin-top: 4px; height: 4px; }
.ep-kind { color: var(--muted); }
.ep.playing { background: var(--mint); border-radius: 14px; }
.ep.playing .ep-kind { color: var(--green-600); }

/* actions: YouTube, share, download (small pills; on the cover and under the player's controls) */
.act { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; border-radius: 99px; font-size: 13.5px; font-weight: 700;
  border: 1px solid rgb(var(--fg) / .3); background: rgb(var(--fg) / .08); }
.act .ic { width: 18px; height: 18px; }
.cover-acts, .pl-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.cover-acts { margin-top: 10px; }
.pl-actions { justify-content: center; margin-top: 10px; }

/* ---- player ---- */
.pl { display: grid; justify-items: center; gap: 10px; padding: 4px 20px 32px; text-align: center; }
.pl-video { width: 100%; max-height: 62vh; border-radius: 18px; background: #000; }
.pl-art.logo-art img { width: 52%; }
.pl-art { width: min(250px, 66vw); aspect-ratio: 1; object-fit: cover; margin: 18px 0 8px; border-radius: 24px;
  box-shadow: 0 0 0 2px rgba(229, 185, 92, .55), 0 18px 48px rgba(0, 0, 0, .45); }
/* a 16:9 picture (an audio lesson's thumbnail, a wide video's frame): whole, not cut to a square */
.pl-art.wide { width: min(420px, 100%); aspect-ratio: 16 / 9; border-radius: 18px; }
/* a lesson without its own picture: its name under «التحديات الإيمانية», so the cover says which lesson is playing */
.pl-art.named-art { container-type: inline-size; align-content: center; gap: 14px; }
.pl-art.named-art img { width: 46%; }
.named-art .art-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; max-width: 82%;
  font-size: 16px; font-size: 6.4cqw; line-height: 1.6; font-weight: 700; color: var(--gold-soft); text-wrap: balance; }
.speed { display: flex; gap: 6px; margin-top: 12px; }
.speed button { min-width: 50px; height: 34px; padding: 0 8px; border-radius: 99px; border: 1px solid rgb(var(--fg) / .28);
  font-size: 13.5px; font-weight: 700; font-feature-settings: "tnum"; }
.speed button[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: var(--green-900); }
.pl-summary { width: 100%; display: grid; gap: 4px; margin-top: 14px; padding: 14px 16px; border-radius: 16px; text-align: start;
  background: rgb(var(--fg) / .07); }
.pl-summary h2 { font-size: 14px; color: var(--accent-ink-soft); }
.pl-summary p { font-size: 15px; line-height: 1.85; opacity: .92; white-space: pre-line; }
/* «عن الدرس»: one line and «المزيد» beside it; open, the whole text with «أقل» under it. */
.about.can-open:not(.open) { cursor: pointer; }
.about-text { display: flex; align-items: baseline; gap: 10px; }
.about-lead { flex: 1; min-width: 0; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.about-text .more { flex: none; margin-top: 0; }
.about-text .rest { display: none; }
.about.open .about-text { display: grid; gap: 6px; }
.about.open .about-lead { display: block; overflow: visible; }
.about.open .rest { display: block; padding-top: 10px; border-top: 1px solid rgb(var(--fg) / .12); font-size: 14.5px; overflow-wrap: anywhere; }
.pl h1 { margin-top: 6px; font-size: 24px; line-height: 1.45; }
.who { opacity: .8; }
.pl-series { font-size: 14px; color: var(--accent-ink-soft); text-decoration: underline; text-underline-offset: 4px; }
.resume-note { font-size: 13px; padding: 4px 14px; border-radius: 99px; background: rgba(229, 185, 92, .18); }
.seek { width: 100%; display: grid; gap: 4px; margin-top: 12px; }
.seek input { width: 100%; accent-color: var(--gold); }
.times { display: flex; justify-content: space-between; font-size: 13px; opacity: .78; }
.ctrl { display: flex; align-items: center; gap: 28px; margin-top: 6px; }
.skip { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid rgb(var(--fg) / .5); }
.skip small { font-size: 11px; line-height: 1; margin-top: -4px; }
.ctrl .main { width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center; background: var(--gold); color: var(--green-900); }
.ctrl .main .ic { width: 30px; height: 30px; }
.next { margin-top: 18px; max-width: 100%; padding: 12px 18px; border-radius: 14px; background: rgb(var(--fg) / .08); font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- challenge ---- */
.ch-detail { display: grid; gap: 10px; padding: 4px 18px 32px; }
.ch-detail video { width: 100%; max-height: 60vh; border-radius: 18px; background: #000; }
.ch-detail .ch-no { position: static; justify-self: start; margin-top: 8px; }
.ch-detail h1 { font-size: 26px; }
.ch-desc { opacity: .85; }
.ch-intro { display: grid; gap: 12px; line-height: 1.85; white-space: pre-line; overflow-wrap: anywhere; }
.ch-intro .link { text-align: right; }
.ch-action { display: grid; gap: 10px; margin-top: 8px; }
.ch-note { font-size: 14px; opacity: .85; }
.ch-note.error { color: var(--error-ink); }
.ch-done { display: flex; align-items: center; gap: 8px; padding: 14px; border-radius: 14px; background: rgba(229, 185, 92, .16); color: var(--accent-ink); font-weight: 700; }

/* files attached to a lesson (opened outside the Mini App) */
.attachments { width: 100%; display: grid; gap: 8px; margin-top: 16px; text-align: start; }
.attachments h2 { font-size: 15px; color: var(--accent-ink-soft); }
.attachment { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: rgb(var(--fg) / .08); }
.att-kind { padding: 2px 8px; border-radius: 6px; background: var(--gold); color: var(--green-900); font-size: 11px; font-weight: 700; }

/* listen / watch: a video lesson with an audio version, one lesson either way */
.pl-media { width: 100%; display: grid; justify-items: center; }
.pl-media[hidden], .pl-listen[hidden] { display: none; }
.pl-listen { width: 100%; display: grid; justify-items: center; gap: 6px; }
.pl-video.wide { aspect-ratio: 16 / 9; height: auto; }
.mode-switch { display: flex; gap: 4px; padding: 4px; border-radius: 99px; background: rgb(var(--fg) / .08); border: 1px solid rgb(var(--fg) / .14); }
.mode-switch button { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 16px; border-radius: 99px; font-size: 14px; font-weight: 700; color: rgb(var(--text-rgb) / .85); }
.mode-switch button .ic { width: 18px; height: 18px; }
.mode-switch button[aria-pressed="true"] { background: var(--gold); color: var(--green-900); }

/* «حصري»: only in the app, for now */
.ex-chip { display: inline-block; padding: 0 8px; margin-inline-end: 4px; border-radius: 99px; font-size: 11px; font-weight: 700; line-height: 18px;
  vertical-align: 1px; background: var(--gold); color: var(--green-900); }
.ep .thumb.wide { width: 96px; height: 54px; }

/* «التالي»: over the picture when a lesson ends (YouTube-style countdown) */
.pl-stage { position: relative; width: 100%; display: grid; justify-items: center; }
.up-next { position: absolute; inset: auto 8px 8px; z-index: 2; display: grid; gap: 8px; padding: 12px 14px; border-radius: 16px; text-align: start;
  background: rgba(4, 25, 15, .92); border: 1px solid rgba(229, 185, 92, .45); box-shadow: 0 10px 30px rgba(0, 0, 0, .4); }
.up-next[hidden] { display: none; }
.un-head { font-size: 13px; color: var(--gold-soft); }
.un-lesson { display: flex; align-items: center; gap: 10px; }
.un-lesson b { font-size: 15px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.un-thumb { width: 52px; height: 52px; flex: none; border-radius: 10px; object-fit: cover; }
.un-thumb.logo-art img { width: 64%; }
.un-bar { display: block; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .16); overflow: hidden; }
.un-bar i { display: block; width: 100%; height: 100%; background: var(--gold); transition: width 1s linear; }
.un-acts { display: flex; align-items: center; gap: 16px; }
.un-acts .btn { min-height: 40px; padding: 0 16px; font-size: 14px; }
.un-acts .btn .ic { width: 16px; height: 16px; }
.un-cancel { font-size: 14px; opacity: .85; text-decoration: underline; text-underline-offset: 3px; }

/* The section's lessons beside the one playing (YouTube's playlist panel); the list scrolls on its own */
.pl-queue { width: 100%; margin-top: 14px; border-radius: 16px; overflow: hidden; text-align: start;
  background: rgb(var(--fg) / .06); border: 1px solid rgb(var(--fg) / .12); }
.pl-queue header { display: grid; gap: 2px; padding: 12px 14px; border-bottom: 1px solid rgb(var(--fg) / .1); }
.pl-queue header b { font-size: 15px; line-height: 1.5; }
.pl-queue header small { font-size: 12.5px; color: var(--accent-ink-soft); }
.q-list { list-style: none; margin: 0; padding: 6px; max-height: 340px; overflow-y: auto; overscroll-behavior: contain; }
.q-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; }
.q-item.current { background: rgba(229, 185, 92, .16); }
.q-no { width: 22px; flex: none; display: grid; place-items: center; font-size: 12.5px; opacity: .7; }
.q-no .ic { width: 16px; height: 16px; }
.q-item.current .q-no { color: var(--accent-ink); opacity: 1; }
.q-thumb { width: 64px; height: 40px; flex: none; border-radius: 8px; object-fit: cover; }
.q-thumb.logo-art img { width: 46%; }
.q-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.q-text b { font-size: 14px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.q-text small { font-size: 12px; opacity: .7; }
.q-text .bar { height: 3px; margin-top: 2px; }
.q-item.done .q-text b { opacity: .72; }

/* Full screen inside Telegram (Telegram's Android webview ignores the video's own full-screen button) */
.pl-media { position: relative; }
.fs-open { position: absolute; top: 10px; inset-inline-end: 10px; z-index: 1; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: rgba(0, 0, 0, .5); color: #fff; }
.fs-open .ic { width: 22px; height: 22px; }
.fs-close { display: none; }
body.theater { overflow: hidden; }
.pl-stage.theater { position: fixed; inset: 0; z-index: 50; background: #000; }
.pl-stage.theater .pl-media { position: absolute; inset: 0; }
.pl-stage.theater .fs-open { display: none; }
.pl-stage.theater .pl-video { position: absolute; top: 50%; left: 50%; width: 100vw; height: 100dvh; max-width: none; max-height: none; aspect-ratio: auto; border-radius: 0;
  object-fit: contain; transform: translate(-50%, -50%); }
/* A wide video on a phone held upright: turned sideways to fill the screen, like YouTube */
@media (orientation: portrait) {
  .pl-stage.theater.turn .pl-video { width: 100dvh; height: 100vw; transform: translate(-50%, -50%) rotate(90deg); }
}
.pl-stage.theater .fs-close { position: absolute; z-index: 3; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  top: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px) + 12px); inset-inline-start: 12px;
  background: rgba(0, 0, 0, .55); color: #fff; }
.pl-stage.theater .fs-close[hidden] { display: none; }
.pl-stage.theater .up-next { inset: auto 16px calc(var(--tg-safe-area-inset-bottom, 0px) + 16px); max-width: 420px; margin-inline: auto; }

/* «ما أتممته» */
.done-page { padding: 0 16px 24px; }
.done-page .ep-list { margin: 0; }
.done-title { display: flex; align-items: baseline; gap: 8px; }
.done-title small { font-size: 14px; font-weight: 400; color: var(--muted); }
.done-group { margin-bottom: 18px; }
.done-series { display: flex; align-items: center; gap: 8px; padding: 6px 4px 10px; }
.done-series b { flex: 1; min-width: 0; color: var(--green-700); line-height: 1.5; }
.done-series .chev { color: var(--muted); }

/* A long text cut to a few lines; «المزيد» opens it */
.clamp { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; overflow-wrap: anywhere; }
.clamp.open { display: block; -webkit-line-clamp: unset; overflow: visible; }
.more { justify-self: start; margin-top: 2px; font-size: 14px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; color: var(--green-600); }
.more[hidden] { display: none; }
.pl-summary .more { color: var(--accent-ink-soft); }

/* ---- a section as a sheet over «السلاسل» (Netflix's title card) ---- */
.sheet { position: fixed; inset: 0; z-index: 30; }
.sheet[hidden] { display: none; }
body.sheet-open { overflow: hidden; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .6); animation: fade .25s ease; }
.sheet-panel { position: absolute; inset: calc(var(--tg-content-safe-area-inset-top, 0px) + 28px) 0 0; overflow-y: auto; overscroll-behavior: contain;
  border-radius: 14px 14px 0 0; background: var(--raised); color: var(--text); box-shadow: 0 -10px 40px rgba(0, 0, 0, .5); outline: none;
  padding-bottom: calc(env(safe-area-inset-bottom) + 24px); }
body.has-mini .sheet-panel { padding-bottom: calc(env(safe-area-inset-bottom) + 96px); }
.sheet-panel.rise { animation: rise .32s cubic-bezier(.2, .8, .2, 1); }
@keyframes rise { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }
/* A sheet closing (screen-fade.js): its copy slides back down the way it came; on a computer it fades */
.sheet.sheet-out { z-index: 9; pointer-events: none; } /* under the tab bar and the mini player that come back */
.sheet-out .sheet-backdrop { animation: screen-out .28s ease forwards; }
.sheet-out .sheet-panel { animation: sheet-down .3s cubic-bezier(.4, 0, .8, .4) forwards; }
@keyframes sheet-down { to { transform: translateY(100%); } }
@media (min-width: 840px) { .web .sheet-out .sheet-panel { animation: screen-out .2s ease forwards; } }
.sheet-out.sheet-fade .sheet-backdrop, .sheet-out.sheet-fade .sheet-panel { animation: screen-out .16s ease-out forwards; }
@media (prefers-reduced-motion: reduce) { .sheet-out { display: none; } }
@media (min-width: 700px) { .sheet-panel { inset-inline: max(0px, calc(50% - 360px)); } }
.sh-hero { position: relative; aspect-ratio: 16 / 9; background: var(--green-900); }
.sh-hero-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.sh-hero-art.nf-plain b { font-size: 24px; }
.sh-hero .shade { position: absolute; inset: 0; background: linear-gradient(transparent 55%, var(--raised)); }
.sh-close { position: absolute; top: 10px; inset-inline-end: 10px; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(0, 0, 0, .65); color: #fff; }
.sh-body { display: grid; gap: 8px; padding: 4px 16px 0; }
.sh-body h1 { font-size: 23px; line-height: 1.45; }
.sh-meta { font-size: 13px; color: rgb(var(--fg) / .62); }
.sh-play { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; margin-top: 4px; padding: 0 16px; border-radius: 8px;
  background: var(--gold); color: var(--green-950); font-size: 15.5px; font-weight: 700; }
.sh-play span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh-about p { font-size: 14.5px; line-height: 1.85; color: rgb(var(--fg) / .82); }
.sh-about .more { color: var(--accent-ink-soft); }
.sh-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.sh-h { display: flex; align-items: baseline; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid rgb(var(--fg) / .1); font-size: 17px; }
.sh-h small { font-size: 13px; font-weight: 400; color: rgb(var(--fg) / .55); }
.sh-eps { list-style: none; margin: 0; padding: 0; display: grid; }
.sh-ep { width: 100%; display: grid; grid-template-columns: 128px 1fr; align-items: center; gap: 6px 12px; padding: 10px 0; text-align: start; border-radius: 8px; }
.sh-ep-pic { position: relative; display: block; aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; background: var(--green-900); }
.sh-ep-pic > img, .sh-ep-pic > .nf-plain { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.sh-ep-play { position: absolute; inset: 0; margin: auto; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%;
  background: rgba(0, 0, 0, .55); border: 1.5px solid rgba(255, 255, 255, .85); }
.sh-ep-play .ic { width: 15px; height: 15px; }
.sh-ep-pic .nf-plain img { width: 34%; opacity: .12; }
.sh-ep-pic .nf-plain b { inset: auto; font-size: 30px; line-height: 1; color: var(--gold); }
.sh-ep-pic .bar { position: absolute; inset: auto 0 0; height: 3px; border-radius: 0; }
.sh-ep-text { min-width: 0; display: grid; gap: 2px; }
.sh-ep-text b { font-size: 14.5px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sh-ep-text small { display: flex; align-items: center; gap: 4px; font-size: 12.5px; color: rgb(var(--fg) / .58); }
.sh-ep-text small .ic { width: 15px; height: 15px; }
.sh-ep-sum { grid-column: 1 / -1; font-size: 13px; line-height: 1.7; color: rgb(var(--fg) / .6);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sh-ep.done .sh-ep-text b { color: rgb(var(--fg) / .7); }
.sh-ep.playing { background: rgba(229, 185, 92, .1); box-shadow: 0 0 0 6px rgba(229, 185, 92, .1); }
.sh-ep.playing .nf-plain { box-shadow: inset 0 0 0 2px var(--gold); }
.sh-ep.playing .sh-ep-play { background: var(--gold); border-color: var(--gold); color: var(--green-950); }

/* a book read in the app (views/book.js): its name and «صفحة … من …» stay on top; the pages are pictures, white paper */
.bk-head { position: sticky; top: 0; z-index: 2; display: grid; gap: 8px; padding: 14px 16px 12px; background: var(--raised);
  box-shadow: 0 6px 12px -8px rgba(0, 0, 0, .45); }
.bk-head h1 { padding-inline-end: 44px; font-size: 17px; line-height: 1.6; }
.bk-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.bk-at { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: rgb(var(--fg) / .75); }
.bk-at input { width: 4.2em; min-height: 36px; padding: 0 6px; border-radius: 8px; border: 1px solid rgb(var(--fg) / .25);
  background: rgb(var(--fg) / .06); color: inherit; font: inherit; font-weight: 700; text-align: center; }
.bk-at input:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 1px; }
.bk-pages { list-style: none; margin: 0 auto; padding: 12px 12px 0; display: grid; gap: 12px; max-width: 760px; }
.bk-pages li { scroll-margin-top: 120px; }
.bk-page { display: block; width: 100%; border-radius: 4px; overflow: hidden; background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .3); }
.bk-page img { display: block; width: 100%; height: auto; }
