/* =========================================================
   ARABIYYATI — Design System
   عَرَبِيَّتِي · Belajar Bahasa Arab Fushah untuk Pemula
   ========================================================= */

/* ---------- Tokens ---------- */
:root {
  --emerald-950: #022c22;
  --emerald-900: #064e3b;
  --emerald-800: #065f46;
  --emerald-700: #047857;
  --emerald-600: #059669;
  --emerald-500: #10b981;
  --emerald-100: #d1fae5;
  --emerald-50: #ecfdf5;

  --gold-600: #b8912a;
  --gold-500: #d4af37;
  --gold-400: #e6c45c;
  --gold-300: #f2dc94;
  --gold-100: #fbf3d5;

  --cream: #faf7f0;
  --cream-deep: #f2ede1;
  --surface: #ffffff;
  --surface-2: #f6f3ea;
  --surface-3: #efeadd;
  --ink: #1c2b24;
  --ink-soft: #3f5148;
  --muted: #6f7d75;
  --line: #e4e0d4;
  --line-strong: #d3cdbd;

  --danger: #b42318;
  --danger-bg: #fef3f2;
  --success: #067647;
  --success-bg: #ecfdf3;
  --warning: #b54708;
  --warning-bg: #fffaeb;
  --info: #175cd3;
  --info-bg: #eff8ff;

  --font-ui: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-ar: "Amiri", "Scheherazade New", "Traditional Arabic", "Times New Roman", serif;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-pill: 999px;

  --shadow-xs: 0 1px 2px rgba(28, 43, 36, .06);
  --shadow-sm: 0 2px 8px rgba(28, 43, 36, .06), 0 1px 2px rgba(28, 43, 36, .04);
  --shadow-md: 0 12px 28px -12px rgba(6, 78, 59, .18), 0 4px 10px -6px rgba(28, 43, 36, .08);
  --shadow-lg: 0 28px 60px -24px rgba(6, 78, 59, .28), 0 8px 24px -12px rgba(28, 43, 36, .12);

  --header-h: 74px;
  --container: 1180px;
  --ease: cubic-bezier(.22, 1, .36, 1);

  color-scheme: light;
}

[data-theme="dark"] {
  --cream: #0a1320;
  --cream-deep: #0e1a2a;
  --surface: #111e30;
  --surface-2: #16263b;
  --surface-3: #1d3049;
  --ink: #e9f0ea;
  --ink-soft: #c2d0c7;
  --muted: #93a49b;
  --line: #24374d;
  --line-strong: #334b66;

  --emerald-50: #072b22;
  --emerald-100: #064e3b;
  --gold-100: #332b13;

  --danger-bg: #3a1a17;
  --success-bg: #06301f;
  --warning-bg: #33230c;
  --info-bg: #12294a;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, .35);
  --shadow-md: 0 14px 32px -16px rgba(0, 0, 0, .6);
  --shadow-lg: 0 30px 60px -20px rgba(0, 0, 0, .7);

  color-scheme: dark;
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  color: var(--ink);
  background-color: var(--cream);
  background-image:
    radial-gradient(1200px 600px at 85% -10%, rgba(212, 175, 55, .10), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(5, 150, 105, .08), transparent 55%);
  background-attachment: fixed;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--emerald-700); text-decoration: none; }
a:hover { color: var(--emerald-600); }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.2; letter-spacing: -.015em; color: var(--ink); font-weight: 800; }
h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
h3 { font-size: clamp(1.15rem, 2vw, 1.4rem); }
p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.3em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
::selection { background: var(--gold-300); color: #1c2b24; }

:focus-visible {
  outline: 3px solid var(--gold-500);
  outline-offset: 2px;
  border-radius: 6px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: 200;
  background: var(--emerald-800); color: #fff; padding: .7rem 1.1rem;
  border-radius: 0 0 var(--radius) var(--radius); transition: top .2s;
}
.skip-link:focus { top: 0; color: #fff; }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2rem); }

/* Arabic text */
.ar {
  font-family: var(--font-ar);
  direction: rtl;
  unicode-bidi: isolate;
  line-height: 2;
  letter-spacing: 0;
}
.ar-inline { font-family: var(--font-ar); direction: rtl; unicode-bidi: isolate; font-size: 1.15em; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--cream) 82%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
}
.header-inner {
  display: flex; align-items: center; gap: 1rem;
  min-height: var(--header-h);
}
.brand { display: flex; align-items: center; gap: .7rem; color: var(--ink); font-weight: 800; letter-spacing: -.01em; }
.brand:hover { color: var(--ink); }
.brand-mark {
  display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: 14px;
  background: linear-gradient(145deg, var(--emerald-800), var(--emerald-600));
  color: var(--gold-300);
  font-family: var(--font-ar);
  font-size: 1.6rem; line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25), var(--shadow-sm);
  border: 1px solid color-mix(in srgb, var(--gold-500) 40%, transparent);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-size: 1.02rem; }
.brand-sub { font-size: .68rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }

.nav-links { display: flex; align-items: center; gap: .15rem; margin-left: auto; }
.nav-link {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .55rem .8rem; border-radius: var(--radius-pill);
  color: var(--ink-soft); font-size: .88rem; font-weight: 600;
  transition: background .18s, color .18s;
}
.nav-link:hover { background: var(--surface-2); color: var(--ink); }
.nav-link.active { background: var(--emerald-800); color: #fff; box-shadow: var(--shadow-sm); }
.nav-link.active svg { color: var(--gold-300); }
.nav-link svg { width: 17px; height: 17px; flex: none; }

.header-tools { display: flex; align-items: center; gap: .5rem; margin-left: .35rem; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-soft); transition: transform .18s var(--ease), background .18s, color .18s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--emerald-700); transform: translateY(-1px); }
.icon-btn svg { width: 19px; height: 19px; }
.menu-toggle { display: none; }

