/* =========================================================
   مدرسه‌ی من — سامانه‌ی طراحی «کاغذِ جان‌دار»
   Design tokens: paper surfaces, hard offset shadows, RTL
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;700;800&display=swap');

:root {
  --canvas: #FFF8EA;
  --surface: #FFFFFF;
  --surface-blue: #DDF3FF;
  --surface-apricot: #FFE6C7;
  --surface-mint: #DDF4E4;
  --ink: #17213A;
  --ink-muted: #687187;
  --coral: #FF6B5E;
  --coral-hover: #F2554A;
  --yellow: #FFD45A;
  --green: #45B97C;
  --blue: #4D9BE6;
  --border: #E7DCCB;

  --font: 'Vazirmatn', Tahoma, 'Segoe UI', system-ui, sans-serif;

  --r-card: 20px;
  --r-activity: 12px;
  --r-btn: 14px;

  --shadow: 4px 4px 0 var(--ink);
  --shadow-sm: 2px 2px 0 var(--ink);

  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 48px;
  --space-6: 80px;

  --rail-w: 248px;
  --content-max: 1280px;

  --ease-paper: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-draw: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--canvas);
  color: var(--ink);
  font-size: 18px;
  line-height: 1.7;
  letter-spacing: 0;
}
img, svg { display: block; max-width: 100%; }
button { font-family: inherit; letter-spacing: 0; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

.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;
}

:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Type scale ---------- */
.t-display {
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 800;
  line-height: 1.25;
}
.t-heading { font-size: 32px; font-weight: 800; line-height: 1.35; }
.t-sub { font-size: 20px; font-weight: 700; line-height: 1.55; }
.t-body { font-size: 18px; font-weight: 400; line-height: 1.75; }
.t-label {
  font-size: 13px; font-weight: 700; line-height: 1.4;
  color: var(--ink-muted);
}
.t-numeral { font-size: 48px; font-weight: 800; line-height: 1; }
.measure { max-width: 28rem; }

/* =========================================================
   Shell: rail (left) + main (right)
   ========================================================= */
.shell {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}
.shell > .main { order: 1; flex: 1; min-width: 0; }
.shell > .rail { order: 2; }

/* ---------- Side rail (desktop) ---------- */
.rail {
  width: var(--rail-w);
  flex: 0 0 var(--rail-w);
  background: var(--surface);
  border-inline-start: 2px solid var(--border);
  padding: var(--space-3) var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  position: sticky;
  top: 0;
  height: 100vh;
}
.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 24px;
  font-weight: 800;
  color: var(--ink);
}
.wordmark .star-mini { width: 34px; height: 34px; flex: none; }
.rail-grade {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--yellow);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 2px 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  width: fit-content;
}
.rail-nav { display: flex; flex-direction: column; gap: 6px; }
.rail-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: var(--r-btn);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  border: 2px solid transparent;
  cursor: pointer;
  background: transparent;
  width: 100%;
  text-align: start;
  position: relative;
  transition: background 150ms ease-out, border-color 150ms ease-out;
}
.rail-link svg { width: 24px; height: 24px; flex: none; }
.rail-link:hover { background: var(--canvas); }
.rail-link.is-active {
  background: var(--surface-apricot);
  border-color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.rail-link.is-active::after {
  content: '';
  position: absolute;
  inset-inline-start: -2px;
  top: 8px;
  bottom: 8px;
  width: 4px;
  border-radius: 4px;
  background: var(--coral);
}
.rail-foot { margin-top: auto; }
.adult-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 14px;
  border: 2px dashed var(--border);
  border-radius: var(--r-btn);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-muted);
  cursor: pointer;
  background: transparent;
  width: 100%;
  transition: color 150ms ease-out, border-color 150ms ease-out;
}
.adult-link:hover { color: var(--ink); border-color: var(--ink-muted); }
.adult-link svg { width: 22px; height: 22px; }

/* ---------- Mobile top bar ---------- */
.topbar {
  display: none;
  height: 64px;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}
.icon-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--surface);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 150ms ease-out, background 150ms ease-out;
}
.icon-btn:hover { background: var(--canvas); }
.icon-btn:active { transform: scale(0.98); }
.icon-btn svg { width: 24px; height: 24px; }

/* Bottom sheet */
.sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(23, 33, 58, 0.35);
  z-index: 60;
}
.sheet {
  position: fixed;
  inset-inline: 12px;
  bottom: 12px;
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  padding: var(--space-3);
  z-index: 61;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.sheet .rail-link { text-align: start; }

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 14px 28px;
  border-radius: var(--r-btn);
  border: 2px solid var(--ink);
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  transition: background 150ms ease-out, transform 150ms ease-out, box-shadow 150ms ease-out;
}
.btn svg { width: 20px; height: 20px; }
.btn-primary {
  background: var(--coral);
  color: var(--surface);
  box-shadow: var(--shadow);
}
.btn-primary:hover { background: var(--coral-hover); }
.btn-primary:active { transform: scale(0.98); }
.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: var(--canvas); }
.btn-secondary:active { transform: scale(0.98); }
.btn-quiet {
  background: transparent;
  border-color: var(--border);
  color: var(--ink-muted);
  box-shadow: none;
}
.btn-quiet:hover { color: var(--ink); border-color: var(--ink-muted); }
.btn[disabled] {
  opacity: 0.55;
  cursor: default;
  transform: none !important;
}

