/* =========================================================
   موالي الصغير — preview prototype (v4)
   Clean, calm, premium — WHITE background · ONE blue accent
   Day mode only. No orange. No loud multi-colour.
   ========================================================= */

/* ---------- Design tokens ---------- */
:root {
  /* Surfaces — white site with at most a very light band */
  --bg:           #ffffff;   /* the page */
  --band:         #f6f7f9;   /* very light section band */
  --surface:      #ffffff;   /* cards */
  --surface-2:    #f6f7f9;   /* subtle input / fill */
  --line:         #e6e7eb;   /* hairlines */
  --line-strong:  #d6d8dd;

  /* Text — neutral grays */
  --ink:          #1a1815;   /* near-black ink */
  --ink-soft:     #5b5852;   /* muted gray for body */
  --ink-faint:    #8a877f;   /* faint captions */

  /* Primary accent — brand blue (10.83:1 on white, AAA) */
  --accent:       #0730a0;
  --accent-strong:#052680;   /* deeper for gradients / hover */
  --accent-tint:  #eef1fb;   /* very light blue chip fill */
  --accent-tint2: #e2e8f9;

  /* ONE gentle warm micro-accent — soft gold, used very sparingly */
  --gold:         #c8871a;   /* decorative fills only */
  --gold-ink:     #8a5c10;   /* gold as text (passes AA) */
  --gold-tint:    #fbf3e3;

  --radius:       22px;
  --radius-sm:    14px;
  --radius-pill:  999px;

  --shadow-c:     26, 24, 21;
  --shadow-sm:    0 1px 3px rgba(var(--shadow-c), .06), 0 1px 2px rgba(var(--shadow-c), .04);
  --shadow-md:    0 12px 28px -14px rgba(var(--shadow-c), .16);
  --shadow-lg:    0 26px 54px -22px rgba(var(--shadow-c), .22);
  --shadow-accent:0 12px 26px -12px rgba(7, 48, 160, .34);

  --font-body: "IBM Plex Sans Arabic", -apple-system, "SF Pro", system-ui, sans-serif;
  --font-display: "Baloo Bhaijaan 2", var(--font-body);

  /* line-heights: Arabic body ~1.9, display ~1.4 (tashkeel needs room) */
  --lh-body: 1.9;
  --lh-display: 1.4;

  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-back: cubic-bezier(.34, 1.4, .64, 1);
}

/* ---------- Reset / base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
body.no-scroll { overflow: hidden; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
p { margin: 0; }

.wrap { width: min(1140px, 92vw); margin-inline: auto; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: var(--lh-display); margin: 0; letter-spacing: 0; }

/* ---------- Buttons ---------- */
.btn {
  --_bg: var(--surface);
  --_fg: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-family: var(--font-display); font-weight: 700; font-size: 1rem; line-height: 1;
  padding: .82rem 1.5rem; border-radius: var(--radius-pill);
  background: var(--_bg); color: var(--_fg);
  transition: transform .22s var(--ease-back), box-shadow .22s var(--ease), background .3s var(--ease), filter .2s var(--ease);
  will-change: transform;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 3px; }

.btn--primary {
  --_bg: var(--accent);
  --_fg: #fff;
  box-shadow: var(--shadow-accent);
}
.btn--primary:hover { --_bg: var(--accent-strong); box-shadow: 0 18px 34px -14px rgba(7,48,160,.42); }

.btn--ghost {
  --_bg: transparent; --_fg: var(--ink);
  box-shadow: inset 0 0 0 1.5px var(--line-strong);
}
.btn--ghost:hover { --_bg: var(--surface-2); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 40%, var(--line-strong)); color: var(--accent); }

.btn--sm { padding: .58rem 1.1rem; font-size: .95rem; }
.btn--lg { padding: .98rem 1.8rem; font-size: 1.08rem; }
.btn--block { width: 100%; }

/* Google button */
.btn--google {
  --_bg: var(--surface); --_fg: var(--ink);
  box-shadow: inset 0 0 0 1.5px var(--line-strong), var(--shadow-sm);
  padding: .95rem 1.4rem; font-size: 1.05rem;
}
.btn--google:hover { --_bg: var(--surface-2); box-shadow: inset 0 0 0 1.5px var(--line-strong), var(--shadow-md); }
.btn--google .gicon { display: inline-grid; place-items: center; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 60;
  backdrop-filter: saturate(1.1) blur(14px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid transparent;
  transition: background .3s var(--ease), border-color .3s var(--ease), box-shadow .3s var(--ease);
}
.site-header.is-scrolled {
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border-bottom-color: var(--line);
  box-shadow: var(--shadow-sm);
}
.header-inner { display: flex; align-items: center; gap: 1rem; height: 74px; }
.brand { display: inline-flex; align-items: center; gap: .6rem; }
.brand__mark {
  width: 64px; height: 46px; object-fit: contain; /* transparent PNG wordmark — no white box */
}
.brand__name { font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; line-height: 1; color: var(--ink); }
.brand__sm { color: var(--accent); }

.nav { display: flex; gap: 2rem; margin-inline: auto; }   /* centered between logo (right) and actions (left) */
.nav a { font-weight: 600; color: var(--ink-soft); position: relative; padding: .2rem 0; transition: color .2s var(--ease); }
.nav a::after { content: ""; position: absolute; inset-inline: 0; bottom: -3px; height: 2.5px; border-radius: 3px; background: var(--accent); transform: scaleX(0); transform-origin: right; transition: transform .25s var(--ease); }
.nav a:hover { color: var(--ink); }
.nav a:hover::after { transform: scaleX(1); }

.header-actions { display: flex; align-items: center; gap: .6rem; }

/* ---------- Hero ---------- */
.hero { position: relative; z-index: 1; padding: clamp(3rem, 5vw, 5rem) 0 clamp(3.5rem, 6vw, 5.5rem);
  background: linear-gradient(180deg, #e7eefc 0%, #f0f4fd 34%, var(--bg) 66%); }
.theme-dark .hero { background: none; }
.hero__inner { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(2rem, 4vw, 4.5rem); align-items: center; }

.pill {
  display: inline-flex; align-items: center; gap: .5rem;
  background: var(--accent-tint); color: var(--accent);
  padding: .48rem .95rem; border-radius: var(--radius-pill);
  font-weight: 700; font-size: .9rem; line-height: 1;
}
.pill__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); animation: pulse 2.6s var(--ease) infinite; }

.hero__title {
  font-size: clamp(2.5rem, 6vw, 4.3rem);
  margin: 0 0 1.5rem;
  color: var(--ink);
  line-height: 1.34;            /* Arabic + tashkeel needs breathing room */
  letter-spacing: 0;
}
.hero__namewrap { display: inline-block; position: relative; }
.hero__word, .hero__type { color: var(--accent); }
.hero__type { display: none; }
.hero__namewrap.is-typing .hero__word { display: none; }
.hero__namewrap.is-typing .hero__type { display: inline; }
.hero__type::after { content: "|"; color: var(--accent); animation: caret 1s steps(1) infinite; }
.hero__namewrap.pop { animation: pop .5s var(--ease-back); }

.hero__sub { font-size: clamp(1.05rem, 1.5vw, 1.22rem); color: var(--ink-soft); max-width: 36ch; margin: 0 0 2rem; line-height: var(--lh-body); }
.hero__sub b { color: var(--accent); font-weight: 700; }

.hero__actions { display: flex; gap: .8rem; flex-wrap: wrap; margin-bottom: 2rem; }

.trust { list-style: none; display: flex; align-items: center; gap: .85rem; padding: 0; margin: 0; font-size: .9rem; color: var(--ink-soft); font-weight: 600; }
.trust .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--line-strong); }

/* Hero art */
.hero__art { position: relative; }
.storycard {
  position: relative; background: var(--surface); border-radius: var(--radius);
  padding: 12px 12px 8px; box-shadow: var(--shadow-lg);
  border: 1px solid var(--line); transform: rotate(-1.4deg);
}
.storycard__frame { position: relative; border-radius: 16px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0,0,0,.04); }
.storycard__frame img { aspect-ratio: 4/3; object-fit: cover; width: 100%; }
.storycard__badge {
  position: absolute; top: 12px; inset-inline-start: 12px;
  background: var(--accent); color: #fff; font-family: var(--font-display); font-weight: 800;
  padding: .35rem .75rem; border-radius: var(--radius-pill); font-size: .85rem; line-height: 1;
  box-shadow: var(--shadow-sm);
}
.storycard__caption { display: flex; flex-direction: column; gap: .35rem; padding: 1rem .55rem .55rem; }
.storycard__kicker { font-size: .78rem; font-weight: 800; color: var(--accent); letter-spacing: .04em; line-height: 1; }
.storycard__title { font-family: var(--font-display); font-weight: 700; font-size: 1.18rem; line-height: 1.4; color: var(--ink); }
.storycard__title .hl { color: var(--accent); }

/* floating stickers (calm, monochrome-ish) */
.sticker { position: absolute; z-index: 3; display: grid; place-items: center; }
.sticker--star { top: -18px; inset-inline-end: 24px; font-size: 1.6rem; color: var(--gold); filter: drop-shadow(0 6px 10px rgba(0,0,0,.10)); }
.sticker--heart { bottom: 64px; inset-inline-start: -18px; font-size: 1.35rem; color: var(--accent); filter: drop-shadow(0 6px 10px rgba(0,0,0,.10)); }
.sticker--dove { bottom: -24px; inset-inline-end: -14px; width: 96px; height: 96px; border-radius: 50%; overflow: hidden; border: 5px solid var(--surface); box-shadow: var(--shadow-md); }
.sticker--dove img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Generic section ---------- */
.section { position: relative; z-index: 1; padding: clamp(4rem, 7vw, 6.5rem) 0; }
.section--band { background: var(--band); }
.eyebrow { display: inline-block; font-family: var(--font-display); font-weight: 800; color: var(--accent); background: var(--accent-tint); padding: .35rem .9rem; border-radius: var(--radius-pill); font-size: .85rem; line-height: 1; margin-bottom: 1.1rem; }
.section__title { font-size: clamp(1.9rem, 3.8vw, 2.7rem); line-height: 1.4; color: var(--ink); }
.section__head { text-align: center; max-width: 46ch; margin: 0 auto clamp(2.4rem, 4vw, 3.4rem); }
.section__sub, .section__head .section__sub { color: var(--ink-soft); margin-top: 1rem; font-size: 1.1rem; line-height: var(--lh-body); }
.lead { font-size: 1.2rem; color: var(--ink); margin: 0 0 1.1rem; font-weight: 500; line-height: var(--lh-body); }
.muted { color: var(--ink-soft); margin: 0; line-height: var(--lh-body); }

