/* Brand tokens (sampled from the channel's reels and the «ركب المختصر» app), base elements, shared components. */
:root {
  --green-950: #04190f; --green-900: #052419; --green-800: #0a3426; --green-700: #0b4a33;
  --green-600: #0b6948; --green-500: #0d6d4c;
  --gold: #e5b95c; --gold-soft: #f3dc9c; --gold-deep: #b8862f;
  --cream: #f1ece7; --card: #faf8f4; --beige: #e9dcd2; --terracotta: #af4f2d; --mint: #e7ece6;
  --ink: #17251e; --muted: #56635b; --line: #e2dbd2;
  --radius: 20px;
  --tabs-h: 66px; /* the floating glass bar (56px) and its gap above the screen edge */
  --night: #050d0a; /* the Netflix-dark screens */
  /* The theme: what the dark screens are drawn with. These are the dark theme's values; the light one (theme.css)
     changes them. --fg is white (as r g b) for text, lines and tints on the page: rgb(var(--fg) / .72). */
  --fg: 255 255 255; --text: #f6f1e6; --text-rgb: 246 241 230; --text-strong: #fff;
  --accent-ink: var(--gold); --accent-ink-soft: var(--gold-soft); --error-ink: #ffb4a2;
  --page: radial-gradient(130% 55% at 50% 0%, #0d2c20 0%, #071711 50%, var(--night) 100%) fixed var(--night);
  --raised: #0a1511; --bill: #0c1a14; --bill-rgb: 12 26 20; --card-dim: rgba(0, 0, 0, .55); --bar-bg: rgba(5, 13, 10, .88);
  --on: #fff; --on-ink: var(--green-950); --cta-bg: #fff; --cta-ink: #0b2a1e;
  --kufic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140' fill='none' stroke='%23ffffff' stroke-opacity='.055' stroke-width='7'%3E%3Cpath d='M8 8h124v124H8zM32 32h76v76H32zM56 8v48h28M8 84h48v48M84 84h48M108 56v52'/%3E%3C/svg%3E");
  --orb: radial-gradient(circle at 34% 30%, #fff1c2 0%, #f1cf7c 22%, #e5b95c 48%, #b8862f 100%);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; font: 16px/1.6 "Plex Arabic", system-ui, sans-serif; -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body[data-theme="light"] { background: var(--cream); color: var(--ink); }
body[data-theme="dark"] { color: var(--text); background: var(--page); }
/* Always dark in both themes: the green hero and covers, pictures, the mini player, the video stage and the blurred
   «قريبًا» tiles. */
.hero, .cover, .nf-cover, .mini, .pl-stage, .soon-tile {
  --fg: 255 255 255; --text: #f6f1e6; --text-rgb: 246 241 230; --text-strong: #fff;
  --accent-ink: var(--gold); --accent-ink-soft: var(--gold-soft);
}
body.has-tabs #view { padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 12px); }
body.has-mini #view { padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 84px); }
body:not(.has-tabs).has-mini #view { padding-bottom: 96px; }
#view:focus { outline: none; }
/* Moving between screens (screen-fade.js): the old screen's copy fades out over the new one, «تلاشٍ ناعم» */
.screen-out { position: fixed; inset: 0; z-index: 5; overflow: hidden; pointer-events: none; animation: screen-out .16s ease-out forwards; }
.screen-out > * { position: absolute; margin: 0; }
#view.screen-in { animation: screen-in .24s ease-out .04s both; }
@keyframes screen-out { to { opacity: 0; } }
@keyframes screen-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .screen-out { display: none; } #view.screen-in { animation: none; } }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
a { color: inherit; text-decoration: none; }
img, video { display: block; max-width: 100%; }
h1, h2, p { margin: 0; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 8px; }
.num { font-feature-settings: "tnum"; }
.ic { width: 20px; height: 20px; flex: none; }
.wrap { padding: 0 16px; }
.meta { color: var(--muted); font-size: 14px; }
body[data-theme="dark"] .meta { color: rgb(var(--fg) / .72); }
.empty { padding: 32px 18px; text-align: center; opacity: .8; }

/* A lesson without its own thumbnail: the channel logo on brand green (sized by the class it is used with). */
/* The logo with the Hijri year under it in gold, sized from the logo's width (as on the original artwork) */
.brand { display: grid; justify-items: center; container-type: inline-size; }
.brand img { width: 100%; height: auto; display: block; }
.brand-year { margin-top: 6cqw; font-size: 9px; font-size: 14cqw; line-height: 1.2; color: var(--gold); letter-spacing: .02em; white-space: nowrap; }
.logo-art { display: grid; place-items: center; overflow: hidden; background: var(--kufic), radial-gradient(circle at 50% 34%, var(--green-600), var(--green-900)); }
.logo-art img { width: 58%; height: auto; display: block; }
.orb { display: block; border-radius: 50%; background: var(--orb); box-shadow: 0 0 30px rgba(229, 185, 92, .45), inset -6px -8px 14px rgba(120, 80, 20, .35); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.pill { display: inline-block; justify-self: start; padding: 2px 14px; border-radius: 99px; background: var(--terracotta); color: #fff; font-size: 13px; }
.pill.gold { background: var(--gold); color: var(--green-900); font-weight: 700; }
.btn { display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 50px; padding: 0 22px; border-radius: 14px;
  background: var(--green-600); color: #fff; font-weight: 700; font-size: 16px; }
.btn.gold { background: var(--gold); color: var(--green-900); }
.btn:disabled { opacity: .6; }

.bar { display: block; height: 6px; border-radius: 9px; background: var(--mint); overflow: hidden; }
.bar i { display: block; width: 0; height: 100%; border-radius: 9px; background: var(--gold); }
body[data-theme="dark"] .bar { background: rgb(var(--fg) / .16); }

.notice.toast { background: var(--green-700); }

/* «نسخة جديدة · حدّث» (update-bar.js): above the tabs and the mini player, over an open section; dark in both themes */
.update-bar { position: fixed; z-index: 32; inset: auto 0 calc(var(--tabs-h) + env(safe-area-inset-bottom) + 12px); width: fit-content;
  max-width: calc(100% - 24px); margin-inline: auto; display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 6px;
  border: 1px solid rgb(229 185 92 / .4); border-radius: 18px; color: #fff; background: var(--green-950);
  box-shadow: 0 12px 32px rgba(4, 25, 15, .4);
  animation: update-in .3s ease-out both; }
body.has-mini .update-bar { bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 80px); }
body:not(.has-tabs) .update-bar, body.sheet-open .update-bar { bottom: calc(env(safe-area-inset-bottom) + 16px); }
body.has-mini:not(.has-tabs) .update-bar, body.has-mini.sheet-open .update-bar { bottom: calc(env(safe-area-inset-bottom) + 84px); }
.update-bar p { margin: 0; padding-inline-start: 10px; font-size: 15px; font-weight: 700; }
.update-go { min-height: 44px; padding: 0 22px; border: 0; border-radius: 12px; background: var(--gold); color: var(--green-950);
  font: inherit; font-size: 16px; font-weight: 800; cursor: pointer; }
.update-later { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 12px; background: none;
  color: rgb(255 255 255 / .7); cursor: pointer; }
.update-later svg { width: 18px; height: 18px; }
.update-go:focus-visible, .update-later:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 2px; }
@keyframes update-in { from { opacity: 0; transform: translateY(12px); } }
.offscreen { position: fixed; top: -100px; opacity: 0; }
.link { color: var(--green-600); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
body[data-theme="dark"] .link { color: var(--accent-ink); }
/* Website sign-in: a card with the reason and the buttons, in a window (login-dlg) opened by «تسجيل الدخول» */
.login { display: grid; gap: 4px; margin: 12px 0; padding: 16px; text-align: start; color: var(--ink); }
.login b { font-size: 17px; color: var(--green-700); }
/* On the dark screens the sign-in and install cards are black, with light text */
body[data-theme="dark"] .card.login, body[data-theme="dark"] .card.add-home {
  background: var(--card-dim); border-color: rgb(var(--fg) / .1); color: var(--text); }
body[data-theme="dark"] .login b, body[data-theme="dark"] .add-home .ah-text b { color: var(--text-strong); }
body[data-theme="dark"] .card .meta { color: rgb(var(--fg) / .66); }
/* The sign-in window: the card centred over the screen, ✕ in its corner */
.login-dlg { width: min(440px, calc(100% - 32px)); padding: 0; border: 0; background: none; color: var(--text); overflow: visible; }
.login-dlg::backdrop { background: rgba(0, 0, 0, .65); }
body[data-theme] .login-dlg .card.login { margin: 0; padding: 22px 18px 16px; background: var(--raised); border-color: rgb(var(--fg) / .12); }
.dlg-close { position: absolute; top: 10px; inset-inline-end: 10px; z-index: 1; width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: 50%; background: rgb(var(--fg) / .08); color: rgb(var(--fg) / .8); }
.dlg-close .ic { width: 18px; height: 18px; }
/* The sign-in button: white, Telegram's plane in the app's green */
.tg-btn { display: inline-flex; justify-content: center; align-items: center; gap: 10px; min-height: 48px; margin-top: 10px; padding: 0 20px;
  border-radius: 14px; background: #fff; color: var(--green-950); font-size: 16px; font-weight: 700; }
.tg-btn .ic { width: 22px; height: 22px; color: var(--green-600); }
.tg-btn:active { transform: scale(.98); }
.tg-acts, .tg-wait { display: grid; gap: 4px; }
.tg-acts[hidden], .tg-wait[hidden] { display: none; }
.tg-web { justify-self: center; min-height: 40px; padding: 0 12px; font-size: 14px; color: inherit; opacity: .75; text-decoration: underline; text-underline-offset: 3px; }
.tg-wait p { margin: 10px 0 0; font-size: 15px; line-height: 1.7; }
.tg-wait .tg-btn { text-decoration: none; }
/* «في انتظار التأكيد…» with a small turning ring */
.tg-waiting { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 8px; font-size: 14px; opacity: .8; }
.tg-spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-inline-end-color: transparent; animation: tg-spin .9s linear infinite; }
@keyframes tg-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .tg-spin { animation: none; } }
.account { margin: 22px 4px 8px; text-align: center; }

.sec-title { margin: 26px 4px 12px; font-size: 19px; }
body[data-theme="light"] .sec-title { color: var(--green-700); }

.page-head { display: flex; padding: 12px 14px 0; min-height: 12px; }
.back { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; }
body[data-theme="light"] .back { background: var(--card); border: 1px solid var(--line); color: var(--green-700); }
body[data-theme="dark"] .back { background: rgb(var(--fg) / .08); }

/* bottom tabs: a floating pill of liquid glass, like the iOS 26 App Store bar, with one clear lens on the current
   tab. The page shows through, blurred, and a lit rim makes it read as glass. Fully clear glass let busy pictures
   swallow the Arabic labels on a real phone, so the glass is frosted grey (light grey on light pages, neutral dark
   grey on dark ones) and the labels are near-black or white, a little bolder. */
.tabs {
  --glass-veil: linear-gradient(180deg, rgba(250, 250, 252, .74), rgba(238, 238, 242, .66));
  --glass-rim: rgba(255, 255, 255, .8); --glass-solid: rgba(246, 246, 248, .97);
  --tab-ink: #141816; --tab-on: #a8781f; --tab-halo: none; /* a deeper gold: the bright one fades on light glass */
  --lens-fill: linear-gradient(180deg, rgba(255, 255, 255, .38), rgba(255, 255, 255, .12)); --lens-rim: rgba(255, 255, 255, .95);
  /* Smaller than the screen, like Netflix's bar: a pill in the middle, not edge to edge. */
  position: fixed; z-index: 10; bottom: calc(env(safe-area-inset-bottom) + 10px); left: 50%; width: min(300px, calc(100% - 28px));
  transform: translateX(-50%);
}
body[data-theme="dark"] .tabs {
  --glass-veil: linear-gradient(180deg, rgba(58, 62, 60, .62), rgba(30, 33, 32, .74));
  --glass-rim: rgba(255, 255, 255, .30); --glass-solid: rgba(32, 35, 34, .97);
  --tab-ink: #fff; --tab-on: var(--gold); --tab-halo: 0 1px 2px rgba(0, 0, 0, .45);
  --lens-fill: linear-gradient(180deg, rgba(255, 255, 255, .18), rgba(255, 255, 255, .05)); --lens-rim: rgba(255, 255, 255, .40);
}
body:not(.has-tabs) .tabs, body.sheet-open .tabs { display: none; }
.tabs-pill { position: relative; display: flex; height: 56px; border-radius: 999px; overflow: hidden; touch-action: none;
  -webkit-user-select: none; user-select: none; background: var(--glass-solid); border: 1px solid var(--glass-rim);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, .55), inset 0 -1px 1px rgba(255, 255, 255, .10), 0 10px 30px rgba(4, 25, 15, .18); }
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .tabs-pill { -webkit-backdrop-filter: blur(16px) saturate(1.6); backdrop-filter: blur(16px) saturate(1.6); background: var(--glass-veil); }
}
.tabs a { position: relative; z-index: 1; flex: 1; min-width: 0; display: grid; justify-items: center; align-content: center; gap: 3px;
  font-size: 11px; font-weight: 600; color: var(--tab-ink); text-shadow: var(--tab-halo); -webkit-user-drag: none; transition: transform .25s ease, color .2s ease; }
.tabs a .ic { width: 21px; height: 21px; }
.tabs a.on, .tabs.dragging a.lit { color: var(--tab-on); font-weight: 700; transform: scale(1.08); }
.tabs.dragging a.on:not(.lit) { color: var(--tab-ink); font-weight: 600; transform: none; }
.tabs a:focus-visible { outline: 2px solid var(--tab-on); outline-offset: -8px; border-radius: 999px; }
/* The lens: clear glass with a lit rim, above the icons so they show through it. In motion the icon under it
   gets a faint prismatic fringe, as real glass does at speed. */
.tabs-lens { position: absolute; left: 0; top: 0; z-index: 2; border-radius: 999px; pointer-events: none;
  border: .8px solid var(--lens-rim); background: var(--lens-fill);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 2px 8px rgba(4, 25, 15, .08); }
.tabs.moving a.on .ic, .tabs.dragging a.lit .ic { filter: drop-shadow(1.2px 0 0 rgba(255, 70, 70, .55)) drop-shadow(-1.2px 0 0 rgba(70, 170, 255, .55)); }
@media (prefers-contrast: more) {
  .tabs-pill { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--glass-solid); border-color: var(--tab-ink); }
  .tabs-lens { background: none; border: 1.5px solid var(--tab-on); box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) { .tabs a { transition: none; } }

/* mini player above the tabs */
.mini { position: fixed; inset: auto 10px calc(var(--tabs-h) + env(safe-area-inset-bottom) + 8px) 10px; z-index: 11; display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 18px; color: #fff; background: var(--kufic), var(--green-700); box-shadow: 0 10px 30px rgba(4, 25, 15, .35); }
body:not(.has-tabs) .mini, body.sheet-open .mini { bottom: calc(env(safe-area-inset-bottom) + 12px); }
body.sheet-open .mini { z-index: 31; }
.mini[hidden] { display: none; }
.mini-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.mini-lead { display: contents; }
.mini-art { width: 38px; height: 38px; flex: none; border-radius: 10px; object-fit: cover; box-shadow: 0 0 0 1.5px rgba(229, 185, 92, .6); }
.mini-text { flex: 1; min-width: 0; display: grid; gap: 6px; }
.mini-text b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-text .bar { height: 4px; background: rgba(255, 255, 255, .2); }
.mini-toggle { width: 42px; height: 42px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--gold); color: var(--green-900); }
/* ✕: stop and close the bar */
.mini-close { width: 36px; height: 42px; flex: none; margin-inline-start: -4px; display: grid; place-items: center; color: rgba(255, 255, 255, .7); }
.mini-close .ic { width: 20px; height: 20px; }

/* full-screen messages: outside Telegram, loading errors */
.message { min-height: 90vh; display: grid; place-content: center; justify-items: center; gap: 14px; padding: 24px; text-align: center; }
.message h1 { font-size: 24px; color: var(--green-700); }
.message p { color: var(--muted); max-width: 30ch; }
.logo-plate { padding: 18px; border-radius: 24px; background: var(--kufic), var(--green-700); }
.logo-plate .brand { width: 96px; }
.loading { min-height: 90vh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); }
body[data-theme="dark"] .loading { color: rgb(var(--fg) / .72); }
.loading .orb { width: 64px; height: 64px; animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.08); box-shadow: 0 0 50px rgba(229, 185, 92, .7); } }

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

/* one-line alert above the tabs (e.g. session expired) */
.notice { position: fixed; inset: auto 12px calc(var(--tabs-h) + env(safe-area-inset-bottom) + 76px) 12px; z-index: 12; margin: 0;
  padding: 10px 14px; border-radius: 14px; background: var(--terracotta); color: #fff; font-size: 14px; text-align: center; }
/* Over an open sheet too («تم نسخ الرابط» and «أتممت التحدي كاملًا» are said from one), above the bottom bar when it shows */
body.sheet-open .notice { z-index: 33; bottom: calc(env(safe-area-inset-bottom) + 16px); }
body.has-mini.sheet-open .notice { bottom: calc(env(safe-area-inset-bottom) + 84px); }
