:root {
  --ink: #2b2d42;
  --soft: #8d99ae;
  --paper: #fffdf7;
  --accent: #ef476f;
  --sun: #ffd166;
  --leaf: #06d6a0;
  --sky: #118ab2;
  --ghost: #c9ced6;
}

* { box-sizing: border-box; }

html { direction: rtl; }

body {
  margin: 0;
  background: #e9ecf1;
  color: var(--ink);
  font-family: "Rubik", "Heebo", "Arial Hebrew", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.5;
}

.page {
  width: 210mm;
  min-height: 297mm;
  margin: 12px auto;
  padding: 14mm 15mm;
  background: var(--paper);
  box-shadow: 0 2px 12px rgba(0, 0, 0, .15);
  position: relative;
}

.page-head {
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 4px dashed var(--sun);
  padding-bottom: 8px;
  margin-bottom: 12px;
}
.page-head .badge {
  font-size: 40px;
  background: var(--sun);
  border-radius: 50%;
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  flex: none;
}
.page-head h1 { margin: 0; font-size: 26px; line-height: 1.2; }
.page-head .meta { color: var(--soft); font-size: 14px; }
.name-line { margin-inline-start: auto; font-size: 15px; white-space: nowrap; }
.name-line span { display: inline-block; width: 40mm; border-bottom: 2px solid var(--ink); }

.section {
  border: 3px solid var(--sky);
  border-radius: 16px;
  padding: 10px 14px 12px;
  margin: 12px 0;
  break-inside: avoid;
}
.section h2 {
  margin: -22px 0 6px;
  display: inline-block;
  background: var(--paper);
  padding: 0 10px;
  font-size: 19px;
  color: var(--sky);
}
.section.learn { border-color: var(--leaf); }
.section.learn h2 { color: #04a57d; }
.section.wrap { border-color: var(--accent); }
.section.wrap h2 { color: var(--accent); }
.section.make { border-color: var(--accent); }
.section.make h2 { color: var(--accent); }

.time { color: var(--soft); font-size: 14px; font-weight: 400; }
.instr { margin: 4px 0 8px; font-size: 16px; }
.fact { font-size: 18px; margin: 2px 0 8px; }
.question {
  background: #fff3cf;
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 500;
}
.answer-space { height: 18mm; border-bottom: 2px dotted var(--soft); margin-top: 6px; }

/* ---- tracing ---- */
.trace-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px dotted var(--ghost);
  padding: 2px 0;
}
.trace-row .big {
  font-size: 42px;
  line-height: 1.05;
  color: var(--ghost);
  width: 18mm;
  text-align: center;
}
.trace-row .blank { width: 16mm; height: 11mm; border-bottom: 2px solid var(--soft); }
.trace-row .word { font-size: 28px; color: var(--ghost); margin-inline-start: auto; }
.trace-row .word.small { font-size: 20px; color: var(--ink); }
.trace-row .emoji { font-size: 28px; }
.eng-box .trace-row .big { font-size: 32px; width: 14mm; }
.eng-box .trace-row .blank { height: 9mm; }
.english-row .big { font-family: "Comic Sans MS", "Chalkboard", sans-serif; }
.eng-box { margin-top: 8px; padding-top: 6px; border-top: 2px dashed var(--soft); }
.eng-box h3 { margin: 0 0 4px; font-size: 16px; direction: ltr; text-align: right; }
.eng-box .trace-row { direction: ltr; }
.eng-box .trace-row .word { margin-inline-start: 8px; font-size: 24px; margin-left: auto; }

/* ---- counting ---- */
.count-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px dotted var(--ghost); }
.count-row .items { flex: 1; min-width: 0; font-size: 23px; line-height: 1.3; letter-spacing: 2px; overflow-wrap: anywhere; }
.box {
  display: inline-block;
  width: 16mm;
  height: 11mm;
  border: 3px solid var(--sky);
  border-radius: 8px;
  vertical-align: middle;
  background: #fff;
}
.count-row .box { width: 20mm; height: 14mm; flex: none; }

/* ---- math ---- */
.math-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; }
.math-grid .eq {
  font-size: 28px;
  padding: 4px 8px;
  border-bottom: 1px dotted var(--ghost);
  direction: ltr;
  text-align: right;
}

.seq-row { font-size: 28px; padding: 4px 0; direction: ltr; text-align: right; border-bottom: 1px dotted var(--ghost); }
.seq-row .cell { display: inline-block; min-width: 11mm; text-align: center; margin: 0 3px; }