/* ---------- About (من نحن) ---------- */
.about__inner { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2.5rem, 5vw, 4.5rem); align-items: center; }
.framed { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-lg); border: 8px solid var(--surface); background: var(--surface); }
.framed img { aspect-ratio: 4/3; object-fit: cover; width: 100%; }
.framed--tilt { transform: rotate(1.4deg); }

/* ---------- Vision / Why (feature cards) ---------- */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(1.2rem, 2.4vw, 1.8rem); }
.feature {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.9rem 1.6rem; box-shadow: var(--shadow-sm);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s var(--ease);
}
.feature:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--accent) 22%, var(--line)); }
.feature__icon {
  width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center;
  background: var(--accent-tint); color: var(--accent); margin-bottom: 1.15rem;
}
.feature__icon svg { width: 27px; height: 27px; }
.feature__title { font-size: 1.28rem; margin: 0 0 .55rem; line-height: 1.35; color: var(--ink); }
.feature__text { color: var(--ink-soft); margin: 0; line-height: var(--lh-body); font-size: 1rem; }

/* ---------- Library cards (marketing) ---------- */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(1.2rem, 2vw, 1.6rem); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); transition: transform .3s var(--ease), box-shadow .3s var(--ease); display: flex; flex-direction: column; }
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); }
.card__img { position: relative; overflow: hidden; }
.card__img img { aspect-ratio: 4/3; object-fit: cover; width: 100%; transition: transform .5s var(--ease); }
.card:hover .card__img img { transform: scale(1.05); }
.card__body { padding: 1.3rem 1.3rem 1.5rem; display: flex; flex-direction: column; gap: .55rem; flex: 1; }
.card__title { font-size: 1.22rem; line-height: 1.35; color: var(--ink); }
.card__text { color: var(--ink-soft); margin: 0; font-size: .96rem; line-height: 1.7; flex: 1; }
.card__cta { color: var(--accent); font-weight: 700; font-family: var(--font-display); font-size: .95rem; margin-top: .5rem; cursor: pointer; transition: opacity .2s var(--ease); }
.card:hover .card__cta { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }

.card--soon .card__img img { filter: grayscale(.5) brightness(.97); }
.card__lock { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2rem; background: linear-gradient(180deg, rgba(26,24,21,.04), rgba(26,24,21,.22)); }
.badge-soon { align-self: flex-start; background: var(--gold-tint); color: var(--gold-ink); font-family: var(--font-display); font-weight: 800; font-size: .8rem; line-height: 1; padding: .3rem .8rem; border-radius: var(--radius-pill); }

/* ---------- CTA band ---------- */
.cta { position: relative; z-index: 1; padding: clamp(3.5rem, 6vw, 5.5rem) 0; }
.cta__inner {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: .85fr 1.15fr; align-items: center; gap: clamp(1.5rem, 3vw, 2.5rem);
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  border-radius: 28px; padding: clamp(1.8rem, 3vw, 2.8rem);
  box-shadow: var(--shadow-lg);
  color: #fff;
}
.cta__art { border-radius: 20px; overflow: hidden; box-shadow: var(--shadow-md); border: 6px solid rgba(255,255,255,.22); }
.cta__art img { aspect-ratio: 4/3; object-fit: cover; width: 100%; }
.cta__title { font-size: clamp(1.8rem, 3.4vw, 2.4rem); line-height: 1.3; color: #fff; }
.cta__sub { margin: 1rem 0 1.8rem; font-size: 1.1rem; line-height: var(--lh-body); opacity: .94; }
.cta__actions { display: flex; gap: .8rem; flex-wrap: wrap; }
.cta .btn--primary { --_bg: #fff; --_fg: var(--accent); box-shadow: 0 16px 30px -16px rgba(0,0,0,.4); }
.cta .btn--primary:hover { --_bg: #fff; --_fg: var(--accent-strong); filter: brightness(.98); }
.cta .btn--ghost { --_fg: #fff; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.55); }
.cta .btn--ghost:hover { --_bg: rgba(255,255,255,.14); --_fg: #fff; }

/* =========================================================
   FOOTER — full, tidy, professional
   ========================================================= */
.site-footer { position: relative; z-index: 1; background: var(--band); border-top: 1px solid var(--line); }
.footer-top { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: clamp(2rem, 4vw, 3.4rem); padding: clamp(3rem, 5vw, 4.2rem) 0 clamp(2.4rem, 4vw, 3rem); }
.footer__brand { max-width: 34ch; }
.footer__mark { width: 58px; height: 40px; object-fit: contain; margin-bottom: 1rem; } /* transparent PNG — no white box */
.footer__tag { margin: 0 0 1.2rem; color: var(--ink-soft); line-height: var(--lh-body); }
.footer__social { display: flex; gap: .7rem; }
.footer__soc {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  color: var(--accent); background: var(--surface); border: 1px solid var(--line);
  transition: transform .2s var(--ease-back), background .2s var(--ease), color .2s var(--ease), border-color .2s;
}
.footer__soc:hover { transform: translateY(-2px); background: var(--accent); color: #fff; border-color: var(--accent); }
.footer__soc svg { width: 20px; height: 20px; }

.footer__col h4 { font-family: var(--font-display); font-weight: 800; font-size: 1rem; color: var(--ink); margin: .2rem 0 1.1rem; }
.footer__col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.footer__col a { color: var(--ink-soft); font-size: .96rem; transition: color .2s var(--ease); }
.footer__col a:hover { color: var(--accent); }

.footer-bottom { border-top: 1px solid var(--line); padding: 1.5rem 0; }
.footer-bottom .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem 1.6rem; flex-wrap: wrap; }
.footer__copy { color: var(--ink-soft); font-size: .88rem; margin: 0; }
.footer__legal { display: flex; align-items: center; gap: 1.2rem; }
.footer__legal a { color: var(--ink-soft); font-size: .88rem; transition: color .2s var(--ease); }
.footer__legal a:hover { color: var(--accent); }
.footer__made { color: var(--ink-faint); font-size: .85rem; margin: 0; }
.footer__made .heart { color: var(--gold-ink); }

/* =========================================================
   AUTH MODAL (multi-step)
   ========================================================= */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 1.2rem; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(20,22,34,.42); backdrop-filter: blur(5px); animation: fade .25s var(--ease); }
.modal__card { position: relative; width: min(430px, 94vw); background: var(--surface); border-radius: 26px; box-shadow: var(--shadow-lg); text-align: center; animation: modalIn .4s var(--ease-back); border: 1px solid var(--line); overflow: hidden; }
.modal__close { position: absolute; top: 14px; inset-inline-end: 16px; z-index: 5; font-size: 1.5rem; color: var(--ink-soft); line-height: 1; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; transition: background .2s; }
.modal__close:hover { background: var(--surface-2); }
.modal__mark { width: 60px; height: 42px; object-fit: contain; margin: 0 auto 1rem; } /* transparent PNG — no white box */
.modal__title { font-size: 1.5rem; line-height: 1.35; color: var(--ink); }
.modal__sub { color: var(--ink-soft); margin: .7rem 0 0; font-size: .98rem; line-height: 1.7; }
.modal__sub b { color: var(--ink); font-weight: 700; }

/* stepped viewport: only active step shown */
.auth__viewport { position: relative; }
.auth__step { display: none; padding: 2.4rem 2rem 2.2rem; animation: stepIn .35s var(--ease); }
.auth__step.is-active { display: block; }

.auth__form { display: grid; gap: .9rem; margin-top: 1.6rem; text-align: start; }
.auth__label { font-weight: 700; font-size: .9rem; color: var(--ink-soft); margin: 0 .2rem -.2rem; }
.auth__input {
  font-family: var(--font-body); font-size: 1.05rem; font-weight: 600;
  padding: .9rem 1.1rem; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease);
  width: 100%;
}
.auth__input::placeholder { color: var(--ink-faint); font-weight: 500; }
.auth__input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent); }
.auth__input--big { font-size: 1.2rem; text-align: center; padding: 1rem 1.1rem; }

.auth__divider { display: flex; align-items: center; gap: 1rem; color: var(--ink-faint); font-size: .9rem; font-weight: 600; margin: 1.5rem 0 0; }
.auth__divider::before, .auth__divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.auth__back { position: absolute; top: 14px; inset-inline-start: 16px; z-index: 5; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-soft); transition: background .2s; }
.auth__back svg { transform: scaleX(1); }
.auth__back:hover { background: var(--surface-2); }

.auth__resend { margin: 1.2rem 0 0; color: var(--ink-soft); font-size: .92rem; }
.auth__resend .link { color: var(--accent); font-weight: 700; cursor: pointer; }
.auth__resend .link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* code inputs */
.code { display: flex; gap: .6rem; justify-content: center; margin: 1.8rem 0; direction: ltr; }
.code__box {
  width: 52px; height: 62px; text-align: center;
  font-family: var(--font-display); font-weight: 800; font-size: 1.6rem; color: var(--ink);
  border: 1.5px solid var(--line-strong); border-radius: 14px; background: var(--surface);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease), transform .18s var(--ease-back);
}
.code__box:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent); transform: translateY(-2px); }
.code__box.filled { border-color: color-mix(in srgb, var(--accent) 55%, var(--line-strong)); }