/* =========================================================
   Home — hero stage
   ========================================================= */
.main-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 40px 48px 96px;
}
.stage {
  min-height: 520px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: var(--space-4);
  align-items: center;
}
.stage-copy { display: flex; flex-direction: column; gap: var(--space-3); }
.stage-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-muted);
}
.stage h1 { max-width: 14ch; }
.stage-sub { color: var(--ink-muted); font-size: 20px; max-width: 26rem; }
.stage-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.stage-art {
  position: relative;
  margin-inline-end: -32px;
}
.stage-art svg { width: 100%; height: auto; overflow: visible; }

/* signature moment: three subject chips flying from the star */
.fly-chip {
  position: absolute;
  width: 26px; height: 26px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
}
.fly-chip.c1 { background: var(--coral); }
.fly-chip.c2 { background: var(--blue); }
.fly-chip.c3 { background: var(--green); }
.is-flying .fly-chip {
  animation: fly-out 900ms var(--ease-draw) forwards;
}
.is-flying .fly-chip.c2 { animation-delay: 80ms; }
.is-flying .fly-chip.c3 { animation-delay: 160ms; }
@keyframes fly-out {
  0%   { opacity: 1; transform: translate(0, 0) rotate(0deg) scale(1); }
  100% { opacity: 0; transform: translate(var(--fx, -120px), var(--fy, 120px)) rotate(140deg) scale(1.6); }
}

/* tree draw */
.tree-draw {
  stroke-dasharray: var(--len, 400);
  stroke-dashoffset: var(--len, 400);
}
.is-drawing .tree-draw {
  animation: draw-line 900ms var(--ease-draw) forwards;
}
@keyframes draw-line {
  to { stroke-dashoffset: 0; }
}

/* =========================================================
   Subject archipelago
   ========================================================= */
.section { margin-top: var(--space-6); }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}
.islands {
  display: grid;
  grid-template-columns: 0.95fr 0.8fr 1.1fr;
  gap: var(--space-3);
  align-items: stretch;
}
.island {
  display: flex;
  flex-direction: column;
  min-height: 360px;
  border: 2px solid var(--ink);
  border-radius: var(--r-card);
  overflow: hidden;
  cursor: pointer;
  text-align: start;
  padding: 0;
  color: var(--ink);
  transition: transform 150ms ease-out, box-shadow 150ms ease-out;
}
.island:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.island:active { transform: translateY(0) scale(0.99); }
.island-art {
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3) var(--space-3) 0;
}
.island-art svg { width: min(230px, 80%); height: auto; }
.island-body {
  padding: var(--space-3) 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.island-title { font-size: 32px; font-weight: 800; line-height: 1.2; }
.island-tag { color: var(--ink); font-size: 18px; flex: 1; }
.stage-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 14px;
}
.island-prog { margin: 6px 0 2px; }
.island-prog .bar { margin-bottom: 6px; }
.island-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 18px;
}
.island-cta .arrow-dot {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.field-math .island-art { background: var(--surface-blue); margin: 12px 12px 0; border-radius: 16px 16px 0 0; min-height: 170px; }
.field-farsi .island-art { background: var(--surface-apricot); margin: 12px 12px 0; border-radius: 16px 16px 0 0; min-height: 170px; }
.field-science .island-art { background: var(--surface-mint); margin: 12px 12px 0; border-radius: 16px 16px 0 0; min-height: 170px; }
.field-math { background: var(--surface); }
.field-farsi { background: var(--surface); }
.field-science { background: var(--surface); }

/* =========================================================
   Active lesson strip
   ========================================================= */
.lesson-strip {
  position: relative;
  background: var(--surface-mint);
  border: 2px solid var(--ink);
  border-radius: var(--r-card);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.lesson-strip .marker {
  position: absolute;
  inset-inline-start: -22px;
  top: 50%;
  transform: translateY(-50%);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}
.lesson-strip .marker svg { width: 34px; height: 34px; }
.strip-copy { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 4px; }
.strip-meta { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }

/* =========================================================
   Activity row (4-up)
   ========================================================= */
.activity-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3);
}
.act-card {
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: var(--r-card);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  text-align: start;
  color: var(--ink);
  transition: transform 150ms ease-out, box-shadow 150ms ease-out;
}
.act-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.act-ill {
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-activity);
}
.act-ill svg { width: 84px; height: 84px; }
.act-title { font-size: 20px; font-weight: 800; }
.act-desc { color: var(--ink-muted); font-size: 15px; flex: 1; }
.act-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-size: 16px;
  color: var(--ink);
}

/* =========================================================
   Lessons index
   ========================================================= */