@media (max-width: 960px) {
  .menu-toggle { display: inline-grid; }
  .nav-links {
    position: absolute; inset: calc(var(--header-h) - 1px) 0 auto 0;
    flex-direction: column; align-items: stretch; gap: .25rem;
    padding: .8rem clamp(1rem, 4vw, 2rem) 1.1rem;
    background: var(--cream);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-link { padding: .8rem 1rem; }
  .nav-link.active { background: var(--emerald-800); }
  .header-tools { margin-left: auto; }
}

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--emerald-800);
  --btn-fg: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 46px; padding: .65rem 1.25rem;
  border: 1px solid transparent; border-radius: var(--radius-pill);
  background: var(--btn-bg); color: var(--btn-fg);
  font-size: .93rem; font-weight: 700; letter-spacing: .005em;
  transition: transform .18s var(--ease), box-shadow .18s, background .18s, color .18s, border-color .18s;
  text-align: center;
}
.btn:hover { color: var(--btn-fg); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-gold { --btn-bg: var(--gold-500); --btn-fg: #2a2208; }
.btn-gold:hover { --btn-bg: var(--gold-400); }
.btn-outline {
  --btn-bg: transparent; --btn-fg: var(--emerald-800);
  border-color: color-mix(in srgb, var(--emerald-800) 35%, transparent);
}
[data-theme="dark"] .btn-outline { --btn-fg: var(--emerald-100); border-color: #2c5a49; }
.btn-outline:hover { --btn-bg: var(--emerald-50); }
.btn-ghost { --btn-bg: transparent; --btn-fg: var(--ink-soft); }
.btn-ghost:hover { --btn-bg: var(--surface-2); }
.btn-soft { --btn-bg: var(--emerald-50); --btn-fg: var(--emerald-800); }
[data-theme="dark"] .btn-soft { --btn-fg: var(--emerald-100); }
.btn-danger { --btn-bg: var(--danger); --btn-fg: #fff; }
.btn-sm { min-height: 38px; padding: .4rem .9rem; font-size: .84rem; }
.btn-lg { min-height: 54px; padding: .85rem 1.7rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }

.btn-icon { width: 44px; padding: 0; }
.btn-audio {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--emerald-700) 25%, transparent);
  background: var(--emerald-50); color: var(--emerald-700);
  transition: transform .18s var(--ease), background .18s;
}
[data-theme="dark"] .btn-audio { color: var(--emerald-100); background: var(--emerald-100); }
.btn-audio:hover { transform: scale(1.08); background: var(--emerald-100); }
.btn-audio svg { width: 18px; height: 18px; }
.btn-audio.is-speaking { animation: pulse 1s infinite; }

/* ---------- Typography helpers ---------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .74rem; font-weight: 800; letter-spacing: .18em; text-transform: uppercase;
  color: var(--emerald-700); margin: 0 0 .9rem;
}
[data-theme="dark"] .eyebrow { color: var(--gold-400); }
.eyebrow::before {
  content: ""; width: 26px; height: 2px; background: var(--gold-500); border-radius: 2px;
}
.display-ar {
  font-family: var(--font-ar); direction: rtl; color: var(--emerald-800);
  font-size: clamp(1.4rem, 3vw, 2rem); line-height: 1.8;
}
[data-theme="dark"] .display-ar { color: var(--gold-300); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.lead { font-size: clamp(1rem, 1.6vw, 1.12rem); color: var(--ink-soft); }
.gold { color: var(--gold-600); }
[data-theme="dark"] .gold { color: var(--gold-400); }

.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .28rem .7rem; border-radius: var(--radius-pill);
  background: var(--gold-100); color: var(--gold-600);
  font-size: .72rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  border: 1px solid color-mix(in srgb, var(--gold-500) 30%, transparent);
}
[data-theme="dark"] .badge { color: var(--gold-300); }
.badge-emerald { background: var(--emerald-50); color: var(--emerald-700); border-color: color-mix(in srgb, var(--emerald-600) 25%, transparent); }
[data-theme="dark"] .badge-emerald { color: var(--emerald-100); }
.badge-muted { background: var(--surface-2); color: var(--muted); border-color: var(--line); }

/* ---------- Section shells ---------- */
.section { padding: clamp(2.8rem, 6vw, 5rem) 0; }
.section-tight { padding: clamp(2rem, 4vw, 3.2rem) 0; }
.section-head { max-width: 720px; margin-bottom: clamp(1.6rem, 3vw, 2.6rem); }
.section-head.center { margin-inline: auto; text-align: center; }
.section-head h2 { margin-bottom: .35rem; }
.section-head p { color: var(--muted); margin-bottom: 0; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: clamp(2.5rem, 6vw, 5.5rem) 0 clamp(2.5rem, 5vw, 4.5rem); }
.hero-grid {
  display: grid; grid-template-columns: 1.08fr .92fr; gap: clamp(2rem, 5vw, 4rem); align-items: center;
}
.hero-copy h1 { max-width: 14ch; }
.hero-copy h1 .highlight { color: var(--emerald-700); position: relative; white-space: nowrap; }
[data-theme="dark"] .hero-copy h1 .highlight { color: var(--gold-300); }
.hero-copy h1 .highlight::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: .06em; height: .22em;
  background: var(--gold-300); border-radius: 4px; z-index: -1; opacity: .75;
}
.hero-ar {
  font-family: var(--font-ar); direction: rtl; color: var(--emerald-700);
  font-size: clamp(1.4rem, 3vw, 1.9rem); margin-bottom: .4rem;
}
[data-theme="dark"] .hero-ar { color: var(--gold-300); }
.hero-description { max-width: 56ch; color: var(--ink-soft); }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1.4rem 0 1.6rem; }
.trust-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .6rem 1.3rem; }
.trust-list li { display: inline-flex; align-items: center; gap: .45rem; font-size: .82rem; font-weight: 600; color: var(--muted); }
.trust-list .check {
  display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
  background: var(--emerald-100); color: var(--emerald-800); font-size: .62rem; font-weight: 900;
}
[data-theme="dark"] .trust-list .check { background: #0d3b2e; color: var(--emerald-100); }

/* Hero visual */
.hero-visual { position: relative; min-height: 420px; display: grid; place-items: center; }
.arch-card {
  position: relative; width: min(100%, 390px); aspect-ratio: 4 / 4.6;
  border-radius: 200px 200px var(--radius-xl) var(--radius-xl);
  background:
    radial-gradient(120% 90% at 50% 0%, #0b6b53 0%, var(--emerald-900) 55%, var(--emerald-950) 100%);
  border: 1px solid color-mix(in srgb, var(--gold-500) 55%, transparent);
  box-shadow: var(--shadow-lg), inset 0 0 0 8px rgba(255,255,255,.04);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 2rem 1.5rem; text-align: center; overflow: hidden;
}
.arch-card::before {
  content: ""; position: absolute; inset: 14px; border-radius: inherit;
  border: 1px solid rgba(212, 175, 55, .35);
  background-image: radial-gradient(rgba(255,255,255,.08) 1px, transparent 1px);
  background-size: 18px 18px;
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent 70%);
  mask-image: linear-gradient(to bottom, #000, transparent 70%);
  pointer-events: none;
}
.arch-card .arch-label { position: relative; z-index: 1; font-size: .68rem; letter-spacing: .28em; text-transform: uppercase; color: var(--gold-300); font-weight: 700; margin-bottom: .8rem; }
.arch-card .arch-ar {
  position: relative; z-index: 1; font-family: var(--font-ar); direction: rtl;
  color: #fff; font-size: clamp(2.3rem, 5vw, 3.3rem); line-height: 1.6; margin: 0 0 .4rem;
  text-shadow: 0 2px 20px rgba(0,0,0,.35);
}
.arch-card .arch-latin { position: relative; z-index: 1; color: var(--gold-200, #f2dc94); font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; }
.arch-card .arch-divider { position: relative; z-index: 1; width: 46px; height: 1px; background: rgba(212,175,55,.6); margin: 1.1rem 0; }
.arch-card .arch-sub { position: relative; z-index: 1; color: rgba(255,255,255,.72); font-size: .82rem; max-width: 24ch; margin: 0; }

.float-card {
  position: absolute; z-index: 2;
  display: flex; align-items: center; gap: .65rem;
  padding: .7rem .9rem; border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  animation: floaty 6s ease-in-out infinite;
}
.float-card .fc-ar { font-family: var(--font-ar); direction: rtl; font-size: 1.35rem; line-height: 1; color: var(--emerald-800); }
[data-theme="dark"] .float-card .fc-ar { color: var(--gold-300); }
.float-card .fc-id { font-size: .72rem; font-weight: 700; color: var(--muted); }
.float-card .fc-title { font-size: .64rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.float-a { top: 9%; right: -4%; animation-delay: -1.5s; }
.float-b { bottom: 14%; left: -6%; animation-delay: -3.5s; }
.float-c {
  bottom: 3%; right: 4%; flex-direction: column; align-items: flex-start; gap: .35rem;
  min-width: 168px; animation-delay: -2.2s;
}
.float-c .mini-bar { width: 100%; height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.float-c .mini-bar span { display: block; height: 100%; width: 72%; background: linear-gradient(90deg, var(--emerald-600), var(--gold-500)); border-radius: 99px; }
.float-c .mini-row { display: flex; justify-content: space-between; width: 100%; font-size: .64rem; color: var(--muted); font-weight: 700; }

@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,.35); } 50% { box-shadow: 0 0 0 9px rgba(16,185,129,0); } }

/* ---------- Stats strip ---------- */
.stats-strip {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--line); border: 1px solid var(--line);
  border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.stat { background: var(--surface); padding: 1.2rem 1.1rem; display: flex; flex-direction: column; gap: .15rem; }
.stat-value { font-size: clamp(1.3rem, 2.4vw, 1.8rem); font-weight: 800; letter-spacing: -.02em; color: var(--emerald-800); line-height: 1.2; }
[data-theme="dark"] .stat-value { color: var(--gold-300); }
.stat-label { font-size: .74rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* ---------- Cards / grids ---------- */
.grid { display: grid; gap: 1.1rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: clamp(1.2rem, 2.4vw, 1.8rem);
  box-shadow: var(--shadow-sm);
  transition: transform .25s var(--ease), box-shadow .25s, border-color .25s;
}
.card-hover:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--emerald-600) 30%, var(--line)); }

.feature-icon {
  display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px;
  background: var(--emerald-50); color: var(--emerald-700); margin-bottom: 1rem;
  border: 1px solid color-mix(in srgb, var(--emerald-600) 18%, transparent);
}
[data-theme="dark"] .feature-icon { background: var(--emerald-100); color: var(--emerald-100); }
.feature-icon svg { width: 24px; height: 24px; }
.feature-card h3 { margin-bottom: .35rem; font-size: 1.08rem; }
.feature-card p { color: var(--muted); font-size: .9rem; margin-bottom: 0; }
.feature-card .card-link { display: inline-flex; align-items: center; gap: .35rem; margin-top: .9rem; font-size: .84rem; font-weight: 700; color: var(--emerald-700); }
[data-theme="dark"] .feature-card .card-link { color: var(--gold-300); }
.feature-card .card-link svg { width: 15px; height: 15px; transition: transform .2s; }
.feature-card:hover .card-link svg { transform: translateX(4px); }

/* path steps */
.path-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; counter-reset: step; }
.path-step {
  position: relative; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 1.5rem 1.2rem 1.3rem; box-shadow: var(--shadow-sm);
}
.path-step::before {
  counter-increment: step; content: "0" counter(step);
  display: inline-grid; place-items: center; min-width: 38px; height: 38px; padding: 0 .45rem;
  border-radius: 12px; background: var(--emerald-800); color: var(--gold-300);
  font-size: .78rem; font-weight: 800; letter-spacing: .06em; margin-bottom: .9rem;
}
.path-step h3 { font-size: 1rem; margin-bottom: .3rem; }
.path-step p { font-size: .84rem; color: var(--muted); margin-bottom: .8rem; }
.path-step .path-tag { font-size: .68rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--emerald-700); }
[data-theme="dark"] .path-step .path-tag { color: var(--gold-300); }
.path-step::after {
  content: ""; position: absolute; top: 50%; right: -1rem; width: 1rem; height: 2px;
  background: var(--line-strong);
}
.path-step:last-child::after { display: none; }