/* step 3 hero image */
.auth__step--name .auth__hero { width: 120px; height: 120px; margin: 0 auto 1.2rem; border-radius: 50%; overflow: hidden; border: 5px solid var(--surface); box-shadow: var(--shadow-md); background: var(--accent-tint); }
.auth__step--name .auth__hero img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }

/* =========================================================
   LIBRARY SCREEN (after login)
   ========================================================= */
.app-screen { position: fixed; inset: 0; z-index: 90; background: var(--bg); overflow-y: auto; animation: appIn .45s var(--ease); }
.app-screen[hidden] { display: none; }

.appbar { position: sticky; top: 0; z-index: 5; backdrop-filter: saturate(1.1) blur(14px); background: color-mix(in srgb, var(--bg) 90%, transparent); border-bottom: 1px solid var(--line); }
.appbar__inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 72px; }
.appbar__user { display: flex; align-items: center; gap: .7rem; }
.appbar__chip { display: inline-flex; align-items: center; gap: .5rem; background: var(--surface); border: 1px solid var(--line); padding: .5rem .95rem; border-radius: var(--radius-pill); font-family: var(--font-display); font-weight: 700; font-size: .95rem; box-shadow: var(--shadow-sm); }
.appbar__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
.appbar__chip b { color: var(--accent); }

.library-screen { padding: clamp(2.2rem, 4vw, 3.6rem) 0 5rem; }
.shelf-head { text-align: center; margin-bottom: clamp(2.4rem, 4vw, 3.6rem); }
.shelf-greeting { font-size: clamp(2rem, 4.5vw, 2.9rem); line-height: 1.3; color: var(--ink); }
.shelf-greeting span#greetName { color: var(--accent); }
.shelf-wave { display: inline-block; animation: wave 2.4s var(--ease) infinite; transform-origin: 70% 70%; }
.shelf-sub { color: var(--ink-soft); margin-top: 1rem; font-size: 1.1rem; line-height: var(--lh-body); }

/* bookshelf */
.shelf { position: relative; margin-top: 1rem; }
.shelf__row { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(1.4rem, 3vw, 2.6rem); align-items: end; justify-items: center; padding: 0 1rem 1.2rem; }
.shelf__plank { height: 18px; border-radius: 8px; background: linear-gradient(180deg, var(--line), var(--line-strong)); box-shadow: 0 14px 24px -16px rgba(var(--shadow-c), .4), inset 0 1px 0 rgba(255,255,255,.6); }

/* a book */
.book-item { width: 100%; max-width: 190px; }
.bookcover {
  position: relative; width: 100%; aspect-ratio: 3/4;
  border-radius: 6px 12px 12px 6px; overflow: hidden;
  box-shadow: var(--shadow-md), -6px 0 0 -1px color-mix(in srgb, var(--ink) 10%, transparent);
  background: var(--surface); cursor: pointer;
  transform-origin: bottom center;
  transition: transform .35s var(--ease-back), box-shadow .35s var(--ease);
  border: 1px solid var(--line);
}
/* spine */
.bookcover::before { content: ""; position: absolute; top: 0; bottom: 0; inset-inline-end: 0; width: 12px; background: linear-gradient(90deg, rgba(0,0,0,.14), rgba(0,0,0,0)); z-index: 3; pointer-events: none; }
.bookcover::after { content: ""; position: absolute; inset: 0; z-index: 2; background: linear-gradient(180deg, rgba(0,0,0,0) 48%, rgba(10,12,26,.55)); pointer-events: none; }
.bookcover img { width: 100%; height: 100%; object-fit: cover; }
.bookcover__title { position: absolute; z-index: 4; inset-inline: 12px; bottom: 12px; color: #fff; font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; line-height: 1.35; text-shadow: 0 2px 8px rgba(0,0,0,.5); text-align: start; }
.book-item:hover .bookcover, .book-item:focus-within .bookcover { transform: translateY(-12px) rotate(-1.4deg) scale(1.02); box-shadow: var(--shadow-lg), -6px 0 0 -1px color-mix(in srgb, var(--ink) 12%, transparent); }
.book-item__label { margin-top: .9rem; text-align: center; font-family: var(--font-display); font-weight: 700; font-size: 1rem; line-height: 1.4; color: var(--ink); }
.book-item__sub { display: block; color: var(--ink-soft); font-weight: 600; font-size: .82rem; margin-top: .25rem; }

/* locked book */
.book-item--locked .bookcover { cursor: not-allowed; }
.book-item--locked .bookcover img { filter: grayscale(.55) brightness(.9); }
.book-item--locked:hover .bookcover { transform: none; }
.bookcover__lock { position: absolute; z-index: 5; top: 10px; inset-inline-start: 10px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: rgba(10,12,26,.55); color: #fff; font-size: 1rem; backdrop-filter: blur(2px); }
.bookcover__soon { position: absolute; z-index: 5; top: 12px; inset-inline-end: 18px; background: var(--gold-tint); color: var(--gold-ink); font-family: var(--font-display); font-weight: 800; font-size: .72rem; line-height: 1; padding: .28rem .65rem; border-radius: var(--radius-pill); }

/* =========================================================
   BOOK READER (page-flip)
   ========================================================= */
.reader { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: clamp(1rem, 3vw, 2rem); }
.reader[hidden] { display: none; }
.reader__backdrop { position: absolute; inset: 0; background: rgba(12,14,26,.72); backdrop-filter: blur(6px); animation: fade .3s var(--ease); }
.reader__close { position: absolute; top: max(18px, env(safe-area-inset-top)); inset-inline-end: 22px; z-index: 10; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 1.7rem; color: #fff; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22); transition: background .2s, transform .2s var(--ease-back); }
.reader__close:hover { background: rgba(255,255,255,.26); transform: rotate(90deg); }

.reader__stage { position: relative; z-index: 2; display: flex; align-items: center; gap: clamp(.5rem, 2vw, 1.6rem); animation: modalIn .4s var(--ease-back); }

.reader__nav { flex: 0 0 auto; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; color: var(--accent); background: var(--surface); box-shadow: var(--shadow-md); transition: transform .2s var(--ease-back), box-shadow .2s var(--ease), opacity .2s; }
.reader__nav:hover { transform: scale(1.08); box-shadow: var(--shadow-lg); }
.reader__nav[disabled] { opacity: .3; pointer-events: none; }

/* the book — 3D flip stage */
.book {
  position: relative;
  width: min(72vw, 560px);
  aspect-ratio: 3/4;
  max-height: 78vh;
  perspective: 2200px;
}
.book__pages { position: absolute; inset: 0; transform-style: preserve-3d; }

.page {
  position: absolute; inset: 0;
  background: var(--surface); color: var(--ink);
  border-radius: 8px 16px 16px 8px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform-origin: left center;      /* RTL: pages hinge on the left */
  transform: rotateY(0deg);
  transition: transform .8s var(--ease);
  backface-visibility: hidden;
  display: flex; flex-direction: column;
  border: 1px solid var(--line);
}
.page.is-flipped { transform: rotateY(-178deg); }

.page__img { flex: 1 1 58%; overflow: hidden; background: var(--accent-tint); }
.page__img img { width: 100%; height: 100%; object-fit: cover; }
.page__body { flex: 0 0 auto; padding: clamp(1.1rem, 2.4vw, 1.8rem) clamp(1.3rem, 3vw, 2rem) clamp(1.4rem, 3vw, 2rem); display: flex; flex-direction: column; gap: .6rem; background: var(--surface); }
.page__kicker { font-family: var(--font-display); font-weight: 800; font-size: .78rem; letter-spacing: .04em; color: var(--accent); line-height: 1; }
.page__text { font-size: clamp(1.02rem, 1.5vw, 1.16rem); line-height: var(--lh-body); color: var(--ink); }
.page__text .hl { color: var(--accent); font-weight: 700; }

/* cover page look */
.page--cover .page__img { flex: 1 1 100%; }
.page--cover .page__body { position: absolute; inset-inline: 0; bottom: 0; background: linear-gradient(180deg, transparent, rgba(10,12,26,.8)); color: #fff; gap: .5rem; }
.page--cover .page__kicker { color: rgba(255,255,255,.85); }
.page--cover .page__title { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.6rem, 3vw, 2.2rem); line-height: 1.3; color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,.4); }
.page--cover .page__by { color: rgba(255,255,255,.9); font-weight: 600; font-size: .98rem; }
.page--cover .page__by .hl { color: #fff; text-decoration: underline; text-decoration-color: rgba(255,255,255,.5); text-underline-offset: 3px; }

/* end page */
.page--end { align-items: center; justify-content: center; text-align: center; }
.page--end .page__img { flex: 0 0 auto; width: 90px; height: 90px; margin: 0 auto; border-radius: 50%; }
.page--end .page__body { align-items: center; text-align: center; }
.page--end .page__title { font-family: var(--font-display); font-weight: 800; font-size: 1.6rem; line-height: 1.35; color: var(--ink); }

/* page turn edge hint */
.page__edge { position: absolute; top: 0; bottom: 0; width: 18%; z-index: 6; cursor: pointer; }
.page__edge--next { inset-inline-start: 0; }
.page__edge--prev { inset-inline-end: 0; }

.reader__dots { position: relative; z-index: 3; display: flex; gap: .5rem; justify-content: center; margin-top: 1.4rem; }
.reader__dot { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.35); transition: background .3s var(--ease), transform .3s var(--ease-back); }
.reader__dot.is-active { background: #fff; transform: scale(1.35); }

/* ---------- Animations ---------- */
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 28%, transparent); } 50% { box-shadow: 0 0 0 7px transparent; } }
@keyframes caret { 50% { opacity: 0; } }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.1); } 100% { transform: scale(1); } }
@keyframes fade { from { opacity: 0; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes stepIn { from { opacity: 0; transform: translateX(-14px); } }
@keyframes appIn { from { opacity: 0; transform: scale(1.01); } }
@keyframes wave { 0%,60%,100% { transform: rotate(0); } 20% { transform: rotate(16deg); } 40% { transform: rotate(-8deg); } }

@keyframes bob { 0%,100% { transform: translateY(0) rotate(var(--rot, 0deg)); } 50% { transform: translateY(-10px) rotate(var(--rot, 0deg)); } }
.float { animation: bob 6s var(--ease) infinite; }
.storycard.float { --rot: -1.4deg; }
.framed--tilt.float { --rot: 1.4deg; }
.float-slow { animation: bob 7s var(--ease) infinite; }
.float-slower { animation: bob 8.5s var(--ease) infinite; }

/* Scroll reveal */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s var(--ease), transform .7s var(--ease); transition-delay: calc(var(--i, 0) * 90ms); }
.reveal--right { transform: translateY(16px) translateX(22px); }
.reveal.is-in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 940px) {
  .nav { display: none; }
  .header-actions { margin-inline-start: auto; }   /* push actions to the far edge when nav is hidden */
  .hero__inner { grid-template-columns: 1fr; }
  .hero__art { margin-top: 1.5rem; max-width: 500px; }
  .about__inner { grid-template-columns: 1fr; }
  .about__art { order: 2; }
  .features { grid-template-columns: 1fr; max-width: 460px; margin-inline: auto; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .steps__row { grid-template-columns: 1fr; max-width: 440px; margin-inline: auto; gap: 2.4rem; }
  .board { grid-template-columns: repeat(2, 1fr); }
  .cta__inner { grid-template-columns: 1fr; }
  .cta__art { order: 2; max-width: 360px; }
  .shelf__row { grid-template-columns: repeat(3, 1fr); }
  .footer-top { grid-template-columns: 1fr 1fr; }
  .footer__brand { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .hide-mobile { display: none; }
  .hero { padding-top: 1.8rem; }
  .hero__actions { flex-direction: column; align-items: stretch; }
  .hero__actions .btn { width: 100%; }
  .cards { grid-template-columns: 1fr; }
  .footer-top { grid-template-columns: 1fr; text-align: start; }
  .footer-bottom .wrap { flex-direction: column; align-items: flex-start; gap: .8rem; }

  .shelf__row { grid-template-columns: repeat(2, 1fr); gap: 1.4rem 1.1rem; }
  .book-item { max-width: none; }
  .appbar__chip { display: none; }

  .code__box { width: 44px; height: 54px; font-size: 1.35rem; }
  .book { width: 84vw; max-height: 72vh; }
  .reader__nav { width: 44px; height: 44px; }
  .reader__stage { gap: .3rem; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}

/* =========================================================
   v5 additions — richer hero scene, "قريباً" states,
   closed-registration modal.  Blue primary + gold companion.
   ========================================================= */

/* Hero backdrop glow */
.hero { overflow: hidden; }
.hero__inner { position: relative; z-index: 1; }

/* ---------- soft drifting clouds (children's-story ambiance) ---------- */
.clouds { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.cloud { position: absolute; background: #fff; border-radius: 100px;
  box-shadow: 0 10px 30px -8px rgba(7, 48, 160, .10); will-change: transform; }
.cloud::before, .cloud::after { content: ""; position: absolute; background: #fff; border-radius: 50%; }
.cloud::before { width: 58%; height: 150%; top: -60%; inset-inline-start: 14%; }
.cloud::after  { width: 40%; height: 120%; top: -44%; inset-inline-start: 52%; }
.cloud--1 { width: 130px; height: 40px; top: 8%;  inset-inline-end: -170px; opacity: .95; animation: drift 48s linear infinite; }
.cloud--2 { width: 92px;  height: 30px; top: 20%; inset-inline-end: -170px; opacity: .8;  animation: drift 66s linear infinite; animation-delay: -22s; }
.cloud--3 { width: 168px; height: 50px; top: 33%; inset-inline-end: -200px; opacity: .72; animation: drift 84s linear infinite; animation-delay: -46s; }
.cloud--4 { width: 80px;  height: 26px; top: 15%; inset-inline-end: -150px; opacity: .7;  animation: drift 58s linear infinite; animation-delay: -12s; }
@keyframes drift { to { transform: translateX(calc(-100vw - 360px)); } }
@media (prefers-reduced-motion: reduce) { .cloud { animation: none; } }
.rm .cloud { animation: none; }
.hero__glow {
  position: absolute; z-index: 0; inset-inline-end: -12%; top: -24%;
  width: 62vw; height: 62vw; max-width: 760px; max-height: 760px;
  background:
    radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--accent) 15%, transparent), transparent 60%),
    radial-gradient(circle at 70% 70%, color-mix(in srgb, var(--gold) 12%, transparent), transparent 60%);
  pointer-events: none;
}

/* Hero illustration — tidy framed card (square-ish, gently tilted) */
.hero__frame {
  position: relative; z-index: 2; max-width: 440px; margin-inline: auto;
  background: var(--surface);
  border: 9px solid var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  transform: rotate(-1.6deg);
}
.hero__frame::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px var(--line); pointer-events: none; }
.hero__frame img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 14px; }
.hero__frame.float { --rot: -1.6deg; }