.page-head {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: var(--space-5);
}
.page-head .t-display { max-width: 20ch; }
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--ink-muted);
  cursor: pointer;
  background: none;
  border: 0;
  padding: 8px 0;
  font-size: 16px;
}
.back-link:hover { color: var(--ink); }
.back-link svg { width: 18px; height: 18px; }

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: var(--space-3);
}
.lesson-card {
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: var(--r-card);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  text-align: start;
  color: var(--ink);
  min-height: 210px;
  transition: transform 150ms ease-out, box-shadow 150ms ease-out;
}
.lesson-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.lesson-card.is-done { background: var(--surface-mint); }
.lesson-card .num-badge {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  background: var(--yellow);
  font-size: 18px;
}
.lesson-card.is-done .num-badge { background: var(--green); color: var(--surface); }
.lesson-card h3 { font-size: 20px; font-weight: 800; line-height: 1.4; }
.lesson-card p { color: var(--ink-muted); font-size: 15px; flex: 1; }
.lesson-meta { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 2px solid var(--border);
  border-radius: 999px;
  padding: 2px 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-muted);
  background: var(--surface);
}
.chip.is-done { border-color: var(--green); color: var(--green); }
.chip svg { width: 14px; height: 14px; }

/* =========================================================
   Lesson screen (3 columns)
   ========================================================= */
.lesson-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 240px;
  gap: var(--space-3);
  align-items: start;
}
.lesson-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 24px;
}
.side-card {
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: var(--r-card);
  padding: var(--space-2);
}
.side-card h3 { font-size: 16px; font-weight: 800; margin-bottom: 10px; }
.step-list { display: flex; flex-direction: column; gap: 8px; }
.step-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-activity);
  border: 2px solid var(--border);
  background: var(--surface);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  color: var(--ink);
  text-align: start;
  width: 100%;
}
.step-item.is-current {
  border-color: var(--ink);
  background: var(--surface-apricot);
  box-shadow: var(--shadow-sm);
}
.step-item.is-done { background: var(--surface-mint); border-color: var(--green); }
.step-dot {
  width: 26px; height: 26px;
  flex: none;
  border-radius: 50%;
  border: 2px solid var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800;
  background: var(--surface);
}
.step-item.is-done .step-dot { background: var(--green); color: #fff; border-color: var(--ink); }

.lesson-center {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}
.teach-card {
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: var(--r-card);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}
.teach-card h2 { font-size: 32px; font-weight: 800; line-height: 1.35; }
.objective-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-apricot);
  border: 2px solid var(--ink);
  border-radius: var(--r-activity);
  padding: 12px 16px;
  font-weight: 700;
  font-size: 18px;
}
.objective-banner svg { width: 28px; height: 28px; flex: none; }
.center-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) 0;
}
.center-stage .big-art {
  width: min(320px, 70%);
  height: auto;
}
.teach-figs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: center;
}
.teach-fig {
  background: var(--canvas);
  border: 2px solid var(--ink);
  border-radius: var(--r-activity);
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 130px;
}
.teach-fig svg { width: 96px; height: 96px; }
.teach-fig .cap { font-size: 15px; font-weight: 700; text-align: center; }
.teach-steps { display: flex; flex-direction: column; gap: var(--space-2); }
.teach-step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--canvas);
  border-radius: var(--r-activity);
  border: 2px solid var(--border);
  padding: var(--space-2);
}
.teach-step .step-dot { margin-top: 2px; }

.progress-panel .bar {
  height: 14px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--canvas);
  overflow: hidden;
}
.progress-panel .bar > span {
  display: block;
  height: 100%;
  background: var(--green);
  border-inline-end: 2px solid var(--ink);
  transition: width 420ms ease-out;
}
.star-row { display: flex; gap: 6px; }
.star-row .star-mini { width: 26px; height: 26px; }

/* =========================================================
   Activities
   ========================================================= */
.activity-card {
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: var(--r-activity);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.activity-card.is-focus { box-shadow: var(--shadow); }
.act-prompt {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.5;
}
.act-prompt .bubble {
  width: 52px; height: 52px;
  flex: none;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--yellow);
  display: inline-flex; align-items: center; justify-content: center;
}
.act-prompt .bubble svg { width: 28px; height: 28px; }

.objects-board {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  background: var(--canvas);
  border: 2px dashed var(--border);
  border-radius: var(--r-activity);
  padding: var(--space-3);
}
.objects-board svg { width: 56px; height: 56px; }

.numline {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.numline button {
  min-width: 56px;
  min-height: 56px;
  border-radius: var(--r-activity);
  border: 2px solid var(--ink);
  background: var(--surface);
  font-size: 24px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 360ms var(--ease-spring), background 150ms ease-out;
}
.numline button:hover { background: var(--surface-blue); }
.numline button.picked { background: var(--blue); color: #fff; }
.numline button.pop { transform: scale(1.06); }

.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(120px, 100%), 1fr));
  gap: 12px;
}
.opt {
  min-height: 64px;
  border-radius: var(--r-activity);
  border: 2px solid var(--ink);
  background: var(--surface);
  font-size: 22px;
  font-weight: 800;
  cursor: pointer;
  padding: 12px 16px;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 360ms var(--ease-spring), background 150ms ease-out;
}
.opt:hover { background: var(--canvas); }
.opt.pop { transform: scale(1.06); }
.opt.is-right {
  background: var(--green);
  color: #fff;
  animation: pop-card 360ms var(--ease-spring);
}
.opt.is-wrong {
  background: var(--surface-apricot);
  border-color: var(--coral);
}
.opt.is-locked { cursor: default; }
.opt svg { width: 40px; height: 40px; }
.opt .letter-glyph { font-size: 34px; font-weight: 800; }