/* ---------- Word of the day ---------- */
.wotd {
  display: grid; grid-template-columns: 1.2fr .8fr; gap: 0;
  background: linear-gradient(135deg, var(--emerald-900), var(--emerald-800) 60%, #0a5c47);
  border-radius: var(--radius-xl); overflow: hidden; color: #fff;
  box-shadow: var(--shadow-lg); border: 1px solid rgba(212,175,55,.25);
  position: relative;
}
.wotd::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255,255,255,.07) 1px, transparent 1px);
  background-size: 20px 20px;
  -webkit-mask-image: linear-gradient(115deg, #000, transparent 65%);
  mask-image: linear-gradient(115deg, #000, transparent 65%);
}
.wotd-main { padding: clamp(1.8rem, 4vw, 3rem); position: relative; z-index: 1; }
.wotd-label { font-size: .68rem; letter-spacing: .24em; text-transform: uppercase; color: var(--gold-300); font-weight: 800; margin-bottom: .6rem; }
.wotd-ar { font-family: var(--font-ar); direction: rtl; font-size: clamp(2.8rem, 6vw, 4.4rem); line-height: 1.5; margin: 0 0 .2rem; color: #fff; }
.wotd-latin { color: var(--gold-200, #f2dc94); font-size: .9rem; letter-spacing: .06em; margin-bottom: .8rem; }
.wotd-id { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; }
.wotd-example { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); border-radius: var(--radius); padding: .9rem 1rem; margin-bottom: 1.2rem; max-width: 46ch; }
.wotd-example .ex-ar { font-family: var(--font-ar); direction: rtl; font-size: 1.3rem; line-height: 1.9; margin-bottom: .2rem; }
.wotd-example .ex-latin { font-size: .74rem; font-style: italic; color: rgba(255,255,255,.62); margin-bottom: .1rem; }
.wotd-example .ex-id { font-size: .82rem; color: rgba(255,255,255,.72); }
.wotd-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.wotd-actions .btn-outline { --btn-fg: #fff; border-color: rgba(255,255,255,.35); }
.wotd-actions .btn-outline:hover { --btn-bg: rgba(255,255,255,.1); }
.wotd-side {
  position: relative; z-index: 1; display: grid; place-items: center; padding: 2rem;
  border-left: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.12);
}
.ring { --p: 0; --size: 150px; width: var(--size); height: var(--size); position: relative; display: grid; place-items: center; }
.ring::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(var(--gold-500) calc(var(--p) * 1%), rgba(255,255,255,.14) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 12px), #000 calc(100% - 11px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 12px), #000 calc(100% - 11px));
}
.ring-inner { text-align: center; }
.ring-value { font-size: 1.9rem; font-weight: 800; line-height: 1; }
.ring-label { font-size: .64rem; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.65); margin-top: .25rem; }

/* ---------- FAQ ---------- */
.faq-list { display: grid; gap: .7rem; }
.faq-item { padding: 0; overflow: hidden; }
.faq-item summary {
  cursor: pointer; padding: 1rem 1.2rem; font-weight: 700; list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 1.3rem; line-height: 1; color: var(--emerald-700); font-weight: 800; }
[data-theme="dark"] .faq-item summary::after { color: var(--gold-300); }
.faq-item[open] summary::after { content: "−"; }
.faq-item .faq-body { padding: 0 1.2rem 1.1rem; color: var(--muted); font-size: .9rem; }
.faq-item .faq-body p:last-child { margin-bottom: 0; }

/* ---------- CTA band ---------- */
.cta-band {
  display: flex; align-items: center; justify-content: space-between; gap: 2rem;
  background: linear-gradient(120deg, var(--emerald-900), var(--emerald-700));
  border-radius: var(--radius-xl); padding: clamp(1.8rem, 4vw, 3rem);
  color: #fff; position: relative; overflow: hidden; box-shadow: var(--shadow-lg);
  border: 1px solid rgba(212,175,55,.3);
}
.cta-band::after {
  content: "ع"; font-family: var(--font-ar); position: absolute; right: 2%; bottom: -38%;
  font-size: 16rem; line-height: 1; color: rgba(255,255,255,.05); pointer-events: none;
}
.cta-band h2 { color: #fff; margin-bottom: .35rem; }
.cta-band p { color: rgba(255,255,255,.75); margin-bottom: 0; max-width: 52ch; }
.cta-band .btn { flex: none; }

/* ---------- Page hero ---------- */
.page-hero {
  padding: clamp(2rem, 4vw, 3.4rem) 0 clamp(1.2rem, 2.5vw, 2rem);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  background:
    radial-gradient(700px 280px at 90% -40%, rgba(212,175,55,.12), transparent 70%),
    radial-gradient(600px 300px at 0% -30%, rgba(5,150,105,.10), transparent 65%);
}
.page-hero .breadcrumb { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; font-size: .76rem; color: var(--muted); margin-bottom: 1rem; font-weight: 600; }
.page-hero .breadcrumb a { color: var(--muted); }
.page-hero .breadcrumb a:hover { color: var(--emerald-700); }
.page-hero h1 { margin-bottom: .4rem; }
.page-hero .lead { max-width: 66ch; margin-bottom: 0; }
.page-hero .hero-actions { margin-bottom: 0; }
.page-hero-flex { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }
.page-hero-ar { font-family: var(--font-ar); direction: rtl; font-size: clamp(1.6rem, 3vw, 2.2rem); color: var(--emerald-700); }
[data-theme="dark"] .page-hero-ar { color: var(--gold-300); }

/* ---------- Progress bars ---------- */
.progress { height: 9px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--emerald-600), var(--emerald-500)); transition: width .5s var(--ease); }
.progress.gold > span { background: linear-gradient(90deg, var(--gold-600), var(--gold-400)); }
.progress-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; font-size: .78rem; font-weight: 700; color: var(--muted); margin-bottom: .35rem; }