.sticker--spark { top: 40%; inset-inline-start: -6px; font-size: 1.5rem; color: var(--gold); filter: drop-shadow(0 6px 10px rgba(0,0,0,.10)); }

/* "قريباً" empty state (قصصنا) */
.soon {
  max-width: 640px; margin-inline: auto; text-align: center;
  background: linear-gradient(180deg, var(--band), var(--surface));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(2.4rem, 5vw, 3.6rem) 1.5rem clamp(2.2rem, 4vw, 3rem);
  box-shadow: var(--shadow-sm);
}
.soon__art { position: relative; width: 168px; height: 118px; margin: 0 auto 1.7rem; }
.soon__ring { position: absolute; inset: 0; margin: auto; width: 128px; height: 128px; border-radius: 50%; background: radial-gradient(circle, var(--accent-tint), transparent 68%); }
.soon__book { position: absolute; bottom: 10px; width: 42px; height: 58px; border-radius: 4px 9px 9px 4px; box-shadow: var(--shadow-md); }
.soon__book--a { inset-inline-start: 34px; background: linear-gradient(160deg, var(--accent), var(--accent-strong)); transform: rotate(-9deg); animation: bob 6s var(--ease) infinite; }
.soon__book--b { inset-inline-start: 63px; height: 66px; z-index: 3; background: linear-gradient(160deg, var(--gold), var(--gold-ink)); animation: bob 6s var(--ease) .45s infinite; }
.soon__book--c { inset-inline-start: 92px; background: linear-gradient(160deg, #4f74d8, var(--accent)); transform: rotate(9deg); animation: bob 6s var(--ease) .9s infinite; }
.soon__spark { position: absolute; }
.soon__spark--1 { top: -4px; inset-inline-end: 30px; font-size: 1.1rem; color: var(--gold); animation: twinkle 2.8s ease-in-out infinite; }
.soon__spark--2 { top: 14px; inset-inline-start: 12px; font-size: .9rem; color: var(--accent); animation: twinkle 2.8s ease-in-out .9s infinite; }
.soon .badge-soon { margin: 0 auto 1rem; }
.soon__title { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.4rem, 3vw, 1.95rem); color: var(--ink); margin: 0 0 .6rem; line-height: 1.35; }
.soon__text { color: var(--ink-soft); max-width: 46ch; margin: 0 auto; line-height: var(--lh-body); }

@keyframes twinkle { 0%,100% { opacity: .3; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.15); } }

/* Registration-closed modal panel */
.closed { padding: 2.8rem 2rem 2.1rem; text-align: center; }
.closed__icon {
  width: 62px; height: 62px; margin: 0 auto 1.1rem; border-radius: 18px;
  display: grid; place-items: center; background: var(--accent-tint); color: var(--accent);
}
.closed .modal__title { margin-top: .2rem; }
.closed .btn { margin-top: .85rem; }

/* Footer "قريباً" chip */
.footer__soon {
  display: inline-block; margin-inline-start: .45rem; vertical-align: middle;
  background: var(--gold-tint); color: var(--gold-ink);
  font-family: var(--font-display); font-weight: 800; font-size: .68rem; line-height: 1;
  padding: .18rem .55rem; border-radius: var(--radius-pill);
}

/* =========================================================
   v6 — hero-name caption, mission band, spacing rhythm
   ========================================================= */

/* Stacked-text rhythm (fixes cramped, touching paragraphs) */
.about__copy p + p { margin-top: 1rem; }
.hero__sub { margin-bottom: 2.2rem; }
.section__head .section__sub { margin-top: 1.1rem; }