@keyframes pop-card {
  0% { transform: scale(1); }
  45% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* letter tiles */
.letter-tile {
  width: 88px; height: 88px;
  border-radius: var(--r-activity);
  border: 2px solid var(--ink);
  background: var(--surface);
  font-size: 44px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 360ms var(--ease-spring), background 150ms ease-out;
}
.letter-tile.is-right { background: var(--green); color: #fff; animation: pop-card 360ms var(--ease-spring); }
.letter-tile.is-wrong { background: var(--surface-apricot); border-color: var(--coral); }

/* equation */
.equation {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}
.eq-box {
  min-width: 72px; min-height: 72px;
  border: 2px solid var(--ink);
  border-radius: var(--r-activity);
  background: var(--canvas);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 40px; font-weight: 800;
  padding: 4px 12px;
}
.eq-op { font-size: 40px; font-weight: 800; }

/* pattern row */
.pattern-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}
.pattern-cell {
  width: 72px; height: 72px;
  border: 2px solid var(--ink);
  border-radius: var(--r-activity);
  background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center;
}
.pattern-cell svg { width: 48px; height: 48px; }
.pattern-cell.is-unknown {
  background: var(--yellow);
  border-style: dashed;
  font-size: 28px;
  font-weight: 800;
}

/* clock */
.clock-wrap { display: flex; justify-content: center; }
.clock-wrap svg { width: min(240px, 70%); height: auto; }

/* ten frame */
.tenframe {
  display: grid;
  grid-template-columns: repeat(5, 52px);
  gap: 8px;
  justify-content: center;
}
.tf-cell {
  width: 52px; height: 52px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center;
}
.tf-cell svg { width: 36px; height: 36px; }

/* story text */
.story-text {
  background: var(--canvas);
  border: 2px solid var(--border);
  border-radius: var(--r-activity);
  padding: var(--space-3);
  font-size: 20px;
  line-height: 2.1;
  max-width: 28rem;
  margin: 0 auto;
}
.word-hl { color: var(--coral); font-weight: 800; }

/* audio button */
.audio-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 12px 22px;
  border-radius: var(--r-btn);
  border: 2px solid var(--ink);
  background: var(--surface-blue);
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.audio-btn:hover { background: #C9E9FF; }
.audio-btn:active { transform: scale(0.98); }
.audio-btn .wave { width: 22px; height: 22px; }
.audio-btn.mini {
  min-height: 48px;
  width: 48px;
  padding: 0;
  border-radius: 50%;
  flex: none;
}
.audio-btn.mini svg { width: 22px; height: 22px; }

/* =========================================================
   Feedback panel
   ========================================================= */
.feedback {
  border-radius: var(--r-activity);
  border: 2px solid var(--ink);
  padding: var(--space-3);
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
}
.feedback.is-right {
  background: var(--surface-mint);
}
.feedback.is-again {
  background: var(--surface-apricot);
}
.feedback .fb-badge {
  width: 56px; height: 56px;
  flex: none;
  border: 2px solid var(--ink);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.feedback.is-right .fb-badge { background: var(--green); }
.feedback.is-again .fb-badge { background: var(--yellow); }
.feedback .fb-badge svg { width: 32px; height: 32px; }
.feedback h3 { font-size: 22px; font-weight: 800; }
.feedback p { color: var(--ink); font-size: 17px; margin-top: 4px; }
.feedback .fb-actions { margin-top: 12px; display: flex; gap: 10px; flex-wrap: wrap; }

/* confetti marks */
.confetti {
  position: absolute;
  width: 10px; height: 10px;
  border-radius: 2px;
  pointer-events: none;
  animation: confetti-pop 620ms ease-out forwards;
}
@keyframes confetti-pop {
  0% { opacity: 1; transform: translate(0, 0) scale(0.6); }
  100% { opacity: 0; transform: translate(var(--cx, 20px), var(--cy, -30px)) scale(1.1); }
}

/* =========================================================
   Progress / parents
   ========================================================= */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-3);
}
.stat-card {
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: var(--r-card);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stat-card .t-numeral { color: var(--ink); }
.subject-progress {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: var(--r-card);
  padding: var(--space-3);
}
.sp-row { display: flex; flex-direction: column; gap: 8px; }
.sp-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.sp-bar {
  height: 16px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--canvas);
  overflow: hidden;
}
.sp-bar > span {
  display: block;
  height: 100%;
  transition: width 420ms ease-out;
}
.sp-bar.m > span { background: var(--blue); }
.sp-bar.f > span { background: var(--coral); }
.sp-bar.s > span { background: var(--green); }

/* modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(23, 33, 58, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 80;
}
.modal {
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* toast for announcements */
.live-region {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* =========================================================
   Entrance motion
   ========================================================= */
.reveal {
  opacity: 0;
  transform: translateY(24px);
}
.reveal.is-in {
  opacity: 1;
  transform: none;
  transition: opacity 480ms var(--ease-paper), transform 480ms var(--ease-paper);
}
.reveal.d1.is-in { transition-delay: 80ms; }
.reveal.d2.is-in { transition-delay: 160ms; }
.reveal.d3.is-in { transition-delay: 240ms; }

/* =========================================================
   تصویرها (تصویرسازی‌های کاغذی)
   ========================================================= */
.img-frame {
  margin: 0;
  border: 2px solid var(--ink);
  border-radius: var(--r-card);
  overflow: hidden;
  background: var(--surface);
}
.img-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.stage-banner {
  height: 230px;
  margin-top: var(--space-3);
}
.stage-banner img { object-position: center 42%; }

/* =========================================================
   ویدیوهای آموزشی و تلفظِ الفبا
   ========================================================= */
.h-ico { width: 26px; height: 26px; display: inline-block; vertical-align: -5px; }
.video-frame {
  margin: 0;
  border: 2px solid var(--ink);
  border-radius: var(--r-card);
  overflow: hidden;
  background: var(--ink);
  box-shadow: var(--shadow);
}
/* ---- کارت‌های تصویر‌دار (درس‌ها و بازی‌ها) ---- */
.act-card .act-ill { position: relative; overflow: hidden; }

/* ---- تصویر بخش‌ها (سینما، پیشرفت، بزرگ‌ترها) ---- */
.section-frame {
  height: 170px;
  margin: 0 0 18px;
}
.section-frame .section-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.modal .section-frame { height: 140px; }

/* ---- کارت‌های ویدیوی آموزشی (تصویر واقعی آپارات) ---- */
.act-card.video-card .act-ill {
  position: relative;
  overflow: hidden;
  height: 150px;
  background: var(--ink-soft, #F1E7D4);
}
.act-card.video-card .act-ill-art { display: flex; align-items: center; justify-content: center; }
.act-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--r-activity);
}
.act-thumb.is-broken { display: none; }
.play-badge {
  position: absolute;
  inset-inline-end: 10px;
  bottom: 10px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--coral);
  border: 3px solid #fff;
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 4px 10px rgba(23, 33, 58, .28);
}
.play-badge svg { width: 18px; height: 18px; }
.dur-badge {
  position: absolute;
  inset-inline-start: 10px;
  bottom: 10px;
  background: rgba(23, 33, 58, .82);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
}
.video-cat { margin-bottom: 6px; display: inline-block; }

