/* ================================================================
   Tawjihi Platform — Theme v3 "مكتبة حيّة"
   Stage-17 redesign (2026-07-01). App-energy + per-subject identity.

   Layering:
   - This file LAYERS ON TOP of app.css. It does not replace base utilities,
     forms, or page-specific component classes that JS depends on (e.g.
     #subject-title, .test-row, .q-int). It restyles them.
   - Activated when body has class .theme-v3 (every v3 page should add it).
   - Backwards-compatible: removing .theme-v3 from body restores previous look.

   Structure:
   1) Tokens (light + dark)
   2) Reset overrides
   3) Nav v3
   4) Hero bento + countdown/streak cards
   5) Section heads + tabs
   6) Subject cards (per-subject theming)
   7) Feature cards
   8) Book grid v3
   9) Test rows v3
   10) Buttons v3
   11) Page-specific tweaks (subject, exam, progress, reader)
   12) Mobile (≤768) overrides
   ================================================================ */


/* ---------- 1) Tokens ---------- */
.theme-v3, .theme-v3 .nav, .theme-v3 .container {
  --v3-bg: #FAFBFC;
  --v3-surface: #FFFFFF;
  --v3-surface-2: #F4F6F8;
  --v3-ink-1: #0F1419;
  --v3-ink-2: #374151;
  --v3-ink-3: #6B7280;
  --v3-line: #E5E7EB;
  --v3-line-soft: #F1F3F6;

  --v3-radius-lg: 24px;
  --v3-radius: 18px;
  --v3-radius-sm: 12px;
  --v3-radius-xs: 9px;

  --v3-shadow-sm: 0 1px 2px rgba(15,20,25,.04), 0 1px 4px rgba(15,20,25,.04);
  --v3-shadow: 0 4px 12px rgba(15,20,25,.06), 0 1px 3px rgba(15,20,25,.04);
  --v3-shadow-lg: 0 12px 32px rgba(15,20,25,.10), 0 4px 8px rgba(15,20,25,.04);

  --v3-brand-1: #6366F1;
  --v3-brand-2: #A855F7;
}

[data-theme="dark"] .theme-v3 {
  --v3-bg: #0B1320;
  --v3-surface: #111827;
  --v3-surface-2: #1F2937;
  --v3-ink-1: #F9FAFB;
  --v3-ink-2: #D1D5DB;
  --v3-ink-3: #9CA3AF;
  --v3-line: #1F2937;
  --v3-line-soft: #1A2230;
}

/* Per-subject palette — one accent + soft tint per subject key.
   Used via data-subject="<key>" on .subj-card-v3 (or .subject-hero, etc.) */