/* Hero illustration — animated child-name caption inside the frame */
.hero__frame { overflow: hidden; }
.hero__cap {
  position: absolute; z-index: 3; inset-inline: 12px; bottom: 12px;
  display: flex; flex-direction: column; gap: .2rem;
  padding: .75rem .95rem; border-radius: 14px;
  background: linear-gradient(180deg, rgba(7,20,60,0), rgba(5,16,48,.88));
  color: #fff; text-align: start;
}
.hero__cap-k { font-family: var(--font-display); font-weight: 700; font-size: .74rem; letter-spacing: .02em; color: rgba(255,255,255,.82); line-height: 1.2; }
.hero__name { font-family: var(--font-display); font-weight: 800; font-size: 1.55rem; line-height: 1.25; color: #fff; }
.hero__name.swap { animation: nameSwap .5s var(--ease-back); }
@keyframes nameSwap { 0% { opacity: 0; transform: translateY(9px) scale(.92); } 100% { opacity: 1; transform: none; } }

/* Mission band — emotional core */
.mission { position: relative; overflow: hidden; z-index: 1;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff; padding: clamp(3rem, 6.5vw, 5rem) 0; text-align: center; }
.mission__glow { position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(60% 90% at 50% -10%, rgba(240,182,64,.26), transparent 62%); }
.mission__inner { position: relative; z-index: 1; max-width: 780px; margin-inline: auto; padding-inline: 1rem; }
.mission__eyebrow { display: inline-block; font-family: var(--font-display); font-weight: 800;
  font-size: .85rem; letter-spacing: .06em; color: var(--gold);
  background: rgba(255,255,255,.12); padding: .38rem .95rem; border-radius: var(--radius-pill); margin-bottom: 1.5rem; }
.mission__line { font-family: var(--font-display); font-weight: 800;
  font-size: clamp(1.7rem, 4.4vw, 3rem); line-height: 1.55; margin: 0; color: #fff; }
.mission__hl { color: var(--gold); }
.mission__salawat { display: block; margin-top: .7rem; font-size: clamp(.95rem, 1.8vw, 1.25rem); font-weight: 700; color: rgba(255,255,255,.9); letter-spacing: .01em; }
.mission__sub { margin: 1.5rem auto 0; max-width: 46ch;
  font-size: clamp(1rem, 1.6vw, 1.16rem); line-height: var(--lh-body); color: rgba(255,255,255,.9); }

/* =========================================================
   v6 — how-it-works steps + professional stories board
   ========================================================= */

/* Steps */
.steps__row { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(1.4rem, 2.8vw, 2.2rem); }
.step { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 2.6rem 1.6rem 1.9rem; text-align: center; box-shadow: var(--shadow-sm);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s var(--ease); }
.step:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--accent) 22%, var(--line)); }
.step__num { position: absolute; top: -22px; inset-inline: 0; margin-inline: auto; width: 46px; height: 46px; border-radius: 50%;
  background: linear-gradient(160deg, var(--accent), var(--accent-strong)); color: #fff;
  font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; display: grid; place-items: center;
  box-shadow: var(--shadow-accent); }
.step__icon { width: 56px; height: 56px; margin: .4rem auto 1.1rem; border-radius: 16px; display: grid; place-items: center;
  background: var(--accent-tint); color: var(--accent); }
.step__icon svg { width: 28px; height: 28px; }
.step__title { font-size: 1.28rem; margin: 0 0 .5rem; color: var(--ink); }
.step__text { color: var(--ink-soft); margin: 0; line-height: var(--lh-body); font-size: 1rem; }

/* Stories board (all "قريباً") */
.board { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(1.1rem, 2vw, 1.6rem); }
.scard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm); transition: transform .35s var(--ease-back), box-shadow .35s var(--ease); }
.scard:hover { transform: translateY(-7px) rotate(-.6deg); box-shadow: var(--shadow-lg); }
.scard__cover { position: relative; aspect-ratio: 3 / 4; overflow: hidden; }
.scard__cover img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(.28) brightness(.9); transition: transform .55s var(--ease), filter .4s var(--ease); }
.scard:hover .scard__cover img { transform: scale(1.06); filter: grayscale(.1) brightness(.96); }
.scard__cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(7,20,60,.06), rgba(7,20,60,.5)); }
.scard__badge { position: absolute; z-index: 2; top: 12px; inset-inline-start: 12px;
  font-family: var(--font-display); font-weight: 800; font-size: .72rem; line-height: 1; color: #fff;
  padding: .32rem .72rem; border-radius: var(--radius-pill); box-shadow: 0 4px 12px -4px rgba(0,0,0,.4); }
.scard__badge--karbala { background: var(--accent-strong); }
.scard__badge--values  { background: var(--gold-ink); }
.scard__badge--ahl     { background: var(--accent); }
.scard__badge--arbaeen { background: #34518f; }
.scard__lock { position: absolute; z-index: 3; inset: 0; margin: auto; width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(255,255,255,.92); color: var(--accent); box-shadow: var(--shadow-md);
  transition: transform .3s var(--ease-back); }
.scard:hover .scard__lock { transform: scale(1.1); }
.scard__body { padding: .95rem 1.05rem 1.15rem; }
.scard__title { font-family: var(--font-display); font-weight: 800; font-size: 1.06rem; color: var(--ink); margin: 0 0 .5rem; line-height: 1.4; }
.scard__soon { display: flex; align-items: center; gap: .45rem; color: var(--gold-ink); font-weight: 700; font-size: .85rem; margin: 0; }
.dotpulse { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); animation: pulse2 1.9s var(--ease) infinite; }
@keyframes pulse2 { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--gold) 55%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.board__note { margin-top: clamp(1.8rem, 3vw, 2.6rem); display: flex; align-items: center; justify-content: center; gap: 1.1rem; flex-wrap: wrap; text-align: center; }
.board__note p { color: var(--ink-soft); margin: 0; }

/* =========================================================
   v6 — login profile step, progress bar, medal, reader name
   ========================================================= */

/* progress bar at top of the auth card */
.auth__progress { height: 4px; background: var(--surface-2); border-radius: 3px 3px 0 0; overflow: hidden; }
.auth__bar { display: block; height: 100%; width: 33%; background: linear-gradient(90deg, var(--accent), var(--gold)); transition: width .45s var(--ease); }

/* step 1 fine print */
.auth__err { margin: .9rem 0 0; font-size: .9rem; font-weight: 600; color: #d1372b; text-align: center; }
.auth__fine { margin: 1.1rem 0 0; font-size: .78rem; color: var(--ink-faint); line-height: 1.7; text-align: center; }
.auth__fine a { color: var(--ink-soft); text-decoration: underline; text-underline-offset: 2px; }

/* step 3 — child profile picker */
.auth__grouplbl { display: block; text-align: start; font-family: var(--font-display); font-weight: 700; font-size: .85rem; color: var(--ink-soft); margin: .5rem .2rem -.3rem; }
.pick { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.pick__opt { position: relative; border: 1.5px solid var(--line-strong); background: var(--surface); border-radius: var(--radius-sm);
  padding: .5rem; display: flex; flex-direction: column; align-items: center; gap: .45rem; cursor: pointer;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), transform .15s var(--ease-back); }
.pick__opt:hover { transform: translateY(-2px); }
.pick__opt img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; object-position: center 18%; border-radius: 10px; }
.pick__opt span { font-family: var(--font-display); font-weight: 700; font-size: .95rem; color: var(--ink); }
.pick__opt.is-sel { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.pick__opt.is-sel::after { content: "✓"; position: absolute; top: 8px; inset-inline-end: 8px; width: 22px; height: 22px;
  border-radius: 50%; background: var(--accent); color: #fff; font-size: .78rem; display: grid; place-items: center; }
.chips { display: flex; gap: .5rem; }
.chip { flex: 1; border: 1.5px solid var(--line-strong); background: var(--surface); border-radius: var(--radius-pill);
  padding: .58rem .5rem; font-family: var(--font-display); font-weight: 700; color: var(--ink-soft);
  transition: border-color .2s var(--ease), background .2s var(--ease), color .2s var(--ease); }
.chip:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line-strong)); }
.chip.is-sel { border-color: var(--accent); background: var(--accent-tint); color: var(--accent); }