/* ---- پخش‌کننده ---- */
.video-frame { position: relative; }
.video-frame .video-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--r-modal, 18px);
  z-index: 1;
}
.video-frame .video-embed { position: relative; z-index: 2; }
.video-frame .video-spinner {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 40px;
  height: 40px;
  border: 4px solid rgba(23, 33, 58, .15);
  border-top-color: var(--coral);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  z-index: 1;
}
@keyframes spin { to { transform: rotate(360deg); } }
.video-frame.is-ready .video-poster,
.video-frame.is-ready .video-spinner { display: none; }
.video-hint { text-align: center; margin: 10px 0 0; }
.video-modal .modal-head > div { flex: 1; }
.video-modal .modal-head h2 { margin: 0; font-size: 22px; }

.video-frame video {
  width: 100%;
  display: block;
  aspect-ratio: 16 / 9;
  background: var(--ink);
}
.video-frame .video-embed {
  width: 100%;
  display: block;
  aspect-ratio: 16 / 9;
  border: 0;
  background: var(--ink);
}
.video-modal {
  width: min(860px, 94vw);
  max-width: 860px;
}
.dedication-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 700;
}
.dedication-line svg { width: 15px; height: 15px; flex: none; }
.audio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
a.act-card { text-decoration: none; }
.ext-card:hover .act-link { color: var(--coral); }

.island-art {
  min-height: 180px;
  align-items: stretch;
  padding: 10px 10px 0;
}
.island-art img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 12px 12px 0 0;
}
.island-art > div {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: var(--space-3);
  align-items: center;
}
.page-hero-copy {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.page-hero-art { height: 280px; }
.page-hero-art img { object-position: center; }

.lesson-card.has-img { padding-top: 10px; }
.lesson-thumb {
  width: 100%;
  height: 118px;
  object-fit: cover;
  border-radius: 14px;
  border: 2px solid var(--ink);
  background: var(--ink-soft, #F1E7D4);
}
.lesson-band { position: relative; overflow: hidden; }
.lesson-band .lesson-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--r-img, 18px);
}
.lesson-band {
  height: 150px;
}
.lesson-band img { object-position: center 40%; }

