/* منصة الروضة من تحضيري — bright KG look, RTL-first, shares the game's palette:
   purple #4a3aa8 · teal #14b8a6 · orange #e8791d · grass #79c24d · gold #ffd54f */
:root {
  --purple: #4a3aa8;
  --purple-2: #5b4bc0;
  --teal: #14b8a6;
  --orange: #e8791d;
  --grass: #79c24d;
  --gold: #ffd54f;
  --paper: #fdfbf4;
  --ink: #2d2a3e;
  --card: #ffffff;
  --radius: 22px;
  --shadow: 0 8px 24px rgba(74, 58, 168, .13);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, #dff3ff 0%, var(--paper) 320px);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── top bar ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 14px 5vw;
  background: var(--purple);
  box-shadow: 0 3px 0 var(--purple-2);
}
.brand {
  color: #fff; text-decoration: none; font-size: 1.45rem; font-weight: 800;
  display: flex; align-items: center; gap: 10px;
}
.brand-mark { font-size: 1.6rem; }
.topbar nav { display: flex; gap: 6px; flex-wrap: wrap; }
.topbar nav a {
  color: #e7e3ff; text-decoration: none; font-weight: 700;
  padding: 8px 18px; border-radius: 999px; transition: background .15s;
}
.topbar nav a:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.topbar nav a.on { background: var(--gold); color: #4a3500; }

/* زر «ألعاب الروضة» — btn-gold مصغّر في أقصى يسار شريط التنقل */
.topbar nav a.topbar-play {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--gold); color: #4a3500;
  padding: 7px 16px; font-weight: 800;
  box-shadow: 0 3px 0 #d9a800;
  transition: transform .1s, box-shadow .1s, background .15s;
}
.topbar nav a.topbar-play:hover { background: #ffdd66; color: #4a3500; }
.topbar nav a.topbar-play:active { transform: translateY(2px); box-shadow: 0 1px 0 #d9a800; }
.topbar nav a.topbar-play .tp-ico { line-height: 1; }
/* شاشات ضيقة جداً: تبقى الأيقونة ويختفي النص — الزر لا يكسر لفّ الترويسة */
@media (max-width: 430px) {
  .topbar nav a.topbar-play { padding: 6px 10px; }
  .topbar nav a.topbar-play .tp-txt { display: none; }
  .topbar nav a.topbar-play .tp-ico { font-size: 1.1rem; }
}

main { flex: 1; padding: 28px 5vw 48px; max-width: 1180px; margin: 0 auto; width: 100%; }

/* ── hero ── */
.hero {
  display: flex; align-items: center; gap: 28px; flex-wrap: wrap;
  background: linear-gradient(135deg, var(--purple) 0%, var(--purple-2) 100%);
  color: #fff; border-radius: calc(var(--radius) + 6px);
  padding: 34px 36px; margin-bottom: 30px; box-shadow: var(--shadow);
}
.hero .pen { font-size: 4.2rem; filter: drop-shadow(0 6px 8px rgba(0,0,0,.25)); }
.hero h1 { margin: 0 0 8px; font-size: clamp(1.5rem, 3.5vw, 2.2rem); }
.hero p { margin: 0; color: #e7e3ff; font-size: 1.05rem; line-height: 1.8; }
.hero .cta {
  margin-top: 16px; display: inline-block; background: var(--gold); color: #4a3500;
  font-weight: 800; font-size: 1.1rem; text-decoration: none;
  padding: 12px 30px; border-radius: 999px; box-shadow: 0 5px 0 #d9a800;
  transition: transform .1s;
}
.hero .cta:active { transform: translateY(4px); box-shadow: 0 1px 0 #d9a800; }

/* ── section cards / grids ── */
.grid { display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.sections { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin-bottom: 34px; }
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; text-decoration: none; color: var(--ink);
  display: flex; flex-direction: column; transition: transform .15s, box-shadow .15s;
}
a.card:hover { transform: translateY(-4px); box-shadow: 0 14px 30px rgba(74, 58, 168, .2); }
.card .art {
  height: 150px; display: flex; align-items: center; justify-content: center;
  font-size: 3.4rem; color: #fff;
}
.card .art img { width: 100%; height: 100%; object-fit: cover; }
.card .body { padding: 16px 18px 20px; }
.card h3 { margin: 0 0 6px; font-size: 1.2rem; }
.card p { margin: 0; color: #6d6880; font-size: .95rem; line-height: 1.7; }
.art-games { background: linear-gradient(135deg, var(--teal), #0d9488); }
.art-activities { background: linear-gradient(135deg, var(--orange), #d0640f); }
.art-tahdir { background: linear-gradient(135deg, var(--grass), #58a339); }
.art-worksheets { background: linear-gradient(135deg, #8a7ae0, #4a3aa8); }

.badge {
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  font-size: .8rem; font-weight: 700; margin-top: 10px;
}
.badge.soon { background: #f2efe8; color: #8a8474; }
.badge.ready { background: #dcf4cd; color: #2c6e14; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chips span {
  background: #efeaff; color: var(--purple); border-radius: 999px;
  padding: 3px 11px; font-size: .8rem; font-weight: 700;
}

h1.sec, h2.sec {
  font-size: 1.5rem; margin: 8px 0 18px;
  display: flex; align-items: center; gap: 10px;
}
h1.sec::after, h2.sec::after { content: ""; flex: 1; height: 3px; border-radius: 2px;
  background: linear-gradient(to left, var(--gold), transparent); }

/* ── play page ── */
.playwrap { position: fixed; inset: 0; display: flex; flex-direction: column; background: #16121f; }
.playbar {
  display: flex; align-items: center; gap: 14px;
  background: var(--purple); color: #fff; padding: 10px 16px;
}
.playbar a { color: #fff; text-decoration: none; font-weight: 800;
  background: rgba(255,255,255,.16); padding: 6px 16px; border-radius: 999px; }
.playbar a:hover { background: rgba(255,255,255,.28); }
.playbar .t { font-weight: 800; font-size: 1.1rem; }
.playframe { flex: 1; border: 0; width: 100%; }

/* ── tahdir list ── */
.filelist { display: flex; flex-direction: column; gap: 12px; }
.filelist a {
  display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--ink);
  background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 14px 18px;
  transition: transform .12s;
}
.filelist a:hover { transform: translateY(-2px); }
.filelist .ico { font-size: 1.8rem; }
.filelist .nm { font-weight: 700; flex: 1; }
.filelist .sz { color: #8a8474; font-size: .85rem; }

.foot {
  text-align: center; color: #8a8474; padding: 18px; font-size: .9rem;
  border-top: 1px solid #eee7d9; background: var(--paper);
}
.note { color:#6d6880; background:#fff7e0; border:1px solid #f3e3ac; border-radius:14px;
  padding:12px 18px; line-height:1.8; }

/* ═══════════════════════════════ stylist layer ═══════════════════════════════
   crumbs · toolbar/buttons · prep article · lesson grid · tabs · letters ·
   word cards · stat band · empty states · responsive · print handout        */

/* ── breadcrumbs ── */
.crumbs {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  margin: 0 0 20px; font-size: .95rem; font-weight: 700; color: #8a8474;
}
.crumbs a { color: var(--purple); text-decoration: none; padding: 2px 4px; border-radius: 8px; }
.crumbs a:hover { background: #efeaff; text-decoration: underline; }
.crumbs .sep { color: #c2bcd8; }
.crumbs .cur, .crumbs .here { color: var(--ink); }

/* ── toolbar + buttons ── */
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 22px; border-radius: 999px; border: 0; cursor: pointer;
  font-family: inherit; font-size: .95rem; font-weight: 800; line-height: 1.4;
  text-decoration: none; transition: transform .1s, box-shadow .1s, background .15s;
}
.btn-gold {
  background: var(--gold); color: #4a3500; box-shadow: 0 4px 0 #d9a800;
}
.btn-gold:hover { background: #ffdd66; }
.btn-gold:active { transform: translateY(3px); box-shadow: 0 1px 0 #d9a800; }
.btn-ghost {
  background: #fff; color: var(--purple);
  border: 2px solid #ddd6f5; box-shadow: 0 3px 0 #e7e1f8;
}
.btn-ghost:hover { background: #f4f1ff; border-color: #c9bff0; }
.btn-ghost:active { transform: translateY(2px); box-shadow: 0 1px 0 #e7e1f8; }
.btn:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

/* ── kind chips (حلقة / لقاء أخير) ── */
.kind-chip {
  display: inline-block; padding: 4px 14px; border-radius: 999px;
  font-size: .8rem; font-weight: 800; line-height: 1.6; white-space: nowrap;
}
.kind-halqa { background: #d5f5ef; color: #0b6e60; }
.kind-liqaa { background: #fdeada; color: #a5540e; }

/* ── prep article (lesson handout — readable Arabic long-form) ── */
.prep {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: clamp(20px, 4vw, 40px); max-width: 72ch; margin: 0 auto 30px;
  line-height: 2;
}
.prep-head { margin-bottom: 24px; padding-bottom: 18px; border-bottom: 3px dashed #e7e1f8; }
.prep-head h1 {
  margin: 12px 0 6px; font-size: clamp(1.4rem, 3.4vw, 1.9rem);
  color: var(--purple); line-height: 1.5;
}
.prep-head h2 { margin: 0 0 8px; font-size: 1.5rem; color: var(--purple); }
.prep-meta { margin: 0; color: #6d6880; font-weight: 700; }
/* unit-page variant: cover thumbnail beside the heading */
.prep-head:has(> .cover) { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.prep-head .cover { box-shadow: var(--shadow); flex: 0 0 auto; }
.prep-head:has(> .cover) > div { flex: 1; min-width: 240px; }

.prep-sec { margin: 22px 0; }
.prep-sec h3 {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 12px; padding-bottom: 8px; font-size: 1.15rem;
  color: var(--purple); border-bottom: 2px solid #efeaff;
}
.prep-sec p { margin: 8px 0; line-height: 2; }

/* goals — round grass bullets */
.goals ul { list-style: none; margin: 0; padding: 0; }
.goals li {
  position: relative; padding-inline-start: 26px; margin: 8px 0; line-height: 1.9;
}
.goals li::before {
  content: ""; position: absolute; inset-inline-start: 4px; top: .6em;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--grass); box-shadow: 0 0 0 3px #e6f4da;
}

/* materials — chips line */
.materials .chips-line { display: flex; flex-wrap: wrap; gap: 8px; }
.materials .chips-line span {
  background: #fff3e2; color: #a5540e; border: 1px solid #f5ddba;
  border-radius: 999px; padding: 6px 15px; font-size: .9rem; font-weight: 700;
  line-height: 1.7;
}

/* steps — numbered flow with teal badges */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps li {
  counter-increment: step; position: relative;
  padding-inline-start: 46px; margin: 12px 0; line-height: 2;
}
.steps li::before {
  content: counter(step, arabic-indic);
  position: absolute; inset-inline-start: 0; top: .15em;
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--teal); color: #fff; font-weight: 800; font-size: .9rem;
}

/* qa — numbered question cards */
.qa { list-style: none; margin: 0; padding: 0; counter-reset: q; }
.qa li {
  counter-increment: q; position: relative;
  background: #f7f5ff; border: 1px solid #e5e0f7; border-radius: 14px;
  padding: 12px 16px; padding-inline-start: 54px; margin: 10px 0; line-height: 2;
}
.qa li::before {
  content: counter(q, arabic-indic);
  position: absolute; inset-inline-start: 12px; top: 12px;
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--purple); color: #fff; font-weight: 800; font-size: .9rem;
}

/* ── day separators (unit lesson list) ── */
.day-sep {
  display: flex; align-items: center; gap: 12px;
  font-size: 1.05rem; color: #a5540e; font-weight: 800;
}
.day-sep::before { content: "☀️"; font-size: 1rem; }
.day-sep::after { content: ""; flex: 1; height: 2px; border-radius: 2px; background: #f5ddba; }

/* ── page gallery (source-page thumbnails) ── */
.pagegallery {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.pagegallery a {
  display: block; border-radius: 14px; overflow: hidden;
  background: #fff; box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
.pagegallery img { display: block; width: 100%; height: auto; transition: transform .25s; }
.pagegallery a:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(74, 58, 168, .22); }
.pagegallery a:hover img { transform: scale(1.05); }

/* ── lesson grid + cards ── */
.lessongrid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.lesson-card {
  display: flex; flex-direction: column; gap: 8px; align-items: flex-start;
  background: var(--card); border-radius: 16px; box-shadow: var(--shadow);
  padding: 16px 18px 18px; text-decoration: none; color: var(--ink);
  border: 2px solid transparent;
  transition: transform .13s, box-shadow .13s, border-color .13s;
}
.lesson-card:hover {
  transform: translateY(-4px); border-color: #d9d1f5;
  box-shadow: 0 14px 30px rgba(74, 58, 168, .2);
}
.lesson-card h3, .lesson-card h4 { margin: 0; font-size: 1.05rem; line-height: 1.7; }
.lesson-card p, .lesson-card .excerpt {
  margin: 0; color: #6d6880; font-size: .88rem; line-height: 1.75;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.lesson-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; width: 100%;
}
.lesson-idx {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 30px; border-radius: 50%; padding: 0 6px;
  background: #efeaff; color: var(--purple); font-weight: 800; font-size: .9rem;
}
.lesson-card .unit-name {
  margin-top: auto; padding-top: 6px;
  font-size: .8rem; font-weight: 700; color: var(--teal);
}

/* ── tabs ── */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 22px; }
.tab {
  padding: 8px 18px; border-radius: 999px; text-decoration: none;
  background: #fff; color: var(--purple); font-weight: 800; font-size: .95rem;
  border: 2px solid #e5e0f7; transition: background .15s, border-color .15s;
}
.tab:hover { background: #f4f1ff; border-color: #c9bff0; }
.tab.on { background: var(--purple); border-color: var(--purple); color: #fff; }

/* ── lesson hub (lesson.php — بطاقات الأقسام المستقلة بدل التبويبات) ── */
.hub-grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  margin: 4px 0 26px;
}
.hub-card { min-height: 180px; }
.hub-card h3 { font-size: 1.25rem; }
.hub-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 0 0 22px; }
.lesson-hub .pagegallery { margin-bottom: 18px; }

/* ── lesson prev/next bar (lesson.php) ── */
.lesson-nav {
  display: flex; justify-content: space-between; gap: 14px;
  max-width: 72ch; margin: 0 auto 30px;
}
.lnav {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; gap: 4px;
  background: var(--card); border-radius: 16px; box-shadow: var(--shadow);
  padding: 12px 18px; text-decoration: none; color: var(--ink);
  border: 2px solid transparent;
  transition: transform .12s, border-color .12s, box-shadow .12s;
}
.lnav:hover {
  transform: translateY(-3px); border-color: var(--gold);
  box-shadow: 0 12px 26px rgba(74, 58, 168, .2);
}
.lnav-next { align-items: flex-end; text-align: left; }
.lnav-dir { font-weight: 800; color: var(--purple); font-size: .95rem; }
.lnav-title {
  color: #6d6880; font-size: .88rem; line-height: 1.7; max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lnav-empty { visibility: hidden; box-shadow: none; }

/* ── letters ── */
.letter-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
}
.letter-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: var(--card); border-radius: 16px; box-shadow: var(--shadow);
  padding: 14px 10px 12px; text-decoration: none; color: var(--ink);
  border: 2px solid transparent;
  transition: transform .13s, box-shadow .13s, border-color .13s;
}
.letter-card:hover {
  transform: translateY(-4px); border-color: var(--gold);
  box-shadow: 0 14px 28px rgba(74, 58, 168, .2);
}
.letter-card img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 10px; }
.letter-card .glyph {
  width: 100%; aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-size: 2.8rem; font-weight: 800; color: var(--purple);
  background: #f7f5ff; border-radius: 10px;
}
.letter-card .lname { font-weight: 800; font-size: .92rem; text-align: center; }

/* big letter hero */
/* ترويسة الحرف: شريط عريض بمحتوى قليل — الخلفية المسطّحة البيضاء كانت تُقرأ
   «بطاقة فارغة»، فصارت تدرّجاً لطيفاً يوضّح أنها ترويسة لا إطار صورة ناقص. */
.bigletter {
  display: flex; align-items: center; gap: 26px; flex-wrap: wrap;
  background: linear-gradient(135deg, #f6f3ff 0%, #eaf8f6 100%);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px 28px; margin-bottom: 8px;
}
.bigletter img,
.bigletter > .glyph {
  width: 150px; height: 150px; flex: 0 0 auto;
  background: #f7f5ff; border-radius: 18px; padding: 10px; object-fit: contain;
}
.bigletter > .glyph {
  display: flex; align-items: center; justify-content: center;
  font-size: 4.6rem; font-weight: 800; color: var(--purple); padding: 0;
}
.bl-meta h1, .bl-meta h2 { margin: 0 0 8px; font-size: 1.7rem; color: var(--purple); }
.bl-glyph { font-size: 2.4rem; font-weight: 800; color: var(--teal); line-height: 1.3; }

/* word cards — big KG-readable words */
.word-cards {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.word-card {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  background: var(--card); border-radius: 16px; box-shadow: var(--shadow);
  padding: 16px 14px;
}
.word-card img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 10px; }
.word-card .wtext {
  font-size: 1.55rem; font-weight: 800; color: var(--purple);
  text-align: center; line-height: 1.8;
}

/* Word with no verified picture (see letter.php): a self-contained word plaque.
   `align-self: center` keeps it from stretching to the tallest card in the row —
   that stretch is what produced the big empty white cards users reported. */
.word-card.is-text {
  align-self: center;
  background: linear-gradient(135deg, #f4f0ff 0%, #e8f7f5 100%);
  border: 2px dashed #d3c8f3;
  box-shadow: none;
  padding: 18px 14px;
  gap: 12px;
}
.word-card.is-text .wbadge {
  display: flex; align-items: center; justify-content: center;
  width: 58px; height: 58px; flex: 0 0 auto; border-radius: 50%;
  background: #fff; color: var(--teal);
  font-size: 1.9rem; font-weight: 900; line-height: 1;
  box-shadow: inset 0 0 0 2px #ded4f7;
}

/* ── stat band (hero gradient) ── */
.stat-row {
  display: flex; flex-wrap: wrap; justify-content: space-around; gap: 18px 28px;
  background: linear-gradient(135deg, var(--purple) 0%, var(--purple-2) 100%);
  color: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 26px; margin: 0 0 28px;
}
.stat { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.stat .lbl, .stat > span:last-child { color: #e7e3ff; font-weight: 700; font-size: .92rem; }
.stat b, .stat strong, .stat .num {
  display: block; font-size: 1.9rem; font-weight: 900; color: var(--gold); line-height: 1.5;
}

/* ── empty state ── */
.empty {
  background: #fbf9f2; border: 2px dashed #ddd4bd; border-radius: 16px;
  padding: 26px 22px; text-align: center; color: #8a8474;
  font-weight: 700; line-height: 2;
}
.empty a { color: var(--purple); }
.empty code { direction: ltr; unicode-bidi: embed; background: #f0ecdf; padding: 2px 8px; border-radius: 6px; }

/* lite hero (list pages) */
.hero.hero-lite { padding: 26px 30px; }

/* ── responsive (mobile-first collapse) ── */
@media (max-width: 700px) {
  .topbar { padding: 10px 4vw; }
  .topbar nav a { padding: 7px 12px; font-size: .92rem; }
  .topbar nav a.topbar-play { padding: 6px 12px; }
  main { padding: 20px 4vw 40px; }
  .hero { padding: 24px 22px; gap: 16px; }
  .hero .pen { font-size: 3rem; }
  .prep { padding: 20px 16px; }
  .bigletter { justify-content: center; text-align: center; }
  .bl-meta { width: 100%; }
  .stat-row { padding: 16px 14px; gap: 12px 18px; }
  .stat b, .stat strong, .stat .num { font-size: 1.5rem; }
  .letter-grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
  .word-cards, .pagegallery { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .lessongrid { grid-template-columns: 1fr; }
  .toolbar .btn { flex: 1 1 auto; justify-content: center; }
  .qa li { padding-inline-start: 48px; }
  .hub-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .hub-card { min-height: 0; }
  .hub-actions .btn { flex: 1 1 auto; justify-content: center; }
  .lesson-nav { gap: 10px; }
  .lnav { padding: 10px 14px; }
  .lnav-dir { font-size: .88rem; }
  .lnav-title { font-size: .8rem; }
}

/* ══════════════════════════════ print handout ══════════════════════════════
   lesson.php prints as a clean black-on-white A4 teacher handout            */
@media print {
  @page { margin: 1.6cm; }
  .topbar, .foot, .noprint, .crumbs, .toolbar,
  .pagegallery, .tabs, .hub-grid, .hub-actions, .lesson-nav,
  .hero { display: none !important; }
  html, body { background: #fff !important; color: #000 !important; }
  body { display: block; font-size: 12.5pt; }
  main { max-width: 100%; padding: 0; margin: 0; }
  .prep {
    max-width: 100%; margin: 0; padding: 0;
    background: #fff; box-shadow: none; border-radius: 0; line-height: 1.9;
  }
  .prep-head {
    border-bottom: 2.5pt solid #000; padding-bottom: 10pt; margin-bottom: 14pt;
  }
  .prep-head h1 { color: #000; font-size: 17pt; margin: 6pt 0 4pt; }
  .prep-meta { color: #000; font-size: 11pt; }
  .kind-chip {
    background: #fff !important; color: #000 !important;
    border: 1pt solid #000; padding: 1pt 10pt; font-size: 10pt;
  }
  .prep-sec { break-inside: avoid; page-break-inside: avoid; margin: 12pt 0; }
  .prep-sec h3 {
    color: #000; border-bottom: 1pt solid #000;
    font-size: 13pt; padding-bottom: 4pt; margin-bottom: 8pt;
  }
  .goals li { break-inside: avoid; }
  .goals li::before { background: #000; box-shadow: none; }
  .materials .chips-line span {
    background: #fff; border: 1pt solid #000; color: #000; font-size: 10.5pt;
  }
  .steps li, .qa li { break-inside: avoid; }
  .steps li::before {
    background: #fff; color: #000; border: 1.2pt solid #000;
    width: 22pt; height: 22pt; font-size: 10pt;
  }
  .qa li { background: #fff; border: 1pt solid #888; border-radius: 6pt; }
  .qa li::before {
    background: #fff; color: #000; border: 1.2pt solid #000;
    width: 22pt; height: 22pt; font-size: 10pt;
  }
  a { color: #000 !important; text-decoration: none !important; }
  .stat-row, .lessongrid, .bigletter, .word-cards, .letter-grid {
    box-shadow: none;
  }
  .empty { display: none; }
}

/* ═══════════════ activity player (quiz/match/count over book crops) ═══════════════ */
.act-body { background: linear-gradient(180deg, #dff3ff 0%, var(--paper) 420px); }
.act-root { flex: 1; width: 100%; max-width: 900px; margin: 0 auto; padding: 18px 4vw 40px; }
.act-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.act-stars {
  background: var(--purple); color: var(--gold); font-weight: 800; font-size: 1.15rem;
  border-radius: 999px; padding: 8px 18px; box-shadow: var(--shadow);
}
.act-stars.pop { animation: act-pop .4s; }
@keyframes act-pop { 40% { transform: scale(1.25); } }
.act-stem { flex: 1; margin: 0; font-size: clamp(1.3rem, 4vw, 2rem); color: var(--purple); }
.act-snd {
  border: 0; background: var(--gold); font-size: 1.3rem; cursor: pointer;
  width: 52px; height: 52px; border-radius: 50%; box-shadow: 0 4px 0 #d9a800;
}
.act-snd:active { transform: translateY(3px); box-shadow: 0 1px 0 #d9a800; }

.act-choices { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.act-choices.two { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
.act-choice, .act-card, .act-num {
  border: 4px solid #e7e1f8; background: #fff; border-radius: 20px; cursor: pointer;
  box-shadow: var(--shadow); transition: transform .12s, border-color .15s, background .15s;
  padding: 12px; min-height: 150px;
  display: flex; align-items: center; justify-content: center;
}
.act-choice img, .act-card img { max-width: 100%; max-height: 200px; border-radius: 10px; }
.act-choice:hover, .act-card:hover, .act-num:hover { transform: translateY(-4px); border-color: #c9bff0; }
.act-choice.right, .act-num.right { border-color: var(--grass); background: #ecf9e2; }
.act-choice.wrong, .act-num.wrong, .act-card.wrong { border-color: #e88888; background: #fdeaea; }
.act-choice.done { pointer-events: none; }
.act-choice-text { font-size: 1.6rem; font-weight: 800; color: var(--ink); }
.shake { animation: act-shake .45s; }
@keyframes act-shake { 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); } 80% { transform: translateX(4px); } }

.act-match-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.act-card { min-height: 130px; }
.act-card.sel { border-color: var(--gold); background: #fff8e0; }
.act-card.match { border-color: var(--grass); background: #ecf9e2; transform: scale(1.05); }
.act-card.gone { opacity: 0; pointer-events: none; transform: scale(.6); transition: all .4s; }

.act-count-fig {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; display: flex; justify-content: center; margin-bottom: 20px;
}
.act-count-fig img { max-width: 100%; max-height: 340px; border-radius: 12px; }
.act-count-nums { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; }
.act-num { font-size: 2.6rem; font-weight: 800; color: var(--purple); min-width: 110px; min-height: 110px; }

.act-celebrate {
  position: fixed; inset: 0; background: rgba(74, 58, 168, .92); color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  opacity: 0; transition: opacity .3s; z-index: 50; text-align: center; padding: 20px;
}
.act-celebrate.on { opacity: 1; }
.act-celebrate-star { font-size: 4.5rem; animation: act-pop 1s; }
.act-celebrate h2 { margin: 0; font-size: clamp(1.6rem, 5vw, 2.6rem); }
.act-celebrate-stars { font-size: 2rem; letter-spacing: 6px; }
.act-celebrate-row { display: flex; gap: 12px; margin-top: 14px; flex-wrap: wrap; justify-content: center; }

/* ═══════════════ home page (index.php) — hm-* ═══════════════ */
.hm-hero { flex-direction: column; align-items: stretch; gap: 4px; padding: 30px 34px; }
.hm-hero-top { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }
.hm-hero-copy { flex: 1; min-width: 260px; }
.hm-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.hm-actions .cta { margin-top: 0; }
.hm-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 18px;
}
.hm-stat {
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 16px; padding: 12px 8px; text-align: center;
}
.hm-stat b {
  display: block; font-size: 1.6rem; font-weight: 900;
  color: var(--gold); line-height: 1.4;
}
.hm-stat span { color: #e7e3ff; font-weight: 700; font-size: .88rem; }

.hm-sections {
  display: grid; gap: 20px; grid-template-columns: repeat(3, 1fr); margin: 0 0 36px;
}
.hm-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 20px 18px; display: flex; flex-direction: column; gap: 10px;
  text-decoration: none; color: var(--ink); border: 2px solid transparent;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.hm-card:hover {
  transform: translateY(-4px); border-color: #d9d1f5;
  box-shadow: 0 14px 30px rgba(74, 58, 168, .2);
}
.hm-ico {
  width: 58px; height: 58px; border-radius: 17px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; box-shadow: 0 4px 10px rgba(45, 42, 62, .14);
}
.hm-ico-teal   { background: linear-gradient(135deg, var(--teal), #0d9488); }
.hm-ico-purple { background: linear-gradient(135deg, #8a7ae0, var(--purple)); }
.hm-ico-grass  { background: linear-gradient(135deg, var(--grass), #58a339); }
.hm-ico-orange { background: linear-gradient(135deg, var(--orange), #d0640f); }
.hm-ico-gold   { background: linear-gradient(135deg, var(--gold), #f0b429); }
.hm-ico-deep   { background: linear-gradient(135deg, var(--purple-2), #3b2e8c); }
.hm-card h3 { margin: 2px 0 0; font-size: 1.18rem; }
.hm-card p { margin: 0; color: #6d6880; font-size: .93rem; line-height: 1.75; flex: 1; }
.hm-go {
  align-self: flex-start; background: #efeaff; color: var(--purple);
  font-weight: 800; font-size: .88rem; padding: 7px 18px; border-radius: 999px;
  transition: background .15s, color .15s;
}
.hm-card:hover .hm-go { background: var(--gold); color: #4a3500; }

.hm-path {
  display: grid; gap: 20px; grid-template-columns: repeat(3, 1fr); margin: 0 0 36px;
}
.hm-step {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 20px 18px; text-decoration: none; color: var(--ink);
  border: 2px solid transparent;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.hm-step:hover {
  transform: translateY(-4px); border-color: var(--gold);
  box-shadow: 0 14px 30px rgba(74, 58, 168, .2);
}
.hm-step-num {
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%; margin-bottom: 10px;
  background: var(--teal); color: #fff; font-weight: 800; font-size: 1.05rem;
  box-shadow: 0 0 0 4px #d5f5ef;
}
.hm-step h3 { margin: 0 0 6px; font-size: 1.1rem; }
.hm-step p { margin: 0; color: #6d6880; font-size: .92rem; line-height: 1.75; }

@media (max-width: 980px) {
  .hm-sections { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .hm-path { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .hm-hero { padding: 24px 20px; }
  .hm-hero-top { gap: 16px; }
  .hm-stats { grid-template-columns: repeat(2, 1fr); }
  .hm-stat b { font-size: 1.35rem; }
  .hm-sections { grid-template-columns: 1fr; }
  .hm-actions .cta, .hm-actions .btn {
    flex: 1 1 auto; justify-content: center; text-align: center;
  }
}

/* ── مرجع صور المصدر المطويّ (lesson.php → details.src-ref) ── */
.src-ref {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 18px;
}
.src-ref summary { cursor: pointer; font-weight: 800; font-size: 1.05rem; color: var(--purple); }
.src-ref summary:hover { color: var(--purple-2); }
.src-ref[open] summary { margin-bottom: 14px; }

/* ═══════════════ games page (games.php) — gm-* ═══════════════ */
.gm-modes { margin-bottom: 8px; }
.gm-art { flex-direction: column; gap: 4px; }
.gm-art .gm-ico { font-size: 3rem; line-height: 1.2; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .2)); }
.gm-art .gm-smp {
  font-size: 1.15rem; font-weight: 800; letter-spacing: 3px;
  color: rgba(255, 255, 255, .92); text-shadow: 0 2px 4px rgba(0, 0, 0, .18);
}
.gm-art-ar  { background: linear-gradient(135deg, #8a7ae0, var(--purple)); }
.gm-art-en  { background: linear-gradient(135deg, var(--teal), #0d9488); }
.gm-art-num { background: linear-gradient(135deg, var(--orange), #d0640f); }
.card-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

.gm-hint { margin: -6px 0 16px; color: #6d6880; line-height: 1.8; }
.gm-sub {
  display: flex; align-items: center; gap: 8px;
  margin: 22px 0 12px; font-size: 1.1rem; color: var(--purple); font-weight: 800;
}
.play-chips {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
}
.play-chip {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--card); border-radius: 14px; box-shadow: var(--shadow);
  padding: 10px 6px 8px; text-decoration: none; color: var(--ink);
  border: 2px solid transparent; text-align: center;
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.play-chip:hover {
  transform: translateY(-3px); border-color: var(--gold);
  box-shadow: 0 10px 22px rgba(74, 58, 168, .2);
}
.play-chip .g { font-size: 1.75rem; font-weight: 800; color: var(--purple); line-height: 1.4; }
.play-chip .n { font-size: .72rem; font-weight: 700; color: #8a8474; }

.gm-coming {
  display: flex; align-items: center; gap: 16px;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 22px; max-width: 620px; margin-top: 34px;
}
.gm-coming .ico { font-size: 2.1rem; }
.gm-coming h3 { margin: 0 0 4px; font-size: 1.05rem; }
.gm-coming p { margin: 0; color: #6d6880; font-size: .9rem; line-height: 1.75; }

@media (max-width: 700px) {
  .play-chips { grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); }
  .card-actions .btn { flex: 1 1 auto; justify-content: center; }
}

/* ── شعار تحضيري (نفس شارة الألعاب) ─────────────────────────────────── */
.brand-logo { height: 30px; width: 30px; border-radius: 8px; vertical-align: middle;
              margin-inline-start: 2px; box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.doc-logo   { height: 26px; width: 26px; border-radius: 7px; vertical-align: middle; }
.doc-logo-s { height: 16px; width: 16px; border-radius: 4px; vertical-align: -3px; }

/* ── تضمين منصة ألعاب الوحدات (k.tahdiri) ───────────────────────────── */
.games-embed { position: relative; margin: 8px 0 24px; }
.games-embed iframe {
  width: 100%; height: min(78vh, 860px); border: 0; border-radius: 18px;
  background: #fff; box-shadow: var(--shadow, 0 6px 24px rgba(0,0,0,.08));
}
.games-embed-open { position: absolute; top: 10px; left: 10px; }
.lesson-games-embed iframe { height: min(70vh, 760px); }