/* reader — child name in gold (the "name = gold" rule), medal end page */
.page__text .hl { color: var(--gold-ink); font-weight: 700; }
.page--end .medal { color: var(--gold); margin-bottom: .2rem; filter: drop-shadow(0 8px 12px color-mix(in srgb, var(--gold) 42%, transparent)); animation: medalPop .6s var(--ease-back); }
@keyframes medalPop { 0% { transform: scale(.4) rotate(-14deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
.book-item { transition: opacity .5s var(--ease), transform .5s var(--ease); }

/* =========================================================
   v7 — account avatar, Apple-style settings, avatar picker,
   offline screen, dark mode + font size, premium auth
   ========================================================= */

/* auth — more premium */
.modal__card.auth { width: min(462px, 94vw); }
.auth__step { padding: 2.3rem 1.9rem 2rem; }
/* transparent logo — NO box (brand rule) */
.modal__mark { width: 84px; height: 58px; margin: 0 auto 1.2rem; padding: 0; background: none; box-shadow: none; border-radius: 0; object-fit: contain; }
.auth__input { background: var(--surface-2); border: 1.5px solid transparent; border-radius: 14px; min-height: 56px; }
.auth__input:focus { background: var(--surface); border-color: var(--accent); }
/* premium tap targets */
.auth__form .btn, .btn--google.btn--block { min-height: 56px; font-size: 1.04rem; }
.auth__form { gap: 1rem; }
.avatar-strip { display: flex; gap: .55rem; overflow-x: auto; padding: .15rem .1rem .5rem; scroll-snap-type: x mandatory; }
.avatar-strip .avatar-opt { flex: 0 0 54px; width: 54px; scroll-snap-align: center; }

/* account avatar button (appbar) */
.avatar-btn { width: 44px; height: 44px; border-radius: 50%; overflow: hidden; padding: 0;
  border: 2px solid var(--line); background: var(--surface); box-shadow: var(--shadow-sm);
  transition: transform .2s var(--ease-back), box-shadow .2s var(--ease), border-color .2s var(--ease); }
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-btn:hover { transform: translateY(-1px) scale(1.06); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }

/* sheet (settings / picker) */
.sheet { position: fixed; inset: 0; z-index: 130; display: flex; justify-content: center; align-items: flex-start; padding: 3vh 1rem; }
.sheet[hidden] { display: none; }
.sheet__backdrop { position: absolute; inset: 0; background: rgba(16,20,34,.5); backdrop-filter: blur(6px); animation: fade .25s var(--ease); }
.sheet__panel { position: relative; z-index: 1; width: min(520px, 96vw); max-height: 94vh; background: var(--band);
  border-radius: 24px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--line); animation: modalIn .4s var(--ease-back); }
.sheet__panel--sm { width: min(440px, 96vw); }
.sheet__bar { display: flex; align-items: center; gap: .5rem; padding: .85rem 1rem; position: sticky; top: 0; z-index: 2;
  background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: saturate(1.1) blur(12px); border-bottom: 1px solid var(--line); }
.sheet__title { flex: 1; text-align: center; font-family: var(--font-display); font-weight: 800; font-size: 1.12rem; color: var(--ink); margin: 0; }
.sheet__close { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); color: var(--ink-soft); font-size: .95rem; display: grid; place-items: center; transition: background .15s; }
.sheet__close:hover { background: var(--line); color: var(--ink); }
.sheet__spacer { width: 32px; }
.sheet__scroll { overflow-y: auto; padding: 1.1rem 1.1rem 1.6rem; }

/* profile card */
.profile-card { text-align: center; padding: .4rem 0 1.3rem; }
.profile-card__avatar { position: relative; width: 96px; height: 96px; margin: 0 auto .85rem; display: block; padding: 0; background: none; }
.profile-card__avatar img { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; border: 3px solid var(--surface); box-shadow: var(--shadow-md); }
.profile-card__edit { position: absolute; bottom: 0; inset-inline-end: 0; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: #fff; display: grid; place-items: center; border: 2px solid var(--band); box-shadow: var(--shadow-sm); }
.profile-card__name { font-family: var(--font-display); font-weight: 800; font-size: 1.4rem; color: var(--ink); margin: 0 0 .25rem; }
.profile-card__change { color: var(--accent); font-weight: 700; font-size: .9rem; }
.profile-card__change:hover { text-decoration: underline; text-underline-offset: 3px; }

/* settings groups (iOS) */
.settings-group { margin-bottom: 1.3rem; }
.settings-group__label { display: block; font-size: .78rem; font-weight: 700; color: var(--ink-faint); margin: 0 .85rem .5rem; }
.settings-list { background: var(--surface); border-radius: 16px; border: 1px solid var(--line); box-shadow: var(--shadow-sm); overflow: hidden; }
.srow { display: flex; align-items: center; gap: .75rem; width: 100%; text-align: start; padding: .82rem .9rem;
  border-bottom: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 1rem; font-family: var(--font-body); }
.srow:last-child { border-bottom: 0; }
.srow__ic { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 9px; background: var(--c, #888); display: grid; place-items: center; }
.srow__t { flex: 1; font-weight: 600; }
.srow__v { color: var(--ink-faint); font-weight: 600; font-size: .92rem; }
.srow__chev { color: var(--ink-faint); font-size: 1.3rem; line-height: 1; }
button.srow, a.srow { cursor: pointer; transition: background .15s var(--ease); }
button.srow:hover, a.srow:hover { background: var(--surface-2); }
.srow--col { flex-direction: column; align-items: stretch; gap: .7rem; }
.srow__line { display: flex; align-items: center; gap: .75rem; }
.srow--danger { justify-content: center; color: #d1372b; font-weight: 800; }
.srow--danger:hover { background: color-mix(in srgb, #d1372b 9%, var(--surface)); }
.settings-ver { text-align: center; color: var(--ink-faint); font-size: .8rem; margin: .3rem 0 0; }

/* iOS switch */
.switch { position: relative; display: inline-block; width: 46px; height: 28px; flex: 0 0 auto; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch__k { position: absolute; inset: 0; background: var(--line-strong); border-radius: 999px; transition: background .25s var(--ease); }
.switch__k::before { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.28); transition: transform .25s var(--ease-back); }
.switch input:checked + .switch__k { background: #34c759; }
.switch input:checked + .switch__k::before { transform: translateX(-18px); }

/* segmented control */
.seg { display: inline-flex; background: var(--surface-2); border-radius: 11px; padding: 3px; gap: 2px; }
.seg--gender { display: flex; width: 100%; margin-bottom: 1rem; }
.seg__b { flex: 1; padding: .5rem .8rem; border-radius: 8px; font-family: var(--font-display); font-weight: 700; font-size: .9rem; color: var(--ink-soft); transition: background .2s, color .2s, box-shadow .2s; white-space: nowrap; }
.seg__b.is-on { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); }

/* avatar picker grid */
.avatar-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: .7rem; }
.avatar-opt { border-radius: 50%; border: 3px solid transparent; background: var(--surface); padding: 0; transition: border-color .2s var(--ease), transform .15s var(--ease-back), box-shadow .2s; }
.avatar-opt img { width: 100%; aspect-ratio: 1 / 1; border-radius: 50%; display: block; }
.avatar-opt:hover { transform: translateY(-2px); }
.avatar-opt.is-sel { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }

/* offline screen */
.offline { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 1.5rem;
  background: linear-gradient(180deg, var(--bg), var(--band)); animation: fade .3s var(--ease); }
.offline[hidden] { display: none; }
.offline__box { text-align: center; max-width: 380px; }
.offline__art { color: var(--accent); display: inline-block; margin: 0 auto .6rem; opacity: .9; animation: bob 5s var(--ease) infinite; }
.offline__logo { width: 66px; height: 48px; object-fit: contain; margin: 0 auto 1rem; display: block; }
.offline__title { font-family: var(--font-display); font-weight: 800; font-size: 1.6rem; color: var(--ink); margin: 0 0 .6rem; }
.offline__sub { color: var(--ink-soft); margin: 0 0 1.7rem; line-height: var(--lh-body); }

/* font-size preference (root scales rem) */
html.font-s { font-size: 15px; }
html.font-l { font-size: 18px; }

/* dark mode (user toggle) */
html.theme-dark {
  --bg: #0f1320; --band: #151b2c; --surface: #1b2237; --surface-2: #232c45; --line: #2b3450; --line-strong: #3a4568;
  --ink: #eef1f8; --ink-soft: #aeb7cd; --ink-faint: #7d88a4;
  --accent: #6f8ff5; --accent-strong: #5b7cf0; --accent-tint: #1e2a4d; --accent-tint2: #24346a;
  --gold: #e5b458; --gold-ink: #e9c06a; --gold-tint: #2a2416;
}
html.theme-dark body { background: var(--bg); }
html.theme-dark .site-header { background: color-mix(in srgb, var(--bg) 82%, transparent); }

/* responsive: full-screen sheets + smaller avatar grid on phones */
@media (max-width: 560px) {
  .sheet { padding: 0; align-items: stretch; }
  .sheet__panel, .sheet__panel--sm { width: 100%; max-height: 100vh; height: 100dvh; border-radius: 0; border: 0; }
  .avatar-grid { grid-template-columns: repeat(4, 1fr); }
}

/* =========================================================
   v8 — MOBILE-FIRST pass (authoritative — keep LAST in file)
   ========================================================= */
.nav-toggle { display: none; width: 46px; height: 42px; border-radius: 12px; background: var(--surface-2);
  flex-direction: column; align-items: center; justify-content: center; gap: 4.5px; margin-inline-start: auto;
  transition: background .2s var(--ease); }
.nav-toggle:hover { background: var(--line); }
.nav-toggle span { display: block; width: 21px; height: 2.5px; background: var(--ink); border-radius: 2px;
  transition: transform .25s var(--ease-back), opacity .18s var(--ease); }
.nav-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.nav-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.mobile-menu { display: none; }
@keyframes menuDrop { from { opacity: 0; transform: translateY(-8px); } }

@media (max-width: 940px) {
  /* header → hamburger */
  .nav { display: none; }
  .header-actions { display: none; }
  .nav-toggle { display: flex; }
  .mobile-menu:not([hidden]) { display: block; }
  .mobile-menu { border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 96%, transparent); backdrop-filter: blur(12px);
    padding: .8rem 1.2rem 1.3rem; box-shadow: var(--shadow-md); animation: menuDrop .25s var(--ease); }
  .mobile-menu__nav { display: flex; flex-direction: column; }
  .mobile-menu__nav a { padding: .95rem .2rem; font-family: var(--font-display); font-weight: 700;
    font-size: 1.12rem; color: var(--ink); border-bottom: 1px solid var(--line); }
  .mobile-menu__nav a:last-child { border-bottom: 0; }
  .mobile-menu__actions { display: flex; flex-direction: column; gap: .6rem; margin-top: .9rem; }

  /* fix grids that later base rules had overridden */
  .steps__row { grid-template-columns: 1fr; max-width: 460px; margin-inline: auto; gap: 2.2rem; }
  .board { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  /* phone type scale + rhythm */
  .wrap { width: 90vw; }
  .hero { padding-top: 1.4rem; }
  .hero__title { font-size: clamp(2.15rem, 9vw, 2.9rem); }
  .hero__sub { font-size: 1.08rem; }
  .mission__line { font-size: clamp(1.55rem, 6.6vw, 2.1rem); line-height: 1.6; }
  .section__title { font-size: clamp(1.65rem, 6vw, 2.1rem); }
  .section { padding: clamp(2.6rem, 9vw, 3.6rem) 0; }
  .hero__frame { max-width: 340px; }

  /* board: 2 tidy columns */
  .board { grid-template-columns: repeat(2, 1fr); gap: .85rem; }
  .scard__title { font-size: .96rem; }
  .scard__badge { font-size: .66rem; padding: .28rem .6rem; }

  /* reader: swipe-only (no side arrows), bigger book */
  .reader { padding: 0; }
  .reader__nav { display: none; }
  .reader__stage { gap: 0; width: 100%; justify-content: center; }
  .book { width: 92vw; max-height: 76vh; }
  .reader__dots { margin-top: 1rem; }

  /* larger footer tap targets */
  .footer__col a, .footer__legal a { display: inline-block; padding: .25rem 0; }
  .footer-top { gap: 1.6rem; }
}

/* =========================================================
   v9 — MOBILE SMOOTHNESS & MOTION (native-app feel)
   ========================================================= */

/* kill the grey tap flash + 300ms delay everywhere */
* { -webkit-tap-highlight-color: transparent; }
a, button, .srow, .scard, .step, .feature, .avatar-opt, .pick__opt, .chip, .bookcover, .book-item { touch-action: manipulation; }

/* spring easing token for interactions */
:root { --spring: cubic-bezier(.22, 1, .36, 1); }

/* overlays: contain scroll + smooth momentum, never bleed to the page */
.sheet__scroll, .modal__card, .app-screen, .reader { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
/* robust flex-scroll so tall sheets scroll inside a capped panel */
.sheet__scroll { flex: 1 1 auto; min-height: 0; }

/* safe-area padding for notched phones */
@supports (padding: max(0px)) {
  .site-header .header-inner, .appbar__inner { padding-inline: max(4vw, env(safe-area-inset-right)) max(4vw, env(safe-area-inset-left)); }
}

/* ---- touch devices: tactile press feedback on everything ---- */
@media (hover: none) {
  .btn { transition: transform .16s var(--spring), box-shadow .2s var(--ease), background .3s var(--ease), filter .2s; }
  .btn:active { transform: scale(.955); }
  .scard, .step, .feature, .srow, .avatar-opt, .pick__opt, .chip, .footer__soc, .avatar-btn, .nav-toggle, .seg__b { transition: transform .16s var(--spring), background .18s var(--ease), box-shadow .2s var(--ease), border-color .2s; }
  .scard:active, .step:active, .feature:active, .avatar-opt:active, .pick__opt:active, .footer__soc:active { transform: scale(.97); }
  .srow:active { background: var(--surface-2); transform: scale(.99); }
  .book-item:active .bookcover { transform: translateY(-4px) scale(.98); }
  .chip:active, .seg__b:active { transform: scale(.95); }
  /* hover-only lifts shouldn't stick after a tap on touch screens */
  .scard:hover, .step:hover, .feature:hover, .card:hover { transform: none; }
}

@media (max-width: 560px) {
  /* ---- bottom-sheet pattern for settings + picker ---- */
  .sheet { align-items: flex-end; padding: 0; }
  .sheet__panel, .sheet__panel--sm {
    width: 100%; height: auto; max-height: 92dvh; border: 0; border-radius: 24px 24px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
    animation: sheetUp .42s var(--spring);
  }
  .sheet__panel::before {
    content: ""; display: block; width: 42px; height: 5px; border-radius: 3px;
    background: var(--line-strong); margin: 9px auto 2px; flex: 0 0 auto;
  }
  .sheet__bar { border-radius: 0; }

  /* ---- auth modal as a bottom sheet too ---- */
  .modal { align-items: flex-end; padding: 0; }
  .modal__card { width: 100%; max-height: 96dvh; overflow-y: auto; border-radius: 26px 26px 0 0;
    animation: sheetUp .42s var(--spring); padding-bottom: env(safe-area-inset-bottom); }
  .modal__card.auth::before { content:""; position: absolute; top: 11px; left: 50%; transform: translateX(-50%);
    width: 44px; height: 5px; border-radius: 999px; background: var(--line-strong); z-index: 6; }
  .modal__card.auth .auth__step { padding-top: 2.6rem; }
  .modal__backdrop { animation: fade .3s var(--ease); }

  /* ---- staggered mobile-menu items ---- */
  .mobile-menu:not([hidden]) .mobile-menu__nav a,
  .mobile-menu:not([hidden]) .mobile-menu__actions .btn { animation: menuItem .34s var(--spring) backwards; }
  .mobile-menu__nav a:nth-child(1) { animation-delay: .04s; }
  .mobile-menu__nav a:nth-child(2) { animation-delay: .09s; }
  .mobile-menu__nav a:nth-child(3) { animation-delay: .14s; }
  .mobile-menu__nav a:nth-child(4) { animation-delay: .19s; }
  .mobile-menu__actions .btn:nth-child(1) { animation-delay: .24s; }
  .mobile-menu__actions .btn:nth-child(2) { animation-delay: .29s; }

  /* ---- smoother, snappier scroll reveals on phones ---- */
  .reveal { transform: translateY(30px); transition: opacity .6s var(--spring), transform .6s var(--spring); }
  .reveal--right { transform: translateY(22px); }

  /* ---- reader: GPU-smooth flips + comfy close in safe area ---- */
  .page { will-change: transform; }
  .reader__close { top: max(16px, env(safe-area-inset-top)); }
}

@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
@keyframes menuItem { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

/* =========================================================
   v10 — clean hero backdrop, redesigned 2-panel login,
   per-platform sizing (phone / tablet / laptop / desktop)
   ========================================================= */

/* Hero backdrop: clean, blue-only whisper (no muddy gold/beige) */
.hero__glow {
  inset-inline-end: -10%; top: -18%;
  background: radial-gradient(46% 52% at 72% 20%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 72%);
  filter: none;
}

/* ---------- Login — two-panel, spacious, professional ---------- */
.auth__grid { display: grid; grid-template-columns: 1fr; }
.auth__main { min-width: 0; }
.auth__aside { display: none; }
.auth__aside-glow { position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(60% 55% at 28% 8%, rgba(240,182,64,.30), transparent 60%); }
.auth__aside-logo { width: 108px; height: 74px; object-fit: contain; filter: brightness(0) invert(1); opacity: .97; }
.auth__aside-title { font-family: var(--font-display); font-weight: 800; font-size: 1.65rem; color: #fff; margin: 1.1rem 0 0; line-height: 1.4; }
.auth__aside-sub { color: rgba(255,255,255,.92); line-height: 1.95; margin: .8rem 0 0; font-size: .98rem; }
.auth__perks { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: .75rem; position: relative; }
.auth__perks li { display: flex; align-items: center; gap: .6rem; color: #fff; font-weight: 600; }
.auth__perks li::before { content: "✓"; flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%;
  background: rgba(255,255,255,.16); color: var(--gold); display: grid; place-items: center; font-weight: 800; font-size: .78rem; }

/* roomier form rhythm (fixes cramped text) */
.modal__sub { margin-top: .85rem; }
.auth__form { margin-top: 1.7rem; gap: 1rem; }
.auth__divider { margin-top: 1.7rem; }
.auth__grouplbl { margin-top: .85rem; }

@media (min-width: 720px) {
  .modal__card.auth { width: min(860px, 94vw); }
  .auth__grid { grid-template-columns: .82fr 1fr; align-items: stretch; }
  .auth__aside { display: flex; position: relative; overflow: hidden; flex-direction: column; justify-content: center;
    background: linear-gradient(160deg, var(--accent), var(--accent-strong)); color: #fff; padding: 2.8rem 2.1rem; }
  .auth__main .modal__mark { display: none; } /* brand shown in the aside */
  .auth__step { padding: 2.8rem 2.6rem 2.4rem; }
  .modal__card.auth .modal__close { inset-inline-start: 16px; inset-inline-end: auto; color: var(--ink); }
}

/* ---------- Large desktop: roomier ---------- */
@media (min-width: 1400px) {
  .wrap { width: min(1240px, 88vw); }
  .hero__title { font-size: clamp(4rem, 4.6vw, 5.2rem); }
  .section { padding: clamp(5rem, 7vw, 7.5rem) 0; }
  .mission { padding: clamp(4rem, 6vw, 6rem) 0; }
}

/* ---------- Tablet: keep multi-column (don't drop to phone layout early) ---------- */
@media (min-width: 861px) and (max-width: 1200px) {
  .features { grid-template-columns: repeat(3, 1fr); max-width: none; margin-inline: 0; }
  .steps__row { grid-template-columns: repeat(3, 1fr); max-width: none; }
  .board { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 641px) and (max-width: 860px) {
  .features { grid-template-columns: repeat(2, 1fr); max-width: 640px; margin-inline: auto; }
  .steps__row { grid-template-columns: repeat(3, 1fr); max-width: none; }
  .board { grid-template-columns: repeat(3, 1fr); }
  .footer-top { grid-template-columns: 1fr 1fr; }
}

/* =========================================================
   v11 — NEW LIBRARY SCREEN (professional 3D bookshelf)
   ========================================================= */

/* Library screen base */
.lib-main {
  position: relative;
  padding: clamp(2rem, 4vw, 3.4rem) 0 5rem;
  min-height: calc(100vh - 72px);
  background: linear-gradient(180deg, #ecf0fb 0%, var(--bg) 30%);
}
.lib-wrap { position: relative; z-index: 1; }

/* Greeting */
.lib-head { text-align: center; margin-bottom: clamp(1.8rem, 3vw, 2.8rem); }
.lib-greeting {
  font-size: clamp(2rem, 5vw, 3rem);
  font-family: var(--font-display);
  font-weight: 800; line-height: 1.3; color: var(--ink); margin: 0 0 .6rem;
}
.lib-greeting__name { color: var(--gold); }
.lib-sub { color: var(--ink-soft); font-size: 1.08rem; line-height: var(--lh-body); margin: 0; }

/* Category tabs */
.lib-tabs {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  margin-bottom: clamp(1.6rem, 3vw, 2.4rem); justify-content: center;
}
.lib-tab {
  font-family: var(--font-display); font-weight: 700; font-size: .95rem;
  padding: .52rem 1.2rem; border-radius: var(--radius-pill);
  border: 1.5px solid var(--line-strong);
  background: var(--surface); color: var(--ink-soft);
  cursor: pointer; transition: all .22s var(--ease);
}
.lib-tab:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line-strong)); color: var(--accent); }
.lib-tab.is-active {
  background: var(--accent); color: #fff;
  border-color: var(--accent);
  box-shadow: 0 6px 20px -8px rgba(7,48,160,.45);
}

/* Book grid */
.lib-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(1.4rem, 2.8vw, 2.2rem);
  align-items: start;
}

/* Single book card */
.lib-book { display: flex; flex-direction: column; gap: .6rem; }
.lib-book[hidden] { display: none; }

.lib-book__btn {
  display: block; width: 100%; padding: 0; border: none; background: none;
  cursor: pointer; border-radius: 18px; overflow: hidden;
  transform-origin: bottom center;
  transition: transform .38s var(--ease-back), box-shadow .38s var(--ease);
  box-shadow: 0 8px 32px -14px rgba(7,48,160,.22), 0 2px 8px rgba(0,0,0,.07);
  position: relative;
}
.lib-book__btn:hover {
  transform: translateY(-12px) rotate(-1.4deg) scale(1.03);
  box-shadow: 0 28px 52px -20px rgba(7,48,160,.38), 0 4px 18px rgba(0,0,0,.1);
}
.lib-book__btn:active { transform: translateY(-4px) scale(.99); }

/* Book cover */
.lib-book__cover {
  position: relative; width: 100%; aspect-ratio: 3/4;
  background: var(--c, var(--accent));
}
.lib-book__cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Spine shadow on the left (for 3D feel) */
.lib-book__btn::before {
  content: ""; position: absolute; top: 0; bottom: 0;
  inset-inline-start: 0; width: 10px;
  background: linear-gradient(to inline-end, rgba(0,0,0,.22), rgba(0,0,0,0));
  z-index: 4; pointer-events: none; border-radius: 18px 0 0 18px;
}
/* Shine overlay */
.lib-book__cover::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.18) 0%, transparent 48%, rgba(0,0,0,.12) 100%);
  pointer-events: none; z-index: 2;
}

/* Footer overlay on cover */
.lib-book__foot {
  position: absolute; inset-inline: 0; bottom: 0;
  padding: 2.2rem 1rem 1rem;
  background: linear-gradient(180deg, transparent 0%, rgba(2,8,30,.82) 100%);
  color: #fff; text-align: start; z-index: 3;
}
.lib-book__badge {
  display: inline-block;
  font-family: var(--font-display); font-weight: 800;
  font-size: .68rem; line-height: 1;
  padding: .24rem .65rem; border-radius: 999px;
  background: rgba(255,255,255,.22); color: #fff;
  margin-bottom: .42rem;
}
.lib-book__title {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(.92rem, 1.4vw, 1.1rem);
  line-height: 1.3; color: #fff; margin: 0 0 .22rem;
  text-shadow: 0 1px 6px rgba(0,0,0,.3);
}
.lib-book__hero { font-size: .78rem; color: rgba(255,255,255,.82); margin: 0; }
.lib-book__hero b { color: #f6d47c; font-weight: 700; }

/* Book info (below the card) */
.lib-book__info {
  display: flex; align-items: center; justify-content: center; gap: .5rem;
}
.lib-book__age {
  font-size: .8rem; font-weight: 700; color: var(--ink-faint);
  background: var(--surface-2); padding: .22rem .7rem;
  border-radius: var(--radius-pill);
}

/* Responsive */
@media (max-width: 940px) { .lib-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) { .lib-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; } }

/* Empty state */
.lib-empty {
  grid-column: 1 / -1; text-align: center;
  padding: 3rem 1rem; color: var(--ink-soft); font-size: 1.1rem;
}

/* Appbar: keep existing appbar but override for new lib */
.app-screen .appbar {
  position: sticky; top: 0; z-index: 5;
  backdrop-filter: saturate(1.1) blur(16px);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 var(--line);
}

/* =========================================================
   v11 — Button redirect wrappers (landing page)
   ========================================================= */
.btn-auth-link {
  display: inline-flex; text-decoration: none;
}

/* =========================================================
   v12 — FULL RESPONSIVE: Mobile · Tablet · Desktop
   Breakpoints:
     xs  < 380px  — very small phones
     sm  380–560px — standard phones
     md  561–768px — large phones / small tablet
     lg  769–1024px — iPad portrait / landscape
     xl  1025px+  — desktop
   ========================================================= */

/* ---- LIBRARY: mobile tweaks ---- */
@media (max-width: 768px) {
  .lib-main { padding: 1.6rem 0 4rem; }
  .lib-head { margin-bottom: 1.4rem; }
  .lib-greeting { font-size: clamp(1.6rem, 7vw, 2.2rem); }
  .lib-sub { font-size: .92rem; }
  .lib-tabs { gap: .45rem; flex-wrap: wrap; justify-content: center; }
  .lib-tab { font-size: .85rem; padding: .44rem 1rem; }
  .lib-book__foot { padding: 1.6rem .85rem .9rem; }
  .lib-book__badge { font-size: .6rem; padding: .18rem .5rem; margin-bottom: .3rem; }
  .lib-book__title { font-size: .84rem; }
  .lib-book__hero { font-size: .7rem; }
  .lib-book__age { font-size: .74rem; }
  .lib-book__info { padding: .35rem 0 0; }
}

/* ---- LIBRARY: small phone (< 480px) ---- */
@media (max-width: 480px) {
  .lib-grid { grid-template-columns: repeat(2, 1fr); gap: .75rem; }
  .lib-greeting { font-size: clamp(1.4rem, 8vw, 1.9rem); }
  .appbar__inner { padding-block: .65rem; }
  .lib-book__foot { padding: 1.2rem .7rem .75rem; }
  .lib-book__title { font-size: .8rem; line-height: 1.2; }
  .lib-book__badge { display: none; }
  .lib-book__hero b { font-size: .72rem; }
}

/* ---- LIBRARY: very small phone (< 360px) ---- */
@media (max-width: 359px) {
  .lib-grid { gap: .55rem; }
  .lib-book__btn { border-radius: 12px; }
  .lib-tab { font-size: .78rem; padding: .38rem .8rem; }
}

/* ---- LIBRARY: tablet (769–1024px): 3 columns ---- */
@media (min-width: 769px) and (max-width: 1024px) {
  .lib-grid { grid-template-columns: repeat(3, 1fr); }
  .lib-greeting { font-size: clamp(1.9rem, 4vw, 2.5rem); }
  .lib-main { padding: 2.2rem 0 5rem; }
}

/* ---- LIBRARY: iPad pro / laptop (1025–1280px): 4 cols ---- */
@media (min-width: 1025px) {
  .lib-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ---- APPBAR: hide chip on tablet and below ---- */
@media (max-width: 940px) {
  .appbar__chip { font-size: .82rem; padding: .3rem .75rem; }
}
@media (max-width: 600px) {
  .appbar__chip { display: none; }
}

/* ---- READER: tablet ---- */
@media (min-width: 641px) and (max-width: 1024px) {
  .book { width: 70vw; max-width: 540px; max-height: 80vh; }
  .reader__nav { width: 50px; height: 50px; }
}

/* ---- READER: mobile ---- */
@media (max-width: 640px) {
  .reader { padding: 0; }
  .reader__nav { display: none; }
  .reader__stage { gap: 0; width: 100%; justify-content: center; }
  .book { width: 92vw; max-height: 76vh; }
  .reader__dots { margin-top: .85rem; }
  .page__text { font-size: .97rem; }
}

/* ---- HERO: phone improvements ---- */
@media (max-width: 430px) {
  .hero { padding-top: 1rem; }
  .hero__title { font-size: clamp(2rem, 9vw, 2.9rem); line-height: 1.3; }
  .hero__sub { font-size: 1.05rem; }
  .hero__actions { gap: .65rem; }
}

/* ---- HERO: restore 2-col on tablet (max-width:940px forces 1-col) ---- */
@media (min-width: 769px) and (max-width: 940px) {
  .hero__inner { grid-template-columns: 1fr 1fr; }
  .hero__art { margin-top: 0; max-width: none; }
}

/* ---- HEADER: iPad portrait ---- */
@media (min-width: 769px) and (max-width: 940px) {
  .header-actions { display: flex; }
  .nav { display: flex; }
  .nav-toggle { display: none; }
}

/* ---- FOOTER: tablet ---- */
@media (min-width: 641px) and (max-width: 940px) {
  .footer-top { grid-template-columns: 1fr 1fr; gap: 2rem; }
}

/* ---- SETTINGS SHEET: tablet ---- */
@media (min-width: 561px) and (max-width: 940px) {
  .sheet__panel { width: min(420px, 92vw); }
  .sheet__panel--sm { width: min(380px, 92vw); }
}

/* ---- AUTH PAGE: mobile within auth.html ---- */
@media (max-width: 440px) {
  /* OTP boxes fit in one row of 6 */
  .ap-code { gap: .35rem; }
  .ap-code__box { width: 42px; height: 52px; font-size: 1.3rem; }
}
@media (max-width: 360px) {
  .ap-code__box { width: 36px; height: 48px; font-size: 1.15rem; }
  .ap-card { border-radius: 20px; }
}

/* ---- SAFE AREA: notched phones ---- */
@supports (padding: max(0px)) {
  .lib-main { padding-bottom: max(4rem, calc(env(safe-area-inset-bottom) + 3rem)); }
  .reader__dots { padding-bottom: env(safe-area-inset-bottom); }
  .appbar__inner { padding-inline: max(1.2rem, env(safe-area-inset-right)); }
}

/* Reader: Hadith / highlighted quote */
.page__hadith {
  display: block;
  text-align: center;
  font-style: normal;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05em;
  color: var(--gold, #c8871a);
  margin: .85em 0 .6em;
  padding: .55rem 1rem;
  border-inline-start: 3px solid var(--gold, #c8871a);
  background: color-mix(in srgb, var(--gold, #c8871a) 10%, transparent);
  border-radius: 0 10px 10px 0;
  line-height: 1.7;
}