/* ---- tables ---- */
table.t { width: 100%; border-collapse: collapse; margin-top: 6px; }
table.t th, table.t td { border: 2px solid var(--soft); padding: 2px 10px; text-align: center; height: 9mm; font-size: 17px; }
table.t th { background: #eef6fb; }

.drawboxes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 6px; }
.drawboxes div { border: 2px solid var(--soft); border-radius: 8px; height: 36mm; text-align: center; font-size: 15px; background: #fff; }

/* ---- activity page ---- */
.materials { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 4px 0 8px; list-style: none; }
.materials li { background: #eaf8f3; border: 2px solid var(--leaf); border-radius: 20px; padding: 2px 12px; font-size: 15px; }
ol.steps { padding-inline-start: 26px; margin: 6px 0; }
ol.steps li { margin: 6px 0; font-size: 18px; }
ol.steps li::marker { color: var(--accent); font-weight: 700; }
.tip {
  background: #eef6fb;
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 15px;
  margin-top: 10px;
}
.tip b { color: var(--sky); }

.wrapbox { height: 28mm; border: 3px dashed var(--soft); border-radius: 12px; background: #fff; }
.stars { font-size: 26px; margin-top: 6px; letter-spacing: 6px; color: var(--sun); }

/* ---- templates ---- */
.tpl { display: flex; flex-wrap: wrap; gap: 8mm; justify-content: center; margin-top: 8mm; }
.circle {
  width: 36mm;
  height: 36mm;
  border: 2px dashed var(--soft);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 56px;
  font-weight: 700;
  color: var(--ink);
  background: #fff;
}
.planet {
  border: 2px dashed var(--soft);
  border-radius: 50%;
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 12px;
  line-height: 1.1;
  background: #fff;
}
.card {
  width: 40mm;
  height: 40mm;
  border: 2px dashed var(--soft);
  border-radius: 8px;
  display: grid;
  place-items: center;
  text-align: center;
  background: #fff;
}
.card .l { font-size: 64px; font-weight: 700; }
.card .e { font-size: 44px; }
.card .w { font-size: 16px; }
.dice-net { display: grid; grid-template-columns: repeat(4, 30mm); grid-template-rows: repeat(3, 30mm); gap: 0; margin: 4mm auto; width: max-content; }
.dice-net svg { width: 30mm; height: 30mm; border: 2px dashed var(--soft); background: #fff; }
.shapes-sheet { display: flex; flex-wrap: wrap; gap: 6mm; justify-content: center; margin-top: 8mm; align-items: center; }

.cert {
  border: 8px double var(--sun);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  margin-top: 20mm;
  background: #fffaf0;
}
.cert .stars-big { font-size: 40px; }
.cert h2 { margin: 6px 0; font-size: 42px; color: var(--accent); background: none; }
.cert .line { display: inline-block; width: 90mm; border-bottom: 2px solid var(--ink); margin: 0 8px; }

/* ---- challenge page ---- */
.page.compact { padding: 8mm 14mm; }
.compact .section { margin: 12px 0; padding: 4px 12px 6px; }
.compact .instr { font-size: 14px; margin: 2px 0 4px; }
.compact .math-grid .eq { font-size: 20px; padding: 0 6px; }
.compact .math-grid { gap: 2px 20px; }
.compact .question { font-size: 14px; margin-top: 4px; padding: 4px 10px; }
.compact .page-head { padding-bottom: 4px; margin-bottom: 6px; }
.compact .page-head .badge { width: 48px; height: 48px; font-size: 30px; }
.compact .page-head h1 { font-size: 22px; }
.read-line { font-size: 20px; padding: 0; line-height: 1.4; }
.copy-line { height: 8mm; border-bottom: 2px solid var(--soft); margin-top: 4px; }
.answers { font-size: 11px; color: var(--soft); border-top: 1px dotted var(--ghost); padding-top: 3px; margin-top: 6px; }
.ws { display: grid; gap: 0; width: max-content; margin: 4px auto; direction: rtl; }
.ws span { width: 8mm; height: 8mm; display: grid; place-items: center; font-size: 18px; border: 1px solid var(--ghost); background: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 4px 0; }
.chip { background: #fff3cf; border: 2px solid var(--sun); border-radius: 16px; padding: 0 10px; font-size: 16px; }
svg.dots { display: block; margin: 0 auto; width: 54mm; height: 54mm; }
.odd-row { display: flex; gap: 14px; justify-content: center; font-size: 30px; padding: 0; line-height: 1.3; }
.scr-row { display: flex; align-items: center; gap: 10px; margin: 4px 0; }
.lts { display: flex; gap: 5px; }
.lt { width: 10mm; height: 10mm; border-radius: 50%; border: 2px solid var(--sky); display: grid; place-items: center; font-size: 22px; background: #fff; }
.blank.wide { display: inline-block; width: 38mm; height: 8mm; border-bottom: 2px solid var(--soft); }
.cmp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 20px; }
.cmp { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 24px; direction: ltr; }
.cmp .box { width: 12mm; height: 10mm; }
.code-row { display: flex; gap: 8px; justify-content: center; margin: 6px 0; direction: rtl; }
.code-cell { display: flex; flex-direction: column; align-items: center; font-size: 20px; }
.code-cell .box { width: 11mm; height: 11mm; }

/* ---- index ---- */
.hero {
  background: linear-gradient(135deg, var(--sun), #ffe8a8);
  border-radius: 20px;
  padding: 18px 22px;
}
.hero h1 { margin: 0 0 4px; font-size: 34px; }
.week-title { margin: 22px 0 8px; font-size: 22px; color: var(--sky); border-bottom: 3px solid var(--sky); }
.days { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.day-card {
  display: block;
  text-decoration: none;
  color: var(--ink);
  border: 3px solid var(--ghost);
  border-radius: 14px;
  padding: 8px 10px;
  background: #fff;
}
.day-card:hover { border-color: var(--accent); }
.day-card .num { color: var(--soft); font-size: 13px; }
.day-card .ic { font-size: 28px; }
.day-card .tt { font-weight: 500; font-size: 15px; line-height: 1.25; }
.guide ul { columns: 2; padding-inline-start: 20px; }
.nav { display: flex; justify-content: space-between; margin: 12px auto; width: 210mm; }
.nav a { background: #fff; padding: 6px 14px; border-radius: 20px; text-decoration: none; color: var(--sky); font-weight: 500; }

@page { size: A4; margin: 0; }

@media print {
  body { background: #fff; }
  .page { margin: 0; box-shadow: none; page-break-after: always; break-after: page; width: 210mm; min-height: 0; padding: 10mm 14mm; }
  .nav, .no-print { display: none !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media (max-width: 800px) {
  .page { width: auto; min-height: 0; margin: 8px; padding: 14px; }
  .nav { width: auto; margin: 8px; }
  .guide ul { columns: 1; }
}