/* ---------- Chips & toolbar ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; margin-bottom: 1.4rem; }
.search-box { position: relative; flex: 1 1 260px; max-width: 420px; }
.search-box svg { position: absolute; left: .95rem; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.search-box input {
  width: 100%; min-height: 46px; padding: .6rem 1rem .6rem 2.7rem;
  border-radius: var(--radius-pill); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-size: .9rem;
  transition: border-color .18s, box-shadow .18s;
}
.search-box input:focus { outline: none; border-color: var(--emerald-500); box-shadow: 0 0 0 4px color-mix(in srgb, var(--emerald-500) 18%, transparent); }
.search-box input::placeholder { color: var(--muted); }

.chips { display: flex; gap: .45rem; overflow-x: auto; padding: .2rem 0 .5rem; scrollbar-width: thin; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem .9rem; border-radius: var(--radius-pill);
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-soft); font-size: .82rem; font-weight: 700; white-space: nowrap;
  transition: background .18s, color .18s, border-color .18s, transform .18s;
}
.chip:hover { border-color: var(--emerald-500); color: var(--emerald-700); transform: translateY(-1px); }
.chip.active { background: var(--emerald-800); border-color: var(--emerald-800); color: #fff; }
.chip .chip-ar { font-family: var(--font-ar); direction: rtl; font-size: 1.02em; }
.chip .count { font-size: .68rem; opacity: .7; }

/* ---------- Word cards ---------- */
.word-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 1rem; }
.word-card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 1.15rem 1.2rem 1.1rem; box-shadow: var(--shadow-sm);
  transition: transform .22s var(--ease), box-shadow .22s, border-color .22s;
  position: relative; overflow: hidden;
}
.word-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--emerald-500) 35%, var(--line)); }
.word-card.is-known { border-color: color-mix(in srgb, var(--emerald-500) 55%, var(--line)); }
.word-card.is-known::after {
  content: "✓"; position: absolute; top: 0; right: 0; width: 34px; height: 34px;
  display: grid; place-items: center; background: var(--emerald-600); color: #fff; font-weight: 800;
  border-radius: 0 var(--radius-lg) 0 var(--radius-lg); font-size: .8rem;
}
.word-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .2rem; }
.word-index { font-size: .68rem; font-weight: 800; color: var(--muted); letter-spacing: .1em; }
.word-audio-group { display: flex; gap: .35rem; }
.word-audio-group .btn-audio { width: 34px; height: 34px; }
.word-audio-group .btn-audio svg { width: 15px; height: 15px; }
.word-arabic {
  font-family: var(--font-ar); direction: rtl; unicode-bidi: isolate;
  font-size: clamp(2.1rem, 3.6vw, 2.7rem); line-height: 1.75;
  color: var(--emerald-800); margin: .1rem 0 .1rem;
}
[data-theme="dark"] .word-arabic { color: var(--gold-300); }
.word-latin { font-size: .8rem; color: var(--muted); font-style: italic; letter-spacing: .02em; }
.word-meaning { font-size: 1.02rem; font-weight: 800; margin: .35rem 0 .8rem; }
.word-example {
  margin-top: auto; background: var(--surface-2); border-radius: var(--radius-sm);
  padding: .7rem .8rem; font-size: .82rem; color: var(--ink-soft);
  border: 1px dashed var(--line-strong);
}
.word-example .ex-ar { font-family: var(--font-ar); direction: rtl; font-size: 1.12rem; line-height: 1.9; margin-bottom: .15rem; color: var(--ink); }
.word-example .ex-id { color: var(--muted); font-size: .76rem; }
.word-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .8rem; }
.known-btn {
  display: inline-flex; align-items: center; gap: .35rem; padding: .32rem .65rem;
  border-radius: var(--radius-pill); border: 1px solid var(--line);
  background: transparent; color: var(--muted); font-size: .72rem; font-weight: 700;
}
.known-btn:hover { border-color: var(--emerald-500); color: var(--emerald-700); }
.known-btn.on { background: var(--emerald-50); border-color: var(--emerald-500); color: var(--emerald-700); }
[data-theme="dark"] .known-btn.on { color: var(--emerald-100); }
.empty-state {
  grid-column: 1 / -1; text-align: center; padding: 3rem 1rem; color: var(--muted);
  border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); background: var(--surface);
}
.empty-state strong { display: block; color: var(--ink); font-size: 1.05rem; margin-bottom: .25rem; }

