/* Lesson player. Shared by the Rails page and the offline pack (PackExporter inlines this file). */
.hp {
  --hp-ink: #2c2a26;
  --hp-card: #fffdf7;
  --hp-tap: #3d6b5a;
  --hp-a: #3d7dca;
  --hp-a-soft: #dbe9fb;
  --hp-b: #4f9a3a;
  --hp-b-soft: #ddf2d6;
  --hp-gold: #f6c431;
  color: var(--hp-ink);
  max-width: 820px;
  margin: 0 auto;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation; /* fast taps count; no double-tap zoom */
}
.hp svg { display: block; }
.hp button { font: inherit; color: inherit; }

.hp-bar { display: flex; align-items: center; gap: 10px; position: relative; }
.hp-steps { display: flex; gap: 8px; list-style: none; margin: 0; padding: 0; flex: 1; }
/* Look, Play, Done: where he is in the lesson. Not buttons, so no button border; only "now" is filled. */
.hp-steps li {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px;
  font-size: 20px; font-weight: 700; opacity: .4;
}
.hp-steps li svg { width: 24px; height: 24px; }
.hp-steps li.is-done { opacity: .7; }
.hp-steps li.is-now { opacity: 1; background: var(--hp-tap); color: #fff; }
.hp-icon {
  width: 64px; height: 64px; padding: 12px; border: 3px solid var(--hp-ink); border-radius: 50%;
  background: var(--hp-card); cursor: pointer; flex: none;
}
.hp-icon svg { width: 100%; height: 100%; }
.hp-icon--small { width: 48px; height: 48px; padding: 9px; opacity: .6; }
/* Hold-to-leave: the back button fills from the bottom while it is held. */
.hp-back { position: relative; overflow: hidden; -webkit-touch-callout: none; touch-action: none; }
.hp-hold-hint {
  position: absolute; top: 100%; left: 0; z-index: 2; margin-top: 6px; padding: 6px 12px; border-radius: 12px;
  background: var(--hp-ink); color: #fff; font-size: 18px; white-space: nowrap; pointer-events: none;
}
.hp-hold-hint[hidden] { display: none; }
.hp-back svg { position: relative; }
.hp-back::before { content: ""; position: absolute; inset: 0; background: var(--hp-tap); transform: scaleY(0); transform-origin: bottom; }
.hp-back.is-holding { opacity: 1; color: #fff; }
.hp-back.is-holding::before { transform: scaleY(1); transition: transform var(--hp-hold, 1s) linear; }

.hp-dots { display: flex; justify-content: center; gap: 10px; min-height: 18px; margin: 14px 0; }
.hp-dots i { width: 16px; height: 16px; border-radius: 50%; border: 3px solid var(--hp-ink); }
.hp-dots i.is-done { background: var(--hp-ink); }
.hp-dots i.is-now { background: var(--hp-gold); }

.hp-card {
  position: relative; background: var(--hp-card); border: 3px solid var(--hp-ink); border-radius: 24px;
  padding: 20px 20px 24px; min-height: 640px; display: flex; flex-direction: column; align-items: center;
}
.hp-text { font-size: 36px; line-height: 1.2; margin: 4px 0 6px; text-align: center; }
.hp-total { font-size: 76px; font-weight: 800; line-height: 1; margin: 0 0 6px; }
.hp-visual { width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; flex: 1; }
.hp-actions { width: 100%; display: flex; justify-content: center; margin-top: 18px; }
/* A question with no picture above it: put the answers in the middle, not at the bottom. */
.hp-visual:empty { display: none; }
.hp-visual:empty + .hp-actions { flex: 1; align-items: center; }

.hp-btn {
  display: inline-flex; align-items: center; gap: 10px; min-height: 72px; padding: 14px 34px;
  font-size: 28px; font-weight: 700; border: 3px solid var(--hp-ink); border-radius: 20px;
  background: var(--hp-tap); color: #fff !important; cursor: pointer;
}
.hp-btn svg { width: 30px; height: 30px; }

/* Five-frames and ten-frames, on a scene or on their own. */
.hp-scene { position: relative; width: 100%; max-width: 720px; }
.hp-prop { display: block; width: 100%; height: auto; pointer-events: none; }
.hp-scene .hp-frame { position: absolute; inset: 21% 15%; width: auto; display: flex; align-items: center; justify-content: center; }
.hp-scene--basket .hp-frame { inset: 37% 20% 15%; }
.hp-scene--box .hp-frame { inset: 31% 19% 12%; }
.hp-bare { width: 100%; max-width: 560px; }
.hp-bare:has(.hp-frame--wide) { max-width: 500px; }
/* With a bond diagram underneath, keep the picture smaller so Next stays on screen. */
.hp-scene:has(+ .hp-bond), .hp-bare:has(+ .hp-bond) { max-width: 500px; }
.hp-visual > .hp-bond:only-child { max-width: 520px; }
.hp-frame { display: flex; gap: 6%; justify-content: center; width: 100%; }
/* Without a plate, draw real ten-frames: one box per ten, tens stacked so 20 reads as "two tens". */
.hp-frame--wide { flex-direction: column; gap: 14px; }
.hp-bare .hp-block { border: 3px solid var(--hp-ink); border-radius: 16px; padding: 8px; background: #fff; }
.hp-block { display: grid; grid-template-columns: repeat(var(--cols, 5), 1fr); gap: 6px; width: 100%; }
.hp-slot {
  position: relative; aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: rgba(44, 42, 38, .06); max-width: 110px; width: 100%; justify-self: center;
}
.hp-slot img { width: 88%; height: 88%; object-fit: contain; pointer-events: none; }
.hp-slot.is-empty { background: transparent; border: 3px dashed rgba(44, 42, 38, .35); }
.hp-slot--a { background: var(--hp-a-soft); box-shadow: inset 0 0 0 3px var(--hp-a); }
.hp-slot--b { background: var(--hp-b-soft); box-shadow: inset 0 0 0 3px var(--hp-b); }
.hp-slot.is-dim { cursor: pointer; }
.hp-slot.is-dim img { opacity: .6; }
.hp-slot.is-placed { cursor: pointer; }
.hp-slot.is-extra { box-shadow: 0 0 0 4px #e5483b; }
.hp-badge {
  position: absolute; right: -4px; top: -6px; min-width: 30px; height: 30px; padding: 0 6px;
  border-radius: 15px; background: var(--hp-ink); color: #fff; font-size: 18px; line-height: 30px; text-align: center;
}

/* Egg counting labels sit in their own strip above the pictures. Reserve the same strip
   between rows so a second-row label cannot cover an egg in the first row. */
.hp-card--tapCount .hp-frame--egg { --hp-count-label: 30px; }
.hp .hp-card--tapCount .hp-frame--egg .hp-block { padding-top: calc(var(--hp-count-label) + 2px); row-gap: calc(var(--hp-count-label) + 6px); }
.hp-card--tapCount .hp-frame--egg .hp-badge { top: calc(-1 * var(--hp-count-label) - 2px); right: 50%; transform: translateX(50%); }

/* Take away: crossed out, Singapore-style. */
.hp-slot:not(.is-empty)[role="button"] { cursor: pointer; }
.hp-slot.is-crossed img { opacity: .3; }
.hp-slot.is-crossed::after {
  content: ""; position: absolute; inset: 14%;
  background:
    linear-gradient(45deg, transparent 44%, #e5483b 44%, #e5483b 56%, transparent 56%),
    linear-gradient(-45deg, transparent 44%, #e5483b 44%, #e5483b 56%, transparent 56%);
}
.hp-equation { display: flex; flex-wrap: wrap; max-width: 100%; gap: 18px; justify-content: center; align-items: center; margin: 4px 0 0; font-size: 72px; font-weight: 800; line-height: 1; }
.hp-eq-a { color: var(--hp-a); }
.hp-eq-b { color: var(--hp-b); }
.hp-eq-take { color: #e5483b; }
.hp-sides--quiz .hp-side { min-height: 220px; display: flex; align-items: center; justify-content: center; }

/* Two groups, then together. */
.hp-join { display: flex; align-items: center; gap: 10px; width: 100%; }
.hp-part { flex: 1; display: flex; flex-direction: column; align-items: center; transition: transform .45s ease, opacity .45s ease; }
.hp-part-total { font-size: 56px; font-weight: 800; margin: 4px 0 0; }
.hp-part--a .hp-part-total { color: var(--hp-a); }
.hp-part--b .hp-part-total { color: var(--hp-b); }
.hp-and { font-size: 30px; font-weight: 700; }
.hp-join.is-merging .hp-part--a { transform: translateX(25%); opacity: .2; }
.hp-join.is-merging .hp-part--b { transform: translateX(-25%); opacity: .2; }
.hp-join.is-merging .hp-and { opacity: 0; }
.hp-compare { gap: 24px; align-items: flex-start; }
.hp-part.is-more { border-radius: 20px; box-shadow: 0 0 0 6px rgba(246, 196, 49, .7); }

/* Equal groups: each group in its own box, in turn colours; tap a box to count it. */
.hp-eqgroups { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; width: 100%; }
.hp-eqgroup {
  display: flex; flex-direction: column; align-items: center; padding: 10px; border: 3px solid var(--hp-a);
  border-radius: 20px; background: #fff; transition: box-shadow .2s ease;
}
.hp-eqgroup--b { border-color: var(--hp-b); }
.hp-eqgroup.is-dim { cursor: pointer; border-style: dashed; }
.hp-eqgroup-items { display: grid; grid-template-columns: repeat(var(--size, 2), 84px); gap: 6px; }
.hp-eqgroup-total { font-size: 44px; font-weight: 800; line-height: 1; min-height: 44px; margin: 6px 0 0; }
.hp-eqgroup--a .hp-eqgroup-total { color: var(--hp-a); }
.hp-eqgroup--b .hp-eqgroup-total { color: var(--hp-b); }

/* Number chart: rows of ten. Counted numbers are lit; the next one waits with a dashed edge; "?" is asked. */
.hp-chart { display: flex; flex-direction: column; gap: 6px; width: 100%; max-width: 680px; }
.hp-chart-row { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 6px; }
.hp-chart-cell {
  min-width: 0; aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border: 2px solid rgba(44, 42, 38, .25); border-radius: 12px; background: #fff;
  font-size: 26px; font-weight: 800; color: rgba(44, 42, 38, .4); font-variant-numeric: tabular-nums;
}
.hp-chart-cell.is-lit { background: var(--hp-b-soft); border-color: var(--hp-b); color: var(--hp-ink); }
.hp-chart-cell.is-next { border: 3px dashed var(--hp-tap); color: var(--hp-ink); cursor: pointer; }
.hp-chart-cell.is-ask { border: 3px dashed var(--hp-gold); background: #fff7d6; color: var(--hp-ink); }

/* Number bond: whole on top, two parts below. */
.hp-bond { width: 100%; max-width: 380px; }
.hp-bond-line { stroke: var(--hp-ink); stroke-width: 5; }
.hp-bond circle { stroke: var(--hp-ink); stroke-width: 5; fill: #fff; }
.hp-bond-a circle { stroke: var(--hp-a); fill: var(--hp-a-soft); }
.hp-bond-b circle { stroke: var(--hp-b); fill: var(--hp-b-soft); }
.hp-bond .is-unknown circle { fill: #fff; stroke-dasharray: 10 8; }
.hp-bond text { font-size: 52px; font-weight: 800; fill: var(--hp-ink); font-family: inherit; }

.hp-sides { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; width: 100%; }
.hp-side { border: 3px solid var(--hp-ink); border-radius: 20px; padding: 16px; text-align: center; background: #f4f1ea; }
.hp-side p { font-size: 34px; font-weight: 800; margin: 0 0 8px; }
.hp-side img { width: 70%; max-width: 200px; aspect-ratio: 1; }

/* Pictures with words: science, English, computing. */
.hp-pictures { display: flex; justify-content: center; gap: 20px; width: 100%; flex-wrap: wrap; }
.hp-pic { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.hp-pic img { width: 220px; height: 220px; object-fit: contain; }
.hp-pictures--2 .hp-pic img { width: 200px; height: 200px; }
.hp-pictures--3 .hp-pic img { width: 170px; height: 170px; }
.hp-pic figcaption { font-size: 32px; font-weight: 800; }
.hp-pic--big img { width: 240px; height: 240px; }
/* iPad and wider: pictures fill more of the card. */
@media (min-width: 700px) {
  .hp-pic img { width: 300px; height: 300px; }
  .hp-pictures--2 .hp-pic img { width: 260px; height: 260px; }
  .hp-pictures--3 .hp-pic img { width: 210px; height: 210px; }
  .hp-pic--big img { width: 280px; height: 280px; }
}
/* A picture above word buttons ("___ is a girl."): to talk about, not to count. */
.hp-shown .hp-pic img { width: 200px; height: 200px; }
.hp-shown.hp-pictures--2 .hp-pic img { width: 160px; height: 160px; }
/* "click" cards: one big mouse to tap; a dot lights for each tap. */
.hp-clicker {
  display: flex; flex-direction: column; align-items: center; gap: 12px; max-width: 100%;
  padding: 18px 28px; border: 4px solid var(--hp-ink); border-radius: 28px; background: #fff; cursor: pointer;
  touch-action: manipulation; transition: transform .1s ease;
}
.hp-clicker:active { transform: scale(.96); }
.hp-clicker img { width: 220px; max-width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; }
.hp-clicker.is-done { border-color: var(--hp-gold); box-shadow: 0 0 0 7px rgba(246, 196, 49, .55); }
.hp-click-dots { display: flex; gap: 14px; }
.hp-click-dots i { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--hp-ink); background: #fff; }
.hp-click-dots i.is-on { background: var(--hp-tap); }
/* "computer:off": the same picture, dark and grey, so it reads as switched off. */
.hp-off { filter: grayscale(1) brightness(.4); }
.hp-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; width: 100%; }
.hp-groups--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.hp-group { min-width: 0; border: 3px solid var(--hp-a); background: var(--hp-a-soft); border-radius: 20px; padding: 12px; text-align: center; }
.hp-group--1 { border-color: var(--hp-b); background: var(--hp-b-soft); }
.hp-group--2 { border-color: #c98a2b; background: #fbe9c5; }
.hp-group p { font-size: 30px; font-weight: 800; margin: 0 0 8px; }
.hp-group-items { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.hp-group-items img { width: 96px; max-width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; }
.hp-sort-item { min-height: 280px; display: flex; align-items: center; justify-content: center; }
.hp-bins { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; width: 100%; }
.hp-bin {
  min-height: 170px; padding: 12px; border: 4px solid var(--hp-a); border-radius: 22px; background: var(--hp-a-soft);
  display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer;
}
.hp-bin--1 { border-color: var(--hp-b); background: var(--hp-b-soft); }
.hp-bin-label { font-size: 30px; font-weight: 800; max-width: 100%; overflow-wrap: anywhere; }
.hp-bin-items { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.hp-bin-items img { width: 52px; height: 52px; object-fit: contain; }
/* A few of the same picture side by side (Urdu plural: "many books"). */
.hp-many { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; max-width: 100%; }
.hp-pic .hp-many img, .hp-pic--big .hp-many img { width: 110px; height: 110px; }
.hp-bin-items .hp-many { gap: 0; }
.hp-bin-items .hp-many img { width: 30px; height: 30px; }
.hp-bin.is-out { opacity: .3; }
.hp-bin.is-glow, .hp-bin.is-show { box-shadow: 0 0 0 7px rgba(246, 196, 49, .7); }
.hp-bin.is-show { animation: hp-breathe 1.4s ease-in-out infinite; }

/* Quiz. */
/* minmax(0, 1fr): long words wrap inside their button instead of pushing a button off screen. */
.hp-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; width: 100%; }
.hp-choice {
  min-width: 0; min-height: 132px; padding: 12px; border: 4px solid var(--hp-ink); border-radius: 22px; background: #fff;
  cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  transition: opacity .2s ease, transform .2s ease;
}
.hp-choice--pic { min-height: 200px; }
.hp-choice--pic img { width: 100%; max-width: 130px; height: auto; aspect-ratio: 1; object-fit: contain; }
.hp-pair { display: flex; justify-content: center; gap: 4px; width: 100%; }
.hp-choice--pic .hp-pair img { width: 50%; max-width: 100px; }
.hp-num { font-size: 60px; font-weight: 800; line-height: 1; }
/* A word is only broken when it cannot fit on its own line, never "compu-ter" mid-word. */
.hp-word { font-size: 30px; font-weight: 700; max-width: 100%; overflow-wrap: break-word; }
.hp-pips { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; max-width: 92px; }
.hp-pips i { width: 14px; height: 14px; border-radius: 50%; background: var(--hp-ink); }
.hp-choice.is-out { opacity: .25; cursor: default; }
.hp-choice.is-glow, .hp-choice.is-show { border-color: var(--hp-gold); box-shadow: 0 0 0 6px rgba(246, 196, 49, .55); }
.hp-choice.is-show { animation: hp-breathe 1.4s ease-in-out infinite; }

.hp-place { width: 100%; display: flex; justify-content: center; }
.hp-tray {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; width: 100%; min-height: 120px;
  padding: 14px; border: 3px dashed var(--hp-ink); border-radius: 20px; background: #f4f1ea;
}
.hp-tray-item { width: 96px; height: 96px; padding: 6px; border: 0; background: transparent; cursor: pointer; touch-action: manipulation; }
.hp-tray-item img { width: 100%; height: 100%; }

.hp-tick { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.hp-tick svg { width: 200px; height: 200px; animation: hp-pop .35s ease-out; }

.hp-done { justify-content: center; gap: 12px; }
.hp-bigstar svg { width: 220px; height: 220px; color: var(--hp-gold); animation: hp-pop .5s ease-out; }
.hp-stars { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; color: var(--hp-gold); font-size: 28px; font-weight: 800; }
.hp-stars svg { width: 44px; height: 44px; }

/* Motion: gentle, and none at all in calm mode. */
.hp-slot.is-landing img { animation: hp-land .35s ease-out; }
.hp-slot.is-leaving img { transition: opacity .3s ease, transform .3s ease; opacity: 0; transform: translateY(-20px); }
.hp-pulse { animation: hp-breathe 1.4s ease-in-out infinite; }
@keyframes hp-land { from { transform: translateY(-30px) scale(.7); opacity: .2; } to { transform: none; opacity: 1; } }
@keyframes hp-pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes hp-breathe { 50% { transform: scale(1.06); } }
.hp--calm *, .hp--calm *::before { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { .hp * { animation: none !important; transition: none !important; } }

/* Urdu: Nastaliq (built into iPadOS), larger, right to left. */
.hp[lang="ur"] .hp-text, .hp[lang="ur"] .hp-word, .hp[lang="ur"] .hp-group p, .hp[lang="ur"] .hp-bin-label,
.hp[lang="ur"] .hp-pic figcaption {
  font-family: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Geeza Pro", serif; line-height: 2;
}
.hp[lang="ur"] .hp-text { font-size: 44px; }
@media (max-width: 600px) { .hp[lang="ur"] .hp-text { font-size: 30px; line-height: 1.8; } }
/* "All done!" is English, so it keeps the English font and size in Urdu lessons too. */
.hp[lang="ur"] .hp-done .hp-text { font-family: inherit; line-height: 1.2; font-size: 36px; }
.hp[lang="ur"] .hp-word { font-size: 38px; }
@media (max-width: 600px) { .hp[lang="ur"] .hp-word { font-size: 24px; } }
/* Urdu digits (۱ ۲ ۳, U+06F1...) in the Urdu font, so ۴ ۶ ۷ take their Urdu shapes (not the Persian ones). */
.hp[lang="ur"] .hp-total, .hp[lang="ur"] .hp-badge, .hp[lang="ur"] .hp-part-total, .hp[lang="ur"] .hp-chart-ur,
.hp[lang="ur"] .hp-num--ur {
  font-family: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Geeza Pro", serif;
}
/* The Urdu font sits its digits low; a taller line keeps the big number clear of the pictures under it. */
.hp[lang="ur"] .hp-total { line-height: 1.3; }
.hp-num--ur { line-height: 1.4; }
/* Number chart in an Urdu lesson: the Urdu digit, and under it the digit he already knows (۳ over 3). */
.hp[lang="ur"] .hp-chart-cell { flex-direction: column; gap: 0; line-height: 1.1; }
.hp-chart-ur { font-size: 1em; font-weight: 700; }
.hp-chart-en { font-size: .6em; font-weight: 800; }
/* Numbers not counted yet stay readable (the familiar digit too), just lighter than counted ones. */
.hp[lang="ur"] .hp-chart-cell { color: rgba(44, 42, 38, .6); }
/* The class book's Urdu number chart reads right to left (۱ on the right), so the chart does too. */
.hp[lang="ur"] .hp-chart-row { direction: rtl; }
.hp[lang="ur"] .hp-chart-cell { font-size: 38px; }
.hp[lang="ur"] .hp-chart { max-width: 760px; }
/* A button showing a few of one picture ("Where are ۴ mangoes?"): small pictures in rows of three. */
.hp-choice--pic .hp-many--choice { gap: 4px; width: 100%; max-width: 150px; }
.hp-choice--pic .hp-many--choice img { width: calc(33% - 4px); max-width: 44px; }

@media (max-width: 600px) {
  /* Picture cards: the pictures sit side by side and the Next button stays on the screen. */
  .hp-pictures { flex-wrap: nowrap; gap: 8px; }
  .hp-pic img { width: min(160px, 28vh); height: min(160px, 28vh); }
  .hp-pictures--2 .hp-pic img { width: min(130px, 24vh); height: min(130px, 24vh); }
  .hp-pictures--3 .hp-pic img { width: min(92px, 20vh); height: min(92px, 20vh); }
  .hp-pic figcaption { font-size: 24px; }
  .hp-pictures--3 .hp-pic figcaption { font-size: 19px; }
  .hp-actions { margin-top: 10px; }
  /* Plates: a little smaller, with the mangoes using more of the plate so they stay easy to tap. */
  .hp-visual { gap: 8px; }
  .hp-scene { width: min(100%, 40vh); }
  .hp-scene .hp-frame { inset: 17% 10%; }
  .hp-bond { max-width: min(150px, 22vh); }
  .hp-total { font-size: 42px; }
  .hp-btn { min-height: 52px; padding: 8px 22px; font-size: 24px; }
  /* 11 to 20: two ten-frames, a little smaller and closer together. */
  .hp-bare:has(.hp-frame--wide) { max-width: min(100%, 37vh); }
  .hp-frame--wide { gap: 8px; }
  .hp-bare .hp-block { padding: 5px; gap: 4px; }
  /* "Count each plate": side by side there is no room for two drawn plates, so each plate is a
     plate-coloured oval with the mangoes in rows of three, big enough for a finger. */
  .hp-join .hp-scene { box-sizing: border-box; width: 100%; padding: 12px 8px; border-radius: 50% / 38%; background: #efe7d8; box-shadow: inset 0 0 0 3px #d8cbb4; }
  .hp-join .hp-scene .hp-prop { display: none; }
  .hp-join .hp-scene .hp-frame { position: static; inset: auto; }
  .hp-join .hp-block { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  .hp-join .hp-slot { max-width: 48px; }
  /* No room for the word "and" between two plates on a phone; the mangoes get its space instead
     (about 44px each). "2 and 3 make 5" still appears once they are put together. */
  .hp-card--join .hp-and, .hp-card--compare .hp-and { display: none; }
  .hp-join .hp-scene { padding: 12px 6px; }
  /* Cards where he taps each mango (count, take away): the plate uses the whole width, so each
     mango is about 45px. */
  .hp-card--tapCount .hp-scene, .hp-card--tapAway .hp-scene { width: 100%; }
  .hp-card--tapCount .hp-scene .hp-frame, .hp-card--tapAway .hp-scene .hp-frame { inset: 17% 11%; }
  /* In a basket the pictures sit below the handle and inside the rim. */
  .hp-card--tapCount .hp-scene--basket .hp-frame, .hp-card--tapAway .hp-scene--basket .hp-frame { inset: 29% 10% 10%; }
  .hp-card--tapCount .hp-scene .hp-block, .hp-card--tapAway .hp-scene .hp-block { gap: 6px; }
  /* Taking away from 11 to 20 (two ten-frames): bigger crayons; once the sum ("15 − 1 = 14") shows,
     the big number above it, which says the same, makes room for them. */
  .hp-card--tapAway .hp-bare:has(.hp-frame--wide) { max-width: min(100%, 47vh); }
  .hp-card--tapAway:has(.hp-frame--wide):has(.hp-equation) .hp-total { display: none; }
  .hp-part-total { font-size: 40px; }
  .hp-join { gap: 6px; }
  .hp-join .hp-part { min-width: 0; }
  .hp-and { flex: none; font-size: 20px; }
  /* Done: a smaller star and star row, so Home is on the screen. */
  .hp-done { gap: 6px; }
  .hp-bigstar svg { width: 120px; height: 120px; }
  .hp-stars svg { width: 28px; height: 28px; }
  .hp-steps li span { display: none; }
  .hp-bar { gap: 6px; }
  .hp-steps { gap: 6px; min-width: 0; }
  .hp-steps li { padding: 8px 10px; }
  .hp-icon { width: 54px; height: 54px; padding: 10px; }
  .hp-icon--small { width: 44px; height: 44px; padding: 8px; }
  .hp-text { font-size: 28px; }
  .hp-card { min-height: 0; }
  .hp-choice { min-height: 104px; padding: 8px; border-width: 3px; }
  .hp-choices, .hp-bins, .hp-sides { gap: 10px; }
  .hp-word, .hp-bin-label { font-size: 22px; }
  /* Picture buttons are narrow on a phone: a smaller word so "computer" fits on one line. */
  .hp-choices { gap: 6px; }
  .hp-choice--pic { padding: 4px; }
  .hp-choice--pic .hp-word { font-size: 15px; }
  .hp-equation { font-size: 38px; gap: 6px; }
  .hp-groups { gap: 8px; }
  .hp-group { padding: 8px; }
  .hp-group p { font-size: 22px; overflow-wrap: anywhere; }
  .hp-group-items img { width: 56px; }
  .hp-pic .hp-many img, .hp-pic--big .hp-many img { width: 84px; height: 84px; }
  /* Sorting and "put them on the plate": the picture, the plate and the baskets or tray all fit on one
     phone screen, so he never has to scroll to answer. */
  .hp-sort-item { min-height: 0; }
  .hp-pic--big img { width: min(170px, 24vh); height: min(170px, 24vh); }
  .hp-pic--big figcaption { font-size: 26px; }
  .hp-bin { padding: 8px; }
  .hp-place .hp-scene { width: min(100%, 42vh); }
  .hp-tray { min-height: 0; padding: 6px; gap: 4px; }
  .hp-tray-item { width: 52px; height: 52px; padding: 2px; } /* 5 in one row on the narrowest phone; still above the 44px finger minimum */
  .hp-dots { margin: 6px 0; }
  .hp-card { padding: 10px 12px 14px; }
  .hp-text { margin: 2px 0 4px; }
  .hp-total { font-size: 56px; }
  .hp-bin { min-height: 96px; }
  .hp-clicker img { width: 170px; }
  .hp-shown .hp-pic img, .hp-shown.hp-pictures--2 .hp-pic img { width: 140px; height: 140px; }
  .hp-num { font-size: 44px; }
  .hp-eqgroups { gap: 8px; }
  .hp-eqgroup { padding: 4px; border-radius: 14px; }
  /* Five groups fit in one row (he taps the whole group, so smaller pictures are fine). */
  .hp-eqgroups:has(> :nth-child(5)) { gap: 4px; }
  .hp-eqgroups:has(> :nth-child(5)) .hp-eqgroup-items { grid-template-columns: repeat(var(--size, 2), 21px); }
  /* Two ten-frames and a sum: the sum a little smaller. */
  .hp-visual:has(.hp-frame--wide) .hp-equation { font-size: 32px; }
  .hp-eqgroup-items { grid-template-columns: repeat(var(--size, 2), 27px); gap: 3px; }
  .hp-eqgroup-total { font-size: 24px; min-height: 24px; }
  /* Ten numbers across are about 30px on a phone, too small to tap. Each ten wraps
     into two rows of five (about 60px), and a long chart scrolls inside itself so
     Next stays on the screen. The next number is scrolled into view. */
  .hp-chart { gap: 6px; max-width: 300px; max-height: 220px; margin-inline: auto; overflow-y: auto; }
  .hp-chart-row { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
  .hp-chart-cell { font-size: 22px; border-radius: 10px; border-width: 2px; }
  .hp-chart-cell.is-next, .hp-chart-cell.is-ask { border-width: 2px; }
  /* Urdu chart on a phone: ten in a row would be about 30px a cell, too small to tap and read, so
     it wraps into rows of five (۱–۵, then ۶–۱۰), about 60px a cell. */
  .hp[lang="ur"] .hp-chart-row { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
  .hp[lang="ur"] .hp-chart { gap: 6px; max-width: 340px; }
  .hp[lang="ur"] .hp-chart-cell { font-size: 28px; border-width: 2px; border-radius: 10px; }
  /* Number badges on a phone: smaller, so they don't cover the next picture. */
  .hp-badge { min-width: 22px; height: 22px; padding: 0 4px; border-radius: 11px; font-size: 14px; line-height: 22px; right: -2px; top: -4px; }
  .hp[lang="ur"] .hp-badge { line-height: 26px; }
  .hp-card--tapCount .hp-frame--egg { --hp-count-label: 22px; }
  /* A quiz picture (only to look at; quiz cards carry no "hp-card--mode" class): room between the
     pictures and inside the edge, so none is cut off. Frames he taps on cards keep their full size. */
  .hp-card:not([class*="hp-card--"]) .hp-bare .hp-block { padding: 7px; gap: 5px; }
  .hp-card:not([class*="hp-card--"]) .hp-bare .hp-slot { width: 94%; }
}