.done-art {
  width: min(280px, 70%);
  aspect-ratio: 1 / 1;
}
.done-art > div {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

/* =========================================================
   Footer note
   ========================================================= */
.foot-note {
  margin-top: var(--space-6);
  padding-top: var(--space-3);
  border-top: 2px solid var(--border);
  color: var(--ink-muted);
  font-size: 15px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.foot-group {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

/* =========================================================
   KarenSoft credit — animated brand credit (footer bottom bar)
   ========================================================= */
.karen-credit {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  direction: ltr;
  text-decoration: none;
  padding: 5px 12px 5px 8px;
  border-radius: 12px;
  border: 1px solid rgba(23, 33, 58, 0.12);
  background: rgba(255, 255, 255, 0.55);
  isolation: isolate;
  animation: karen-rise 0.7s cubic-bezier(0.2, 0.8, 0.25, 1) both;
  transition: transform 180ms ease-out, box-shadow 180ms ease-out, border-color 180ms ease-out;
}
.karen-credit:hover {
  transform: translateY(-2px);
  border-color: rgba(23, 33, 58, 0.28);
  box-shadow: var(--shadow-sm);
}
.karen-credit:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 2px;
}
.karen-credit-mark {
  position: relative;
  width: 34px;
  height: 34px;
  flex: none;
}
.karen-credit-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.25, 1);
}
.karen-credit:hover .karen-credit-mark img { transform: scale(1.1) rotate(-4deg); }
.karen-orbit {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 1.5px dashed rgba(0, 36, 150, 0.4);
  animation: karen-spin 12s linear infinite;
}
.karen-orbit-2 {
  inset: -9px;
  border: 1px solid rgba(0, 36, 150, 0.16);
  border-top-color: rgba(0, 100, 255, 0.55);
  animation: karen-spin 6s linear infinite reverse;
}
.karen-credit-body {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.karen-credit-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--ink-muted);
  white-space: nowrap;
  animation: karen-fade 0.9s ease-out 0.15s both;
}
.karen-credit-words {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  border-radius: 6px;
  padding: 3px 2px;
}
.karen-credit-words img { width: auto; }
.karen-word-en { height: 13px; }
.karen-word-fa { height: 20px; }
.karen-credit-sep {
  color: rgba(23, 33, 58, 0.3);
  font-size: 12px;
  line-height: 1;
}
.karen-shine {
  position: absolute;
  top: -10%;
  bottom: -10%;
  left: 0;
  width: 34%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.85), transparent);
  transform: translateX(-130%) skewX(-18deg);
  animation: karen-shimmer 5s ease-in-out 1.2s infinite;
  pointer-events: none;
}
@keyframes karen-spin { to { transform: rotate(360deg); } }
@keyframes karen-shimmer {
  0% { transform: translateX(-130%) skewX(-18deg); }
  55%, 100% { transform: translateX(320%) skewX(-18deg); }
}
@keyframes karen-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes karen-fade {
  from { opacity: 0; letter-spacing: 0.12em; }
  to { opacity: 1; letter-spacing: 0.03em; }
}
@media (prefers-reduced-motion: reduce) {
  .karen-credit,
  .karen-credit-label { animation: none; }
  .karen-orbit,
  .karen-orbit-2,
  .karen-shine { animation: none; display: none; }
  .karen-credit:hover { transform: none; }
}
@media (max-width: 720px) {
  .karen-credit-label { font-size: 10px; }
  .karen-word-en { height: 12px; }
  .karen-word-fa { height: 18px; }
  .karen-credit-mark { width: 30px; height: 30px; }
}

/* =========================================================
   Responsive
   ========================================================= */
/* =========================================================
   صفحه‌ی درس — سه پله‌ی نمایش
   دسکتاپِ بزرگ (≥۱۴۴۰): ۳ ستون · لپ‌تاپ و تبلتِ افقی (۱۰۲۴–۱۴۳۹): ۲ ستون
   تبلتِ عمودی و موبایل (≤۱۰۲۳): ۱ ستون با فهرستِ گام‌های افقی
   ========================================================= */

/* لپ‌تاپ و تبلتِ افقی: ستونِ پیشرفت به پایینِ صفحه می‌رود تا متن تنگ نشود */
@media (max-width: 1439px) {
  .lesson-layout {
    grid-template-columns: 232px minmax(0, 1fr);
  }
  .lesson-side.progress-panel {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    align-items: start;
    position: static;
  }
}