/* ---------- Modal / flashcard ---------- */
.modal { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: 1rem; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(5, 25, 18, .62); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
.modal-panel {
  position: relative; z-index: 1; width: min(100%, 560px); max-height: 92vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg); padding: clamp(1.2rem, 3vw, 1.8rem);
  animation: pop .25s var(--ease);
}
.modal-panel.wide { width: min(100%, 760px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.modal-head h3 { margin: 0; }
.modal-close { border: 0; background: transparent; color: var(--muted); width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; }
.modal-close:hover { background: var(--surface-2); color: var(--ink); }
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.flash-stage { perspective: 1200px; margin: .4rem 0 1rem; }
.flashcard {
  position: relative; width: 100%; min-height: 310px;
  transform-style: preserve-3d; transition: transform .55s var(--ease);
  cursor: pointer;
}
.flashcard.flipped { transform: rotateY(180deg); }
.flash-face {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 1.5rem; border-radius: var(--radius-lg); text-align: center;
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
  border: 1px solid var(--line); background: var(--surface-2);
}
.flash-face.back {
  transform: rotateY(180deg);
  background: linear-gradient(145deg, var(--emerald-900), var(--emerald-800));
  color: #fff; border-color: rgba(212,175,55,.3);
}
.flash-face .flash-ar { font-family: var(--font-ar); direction: rtl; font-size: clamp(2.5rem, 7vw, 3.6rem); line-height: 1.7; color: var(--emerald-800); margin-bottom: .2rem; }
[data-theme="dark"] .flash-face .flash-ar { color: var(--gold-300); }
.flash-face .flash-latin { color: var(--muted); font-style: italic; font-size: .9rem; }
.flash-face .flash-hint { position: absolute; bottom: .9rem; font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.flash-face.back .flash-id { font-size: 1.5rem; font-weight: 800; margin-bottom: .4rem; }
.flash-face.back .flash-ex { font-size: .86rem; color: rgba(255,255,255,.75); max-width: 40ch; }
.flash-face.back .flash-ex .ar { font-size: 1.2rem; color: #fff; margin-bottom: .2rem; }
.flash-controls { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.flash-controls .btn { flex: none; }
.flash-progress { font-size: .78rem; font-weight: 700; color: var(--muted); }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: .5rem; align-items: center; pointer-events: none; width: max-content; max-width: 92vw; }
.toast {
  display: flex; align-items: center; gap: .6rem;
  background: var(--ink); color: var(--cream); padding: .7rem 1.1rem;
  border-radius: var(--radius-pill); box-shadow: var(--shadow-lg);
  font-size: .86rem; font-weight: 600; animation: toastin .3s var(--ease);
  border: 1px solid rgba(255,255,255,.12);
}
[data-theme="dark"] .toast { background: var(--surface-3); color: var(--ink); }
.toast.success { background: var(--emerald-800); color: #fff; }
.toast.gold { background: var(--gold-500); color: #2a2208; }
@keyframes toastin { from { transform: translateY(14px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ---------- Footer ---------- */
.site-footer { margin-top: clamp(3rem, 6vw, 5rem); background: var(--emerald-950); color: rgba(255,255,255,.72); position: relative; overflow: hidden; }
.site-footer::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    radial-gradient(rgba(212,175,55,.13) 1px, transparent 1px);
  background-size: 26px 26px;
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent 60%);
  mask-image: linear-gradient(to bottom, #000, transparent 60%);
}
.footer-inner { position: relative; z-index: 1; padding: clamp(2.4rem, 5vw, 3.6rem) 0 1.6rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr .8fr .8fr .9fr; gap: 2rem; }
.footer-brand .brand { color: #fff; margin-bottom: .8rem; }
.footer-brand .brand-mark { background: linear-gradient(145deg, #0a5c47, #0b7a5d); }
.footer-brand p { font-size: .86rem; color: rgba(255,255,255,.6); max-width: 34ch; margin-bottom: .9rem; }
.footer-ar { font-family: var(--font-ar); direction: rtl; color: var(--gold-300); font-size: 1.3rem; }
.footer-col h4 { color: #fff; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; margin-bottom: .8rem; }
.footer-col ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .45rem; }
.footer-col a { color: rgba(255,255,255,.65); font-size: .86rem; }
.footer-col a:hover { color: var(--gold-300); }
.footer-bottom {
  position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem;
  padding: 1.1rem 0; border-top: 1px solid rgba(255,255,255,.1); font-size: .76rem; color: rgba(255,255,255,.5);
}

/* ---------- Qoidah page ---------- */
.lesson-layout { display: grid; grid-template-columns: 300px 1fr; gap: 1.6rem; align-items: start; }
.lesson-nav {
  position: sticky; top: calc(var(--header-h) + 1rem);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: .7rem; box-shadow: var(--shadow-sm); max-height: calc(100vh - var(--header-h) - 2rem); overflow: auto;
}
.lesson-nav-head { padding: .6rem .7rem .8rem; border-bottom: 1px solid var(--line); margin-bottom: .5rem; }
.lesson-nav-head strong { display: block; font-size: .92rem; }
.lesson-nav-head span { font-size: .74rem; color: var(--muted); }
.lesson-nav button {
  display: flex; align-items: flex-start; gap: .65rem; width: 100%; text-align: left;
  padding: .62rem .7rem; border: 0; border-radius: var(--radius-sm); background: transparent;
  color: var(--ink-soft); font-size: .84rem; font-weight: 600; line-height: 1.35;
  transition: background .18s, color .18s;
}
.lesson-nav button:hover { background: var(--surface-2); color: var(--ink); }
.lesson-nav button.active { background: var(--emerald-800); color: #fff; }
.lesson-nav .lnum {
  flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px;
  background: var(--surface-2); color: var(--muted); font-size: .68rem; font-weight: 800;
}
.lesson-nav button.active .lnum { background: rgba(255,255,255,.16); color: var(--gold-300); }
.lesson-nav button.done .lnum::after { content: "✓"; }
.lesson-nav button.done .lnum { color: var(--emerald-600); }
.lesson-nav button.active.done .lnum { color: var(--gold-300); }
.lesson-content { min-width: 0; }
.lesson-article { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: clamp(1.3rem, 3vw, 2.2rem); box-shadow: var(--shadow-sm); }
.lesson-article h2 { margin-bottom: .2rem; }
.lesson-article .lesson-ar-title { font-family: var(--font-ar); direction: rtl; color: var(--emerald-700); font-size: 1.7rem; margin-bottom: 1rem; }
[data-theme="dark"] .lesson-article .lesson-ar-title { color: var(--gold-300); }
.lesson-article h3 { margin: 1.6rem 0 .5rem; font-size: 1.05rem; }
.lesson-article h3:first-of-type { margin-top: .8rem; }
.lesson-article p { color: var(--ink-soft); font-size: .94rem; }
.lesson-article ul, .lesson-article ol { color: var(--ink-soft); font-size: .94rem; }
.lesson-article li { margin-bottom: .3rem; }
.lesson-article strong { color: var(--ink); }
.lesson-lead { font-size: 1rem; color: var(--muted) !important; margin-bottom: 1.4rem; }

.table-wrap { overflow-x: auto; margin: 1rem 0 1.4rem; border: 1px solid var(--line); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: .87rem; min-width: 460px; background: var(--surface); }
table.data th, table.data td { padding: .65rem .8rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data th { background: var(--surface-2); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 800; white-space: nowrap; }
table.data tr:last-child td { border-bottom: 0; }
table.data td .ar { font-size: 1.2rem; }
table.data td.center { text-align: center; }
.table-ar td, .table-ar th { text-align: right; }
.table-ar td:first-child { font-family: var(--font-ar); font-size: 1.25rem; }

.example-list { display: grid; gap: .7rem; margin: 1rem 0 1.4rem; }
.example-item {
  display: flex; align-items: center; gap: .9rem; justify-content: space-between;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .8rem 1rem;
}
.example-item .ex-body { min-width: 0; }
.example-item .ex-ar { font-family: var(--font-ar); direction: rtl; font-size: 1.35rem; line-height: 1.85; color: var(--ink); }
.example-item .ex-latin { font-size: .76rem; color: var(--muted); font-style: italic; }
.example-item .ex-id { font-size: .84rem; color: var(--ink-soft); }
.example-item .btn-audio { flex: none; }

.rumus-grid { display: grid; gap: .6rem; margin: 1rem 0 1.4rem; }
.rumus {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
  padding: .75rem .9rem; border-radius: var(--radius); background: var(--emerald-50);
  border: 1px solid color-mix(in srgb, var(--emerald-600) 22%, transparent);
  font-size: .88rem;
}
[data-theme="dark"] .rumus { background: var(--emerald-50); }
.rumus .r-ar { font-family: var(--font-ar); direction: rtl; font-size: 1.2rem; color: var(--emerald-800); }
[data-theme="dark"] .rumus .r-ar { color: var(--gold-300); }
.rumus .r-eq { color: var(--muted); font-weight: 800; }
.rumus .r-id { color: var(--ink-soft); }
.lesson-note {
  border-left: 4px solid var(--gold-500); background: var(--gold-100);
  border-radius: 0 var(--radius) var(--radius) 0; padding: .85rem 1rem; margin: 1.2rem 0;
  font-size: .88rem; color: #5d4a10;
}
[data-theme="dark"] .lesson-note { color: var(--gold-300); }
.lesson-note strong { color: inherit; }

.lesson-quiz { margin-top: 1.5rem; background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); padding: clamp(1rem, 2.5vw, 1.5rem); }
.lesson-quiz h3 { margin-top: 0; }
.quiz-q { margin-bottom: .9rem; }
.quiz-q:last-child { margin-bottom: 0; }
.quiz-q .qq-title { font-size: .9rem; font-weight: 700; margin-bottom: .5rem; }
.quiz-q .qq-ar { font-family: var(--font-ar); direction: rtl; font-size: 1.15rem; margin-left: .3rem; }
.quiz-opts { display: grid; gap: .4rem; }
.quiz-opt {
  display: flex; align-items: center; gap: .55rem; width: 100%; text-align: left;
  padding: .5rem .7rem; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface); font-size: .85rem; transition: border-color .15s, background .15s;
}
.quiz-opt:hover { border-color: var(--emerald-500); }
.quiz-opt.correct { border-color: var(--success); background: var(--success-bg); color: var(--success); font-weight: 700; }
.quiz-opt.wrong { border-color: var(--danger); background: var(--danger-bg); color: var(--danger); }
.quiz-opt[disabled] { cursor: default; opacity: .9; }
.lesson-quiz-foot { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-top: 1rem; flex-wrap: wrap; }
.quiz-score { font-size: .85rem; font-weight: 700; color: var(--muted); }

.lesson-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.4rem; flex-wrap: wrap; }
.lesson-progress-card { margin-top: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow-sm); }

/* ---------- Kalimat / token colors ---------- */
.pattern-legend { display: flex; flex-wrap: wrap; gap: .4rem .8rem; font-size: .72rem; color: var(--muted); margin-bottom: 1rem; }
.pattern-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.role-mubtada { --role: #047857; }
.role-khabar { --role: #b8912a; }
.role-fiil { --role: #175cd3; }
.role-fail { --role: #7a5af8; }
.role-maful { --role: #c11574; }
.role-harf { --role: #667085; }
.role-naat { --role: #0e9384; }
.role-manut { --role: #0f766e; }
.role-mudhaf { --role: #dc6803; }
.role-mudhaf-ilaih { --role: #8b5a2b; }
.role-jar { --role: #d92d20; }
.role-sifat { --role: #0e9384; }
.role-other { --role: #667085; }
.token[data-role] { border-color: color-mix(in srgb, var(--role, var(--line)) 45%, var(--line)); }
.token[data-role]::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--role, var(--muted)); flex: none; }
.token .t-role { font-size: .58rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--role, var(--muted)); }

.builder-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl); padding: clamp(1.2rem, 3vw, 2rem); box-shadow: var(--shadow-md); }
.builder-prompt { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: 1rem; }
.builder-prompt .bp-label { font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 800; }
.builder-prompt .bp-id { font-size: clamp(1.05rem, 2vw, 1.3rem); font-weight: 800; }
.dropzone {
  min-height: 112px; border: 2px dashed var(--line-strong); border-radius: var(--radius-lg);
  background: var(--surface-2); padding: .9rem; display: flex; flex-wrap: wrap; gap: .45rem;
  align-content: flex-start; direction: rtl; transition: border-color .18s, background .18s;
}
.dropzone.over { border-color: var(--emerald-500); background: var(--emerald-50); }
.dropzone.correct { border-color: var(--success); border-style: solid; background: var(--success-bg); }
.dropzone.wrong { border-color: var(--danger); border-style: solid; background: var(--danger-bg); animation: shake .35s; }
.dropzone .dz-hint { direction: ltr; width: 100%; align-self: center; text-align: center; color: var(--muted); font-size: .82rem; }
.word-bank { display: flex; flex-wrap: wrap; gap: .45rem; margin: 1rem 0; direction: rtl; min-height: 44px; }
.token {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .5rem .85rem; border-radius: var(--radius-pill);
  background: var(--surface); border: 1px solid var(--line-strong);
  font-family: var(--font-ar); font-size: 1.25rem; line-height: 1.2;
  cursor: pointer; transition: transform .15s var(--ease), box-shadow .15s, background .15s;
  box-shadow: var(--shadow-xs);
}
.token:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); background: var(--gold-100); }
.token:disabled { opacity: .45; cursor: default; transform: none; box-shadow: none; }
.builder-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: 1rem; }
.builder-feedback { margin-top: 1rem; border-radius: var(--radius); padding: .8rem 1rem; font-size: .9rem; font-weight: 600; display: none; }
.builder-feedback.show { display: block; }
.builder-feedback.ok { background: var(--success-bg); color: var(--success); border: 1px solid color-mix(in srgb, var(--success) 30%, transparent); }
.builder-feedback.no { background: var(--danger-bg); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* ---------- Suara page ---------- */
.voice-layout { display: grid; grid-template-columns: 340px 1fr; gap: 1.6rem; align-items: start; }
.voice-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.voice-list-head { padding: .9rem 1rem; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.voice-list-head strong { font-size: .9rem; }
.voice-items { max-height: 520px; overflow: auto; }
.voice-item {
  display: flex; align-items: center; gap: .7rem; width: 100%; text-align: left;
  padding: .7rem 1rem; border: 0; border-bottom: 1px solid var(--line);
  background: transparent; transition: background .15s;
}
.voice-item:last-child { border-bottom: 0; }
.voice-item:hover { background: var(--surface-2); }
.voice-item.active { background: var(--emerald-50); box-shadow: inset 3px 0 0 var(--emerald-600); }
[data-theme="dark"] .voice-item.active { background: var(--emerald-50); }
.voice-item .vi-num { flex: none; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-3); font-size: .66rem; font-weight: 800; color: var(--muted); }
.voice-item.active .vi-num { background: var(--emerald-700); color: #fff; }
.voice-item.done .vi-num { background: var(--emerald-600); color: #fff; }
.voice-item .vi-body { min-width: 0; }
.voice-item .vi-ar { font-family: var(--font-ar); direction: rtl; font-size: 1.15rem; line-height: 1.7; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.voice-item .vi-id { font-size: .74rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.voice-stage { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl); padding: clamp(1.3rem, 3vw, 2.2rem); box-shadow: var(--shadow-md); text-align: center; }
.voice-target .vt-ar { font-family: var(--font-ar); direction: rtl; font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1.7; color: var(--emerald-800); }
[data-theme="dark"] .voice-target .vt-ar { color: var(--gold-300); }
.voice-target .vt-latin { color: var(--muted); font-style: italic; font-size: .88rem; }
.voice-target .vt-id { font-size: 1.02rem; font-weight: 700; margin-top: .2rem; }
.voice-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; margin: 1.3rem 0; }
.record-zone { display: flex; flex-direction: column; align-items: center; gap: .7rem; padding: 1rem; }
.record-btn {
  width: 88px; height: 88px; border-radius: 50%; border: 4px solid var(--surface);
  background: linear-gradient(145deg, #dc2626, #b91c1c); color: #fff;
  display: grid; place-items: center; box-shadow: 0 0 0 1px color-mix(in srgb, #dc2626 35%, transparent), var(--shadow-md);
  transition: transform .18s var(--ease), box-shadow .18s;
}
.record-btn:hover { transform: scale(1.05); }
.record-btn.recording { animation: recpulse 1.4s infinite; }
.record-btn svg { width: 30px; height: 30px; }
@keyframes recpulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,.35); } 50% { box-shadow: 0 0 0 16px rgba(220,38,38,0); } }
.record-hint { font-size: .8rem; color: var(--muted); }
.recording-time { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--danger); }
.wave { display: flex; align-items: center; gap: 3px; height: 28px; }
.wave span { width: 3px; border-radius: 2px; background: var(--emerald-500); height: 8px; animation: wave 1s ease-in-out infinite; }
.wave span:nth-child(2n) { animation-delay: .15s; }
.wave span:nth-child(3n) { animation-delay: .3s; }
.wave span:nth-child(4n) { animation-delay: .45s; }
.wave.paused span { animation-play-state: paused; height: 8px; }
@keyframes wave { 0%, 100% { height: 8px; } 50% { height: 24px; } }
.compare-box { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; }
.audio-preview { display: none; align-items: center; gap: .6rem; padding: .5rem .9rem; border-radius: var(--radius-pill); background: var(--surface-2); border: 1px solid var(--line); font-size: .8rem; font-weight: 700; }
.audio-preview.show { display: inline-flex; }
.transcript-box {
  margin-top: 1rem; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .9rem 1rem; text-align: left;
}
.transcript-box .tb-label { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 800; margin-bottom: .3rem; }
.transcript-box .tb-ar { font-family: var(--font-ar); direction: rtl; font-size: 1.3rem; line-height: 1.8; min-height: 1.8em; }
.score-row { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; flex-wrap: wrap; }
.score-pill { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .8rem; border-radius: var(--radius-pill); font-size: .8rem; font-weight: 800; }
.score-pill.good { background: var(--success-bg); color: var(--success); }
.score-pill.mid { background: var(--warning-bg); color: var(--warning); }
.score-pill.low { background: var(--danger-bg); color: var(--danger); }
.voice-tip { font-size: .8rem; color: var(--muted); margin-top: 1rem; }
.notice {
  display: flex; gap: .7rem; align-items: flex-start; padding: .85rem 1rem;
  border-radius: var(--radius); font-size: .84rem; line-height: 1.55;
  background: var(--info-bg); color: var(--info); border: 1px solid color-mix(in srgb, var(--info) 22%, transparent);
}
.notice.warn { background: var(--warning-bg); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 25%, transparent); }
.notice svg { width: 18px; height: 18px; flex: none; margin-top: .1rem; }

/* ---------- Progres page ---------- */
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.stat-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 1.2rem; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: .3rem; position: relative; overflow: hidden;
}
.stat-card .sc-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--emerald-50); color: var(--emerald-700); margin-bottom: .35rem; }
[data-theme="dark"] .stat-card .sc-icon { background: var(--emerald-100); color: var(--emerald-100); }
.stat-card .sc-icon svg { width: 19px; height: 19px; }
.stat-card .sc-value { font-size: 1.7rem; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; }
.stat-card .sc-label { font-size: .74rem; color: var(--muted); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.stat-card .sc-sub { font-size: .74rem; color: var(--muted); margin-top: .2rem; }

.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .8rem; }
.achievement {
  display: flex; align-items: center; gap: .75rem; padding: .9rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  transition: transform .2s, box-shadow .2s; position: relative;
}
.achievement:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.achievement .ach-icon {
  flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: var(--gold-100); color: var(--gold-600); font-size: 1.2rem;
  border: 1px solid color-mix(in srgb, var(--gold-500) 35%, transparent);
}
.achievement.unlocked .ach-icon { background: linear-gradient(145deg, var(--gold-500), var(--gold-600)); color: #fff; box-shadow: 0 6px 16px -6px rgba(184,145,42,.6); }
.achievement.locked { opacity: .55; filter: grayscale(.4); }
.achievement .ach-name { font-size: .84rem; font-weight: 800; }
.achievement .ach-desc { font-size: .72rem; color: var(--muted); }
.achievement .ach-body { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.achievement .ach-lock { position: absolute; top: .6rem; right: .7rem; color: var(--muted); }
.achievement .ach-lock svg { width: 13px; height: 13px; }

.theme-progress-list { display: grid; gap: .9rem; }
.theme-progress-item { display: grid; gap: .25rem; }
.theme-progress-item .tp-head { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; font-size: .84rem; font-weight: 700; }
.theme-progress-item .tp-head .tp-ar { font-family: var(--font-ar); direction: rtl; color: var(--muted); font-weight: 400; font-size: .95rem; }
.theme-progress-item .tp-count { font-size: .74rem; color: var(--muted); font-weight: 700; }

.history-table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.history-table-wrap table.data { min-width: 520px; }
.result-pill { display: inline-flex; padding: .18rem .55rem; border-radius: var(--radius-pill); font-size: .7rem; font-weight: 800; background: var(--emerald-50); color: var(--emerald-700); }
[data-theme="dark"] .result-pill { color: var(--emerald-100); }

/* ---------- Utilities ---------- */
.stack-sm > * + * { margin-top: .5rem; }
.stack > * + * { margin-top: 1rem; }
.stack-lg > * + * { margin-top: 1.6rem; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; }
.row-between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .7rem; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0 !important; } .mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.w-100 { width: 100%; }
.hide { display: none !important; }
.fade-up { animation: fadeUp .6s var(--ease) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.reveal { opacity: 0; transform: translateY(20px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.visible { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-visual { min-height: 360px; margin-top: .5rem; }
  .arch-card { width: min(100%, 340px); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .path-grid { grid-template-columns: repeat(2, 1fr); }
  .path-step::after { display: none; }
  .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; }
  .footer-col:last-child { grid-column: 1 / -1; }
  .lesson-layout { grid-template-columns: 1fr; }
  .lesson-nav { position: static; max-height: none; display: flex; gap: .4rem; overflow-x: auto; padding: .5rem; }
  .lesson-nav-head { display: none; }
  .lesson-nav button { width: auto; flex: none; white-space: nowrap; padding: .5rem .75rem; }
  .lesson-nav .lnum { width: 20px; height: 20px; }
  .voice-layout { grid-template-columns: 1fr; }
  .voice-items { max-height: 280px; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .stats-strip { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .wotd { grid-template-columns: 1fr; }
  .wotd-side { border-left: 0; border-top: 1px solid rgba(255,255,255,.12); }
  .cta-band { flex-direction: column; align-items: flex-start; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
  .float-a { right: 0; }
  .float-b { left: 0; }
  .hero-visual { min-height: 330px; }
  .word-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .builder-card { padding: 1.1rem; }
  .page-hero-flex { align-items: flex-start; }
}

@media (max-width: 520px) {
  :root { --header-h: 66px; }
  .brand-sub { display: none; }
  .brand-mark { width: 40px; height: 40px; }
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .btn-lg { min-height: 48px; padding: .7rem 1.2rem; font-size: .92rem; }
  .word-grid { grid-template-columns: 1fr; }
  .stat { padding: .9rem .8rem; }
  .stat-label { font-size: .64rem; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-col:last-child { grid-column: auto; }
  .modal { padding: .5rem; }
  .modal-panel { border-radius: var(--radius-lg); }
  .flashcard { min-height: 270px; }
}

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

/* ---------- Print ---------- */
@media print {
  .site-header, .site-footer, .toast-wrap, .btn, .breadcrumb { display: none !important; }
  body { background: #fff; }
  .card, .lesson-article { box-shadow: none; border-color: #ccc; }
}