.theme-v3 [data-subject] {
  --s-grad: linear-gradient(135deg, #6366F1, #4F46E5);
  --s-solid: #6366F1;
  --s-soft: #EEF2FF;
  --s-shadow: rgba(99,102,241,.32);
}
.theme-v3 [data-subject="math_elmi"],
.theme-v3 [data-subject="math_adabi"]   { --s-grad: linear-gradient(135deg,#6366F1,#4F46E5); --s-solid:#6366F1; --s-soft:#EEF2FF; --s-shadow:rgba(99,102,241,.30); }
.theme-v3 [data-subject="physics"]      { --s-grad: linear-gradient(135deg,#06B6D4,#0891B2); --s-solid:#0891B2; --s-soft:#ECFEFF; --s-shadow:rgba(6,182,212,.30); }
.theme-v3 [data-subject="chemistry"]    { --s-grad: linear-gradient(135deg,#14B8A6,#0D9488); --s-solid:#0D9488; --s-soft:#F0FDFA; --s-shadow:rgba(20,184,166,.30); }
.theme-v3 [data-subject="biology"]      { --s-grad: linear-gradient(135deg,#10B981,#059669); --s-solid:#059669; --s-soft:#ECFDF5; --s-shadow:rgba(16,185,129,.30); }
.theme-v3 [data-subject="arabic_motalaa_elmi"],
.theme-v3 [data-subject="arabic_motalaa_adabi"],
.theme-v3 [data-subject="arabic_adab"]  { --s-grad: linear-gradient(135deg,#F43F5E,#E11D48); --s-solid:#E11D48; --s-soft:#FFF1F2; --s-shadow:rgba(244,63,94,.30); }
.theme-v3 [data-subject="islamic_elmi"],
.theme-v3 [data-subject="islamic_adabi"]{ --s-grad: linear-gradient(135deg,#8B5CF6,#7C3AED); --s-solid:#7C3AED; --s-soft:#F5F3FF; --s-shadow:rgba(139,92,246,.30); }
.theme-v3 [data-subject="english_pupils_elmi"],
.theme-v3 [data-subject="english_pupils_adabi"],
.theme-v3 [data-subject="english_reading_plus"] { --s-grad: linear-gradient(135deg,#F59E0B,#D97706); --s-solid:#D97706; --s-soft:#FFFBEB; --s-shadow:rgba(245,158,11,.30); }
.theme-v3 [data-subject="it_elmi"],
.theme-v3 [data-subject="it_adabi"]     { --s-grad: linear-gradient(135deg,#EC4899,#DB2777); --s-solid:#DB2777; --s-soft:#FDF2F8; --s-shadow:rgba(236,72,153,.30); }
.theme-v3 [data-subject="history"]      { --s-grad: linear-gradient(135deg,#F97316,#EA580C); --s-solid:#EA580C; --s-soft:#FFF7ED; --s-shadow:rgba(249,115,22,.30); }
.theme-v3 [data-subject="geography"]    { --s-grad: linear-gradient(135deg,#84CC16,#65A30D); --s-solid:#65A30D; --s-soft:#F7FEE7; --s-shadow:rgba(132,204,22,.30); }
.theme-v3 [data-subject="thaqafa"]      { --s-grad: linear-gradient(135deg,#0EA5E9,#0284C7); --s-solid:#0284C7; --s-soft:#F0F9FF; --s-shadow:rgba(14,165,233,.30); }


/* ---------- 2) Reset overrides on v3 pages ---------- */
.theme-v3 { background: var(--v3-bg); color: var(--v3-ink-1); }
.theme-v3 main, .theme-v3 .home-main { background: transparent; padding: 1.6rem 0; }
.theme-v3 .container { max-width: 1240px; padding: 0 1.25rem; }


/* ---------- 3) Nav v3 ---------- */
.theme-v3 nav.nav {
  background: rgba(250,251,252,.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  position: sticky; top: 0; z-index: 50;
  border-bottom: 1px solid var(--v3-line);
  box-shadow: none;
}
[data-theme="dark"] .theme-v3 nav.nav { background: rgba(11,19,32,.85); }

.theme-v3 .nav-inner { padding: .85rem 0; gap: 1.2rem; display: flex; align-items: center; }
.theme-v3 .brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: inherit; }
.theme-v3 .brand-mark { width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, var(--v3-brand-1), var(--v3-brand-2));
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 4px 12px rgba(99,102,241,.32); }
.theme-v3 .brand-mark img { width: 24px; height: 24px; filter: brightness(0) invert(1); }
.theme-v3 .brand-name { font-family: 'Tajawal', sans-serif; }
.theme-v3 .brand-name strong { display: block; font-weight: 900; font-size: 1.05rem; letter-spacing: -.01em; line-height: 1.1; }
.theme-v3 .brand-name span { font-size: .72rem; font-weight: 500; color: var(--v3-ink-3); }

.theme-v3 .nav-links {
  display: flex; gap: .2rem; flex: 1;
  justify-content: flex-end; margin-right: auto;
}
.theme-v3 .nav-links .nav-link {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .5rem .9rem; border-radius: 10px;
  font-family: 'IBM Plex Sans Arabic', sans-serif;
  font-size: .92rem; font-weight: 500; color: var(--v3-ink-2);
  text-decoration: none;
  transition: background .12s, color .12s;
}
.theme-v3 .nav-links .nav-link svg { width: 16px; height: 16px; opacity: .65; }
.theme-v3 .nav-links .nav-link:hover { background: var(--v3-line-soft); color: var(--v3-ink-1); }
.theme-v3 .nav-links .nav-link.is-active { background: var(--v3-ink-1); color: #fff; }
.theme-v3 .nav-links .nav-link.is-active svg { opacity: 1; }

.theme-v3 .nav-spacer { flex: 0; }
.theme-v3 .nav-search {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .5rem .85rem; border-radius: 10px;
  background: var(--v3-surface-2); border: 1px solid transparent;
  font-size: .88rem; color: var(--v3-ink-2); transition: .15s; min-width: 160px;
}
.theme-v3 .nav-search:focus-within { border-color: var(--v3-brand-1); background: var(--v3-surface); }
.theme-v3 .nav-search input { background: transparent; border: 0; outline: 0; font: inherit; flex: 1; color: var(--v3-ink-1); min-width: 0; }
.theme-v3 .nav-search .kbd { font-size: .7rem; padding: .12rem .35rem; background: var(--v3-surface); border: 1px solid var(--v3-line); border-radius: 5px; color: var(--v3-ink-3); }

.theme-v3 .icon-btn {
  width: 40px; height: 40px; border-radius: 11px;
  background: var(--v3-surface-2); border: 0;
  display: grid; place-items: center; color: var(--v3-ink-2);
  cursor: pointer; transition: background .12s;
}
.theme-v3 .icon-btn:hover { background: var(--v3-line); }
.theme-v3 .icon-btn svg { width: 18px; height: 18px; }

@media (max-width: 880px) {
  .theme-v3 .nav-links { display: none; }
  .theme-v3 .nav-search { display: none; }
  .theme-v3 .nav-links.is-open {
    display: flex; flex-direction: column; gap: .15rem;
    position: fixed; top: 70px; left: 1rem; right: 1rem;
    background: var(--v3-surface);
    border: 1px solid var(--v3-line);
    border-radius: var(--v3-radius);
    padding: .55rem; box-shadow: var(--v3-shadow-lg); z-index: 40;
  }
  .theme-v3 .nav-links.is-open .nav-link { width: 100%; justify-content: flex-start; padding: .7rem .85rem; }
}


/* ---------- 4) Hero bento + cards ---------- */
.theme-v3 .hero-bento-v3 {
  display: grid; grid-template-columns: 2fr 1fr; gap: 1.1rem; margin-bottom: 1.5rem;
}
@media (max-width: 880px) { .theme-v3 .hero-bento-v3 { grid-template-columns: 1fr; } }

/* Stage-18: lightened hero — feels educational (paper + soft tints), not corporate */
.theme-v3 .hero-main-v3 {
  background:
    radial-gradient(circle at 88% 18%, rgba(244,114,182,.10), transparent 55%),
    radial-gradient(circle at 12% 90%, rgba(99,102,241,.10), transparent 55%),
    linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);
  border: 1px solid var(--v3-line);
  border-radius: var(--v3-radius-lg);
  padding: 2.4rem 2.2rem;
  color: var(--v3-ink-1);
  position: relative; overflow: hidden;
  min-height: 340px;
  display: flex; flex-direction: column; justify-content: space-between;
  box-shadow: var(--v3-shadow-sm);
}
/* tiny floating "book" decorations using emoji + transform — feels academic */
.theme-v3 .hero-main-v3::before {
  content: "📚"; position: absolute; top: 1.4rem; left: 1.6rem;
  font-size: 1.6rem; opacity: .22; transform: rotate(-12deg);
  pointer-events: none;
}
.theme-v3 .hero-main-v3::after {
  content: "✏️"; position: absolute; bottom: 1.6rem; left: 2.6rem;
  font-size: 1.4rem; opacity: .18; transform: rotate(-22deg);
  pointer-events: none;
}
.theme-v3 .hero-main-v3 > * { position: relative; z-index: 1; }

.theme-v3 .hero-pill {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .42rem .85rem;
  background: var(--v3-surface-2);
  border: 1px solid var(--v3-line);
  color: var(--v3-ink-2);
  border-radius: 999px;
  font-size: .78rem; font-weight: 600;
  width: fit-content;
}
.theme-v3 .hero-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: #10B981; box-shadow: 0 0 0 4px rgba(16,185,129,.22); }

.theme-v3 .hero-h1-v3 {
  font-family: 'Tajawal', sans-serif; font-weight: 900;
  font-size: clamp(1.9rem, 3.6vw, 2.85rem); line-height: 1.18; letter-spacing: -.025em;
  margin: 1.2rem 0 0 0;
  color: var(--v3-ink-1);
}
.theme-v3 .hero-h1-v3 em {
  font-style: normal;
  background: linear-gradient(120deg, #6366F1, #EC4899);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.theme-v3 .hero-sub-v3 { margin-top: .85rem; font-size: 1.02rem; color: var(--v3-ink-2); max-width: 48ch; line-height: 1.75; }
.theme-v3 .hero-cta-v3 { display: flex; gap: .7rem; flex-wrap: wrap; margin-top: 1.6rem; }
/* Primary CTA on light hero needs to flip — solid indigo on white instead of white on dark */
.theme-v3 .hero-main-v3 .btn-v3-primary {
  background: linear-gradient(135deg, #6366F1, #A855F7);
  color: #fff;
  box-shadow: 0 6px 18px rgba(99,102,241,.32);
}
.theme-v3 .hero-main-v3 .btn-v3-primary:hover {
  box-shadow: 0 10px 24px rgba(99,102,241,.42);
}
.theme-v3 .hero-main-v3 .btn-v3-glass {
  background: var(--v3-surface);
  color: var(--v3-ink-1);
  border: 1px solid var(--v3-line);
}
.theme-v3 .hero-main-v3 .btn-v3-glass:hover {
  background: var(--v3-surface-2);
}

/* ============== Books showcase section (Stage-18) ============== */
.theme-v3 .books-showcase {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1.1rem;
}
.theme-v3 .bs-book {
  display: block;
  text-decoration: none; color: inherit;
  transition: transform .18s ease;
}
.theme-v3 .bs-book:hover { transform: translateY(-4px); }
.theme-v3 .bs-cover {
  aspect-ratio: 3/4;
  border-radius: 14px;
  overflow: hidden;
  background: var(--v3-surface-2);
  border: 1px solid var(--v3-line);
  box-shadow: var(--v3-shadow-sm);
  transition: box-shadow .18s ease, border-color .18s ease;
  position: relative;
}
.theme-v3 .bs-book:hover .bs-cover {
  box-shadow: var(--v3-shadow-lg);
  border-color: transparent;
}
.theme-v3 .bs-cover img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.theme-v3 .bs-cover-fallback {
  width: 100%; height: 100%;
  background: var(--s-grad, linear-gradient(135deg,#6366F1,#A855F7));
  display: grid; place-items: center;
  color: #fff; font-family: 'Tajawal'; font-weight: 900; font-size: 2.4rem; letter-spacing: -.04em;
}
.theme-v3 .bs-name {
  margin-top: .65rem;
  font-family: 'Tajawal', sans-serif; font-weight: 700;
  font-size: .92rem; line-height: 1.35; color: var(--v3-ink-1);
}
.theme-v3 .bs-branch {
  font-size: .78rem; color: var(--v3-ink-3); margin-top: .15rem;
}

@media (max-width: 768px) {
  .theme-v3 .books-showcase {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: .85rem;
  }
  .theme-v3 .bs-name { font-size: .85rem; }
}

.theme-v3 .hero-side-v3 { display: grid; gap: 1.1rem; }
.theme-v3 .countdown-v3 {
  background: linear-gradient(135deg, #FFFBEB, #FEF3C7);
  border-radius: var(--v3-radius); padding: 1.3rem;
  border: 1px solid #FDE68A; position: relative; overflow: hidden;
}
.theme-v3 .countdown-v3::before {
  content: ""; position: absolute; top: -30px; right: -30px; width: 100px; height: 100px;
  background: radial-gradient(circle, rgba(251,191,36,.4), transparent 70%); border-radius: 50%;
}
.theme-v3 .cd-label { font-size: .78rem; font-weight: 700; color: #92400E; letter-spacing: .04em; }
.theme-v3 .cd-big { font-family: 'Tajawal'; font-weight: 900; font-size: 3.4rem; color: #78350F; line-height: 1; margin: .4rem 0; letter-spacing: -.04em; position: relative; }
.theme-v3 .cd-sub { font-size: .85rem; color: #92400E; font-weight: 500; }

.theme-v3 .streak-v3 {
  background: var(--v3-surface); border-radius: var(--v3-radius);
  padding: 1.3rem; border: 1px solid var(--v3-line); box-shadow: var(--v3-shadow-sm);
}
.theme-v3 .streak-row-v3 { display: flex; align-items: center; justify-content: space-between; margin-bottom: .7rem; }
.theme-v3 .streak-label-v3 { font-size: .85rem; color: var(--v3-ink-3); font-weight: 500; }
.theme-v3 .streak-flame-v3 {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #F97316, #EF4444);
  display: grid; place-items: center; color: #fff;
}
.theme-v3 .streak-big-v3 { font-family: 'Tajawal'; font-weight: 900; font-size: 2rem; color: var(--v3-ink-1); line-height: 1; }
.theme-v3 .streak-big-v3 small { font-size: 1rem; font-weight: 700; color: var(--v3-ink-3); margin-right: .3rem; }
.theme-v3 .streak-bar-v3 { height: 6px; background: var(--v3-line-soft); border-radius: 99px; margin-top: .85rem; overflow: hidden; }
.theme-v3 .streak-fill-v3 { height: 100%; width: var(--w, 50%); background: linear-gradient(90deg, #F97316, #EF4444); border-radius: 99px; }


/* ---------- 5) Section heads + tabs ---------- */
.theme-v3 .section-head-v3 {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem;
  margin: 3rem 0 1.5rem; padding: 0 .2rem;
}
.theme-v3 .sh-title-v3 { font-family: 'Tajawal', sans-serif; font-weight: 900; font-size: clamp(1.4rem, 2.6vw, 1.8rem); letter-spacing: -.02em; line-height: 1.2; color: var(--v3-ink-1); }
.theme-v3 .sh-sub-v3 { font-size: .92rem; color: var(--v3-ink-3); margin-top: .25rem; }
.theme-v3 .sh-link-v3 {
  color: var(--v3-ink-1); font-weight: 600; font-size: .92rem;
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .4rem .8rem; border-radius: 10px;
  transition: background .12s; text-decoration: none;
}
.theme-v3 .sh-link-v3:hover { background: var(--v3-line-soft); }

.theme-v3 .seg-v3 {
  display: inline-flex; gap: .25rem; padding: .3rem; background: var(--v3-line-soft);
  border-radius: 12px; margin-bottom: 1.5rem;
}
.theme-v3 .seg-v3 button {
  padding: .55rem 1.1rem; border-radius: 9px; font-size: .9rem; font-weight: 600;
  color: var(--v3-ink-2); transition: .15s; background: transparent; border: 0; cursor: pointer;
  font-family: inherit;
}
.theme-v3 .seg-v3 button.is-active { background: var(--v3-surface); color: var(--v3-ink-1); box-shadow: var(--v3-shadow-sm); }


/* ---------- 6) Subject cards ---------- */
.theme-v3 .subjects-grid-v3 {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.1rem;
}
@media (max-width: 1024px) { .theme-v3 .subjects-grid-v3 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 720px)  { .theme-v3 .subjects-grid-v3 { grid-template-columns: repeat(2, 1fr); } }

.theme-v3 .subj-card-v3 {
  background: var(--v3-surface); border-radius: var(--v3-radius); padding: 1.5rem 1.4rem;
  border: 1px solid var(--v3-line);
  transition: transform .18s, box-shadow .18s, border-color .18s;
  text-decoration: none; color: inherit; position: relative; overflow: hidden;
  display: block;
}
.theme-v3 .subj-card-v3:hover {
  transform: translateY(-4px); box-shadow: var(--v3-shadow-lg);
  border-color: transparent;
}
.theme-v3 .subj-card-v3 .icon-v3 {
  width: 54px; height: 54px; border-radius: 15px;
  display: grid; place-items: center;
  font-family: 'Tajawal'; font-weight: 900; font-size: 1.6rem; color: #fff;
  margin-bottom: 1.1rem; letter-spacing: -.02em;
  background: var(--s-grad);
  box-shadow: 0 6px 14px var(--s-shadow);
}
.theme-v3 .subj-card-v3 .name-v3 {
  font-family: 'Tajawal', sans-serif; font-weight: 900;
  font-size: 1.18rem; letter-spacing: -.01em; line-height: 1.25;
  margin-bottom: .3rem; color: var(--v3-ink-1);
}
.theme-v3 .subj-card-v3 .meta-v3 {
  font-size: .82rem; color: var(--v3-ink-3);
  display: flex; gap: .7rem; flex-wrap: wrap;
}
.theme-v3 .subj-card-v3 .meta-v3 b { color: var(--v3-ink-2); font-weight: 700; }
.theme-v3 .subj-card-v3 .progress-v3 {
  height: 5px; background: var(--v3-line-soft); border-radius: 99px;
  margin-top: 1.1rem; overflow: hidden;
}
.theme-v3 .subj-card-v3 .progress-v3 > i {
  display: block; height: 100%; border-radius: 99px;
  background: var(--s-solid); width: var(--w, 30%);
}


/* ---------- 7) Feature cards ---------- */
.theme-v3 .features-v3 {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-top: 3rem;
}
@media (max-width: 880px) { .theme-v3 .features-v3 { grid-template-columns: repeat(2, 1fr); } }

.theme-v3 .feat-v3 {
  background: var(--v3-surface); border-radius: var(--v3-radius);
  padding: 1.3rem; border: 1px solid var(--v3-line);
  text-decoration: none; color: inherit;
  transition: transform .15s, box-shadow .15s;
  display: block;
}
.theme-v3 .feat-v3:hover { transform: translateY(-2px); box-shadow: var(--v3-shadow); }
.theme-v3 .feat-icon-v3 {
  width: 42px; height: 42px; border-radius: 11px;
  display: grid; place-items: center; color: #fff; margin-bottom: .85rem;
}
.theme-v3 .feat-i-1 { background: linear-gradient(135deg,#6366F1,#4338CA); }
.theme-v3 .feat-i-2 { background: linear-gradient(135deg,#10B981,#059669); }
.theme-v3 .feat-i-3 { background: linear-gradient(135deg,#F59E0B,#D97706); }
.theme-v3 .feat-i-4 { background: linear-gradient(135deg,#EC4899,#DB2777); }
.theme-v3 .feat-title-v3 { font-family: 'Tajawal', sans-serif; font-weight: 900; font-size: 1.05rem; margin-bottom: .25rem; letter-spacing: -.01em; color: var(--v3-ink-1); }
.theme-v3 .feat-desc-v3 { font-size: .85rem; color: var(--v3-ink-3); line-height: 1.6; }


/* ---------- 8) Book grid v3 ---------- */
.theme-v3 .books-grid-v3 {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1.5rem;
}
.theme-v3 .book-v3 {
  background: var(--v3-surface); border-radius: var(--v3-radius);
  border: 1px solid var(--v3-line); overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .18s, box-shadow .18s;
}
.theme-v3 .book-v3:hover { transform: translateY(-3px); box-shadow: var(--v3-shadow-lg); }
.theme-v3 .book-v3 .cover-v3 {
  aspect-ratio: 3/4; background: var(--s-grad);
  display: grid; place-items: center;
  color: #fff; font-family: 'Tajawal'; font-weight: 900; font-size: 3.5rem;
  letter-spacing: -.04em; position: relative; overflow: hidden;
}
.theme-v3 .book-v3 .cover-v3::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 60%, rgba(0,0,0,.18) 100%);
}
.theme-v3 .book-v3 .info-v3 { padding: 1rem 1.1rem 1.2rem; }
.theme-v3 .book-v3 .info-v3 .title-v3 { font-weight: 700; font-size: .98rem; line-height: 1.3; margin-bottom: .25rem; color: var(--v3-ink-1); }
.theme-v3 .book-v3 .info-v3 .meta-v3 { font-size: .82rem; color: var(--v3-ink-3); }


/* ---------- 9) Test rows v3 ---------- */
.theme-v3 .test-row-v3 {
  display: grid; grid-template-columns: auto 1fr auto auto; gap: 1rem;
  align-items: center; padding: 1rem 1.2rem;
  background: var(--v3-surface); border: 1px solid var(--v3-line);
  border-radius: var(--v3-radius); margin-bottom: .6rem;
  transition: border-color .15s, transform .15s;
}
.theme-v3 .test-row-v3:hover { border-color: var(--s-solid, var(--v3-brand-1)); transform: translateX(-3px); }
.theme-v3 .test-row-v3 .test-num-v3 {
  width: 42px; height: 42px; border-radius: 11px;
  background: var(--s-soft, var(--v3-line-soft));
  color: var(--s-solid, var(--v3-brand-1));
  display: grid; place-items: center; font-family: 'Tajawal'; font-weight: 900; font-size: 1.05rem;
}
.theme-v3 .test-row-v3 .test-title-v3 { font-weight: 700; font-size: .96rem; color: var(--v3-ink-1); }
.theme-v3 .test-row-v3 .test-sub-v3 { font-size: .8rem; color: var(--v3-ink-3); margin-top: .15rem; display: flex; gap: .6rem; }
.theme-v3 .test-row-v3 .test-meta-v3 { font-size: .8rem; color: var(--v3-ink-3); }


/* ---------- 10) Buttons v3 ---------- */
.theme-v3 .btn-v3 {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .78rem 1.3rem; border-radius: 14px;
  font-family: 'Tajawal', sans-serif; font-weight: 700; font-size: .95rem;
  transition: transform .15s, box-shadow .15s, background .15s;
  cursor: pointer; border: 0; text-decoration: none;
}
.theme-v3 .btn-v3:hover { transform: translateY(-1px); }

.theme-v3 .btn-v3-primary { background: #fff; color: #1E1B4B; }
.theme-v3 .btn-v3-primary:hover { box-shadow: 0 8px 20px rgba(255,255,255,.18); }

.theme-v3 .btn-v3-glass {
  background: rgba(255,255,255,.14); color: #fff;
  border: 1px solid rgba(255,255,255,.22);
}
.theme-v3 .btn-v3-glass:hover { background: rgba(255,255,255,.22); }

.theme-v3 .btn-v3-solid {
  background: var(--v3-ink-1); color: #fff;
}
.theme-v3 .btn-v3-solid:hover { box-shadow: 0 8px 20px rgba(15,20,25,.22); }

.theme-v3 .btn-v3-ghost {
  background: var(--v3-surface); color: var(--v3-ink-1);
  border: 1px solid var(--v3-line);
}
.theme-v3 .btn-v3-ghost:hover { background: var(--v3-line-soft); }


/* ---------- 11) Page-specific tweaks ---------- */

/* Subject page hero — uses [data-subject] on a wrapper */
.theme-v3 .subject-hero-v3 {
  background: var(--s-grad); border-radius: var(--v3-radius-lg);
  padding: 2.2rem 2rem; color: #fff;
  position: relative; overflow: hidden; margin-bottom: 2rem;
}
.theme-v3 .subject-hero-v3::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(120% 90% at 90% 10%, rgba(255,255,255,.18), transparent 60%);
  pointer-events: none;
}
.theme-v3 .subject-hero-v3 > * { position: relative; z-index: 1; }
.theme-v3 .subject-hero-v3 .crumb-v3 { font-size: .85rem; color: rgba(255,255,255,.78); margin-bottom: 1rem; }
.theme-v3 .subject-hero-v3 .title-v3 { font-family: 'Tajawal'; font-weight: 900; font-size: clamp(1.8rem, 4vw, 2.6rem); letter-spacing: -.025em; line-height: 1.15; }
.theme-v3 .subject-hero-v3 .meta-v3 {
  display: flex; gap: 1.4rem; flex-wrap: wrap; margin-top: 1rem;
  font-size: .92rem; color: rgba(255,255,255,.86);
}
.theme-v3 .subject-hero-v3 .meta-v3 b { color: #fff; font-weight: 700; }

/* Exam page — focused mode */
.theme-v3 main .ctrl-bar {
  background: var(--v3-surface); border-radius: var(--v3-radius);
  border: 1px solid var(--v3-line); padding: .8rem 1rem; box-shadow: var(--v3-shadow-sm);
}

/* Progress stats — bigger rounded */
.theme-v3 .stat-tile, .theme-v3 .result-stat {
  border-radius: var(--v3-radius) !important;
  border: 1px solid var(--v3-line) !important;
  background: var(--v3-surface) !important;
  transition: transform .15s, box-shadow .15s;
}
.theme-v3 .stat-tile:hover, .theme-v3 .result-stat:hover {
  transform: translateY(-2px); box-shadow: var(--v3-shadow);
}

/* Reader bar */
.theme-v3 .reader-bar {
  background: rgba(250,251,252,.95) !important;
  border-bottom: 1px solid var(--v3-line) !important;
  backdrop-filter: saturate(180%) blur(20px);
}


/* ---------- 12) Mobile (≤768) overrides ---------- */
@media (max-width: 768px) {
  .theme-v3 .hero-main-v3 { padding: 1.6rem 1.4rem; min-height: auto; }
  .theme-v3 .hero-h1-v3 { font-size: clamp(1.6rem, 5.5vw, 2.2rem); }
  .theme-v3 .countdown-v3 { padding: 1rem; }
  .theme-v3 .cd-big { font-size: 2.6rem; }
  .theme-v3 .subj-card-v3 { padding: 1.2rem 1rem; }
  .theme-v3 .subj-card-v3 .icon-v3 { width: 46px; height: 46px; font-size: 1.3rem; border-radius: 13px; }
  .theme-v3 .test-row-v3 { grid-template-columns: auto 1fr auto; gap: .8rem; padding: .85rem 1rem; }
  .theme-v3 .test-row-v3 .test-meta-v3 { display: none; }
  .theme-v3 .section-head-v3 { margin-top: 2.2rem; flex-wrap: wrap; }
  .theme-v3 .sh-link-v3 { font-size: .85rem; }
}

/* Focus visible — accessible */
.theme-v3 :focus-visible {
  outline: 2px solid var(--v3-brand-1); outline-offset: 3px; border-radius: 6px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .theme-v3 * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
  .theme-v3 .subj-card-v3:hover, .theme-v3 .feat-v3:hover, .theme-v3 .book-v3:hover { transform: none; }
}
