/* Printable A4 worksheet layout. Everything inside .sheet is sized in millimetres
   so the screen preview and the printed page match. */
.sheet {
  width: 210mm;
  height: 297mm;
  padding: 11mm 12mm 9mm;
  margin: 0;
  background: #fff;
  color: #222;
  font-family: var(--font);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: top left;
  box-shadow: 0 4px 24px rgba(0, 0, 0, .15);
  border-radius: 2mm;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.ws-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 4mm; border-bottom: .6mm solid #333; padding-bottom: 2mm; font-size: 3.6mm; }
.ws-brand { font-weight: 900; font-size: 4.2mm; white-space: nowrap; }
.ws-fields { white-space: nowrap; }
.ws-blank { display: inline-block; width: 48mm; border-bottom: .3mm solid #333; margin: 0 3mm 0 1mm; }
.ws-blank.short { width: 26mm; margin-right: 0; }
.ws-title { font-size: 8mm; margin: 3.5mm 0 1mm; line-height: 1.1; }
.ws-instr { font-size: 4.2mm; margin: 0 0 3mm; }
.ws-instr .bm { color: #666; font-style: italic; }
.ws-body { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 2.5mm; }
.ws-foot { display: flex; justify-content: space-between; gap: 4mm; font-size: 3mm; color: #777; border-top: .3mm solid #ccc; padding-top: 1.5mm; margin-top: 2mm; }

/* handwriting rows */
.ws-row { display: block; flex: none; overflow: visible; }
.ws-row .l-top { stroke: #9AA0AA; stroke-width: .3; }
.ws-row .l-mid { stroke: #B5BAC2; stroke-width: .25; stroke-dasharray: 1.5 1.2; }
.ws-row .l-base { stroke: #D9534F; stroke-width: .4; }
.ws-row .l-desc { stroke: #DADDE2; stroke-width: .25; }
.ws-glyph { font-family: var(--font-learn); font-weight: 400; }
.ws-glyph.model { fill: #222; }
.ws-glyph.trace { fill: #E6E6E6; stroke: #777; stroke-width: .22; stroke-dasharray: .8 .6; }

.ws-emoji { font-size: 9mm; line-height: 1; font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; }
.ws-emoji.lg { font-size: 14mm; }
.ws-emoji.xl { font-size: 24mm; }
.ws-label { font-size: 3.8mm; font-weight: 700; color: #555; margin: 1mm 0 0; }
.ws-label.big { font-size: 5mm; color: #222; }

/* banners & captions */
.ws-banner { display: flex; align-items: center; gap: 8mm; padding: 3mm 6mm; border: .5mm dashed #bbb; border-radius: 5mm; margin-bottom: 2mm; }
.ws-bigletter { font-family: var(--font-learn); font-size: 26mm; line-height: 1; font-weight: 700; }
.ws-bannertext { font-size: 6mm; line-height: 1.25; }
.ws-pic { width: 140mm; margin: 0 auto; }
.ws-pic.big { width: 172mm; }
.ws-pic svg { width: 100%; height: auto; display: block; }
.ws-caption { text-align: center; font-size: 7mm; font-weight: 800; }
.ws-caption.big { font-size: 10mm; }

/* grids */
.ws-grid { display: grid; gap: 4mm; }
.ws-shape { border: .4mm solid #ddd; border-radius: 4mm; padding: 3mm; text-align: center; }
.ws-shape-svg svg { height: 100%; width: auto; max-width: 100%; }
.ws-shape-name { font-size: 5mm; font-weight: 700; }

/* pre-writing */
.ws-stroke { border-bottom: .3mm dashed #ddd; }
.ws-stroke svg { display: block; }

/* words */
.ws-word-head { display: flex; align-items: center; gap: 3mm; font-size: 6mm; margin-top: 1mm; }
.ws-word-head i { color: #666; font-size: 4.5mm; }
.ws-word-line { display: flex; align-items: center; gap: 2mm; }
.ws-word-line .ws-emoji { width: 12mm; text-align: center; }
.ws-word-label { width: 16mm; font-size: 3.6mm; color: #666; font-style: italic; text-align: right; flex: none; }
.ws-syl-letter { display: inline-grid; place-items: center; width: 10mm; height: 10mm; border-radius: 50%; border: .5mm solid #333; font-family: var(--font-learn); font-weight: 700; }

/* numbers */
.ws-num-line { display: flex; align-items: center; gap: 4mm; border-bottom: .3mm dashed #ddd; padding-bottom: 2mm; }
.ws-num-dots { width: 40mm; flex: none; display: flex; flex-wrap: wrap; gap: 1.6mm; }
.ws-dotc { width: 6mm; height: 6mm; border-radius: 50%; border: .45mm solid #333; }
.ws-num-word { width: 100%; font-size: 3.6mm; color: #555; }

/* count and write */
.ws-count-grid { grid-template-columns: 1fr 1fr; }
.ws-count-box { position: relative; height: 66mm; border: .5mm solid #333; border-radius: 4mm; padding: 4mm 4mm 4mm 4mm; }
.ws-count-items { display: flex; flex-wrap: wrap; gap: 2mm; width: 62mm; }
.ws-count-items .ws-emoji { font-size: 10mm; }
.ws-answer { position: absolute; right: 4mm; bottom: 4mm; width: 18mm; height: 18mm; border: .5mm solid #333; border-radius: 2mm; }

/* match lines */
.ws-match { display: flex; flex-direction: column; justify-content: space-around; flex: 1; }
.ws-match-row { display: flex; align-items: center; gap: 3mm; }
.ws-match-cell { width: 50mm; height: 28mm; display: flex; align-items: center; justify-content: center; border: .4mm solid #ccc; border-radius: 4mm; font-size: 14mm; }
.ws-match-cell .emoji { font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; }
.ws-match-cell .art-text { font-family: var(--font-learn); font-size: 13mm; font-weight: 700; }
.ws-match-cell .art-text.long { font-size: 9mm; }
.ws-match-cell .art-count { display: flex; flex-wrap: wrap; gap: 1mm; justify-content: center; max-width: 44mm; }
.ws-match-cell .art-count .emoji { font-size: 8mm; }
.ws-dot { width: 4mm; height: 4mm; border-radius: 50%; background: #222; flex: none; }
.ws-gap { flex: 1; }

/* patterns */
.ws-pattern { display: flex; flex-direction: column; gap: 2mm; padding: 2.5mm 0; border-bottom: .3mm dashed #ddd; }
.ws-seq { display: flex; align-items: center; gap: 3mm; }
.ws-seq .ws-emoji { font-size: 12mm; }
.ws-slot { width: 16mm; height: 16mm; border: .5mm dashed #333; border-radius: 3mm; display: grid; place-items: center; font-size: 8mm; font-weight: 900; color: #999; }
.ws-opts { display: flex; gap: 8mm; padding-left: 4mm; }
.ws-opt .ws-emoji { font-size: 9mm; }

/* sums */
.ws-sum { display: flex; align-items: center; justify-content: space-between; gap: 4mm; border-bottom: .3mm dashed #ddd; padding: 2mm 0; min-height: 32mm; }
.ws-sum-art { display: flex; align-items: center; gap: 3mm; font-size: 9mm; }
.ws-sum-art .art-count { display: flex; flex-wrap: wrap; gap: 1mm; max-width: 50mm; }
.ws-sum-art .emoji { font-size: 9mm; font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; }
.ws-sum-art .crossed { position: relative; opacity: .5; }
.ws-sum-art .crossed::after { content: ""; position: absolute; left: -5%; right: -5%; top: 50%; border-top: .7mm solid #D62839; transform: rotate(-35deg); }
.ws-op { font-size: 9mm; font-weight: 900; }
.ws-sum-eq { font-size: 9mm; font-weight: 700; white-space: nowrap; display: flex; align-items: center; gap: 2mm; }
.ws-box { display: inline-block; width: 15mm; height: 13mm; border: .5mm solid #333; border-radius: 2mm; vertical-align: middle; }
.ws-eq-grid { grid-template-columns: 1fr 1fr; gap: 6mm 10mm; }
.ws-eq { font-size: 10mm; font-weight: 700; display: flex; align-items: center; gap: 2mm; padding: 3mm 0; border-bottom: .3mm dashed #ddd; }

/* circle one */
.ws-circle-row { display: flex; align-items: center; gap: 5mm; padding: 2.5mm 0; border-bottom: .3mm dashed #ddd; }
.ws-circle-label { width: 46mm; font-size: 6mm; font-weight: 700; }
.ws-circle-label i { font-size: 4.2mm; color: #666; font-weight: 400; }
.ws-options { display: flex; gap: 8mm; margin-left: auto; }
.ws-option { font-size: 6.5mm; font-weight: 700; padding: 2mm 5mm; border: .3mm solid #bbb; border-radius: 99mm; }

/* ---------- templates for the large library (choiceRows, countWrite, sums, sequence, wordGap,
   colourShape, colourCount, findColour) ---------- */
.ws-shadow .emoji, .ws-shadow.ws-ch-art .emoji, .ws-shadow .ws-emoji { filter: brightness(0); opacity: .82; }
.ws-ch { display: flex; flex-direction: column; flex: 1; justify-content: space-around; gap: 2mm; }
.ws-ch-row { display: flex; align-items: center; gap: 5mm; padding: 1.5mm 0; border-bottom: .3mm dashed #ddd; }
.ws-ch-row:last-child { border-bottom: 0; }
.ws-ch-prompt { border-right: .5mm dashed #bbb; padding-right: 3mm; }
.ws-ch-prompt { flex: none; width: 58mm; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1mm; text-align: center; }
.ws-ch.no-prompt .ws-ch-opts { margin: 0 auto; }
.ws-ch.wide .ws-ch-prompt { width: 100mm; } .ws-ch.wide .ws-ch-opt { min-width: 20mm; }
.ws-ch.wide .ws-ch-seq .ws-ch-art { font-size: 10mm; } .ws-ch.wide .ws-ch-seq .shape, .ws-ch.wide .ws-ch-seq .swatch { width: 9mm; height: 9mm; }
.ws-ch-opts { flex: 1; display: flex; align-items: center; justify-content: space-around; gap: 4mm; }
.ws-ch-opt { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5mm; min-width: 26mm; min-height: 22mm; padding: 1.5mm 3mm; border: .4mm solid #ccc; border-radius: 5mm; text-align: center; }
.ws-ch-art { display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.ws-ch-scale { display: inline-flex; align-items: center; justify-content: center; line-height: 1; min-height: 1em; }
.ws-ch-xl .ws-ch-opt .ws-ch-art { min-height: 30mm; }
.ws-ch .emoji { font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; }
.ws-ch .art-count { display: flex; flex-wrap: wrap; gap: 1mm; justify-content: center; max-width: 52mm; }
.ws-ch .art-row { display: flex; flex-wrap: wrap; gap: 1.5mm; align-items: center; justify-content: center; max-width: 56mm; }
.ws-ch .art-row .shape, .ws-ch-art > .shape { width: 1em; height: 1em; }
.ws-ch .art-text { font-family: var(--font-learn); font-weight: 700; }
.ws-ch .swatch { display: inline-block; width: 1.1em; height: 1.1em; border-radius: 50%; border: .4mm solid #555; }
.ws-ch-text { font-family: var(--font-learn); font-weight: 700; font-size: 8mm; line-height: 1.1; }
.ws-ch-text.long { font-size: 6mm; }
.ws-ch-label { font-size: 4.6mm; font-weight: 700; line-height: 1.2; display: flex; flex-direction: column; }
.ws-ch-label i { font-size: 3.8mm; font-weight: 400; color: #666; }
.ws-ch-seq { display: flex; align-items: center; gap: 1.5mm; flex-wrap: wrap; justify-content: center; }
.ws-ch-seq .ws-slot { width: 11mm; height: 11mm; font-size: 6mm; }
.ws-clock { width: 1em; height: 1em; display: block; }
.ws-clock text { font-family: var(--font); fill: #222; }
/* sizes: xl (ages 1–2, 3 rows), lg (4–5 rows), md (6–7 rows), sm (8 rows) */
.ws-ch-xl .ws-ch-art { font-size: 30mm; } .ws-ch-xl .ws-ch-opt { min-width: 52mm; min-height: 46mm; border-width: .6mm; }
.ws-ch-xl .ws-ch-prompt { width: 46mm; } .ws-ch-xl .ws-ch-label { font-size: 7mm; } .ws-ch-xl .ws-ch-prompt .ws-ch-art { font-size: 26mm; }
.ws-ch-lg .ws-ch-art { font-size: 15mm; } .ws-ch-lg .ws-ch-opt { min-width: 32mm; min-height: 28mm; }
.ws-ch-lg .ws-ch-prompt .ws-ch-art { font-size: 15mm; } .ws-ch-lg .ws-clock { font-size: 30mm; }
.ws-ch-md .ws-ch-art { font-size: 11mm; } .ws-ch-md .ws-ch-opt { min-width: 27mm; min-height: 19mm; }
.ws-ch-md .ws-ch-prompt .ws-ch-art { font-size: 11mm; } .ws-ch-md .ws-clock { font-size: 25mm; }
.ws-ch-sm .ws-ch-art { font-size: 9mm; } .ws-ch-sm .ws-ch-opt { min-width: 24mm; min-height: 15mm; padding: 1mm 2.5mm; }
.ws-ch-sm .ws-ch-prompt .ws-ch-art { font-size: 9mm; } .ws-ch-sm .ws-ch-text { font-size: 6.5mm; } .ws-ch-sm .ws-clock { font-size: 21mm; }
.ws-ch-sm .ws-ch-text.long { font-size: 5mm; }
.ws-match-cell .shape { width: 20mm; height: 20mm; }
.ws-ch-md .art-count .emoji, .ws-ch-sm .art-count .emoji { font-size: .62em; }
.ws-ch-lg .art-count .emoji { font-size: .55em; }

.ws-count-grid.small .ws-count-box { height: 52mm; }
.ws-count-grid.small .ws-count-items .ws-emoji { font-size: 8.5mm; }

.ws-seqs { display: flex; flex-direction: column; justify-content: space-around; flex: 1; gap: 3mm; }
.ws-seq-row { display: flex; align-items: center; gap: 3mm; flex-wrap: wrap; }
.ws-seq-label { width: 100%; font-size: 4.2mm; font-weight: 700; color: #555; }
.ws-seq-tile { display: inline-grid; place-items: center; width: 19mm; height: 19mm; border: .5mm solid #333; border-radius: 3mm; font-family: var(--font-learn); font-size: 10mm; font-weight: 700; }
.ws-seq-tile.gap { border-style: dashed; background: #FAFAFA; }

.ws-gaps { display: flex; flex-direction: column; justify-content: space-around; flex: 1; }
.ws-gap-row { display: flex; align-items: center; gap: 8mm; padding: 2mm 0; border-bottom: .3mm dashed #ddd; }
.ws-gap-row .ws-emoji.lg { width: 22mm; text-align: center; }
.ws-gap-word { display: flex; gap: 2mm; align-items: center; }
.ws-gap-ch, .ws-gap-box { display: inline-grid; place-items: center; width: 17mm; height: 19mm; font-family: var(--font-learn); font-size: 13mm; font-weight: 700; }
.ws-gap-box { border: .5mm dashed #333; border-radius: 3mm; }
.ws-gap-tr { margin-left: auto; font-size: 4.6mm; color: #666; }

.ws-cs .ws-shape { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ws-cs-name { display: flex; align-items: center; justify-content: center; gap: 3mm; flex-wrap: wrap; font-size: 6mm; font-weight: 800; }
.ws-cs-name i { font-weight: 400; color: #555; }
.ws-cs-dot { width: 9mm; height: 9mm; border-radius: 50%; border: .5mm solid #333; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.ws-cs-shape { width: 100%; font-size: 4.4mm; font-weight: 600; color: #444; }

.ws-ccs { display: flex; flex-direction: column; justify-content: space-around; flex: 1; }
.ws-cc-row { display: flex; align-items: center; gap: 5mm; padding: 2mm 0; border-bottom: .3mm dashed #ddd; }
.ws-cc-n { flex: none; width: 26mm; display: flex; flex-direction: column; align-items: center; font-family: var(--font-learn); font-size: 14mm; font-weight: 700; line-height: 1; }
.ws-cc-n small { font-family: var(--font); font-size: 3.4mm; font-weight: 600; color: #666; margin-top: 1mm; }
.ws-cc-shapes { display: flex; flex-wrap: wrap; gap: 2.5mm; }
.ws-cc-one { display: inline-block; width: 15mm; height: 15mm; }
.ws-ccs.big .ws-cc-one { width: 36mm; height: 36mm; } .ws-ccs.big .ws-cc-shapes { gap: 6mm; } .ws-ccs.big .ws-cc-n { font-size: 22mm; }
.ws-cc-one svg, .ws-fc-tile.shape svg, .ws-fc-target.shape svg { width: 100%; height: 100%; display: block; }

.ws-fc-head { display: flex; align-items: center; gap: 4mm; font-size: 7mm; font-weight: 800; }
.ws-fc-target { display: inline-grid; place-items: center; min-width: 18mm; height: 18mm; padding: 0 3mm; border: .6mm solid #333; border-radius: 4mm; font-family: var(--font-learn); font-size: 12mm; }
.ws-fc-target.shape { width: 18mm; padding: 1.5mm; }
.ws-fc-grid { display: grid; gap: 3mm; flex: 1; align-content: space-around; }
.ws-fc-tile { display: grid; place-items: center; height: 24mm; border: .4mm solid #999; border-radius: 4mm; font-family: var(--font-learn); font-size: 13mm; font-weight: 700; }
.ws-fc-tile.shape { padding: 3mm; }

/* ---------- on-screen (interactive) worksheets ---------- */
.do-scroller { width: 100%; overflow: hidden; border-radius: 3mm; }
.do-scroller.zoomed { overflow: auto; max-height: 78vh; -webkit-overflow-scrolling: touch; }
.do-sizer { position: relative; overflow: hidden; margin: 0 auto; }
.sheet.interactive { position: relative; }
.do-ink { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 5; pointer-events: none; touch-action: auto; }
.do-ink.drawing { pointer-events: auto; touch-action: none; cursor: crosshair; }
.do-lines { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 4; pointer-events: none; }
.do-lines line { stroke: #1E88E5; stroke-width: 4; stroke-linecap: round; }
.do-lines line.do-ok { stroke: #22A861; }
.do-lines line.do-no { stroke: #F08C00; stroke-dasharray: 8 6; }
.sheet.tapping [data-int], .sheet.tapping .do-fillable, .sheet.tapping .ws-match-cell { cursor: pointer; }
.sheet.interactive .do-fillable { pointer-events: all; }
.sheet.interactive [data-int="input"] { position: relative; display: inline-grid; place-items: center; vertical-align: middle; }
.sheet.interactive .ws-answer[data-int="input"] { display: grid; }
.do-val { font-family: var(--font-learn); font-weight: 700; color: #1E5FB4; line-height: 1; font-size: 9mm; }
.ws-answer .do-val { font-size: 12mm; }
.sheet.tapping [data-int="input"]:not(.do-filled) { background: #F2F8FF; }
.do-editing { outline: 1mm solid #3A86FF; outline-offset: .5mm; }
.sheet.interactive [data-int="choice"] { border-radius: 99mm; transition: box-shadow .15s; }
.do-picked { box-shadow: 0 0 0 .8mm #1E88E5; background: #EAF3FF; }
.sheet.interactive .ws-ch-opt[data-int="choice"] { border-radius: 5mm; }
.sheet.interactive .ws-dot { position: relative; }
.sheet.interactive .ws-dot::after { content: ""; position: absolute; inset: -5mm; border-radius: 50%; }
.do-dot-on { background: #1E88E5 !important; box-shadow: 0 0 0 1.5mm rgba(30, 136, 229, .3); }
.do-linked { background: #1E88E5 !important; }
.do-ok { box-shadow: 0 0 0 .9mm #22A861 !important; background: #E6F8EE !important; }
.do-no { box-shadow: 0 0 0 .9mm #F08C00 !important; background: #FFF4E0 !important; }
.do-missing { box-shadow: 0 0 0 .6mm #F7C948 !important; }

/* ---------- printing ---------- */
@media print {
  @page { size: A4 portrait; margin: 0; }
  html, body { background: #fff !important; margin: 0 !important; padding: 0 !important; }
  .no-print, .topbar, .overlay, .skip { display: none !important; }
  #app { max-width: none !important; margin: 0 !important; padding: 0 !important; }
  .sheet-scale { height: auto !important; overflow: visible !important; }
  #app.do-view > :not(.do-host), .do-host > :not(.do-scroller) { display: none !important; }
  .do-scroller, .do-sizer { width: auto !important; height: auto !important; max-height: none !important; overflow: visible !important; }
  .do-check, .do-missing, .do-editing { box-shadow: none !important; outline: none !important; }
  .sheet { height: 296mm; transform: none !important; box-shadow: none !important; border-radius: 0 !important; break-after: avoid; page-break-after: avoid; }
}