/* تبلتِ عمودی و موبایل: تک‌ستون */
@media (max-width: 1023px) {
  .lesson-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .lesson-side { position: static; }
  .lesson-side.contents { order: -1; }
  .lesson-side.progress-panel {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }
  .step-list {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 6px;
    gap: 10px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .step-item {
    width: auto;
    white-space: nowrap;
    scroll-snap-align: center;
  }
}

@media (max-width: 900px) {
  .islands { grid-template-columns: 1fr; }
  .stage {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .stage-art { margin-inline-end: 0; }
  .activity-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-hero { grid-template-columns: 1fr; }
  .page-hero-art { height: 220px; }
}

@media (max-width: 820px) {
  .rail { display: none; }
  .topbar { display: flex; }
  .main-inner { padding: 24px 20px 80px; }
  .section { margin-top: var(--space-5); }
  .lesson-strip .marker {
    position: static;
    transform: none;
  }
  .stage-banner { height: 160px; }
  .lesson-band { height: 110px; }
  .page-hero-art { height: 190px; }
  .island-art img { height: 160px; }
  .teach-card { padding: var(--space-3); }
  .teach-card h2 { font-size: 26px; }
  .act-prompt { font-size: 20px; }
  .stage h1 { font-size: clamp(28px, 8vw, 40px); }
  .island-title { font-size: 28px; }
  .t-heading { font-size: 26px; }
}

@media (max-width: 520px) {
  .activity-row { grid-template-columns: 1fr; }
  .options-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .btn { width: 100%; }
  .stage-actions .btn { width: auto; flex: 1 1 100%; }
  .lesson-strip { padding: var(--space-2); }
}

/* موبایل: اندازه‌های جمع‌وجور و بدون سرریز */
@media (max-width: 620px) {
  .main-inner { padding: 20px 16px 72px; }
  .lesson-band { height: 96px; }
  .objective-banner { font-size: 16px; padding: 10px 12px; gap: 8px; }
  .objective-banner svg { width: 24px; height: 24px; }
  .obj-audio { width: 34px; height: 34px; }
  .teach-card { padding: var(--space-2); }
  .teach-card h2 { font-size: 22px; }
  .activity-card { padding: var(--space-2); }
  .act-prompt { font-size: 18px; gap: 8px; }
  .act-prompt .bubble { width: 42px; height: 42px; }
  .objects-board { padding: var(--space-2); gap: 8px; }
  .objects-board svg { width: 44px; height: 44px; }
  .pattern-row { gap: 8px; }
  .pattern-cell { width: 58px; height: 58px; }
  .pattern-cell svg { width: 38px; height: 38px; }
  .pattern-cell.is-unknown { font-size: 24px; }
  .equation { gap: 8px; }
  .eq-box { min-width: 56px; min-height: 56px; font-size: 30px; padding: 2px 8px; }
  .eq-op { font-size: 30px; }
  .t-numeral { font-size: 38px; }
  .side-card { padding: 14px; }
  .step-item { padding: 8px 10px; font-size: 14px; }
  .step-dot { width: 22px; height: 22px; font-size: 12px; }
  .lesson-card { padding: var(--space-2); min-height: 0; }
  .lesson-card h3 { font-size: 18px; }
}

@media (max-width: 520px) {
  .opt { font-size: 19px; padding: 10px 12px; min-height: 58px; }
  .lesson-grid { gap: 12px; }
}

/* =========================================================
   Reduced motion
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .reveal { opacity: 1 !important; transform: none !important; }
  .tree-draw { stroke-dasharray: none !important; stroke-dashoffset: 0 !important; }
  .fly-chip { display: none; }
}

/* ---- دکمه‌ی شنیدنِ هدف درس ---- */
.objective-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.obj-audio {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: transform 150ms ease-out, background 150ms ease-out;
}
.obj-audio:hover { background: var(--yellow, #FFD45A); transform: translateY(-2px); }
.obj-audio svg { width: 18px; height: 18px; }
.lesson-audio-row { margin-top: 10px; }

/* ---- پخش‌کننده‌ی داخل برنامه: تلاش دوباره و تمام‌صفحه ---- */
.video-frame.is-failed .video-embed,
.video-frame.is-failed .video-spinner { display: none; }
.video-frame.is-failed { min-height: 200px; }
.video-error {
  margin-top: 12px;
  padding: 12px 14px;
  border: 2px dashed var(--coral);
  border-radius: 14px;
  background: #FFF6F4;
}
.video-error[hidden] { display: none; }
.video-error .t-label { margin: 0 0 10px; }
.card-badge {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #F1E7D4;
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 800;
}

/* ---- پلیرِ خود برنامه (پخش با <video>) ---- */
.video-frame .video-native {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  background: var(--ink);
  border-radius: var(--r-modal, 18px);
}
.video-frame.is-loading .video-native { display: none; }
.video-frame.is-native .video-poster,
.video-frame.is-native .video-spinner { display: none; }

/* =========================================================
   حامیِ برنامه — کارتِ سپاس و خطِ زیرِ فوتر
   ========================================================= */
.sponsor-card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-4) 0 var(--space-3);
  padding: var(--space-3);
  background: linear-gradient(135deg, #FFF3F1 0%, #FFF8EA 55%, var(--surface-apricot) 100%);
  border: 2px solid var(--ink);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.sponsor-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 88% 12%, rgba(255, 212, 90, 0.35), transparent 58%);
  pointer-events: none;
}
.sponsor-heart {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  flex: none;
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  animation: sponsor-beat 2.4s ease-in-out infinite;
}
.sponsor-heart svg { width: 38px; height: 38px; }
.sponsor-body { position: relative; z-index: 1; min-width: 0; }
.sponsor-kicker {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  color: var(--coral);
  letter-spacing: 0;
}
.sponsor-name {
  margin: 2px 0 0;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.4;
  color: var(--ink);
}
.sponsor-role {
  margin: 2px 0 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-muted);
}
.sponsor-lead {
  margin: 6px 0 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-muted);
  line-height: 1.8;
}
.sponsor-audience {
  position: relative;
  z-index: 1;
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 0;
  padding-top: 12px;
  border-top: 2px dashed rgba(23, 33, 58, 0.18);
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
}
.sponsor-audience svg { width: 18px; height: 18px; flex: none; }
@keyframes sponsor-beat {
  0%, 100% { transform: scale(1); }
  12% { transform: scale(1.09); }
  24% { transform: scale(1); }
  36% { transform: scale(1.06); }
  48% { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .sponsor-heart { animation: none; }
}

/* خطِ سپاس در فضای بزرگ‌ترها */
.sponsor-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: var(--space-2);
  padding: 12px 14px;
  background: #FFF3F1;
  border: 2px solid var(--ink);
  border-radius: var(--r-activity);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.8;
  color: var(--ink-muted);
}
.sponsor-mini svg { width: 20px; height: 20px; flex: none; }

