/* Ilm for Kids — Worksheet Corner */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=Amiri:wght@400;700&display=swap');

:root {
  --teal: #0f766e;
  --teal-light: #ccfbf1;
  --gold: #f59e0b;
  --gold-light: #fef3c7;
  --rose: #e11d48;
  --rose-light: #ffe4e6;
  --sky: #0284c7;
  --sky-light: #e0f2fe;
  --purple: #7c3aed;
  --purple-light: #ede9fe;
  --ink: #1f2937;
  --muted: #6b7280;
  --bg: #fffbf2;
  --card: #ffffff;
  --line: #d1d5db;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Fredoka', 'Comic Sans MS', system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

a { color: var(--teal); }

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  background: var(--teal);
  color: #fff;
}
.topbar a { color: #fff; text-decoration: none; font-weight: 600; }
.topbar .crumbs { font-size: 15px; opacity: .95; }
.topbar .ws-brand { display: inline-flex; align-items: center; gap: .55rem; font-size: 1.2rem; font-weight: 500; }
.topbar .ws-brand img { height: 64px; width: auto; display: block; margin: -8px 0; filter: drop-shadow(0 2px 3px rgba(0,0,0,.18)); }
@media (max-width: 640px) { .topbar .ws-brand img { height: 50px; } }
.topbar .crumbs a { opacity: .85; }

.toolbar {
  max-width: 900px;
  margin: 18px auto 0;
  padding: 0 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.btn {
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  cursor: pointer;
  background: var(--gold);
  color: #3b2300;
  text-decoration: none;
  display: inline-block;
}
.btn.secondary { background: #fff; color: var(--teal); border: 2px solid var(--teal); }
.toolbar label { display: inline-flex; gap: 6px; align-items: center; font-size: 15px; }
.toolbar .hint { color: var(--muted); font-size: 14px; flex-basis: 100%; }

/* ---------- Hub page ---------- */
.hero {
  text-align: center;
  padding: 36px 16px 10px;
}
.hero h1 { font-size: clamp(30px, 6vw, 46px); margin: 0; color: var(--teal); }
.hero p { margin: 8px auto 0; max-width: 560px; color: var(--muted); font-size: 18px; }

.grid {
  max-width: 980px;
  margin: 26px auto 50px;
  padding: 0 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}
.card {
  background: var(--card);
  border-radius: 22px;
  padding: 22px 20px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: 0 4px 0 rgba(0,0,0,.06), 0 10px 24px rgba(0,0,0,.06);
  border-top: 8px solid var(--c, var(--teal));
  transition: transform .15s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.card:hover { transform: translateY(-4px); }
.card .icon {
  width: 64px; height: 64px;
  border-radius: 18px;
  display: grid; place-items: center;
  background: var(--cl, var(--teal-light));
  font-size: 30px;
  font-weight: 700;
  color: var(--c, var(--teal));
}
.card h2 { margin: 6px 0 0; font-size: 22px; }
.card p { margin: 0; color: var(--muted); font-size: 15px; }
.card .go { margin-top: auto; padding-top: 8px; font-weight: 600; color: var(--c, var(--teal)); }

.tips {
  max-width: 900px;
  margin: 0 auto 50px;
  padding: 18px 20px;
  background: var(--gold-light);
  border-radius: 18px;
  font-size: 16px;
}
.tips h3 { margin: 0 0 6px; }
.tips ul { margin: 0; padding-left: 20px; }

/* ---------- Printable sheets ---------- */
.sheets { padding: 18px 16px 50px; }

.sheet {
  background: #fff;
  width: 100%;
  max-width: 210mm;
  margin: 0 auto 24px;
  padding: 14mm 14mm 10mm;
  border-radius: 6px;
  box-shadow: 0 6px 24px rgba(0,0,0,.08);
  position: relative;
}
.sheet-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 15px;
  margin-bottom: 8px;
}
.sheet-head span { flex: 1; border-bottom: 1.5px solid var(--ink); padding-bottom: 2px; }
.sheet h2 {
  text-align: center;
  font-size: 30px;
  margin: 6px 0 2px;
  color: var(--teal);
}
.sheet .sub { text-align: center; color: var(--muted); margin: 0 0 14px; font-size: 16px; }
.sheet h3 { font-size: 19px; margin: 16px 0 8px; color: var(--ink); }
.sheet-foot {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: 12px;
}

.colour-art svg { width: 100%; height: auto; display: block; }
.colour-art svg * { vector-effect: non-scaling-stroke; }

/* times table bits */
.tt-list { columns: 2; column-gap: 30px; font-size: 22px; margin: 0; padding: 0; list-style: none; }
.tt-list li { padding: 4px 0; border-bottom: 1px dashed var(--line); break-inside: avoid; }
.blank {
  display: inline-block;
  min-width: 52px;
  border-bottom: 2px solid var(--ink);
  height: 1.1em;
  vertical-align: baseline;
}
.count-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.count-row div {
  width: 46px; height: 46px;
  border: 2px solid var(--teal);
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 20px; font-weight: 600;
}
.q-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 18px; font-size: 20px; }
.q-grid div { padding: 6px 0; }
.problems { padding-left: 22px; font-size: 18px; margin: 0; }
.problems li { margin-bottom: 14px; }
.problems .work { display: block; margin-top: 6px; color: var(--muted); font-size: 15px; }
.hundred { display: grid; grid-template-columns: repeat(10, 1fr); border: 2px solid var(--ink); }
.hundred div {
  aspect-ratio: 1.6;
  border: 1px solid var(--line);
  display: grid; place-items: center;
  font-size: 16px;
}

/* ramadan bits */
table.tracker { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tracker th, table.tracker td { border: 1.5px solid var(--ink); text-align: center; padding: 2px; }
table.tracker th { background: var(--gold-light); font-size: 13px; }
table.tracker td { height: 6.6mm; }
.wordsearch { display: grid; gap: 0; border: 2px solid var(--ink); margin: 0 auto; max-width: 150mm; }
.wordsearch div {
  aspect-ratio: 1;
  display: grid; place-items: center;
  font-size: 19px; font-weight: 600;
  border: 1px solid var(--line);
}
.wordsearch div.hit { background: var(--gold-light); }
.wordbank { display: flex; flex-wrap: wrap; gap: 8px 10px; justify-content: center; margin: 14px 0 4px; }
.wordbank span {
  border: 2px solid var(--teal);
  border-radius: 999px;
  padding: 2px 12px;
  font-weight: 600;
  font-size: 16px;
}
.fill { padding-left: 22px; font-size: 18px; }
.fill li { margin-bottom: 14px; }
.writing-lines div { border-bottom: 1.5px solid var(--line); height: 11mm; }
.draw-box { border: 2px dashed var(--teal); border-radius: 14px; height: 70mm; display: grid; place-items: center; color: var(--muted); }

.answer-key { display: none; }
body.show-answers .answer-key { display: block; }
.answer-key .ans { columns: 3; font-size: 16px; padding-left: 22px; }

/* ---------- Print ---------- */
@page { size: A4; margin: 10mm; }

@media print {
  body { background: #fff; }
  .no-print, .topbar, .toolbar { display: none !important; }
  .sheets { padding: 0; }
  .sheet {
    box-shadow: none;
    border-radius: 0;
    margin: 0;
    max-width: none;
    padding: 4mm 4mm 0;
    page-break-after: always;
    break-after: page;
  }
  .sheet:last-child { page-break-after: auto; break-after: auto; }
  .sheet.solo-hidden { display: none; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media (max-width: 600px) {
  .sheet { padding: 18px 14px; }
  .sheet h2 { font-size: 24px; }
  .tt-list { columns: 1; font-size: 20px; }
  .q-grid { grid-template-columns: repeat(2, 1fr); font-size: 18px; }
  .hundred div { font-size: 12px; }
  .wordsearch div { font-size: 13px; }
}

/* subject worksheets */
.match { display: grid; grid-template-columns: 1fr 80px 1fr; gap: 12px 0; font-size: 17px; align-items: center; }
.match .l, .match .r { border: 2px solid var(--teal); border-radius: 12px; padding: 8px 12px; position: relative; }
.match .l::after, .match .r::before { content: ''; position: absolute; top: 50%; width: 12px; height: 12px; margin-top: -6px; border-radius: 50%; background: var(--ink); }
.match .l::after { right: -7px; }
.match .r::before { left: -7px; }
.order { list-style: none; padding: 0; margin: 0; font-size: 17px; }
.order li { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.order li::before { content: ''; flex: none; width: 38px; height: 38px; border: 2px solid var(--teal); border-radius: 10px; }
.sort { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.sort > div { border: 2px solid var(--teal); border-radius: 14px; min-height: 60mm; padding: 8px 12px; }
.sort > div h4 { margin: 0 0 4px; text-align: center; font-size: 18px; }
.pillars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; align-items: end; }
.pillars div { border: 2px solid var(--ink); border-radius: 8px 8px 0 0; height: 62mm; display: flex; align-items: flex-end; justify-content: center; padding: 6px 2px; font-weight: 700; font-size: 20px; }
.dua-card { border: 2px solid var(--teal); border-radius: 14px; padding: 10px 14px; margin-bottom: 12px; }
.dua-card .when { font-weight: 700; color: var(--teal); }
.arabic { font-family: 'Amiri', 'Traditional Arabic', serif; direction: rtl; text-align: center; font-size: 28px; line-height: 1.9; margin: 4px 0; }
.trace { color: #c7cbd1; font-size: 34px; }
.translit { text-align: center; font-style: italic; color: var(--muted); font-size: 15px; }
.scenario { border: 2px solid var(--line); border-radius: 14px; padding: 10px 14px; margin-bottom: 12px; font-size: 17px; }
.scenario .writing-lines div { height: 9mm; }
table.chart { width: 100%; border-collapse: collapse; font-size: 15px; }
table.chart th, table.chart td { border: 1.5px solid var(--ink); padding: 6px; text-align: center; }
table.chart th { background: var(--teal-light); }
table.chart td { height: 12mm; }
table.chart td:first-child { text-align: left; font-weight: 600; }
.note { background: var(--sky-light); border-radius: 12px; padding: 8px 12px; font-size: 15px; margin: 10px 0; }
@media (max-width: 600px) {
  .match { grid-template-columns: 1fr 30px 1fr; font-size: 14px; }
  .sort { grid-template-columns: 1fr; }
  .pillars div { font-size: 13px; }
}