/* بلاکِ زیرِ فوتر: تقدیم + ویژه‌بودن + سپاس از حامی */
.dedi-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  text-align: center;
}
.dedi-block .dedication-line { margin-top: 0; }
.dedi-sub {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}
.sponsor-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 720px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.9;
  color: var(--ink-muted);
}
.sponsor-line svg { width: 15px; height: 15px; flex: none; }

@media (max-width: 620px) {
  .sponsor-card { padding: var(--space-2); gap: 12px; }
  .sponsor-heart { width: 58px; height: 58px; }
  .sponsor-heart svg { width: 30px; height: 30px; }
  .sponsor-name { font-size: 20px; }
}

/* =========================================================
   سازگاریِ صفحه‌ی درس با اندازه‌های مختلف
   ========================================================= */

/* تخته‌ی مقایسه‌ی دو گروه (بیشتر/کمتر/برابر) */
.compare-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  direction: ltr;
}

/* گزینه‌های متنیِ بلند: یک ستون و راست‌چینِ خوانا */
.options-grid.is-long { grid-template-columns: minmax(0, 1fr); }
.options-grid.is-long .opt {
  justify-content: flex-start;
  text-align: start;
  font-size: 18px;
  min-height: 56px;
  padding: 10px 14px;
  line-height: 1.6;
}

/* شکستنِ واژه‌های بلند — جلوگیری از سرریزِ افقی */
.act-prompt,
.opt,
.objective-banner,
.t-body,
.side-card,
.lesson-card h3,
.lesson-card p,
.sponsor-line,
.dedi-sub,
.dedication-line { overflow-wrap: break-word; }

/* جایگاهِ پیمایش برای پرش به کارتِ تمرین در موبایل */
#lesson-center { scroll-margin-top: 88px; }

/* =========================================================
   صفحه‌ی دانلود و نصب
   ========================================================= */
.dl-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-3);
  align-items: start;
  padding: var(--space-3);
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-sm);
}
.dl-badge {
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  flex: none;
  border-radius: 20px;
  background: var(--surface-blue);
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-sm);
}
.dl-badge svg { width: 34px; height: 34px; }
.dl-body { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.dl-body h3 { margin: 0; font-size: 22px; font-weight: 800; line-height: 1.4; }
.dl-steps {
  margin: 0;
  padding-inline-start: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 16px;
  line-height: 1.9;
  color: var(--ink-muted);
}
.dl-steps li::marker { color: var(--coral); font-weight: 800; }
.dl-illo-box {
  margin: 4px 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: var(--space-2);
  background: var(--surface-blue);
  border: 2px dashed var(--border);
  border-radius: var(--r-activity);
}
.dl-illo { width: 200px; height: auto; max-width: 100%; }
.dl-card .stage-actions { margin-top: 4px; }
.dl-card .btn { text-decoration: none; }

@media (max-width: 620px) {
  .dl-card { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: var(--space-2); }
  .dl-badge { width: 54px; height: 54px; border-radius: 16px; }
  .dl-badge svg { width: 28px; height: 28px; }
  .dl-body h3 { font-size: 19px; }
  .dl-steps { font-size: 15px; padding-inline-start: 20px; }
  .dl-illo { width: 170px; }
}

/* =========================================================
   حق‌نشر و بازدارنده‌های کپی
   ========================================================= */
.copyright-line {
  margin: 2px 0 0;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.9;
  color: var(--ink-muted);
  max-width: 760px;
}
.copyright-line small { display: inline-block; }

/* تصویرها انتخاب و کشیده نمی‌شوند */
img, svg { -webkit-user-drag: none; user-select: none; -webkit-touch-callout: none; }
.img-frame { -webkit-tap-highlight-color: transparent; }

/* آیکونِ برنامه در صفحه‌ی دانلود: قابِ کوچک و مرتب */
.install-hero {
  width: 190px;
  height: 190px;
  margin: 0 auto;
  border-radius: 32px;
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.install-hero img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 620px) {
  .install-hero { width: 140px; height: 140px; border-radius: 24px; }
}

/* نشانِ آخرین نسخه در صفحه‌ی دانلود */
.dl-version {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  margin: 2px 0 0;
  padding: 6px 14px;
  border: 2px solid var(--green);
  border-radius: 999px;
  background: var(--surface-mint);
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}
.dl-version svg { width: 16px; height: 16px; flex: none; }
