:root {
  --ink: #2b2340;
  --muted: #6b6480;
  --bg: #fff6e6;
  --card: #ffffff;
  --line: #eadfca;
  --accent: #ff6b35;
  --accent-ink: #ffffff;
  --go: #1f9e74;
  --no: #d6336c;
  --sel: #ff2d7a;
  --r: 18px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.4 ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
h1, h2 { margin: 0; line-height: 1.15; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.screen { display: none; min-height: 100vh; min-height: 100dvh; padding-bottom: env(safe-area-inset-bottom); }
.screen.on { display: block; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px 32px; }
.wrap.narrow { max-width: 620px; }

/* buttons */
.btn {
  border: 2px solid var(--ink); background: var(--card); border-radius: 999px;
  padding: 10px 18px; font-weight: 700; cursor: pointer; min-height: 44px;
  box-shadow: 0 3px 0 var(--ink); transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.btn.go { background: var(--go); color: #fff; }
.btn.ghost { box-shadow: none; border-color: var(--line); background: transparent; }
.btn.ghost:active { transform: none; background: var(--line); }
.btn.small { padding: 6px 14px; min-height: 38px; font-size: 14px; }
.btn.icon { width: 44px; height: 44px; padding: 0; font-size: 30px; line-height: 1; display: grid; place-items: center; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--sel); outline-offset: 2px; }

/* home */
.hero { max-width: 980px; margin: 0 auto; padding: 22px 16px 8px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.hero-act { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.hero-act .btn.ghost { white-space: nowrap; }
.musicbtn { font-size: 22px; position: relative; }
.musicbtn.off { color: var(--muted); border-color: var(--line); box-shadow: none; }
.musicbtn.off::after { content: ""; position: absolute; left: 9px; right: 9px; top: 50%; height: 3px; background: var(--no); transform: rotate(-45deg); border-radius: 2px; }
.logo { font-size: clamp(30px, 7vw, 46px); letter-spacing: -0.02em; }
.logo span { color: var(--accent); }
.tag { margin: 6px 0 0; color: var(--muted); }
.stage { font-size: 20px; margin: 22px 0 12px; }
.stage small { font-size: 15px; color: var(--muted); font-weight: 600; margin-left: 6px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tile {
  display: flex; flex-direction: column; align-items: stretch; gap: 4px; text-align: left;
  background: var(--card); border: 2px solid var(--ink); border-radius: var(--r); padding: 8px 8px 10px;
  cursor: pointer; box-shadow: 0 4px 0 var(--ink); transition: transform .08s, box-shadow .08s;
}
.tile:active { transform: translateY(4px); box-shadow: 0 0 0 var(--ink); }
.tile.locked { cursor: not-allowed; box-shadow: none; border-style: dashed; border-color: #b9aec8; }
.tile.locked .thumb { opacity: .38; filter: saturate(.5); }
.tile.locked .tile-n { color: var(--muted); }
.tile.current { border-color: var(--accent); box-shadow: 0 4px 0 #c94e1f; }
.tile-art { position: relative; display: block; }
.lock { position: absolute; inset: 0; display: grid; place-items: center; }
.lock svg { width: 34px; height: 34px; fill: #fff; stroke: var(--ink); stroke-width: 2; background: #fff; border: 2px solid var(--ink); border-radius: 50%; padding: 6px; box-sizing: content-box; }
.badge { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); background: var(--accent); color: #fff; font-weight: 800; font-size: 15px; padding: 4px 14px; border-radius: 999px; border: 2px solid var(--ink); white-space: nowrap; }
.tile.current .badge { animation: bob 1.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateX(-50%) translateY(-4px); } }
.stagehead { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.startotal { font-weight: 800; color: #b06e00; white-space: nowrap; }
.tile-n { font-weight: 800; font-size: 15px; padding: 0 4px; }
.tile-s { font-size: 13px; color: var(--muted); padding: 0 4px; }
.tile-s.stars { color: #e69500; font-size: 16px; line-height: 1; }
.lists { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.listbtn { display: flex; flex-direction: column; text-align: left; gap: 2px; padding: 14px 16px; border-radius: var(--r); border: 2px solid var(--ink); background: #fff3c4; cursor: pointer; }
.listbtn span { font-size: 13px; color: var(--muted); }
.foot { margin-top: 28px; color: var(--muted); font-size: 14px; text-align: center; }

/* pictures */
.art { display: block; width: 100%; height: auto; }
.art .rg { fill: #fff; stroke: var(--ink); stroke-width: 2.4; stroke-linejoin: round; cursor: pointer; transition: fill .35s ease; }
.art .rg.done { cursor: default; }
.art .rg.active { fill: var(--c, #ffe1ee); fill-opacity: .35; stroke: var(--sel); stroke-width: 4; stroke-dasharray: 8 5; animation: march 1s linear infinite, glow 1.2s ease-in-out infinite alternate; }
@keyframes glow { to { fill-opacity: .7; } }
.art .deco, .art .shade, .art .paint { pointer-events: none; }
.art .shade { fill: url(#cq-shade); stroke: none; }
.sheet-art .shade { display: none; }
.answers .sheet-art .shade { display: inline; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.pic .anim, .doneart .anim { transform-box: fill-box; transform-origin: center; }
.pic .a-sway, .doneart .a-sway { animation: sway 3.6s ease-in-out infinite alternate; }
.pic .a-drift, .doneart .a-drift { animation: drift 7s ease-in-out infinite alternate; }
.pic .a-pulse, .doneart .a-pulse { animation: pulse 2.4s ease-in-out infinite alternate; }
.pic .a-twinkle, .doneart .a-twinkle { animation: pulse 1.3s ease-in-out infinite alternate; }
.pic .a-twinkle + .a-twinkle { animation-delay: -.6s; }
.pic .a-flicker, .doneart .a-flicker { animation: flicker .35s ease-in-out infinite alternate; }
.pic .a-flap, .doneart .a-flap { animation: flap 1.1s ease-in-out infinite alternate; }
.pic .a-wave, .doneart .a-wave { animation: wave 1.2s ease-in-out infinite alternate; }
.pic .a-blink, .doneart .a-blink { animation: blink 5s infinite; }
.pic .a-rise > *, .doneart .a-rise > * { animation: rise 3.2s ease-in infinite; transform-box: fill-box; }
.pic .a-rise > :nth-child(2) { animation-delay: -1.1s; }
.pic .a-rise > :nth-child(3) { animation-delay: -2.2s; }
@keyframes sway { from { transform: rotate(-3deg); } to { transform: rotate(3deg); } }
@keyframes drift { from { transform: translateX(-7px); } to { transform: translateX(7px); } }
@keyframes pulse { from { transform: scale(.94); } to { transform: scale(1.06); } }
@keyframes flicker { from { transform: scaleY(.86); } to { transform: scaleY(1.08); } }
@keyframes flap { from { transform: scaleX(1); } to { transform: scaleX(.86); } }
@keyframes wave { from { transform: skewY(0); } to { transform: skewY(-9deg); } }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes rise { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(-26px); opacity: 0; } }
.art .rg.pop { animation: pop .45s ease; transform-box: fill-box; transform-origin: center; }
@keyframes march { to { stroke-dashoffset: -26; } }
@keyframes pop { 40% { transform: scale(1.06); } }
.thumb { border-radius: 12px; background: #fff; }
.thumb .rg { stroke-width: 2.5; cursor: inherit; }

/* play */
.bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; max-width: 1040px; margin: 0 auto; }
.bar-t { flex: 1; min-width: 0; }
.bar h1 { font-size: 20px; }
.bar p { margin: 0; color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill { background: var(--ink); color: #fff; border-radius: 999px; padding: 4px 12px; font-weight: 800; font-size: 14px; white-space: nowrap; }
.play { max-width: 1040px; margin: 0 auto; padding: 0 16px 16px; display: grid; gap: 14px; }
.play > * { min-width: 0; }
.pic { background: var(--card); border: 2px solid var(--ink); border-radius: var(--r); overflow: hidden; width: 100%; max-width: min(100%, 40vh); max-width: min(100%, 40dvh); justify-self: center; }
.pic .art { width: 100%; height: auto; }
.panel { display: flex; flex-direction: column; gap: 10px; }
.say { position: absolute; top: 6px; right: 6px; width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--line); background: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; }
.say svg { width: 22px; height: 22px; fill: var(--ink); stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.qcard { position: relative; padding-left: 50px !important; padding-right: 50px !important; background: var(--card); border: 2px solid var(--ink); border-radius: var(--r); padding: 10px 14px 12px; text-align: center; }
.lbl { margin: 0; font-size: 13px; color: var(--muted); font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 6px; }
.swatch { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink); display: inline-block; flex: none; }
.q { font-size: clamp(30px, 9vw, 44px); font-weight: 800; letter-spacing: .01em; margin: 2px 0; word-break: break-word; }
.q.spell { letter-spacing: .14em; }
.entry { background: #fff; border: 2px dashed var(--ink); border-radius: 14px; text-align: center; font-size: 34px; font-weight: 800; min-height: 54px; line-height: 50px; }
.entry { position: relative; }
.entry.empty { color: transparent; }
.entry[data-ghost].empty::after { content: attr(data-ghost); position: absolute; inset: 0; color: #c7bdd6; }
.entry.bad { animation: bad .5s; }
@keyframes bad { 0%, 60% { border-color: var(--no); background: #ffe3ea; } }
.key.hint { background: #fff3a8; border-color: #b06e00; animation: nudge .9s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(-3px); } }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.key { min-height: 52px; font-size: 26px; font-weight: 800; border-radius: 14px; border: 2px solid var(--ink); background: #fff; box-shadow: 0 3px 0 var(--ink); cursor: pointer; touch-action: manipulation; }
.key:active { transform: translateY(3px); box-shadow: none; }
.key.ok { background: var(--go); color: #fff; }
.key.del { background: #f3ecdf; }
.textform { display: flex; gap: 8px; }
.textform input { flex: 1; min-width: 0; width: 100%; font-size: 24px; padding: 8px 12px; border: 2px solid var(--ink); border-radius: 14px; }
.fb { min-height: 1.4em; margin: 0; text-align: center; font-weight: 700; }
.fb.ok { color: var(--go); }
.fb.no { color: var(--no); }
.panel > .btn.ghost { align-self: center; }
.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

@media (max-width: 759px) {
  .bar { padding: 8px 16px; }
  .racing .pic { max-width: min(100%, 36vh); max-width: min(100%, 36dvh); }
  .play { gap: 10px; }
  .panel { gap: 8px; }
  .qcard { padding: 6px 12px 8px; }
  .q { font-size: 34px; }
  .entry { min-height: 46px; line-height: 42px; font-size: 30px; }
  .pad { gap: 6px; margin-top: 6px; }
  .key { min-height: 46px; font-size: 24px; }
}
@media (min-width: 760px) and (orientation: portrait) {
  .play { max-width: 620px; }
  .pic { max-width: min(100%, 45vh); }
  .key { min-height: 60px; }
}
@media (min-width: 760px) {
  .bar { padding: 16px 16px 14px; gap: 14px; }
  .bar .musicbtn { margin-right: 6px; }
  .play { padding-top: 10px; gap: 24px; }
}
@media (min-width: 760px) and (orientation: landscape) {
  .play { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
  .pic { max-width: min(100%, calc(100vh - 134px), 620px); }
}

/* pixel mysteries */
.art.pix .rg { stroke: #c9c1d6; stroke-width: .8; stroke-linejoin: miter; }
.art.pix .rg.done { stroke: rgba(0, 0, 0, .12); }
.art.pix .rg.active { stroke: var(--sel); stroke-width: 2.4; stroke-dasharray: none; }
.art.pix .shade { display: none; }
.thumb.pix .rg { stroke-width: 1; }
.qmark { position: absolute; inset: 0; display: grid; place-items: center; font-size: 54px; font-weight: 900; color: var(--accent); -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; }
.tricky { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; margin: 14px 0 0; padding: 12px 16px; border: 2px solid var(--ink); border-radius: var(--r); background: #fff3a8; box-shadow: 0 4px 0 var(--ink); cursor: pointer; text-align: left; }
.tricky b { font-size: 17px; }
.tricky span { color: var(--muted); font-size: 14px; }
.tricky:active { transform: translateY(4px); box-shadow: none; }

/* grown-ups: report, pack */
.rep-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 10px; }
.rep-stats div { background: #fff8ec; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.rep-stats b { display: block; font-size: 18px; }
.rep-stats span { color: var(--muted); font-size: 13px; }
.rep h3 { font-size: 15px; margin: 12px 0 4px; }
.chips span { display: inline-block; background: #ffe3ea; border: 1px solid #f3a6bd; border-radius: 999px; padding: 2px 10px; margin: 0 4px 4px 0; font-weight: 700; font-size: 14px; }
.heat { border-collapse: collapse; width: 100%; font-size: 12px; text-align: center; table-layout: fixed; }
.heat th { color: var(--muted); font-weight: 700; padding: 2px 0; }
.heat td { border: 1px solid #e3dccd; height: 22px; font-weight: 800; }
.heat td.ok, .legend .ok { background: #c8ecc0; color: #1d6b3a; }
.heat td.seen, .legend .seen { background: #eef6ea; color: #567; }
.heat td.tk, .legend .tk { background: #ffd0dc; color: #a0123f; }
.legend { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.legend span { display: inline-grid; place-items: center; width: 20px; height: 18px; border: 1px solid #e3dccd; font-weight: 800; }
.lbl2 { font-weight: 700; margin: 10px 0 6px; }
.tchips { display: flex; flex-wrap: wrap; gap: 6px; }
.tchip { margin: 0; }
.tchip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tchip span { display: grid; place-items: center; min-width: 44px; height: 44px; border: 2px solid var(--ink); border-radius: 12px; font-weight: 800; background: #fff; cursor: pointer; }
.tchip input:checked + span { background: var(--go); color: #fff; }
.tchip input:focus-visible + span { outline: 3px solid var(--sel); outline-offset: 2px; }
.lrow .btn:disabled { opacity: .4; cursor: not-allowed; }

/* fractions */
.fart .fp { fill: var(--fb); stroke: var(--ink); stroke-width: 2.4; stroke-linejoin: round; cursor: pointer; transition: fill .2s; }
.fart .fp.sel { fill: var(--fo); }
.fart .fmark { fill: #fff; stroke: var(--ink); stroke-width: 1.6; opacity: 0; pointer-events: none; transition: opacity .2s; }
.fart .fmark.sel { opacity: 1; }
.thumb.fart .fp { cursor: inherit; }
.fr { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; line-height: 1.05; font-size: .8em; margin: 0 .12em; }
.fr b { border-bottom: .09em solid currentColor; padding: 0 .1em; }
.fr i { font-style: normal; font-weight: 800; }
#qText .fr { font-size: .85em; }
.q.qfrac { font-size: clamp(24px, 6.5vw, 32px); line-height: 1.3; }
.q.qfrac .fr { font-size: 1.05em; }
.fopts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fopt { min-height: 96px; font-size: 40px; font-weight: 800; border: 2px solid var(--ink); border-radius: 16px; background: #fff; box-shadow: 0 4px 0 var(--ink); cursor: pointer; touch-action: manipulation; }
.fopt:active { transform: translateY(4px); box-shadow: none; }
.fopt.right { background: #c8ecc0; }
.fopt.wrong { background: #ffd0dc; opacity: .6; }
.fcount { text-align: center; font-weight: 700; color: var(--muted); margin: 4px 0; }
#fracActs .btn { min-width: 120px; min-height: 52px; font-size: 18px; }
.fb .fr { font-size: .95em; }

/* sticker album */
.albumbtn { display: flex; justify-content: space-between; align-items: center; width: 100%; margin: 14px 0 0; padding: 12px 16px; border: 2px solid var(--ink); border-radius: var(--r); background: #e6f4ff; box-shadow: 0 4px 0 var(--ink); cursor: pointer; font-size: 17px; }
.albumbtn span { color: var(--muted); font-size: 14px; font-weight: 700; }
.albumbtn:active { transform: translateY(4px); box-shadow: none; }
.donesticker { display: inline-block; background: #e6f4ff; border: 2px solid var(--ink); border-radius: 999px; padding: 3px 12px !important; font-weight: 800; font-size: 14px; }
.tabs { display: flex; gap: 6px; margin: 4px 0 12px; }
.tab { flex: 1; min-height: 44px; border: 2px solid var(--ink); border-radius: 12px; background: #fff; font-weight: 800; cursor: pointer; }
.tab[aria-selected="true"] { background: var(--ink); color: #fff; }
.scenes { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.scene-btn { min-height: 40px; padding: 0 14px; border: 2px solid var(--line); border-radius: 999px; background: #fff; font-weight: 700; cursor: pointer; }
.scene-btn[aria-pressed="true"] { border-color: var(--ink); background: #fff3c4; }
.board { position: relative; width: 100%; max-width: 760px; aspect-ratio: 4 / 3; margin: 0 auto; border: 2px solid var(--ink); border-radius: var(--r); overflow: hidden; background: #fff; touch-action: none; }
.board .scene { position: absolute; inset: 0; width: 100%; height: 100%; }
.stk { position: relative; aspect-ratio: 1 / 1; border: 3px solid #fff; border-radius: 14px; overflow: hidden; background: #fff; box-shadow: 0 0 0 2px var(--ink), 0 4px 0 2px rgba(43, 35, 64, .5); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.stk svg { display: block; width: 100%; height: 100%; pointer-events: none; }
.stk.gold { border-color: #f5b800; box-shadow: 0 0 0 2px #8a6500, 0 0 0 5px #ffe27a, 0 4px 0 4px rgba(43, 35, 64, .45); }
.stk.on { position: absolute; transform: translate(-50%, -50%) rotate(-3deg); }
.stk.on:nth-child(even) { transform: translate(-50%, -50%) rotate(3deg); }
.stk.ghost { position: fixed; z-index: 50; transform: translate(-50%, -50%) scale(1.08) rotate(-4deg); pointer-events: none; opacity: .95; }
.tray { display: flex; gap: 12px; overflow-x: auto; padding: 12px 4px 14px; margin: 6px 0; min-height: 70px; }
.tray .stk { flex: 0 0 72px; }
.hint { margin: 8px 0 0; text-align: center; }
@media (min-width: 900px) {
  #boardPane { display: grid; grid-template-columns: minmax(0, 1fr) 248px; grid-template-areas: "scenes scenes" "board tray" "hint clear"; gap: 0 18px; align-items: start; }
  #boardPane .scenes { grid-area: scenes; }
  #boardPane .board { grid-area: board; max-width: min(100%, calc((100vh - 220px) * 4 / 3)); margin: 0; }
  #boardPane .tray { grid-area: tray; flex-wrap: wrap; overflow-x: visible; overflow-y: auto; max-height: calc(100vh - 220px); padding: 4px; margin: 0; align-content: flex-start; }
  #boardPane .hint { grid-area: hint; text-align: left; }
  #boardPane #boardClear { grid-area: clear; justify-self: start; margin-top: 8px; }
}
.coll { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.slot { position: relative; background: #fff; border: 2px dashed #c9bfd8; border-radius: 14px; padding: 6px; text-align: center; }
.slot svg { display: block; width: 100%; height: auto; border-radius: 8px; opacity: .25; filter: grayscale(1); }
.slot.got { border: 2px solid var(--ink); }
.slot.got svg { opacity: 1; filter: none; }
.slot.gold { border-color: #d49a00; box-shadow: 0 0 0 3px #ffe27a; }
.slot-q { position: absolute; left: 0; right: 0; top: 22%; font-size: 40px; font-weight: 900; color: #b4a8c6; }
.slot-n { display: block; font-size: 12px; font-weight: 700; margin-top: 4px; color: var(--muted); }
.slot.got .slot-n { color: var(--ink); }

/* home: carry-on button, folded tiles */
.continue { display: flex; align-items: center; gap: 14px; width: 100%; margin: 14px 0 0; padding: 10px 14px 10px 10px; border: 2px solid var(--ink); border-radius: var(--r); background: var(--accent); color: #fff; box-shadow: 0 5px 0 var(--ink); cursor: pointer; text-align: left; }
.continue:active { transform: translateY(5px); box-shadow: none; }
.cont-art { flex: 0 0 72px; width: 72px; height: 72px; border-radius: 12px; overflow: hidden; background: #fff; border: 2px solid var(--ink); }
.cont-art svg { display: block; width: 100%; height: 100%; }
.cont-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cont-t small { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; opacity: .9; }
.cont-t b { font-size: 22px; line-height: 1.15; }
.cont-t span { font-size: 14px; opacity: .92; }
.cont-go { flex: none; width: 48px; height: 48px; border-radius: 50%; background: #fff; color: var(--accent); display: grid; place-items: center; font-size: 20px; border: 2px solid var(--ink); }
.tile.folded { display: none; }
.showall { align-items: center; justify-content: center; text-align: center; border-style: dashed; box-shadow: none; background: transparent; min-height: 120px; }
.sa-n { font-size: 34px; font-weight: 900; color: var(--muted); }
.sect { margin-top: 6px; }

/* phones: one swipeable row per section, compact header */
@media (max-width: 600px) {
  #home .grid:not(.lists) { display: flex; overflow-x: auto; gap: 10px; margin: 0 -16px; padding: 2px 16px 12px; scroll-snap-type: x mandatory; scroll-padding-left: 16px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  #home .grid:not(.lists)::-webkit-scrollbar { display: none; }
  #home .grid:not(.lists) > .tile, #home .grid:not(.lists) > .tilewrap { flex: 0 0 42%; scroll-snap-align: start; }
  #home .showall { min-height: 0; }
  #home .stage { margin: 16px 0 8px; }
  #home .stage small { display: block; margin: 2px 0 0; font-size: 13px; }
  #home .lists { grid-template-columns: 1fr 1fr; gap: 8px; }
  #home .listbtn { padding: 10px 12px; font-size: 14px; }
  #home .stagehead { align-items: flex-end; }
  #home .startotal { margin-bottom: 8px; }
  .hero { padding: 14px 16px 4px; align-items: center; }
  .logo { font-size: 28px; white-space: nowrap; }
  .tag { font-size: 14px; margin-top: 2px; }
  .hero-act .btn.ghost { padding: 8px 12px; font-size: 14px; }
  .continue { margin-top: 10px; }
  .cont-art { flex-basis: 60px; width: 60px; height: 60px; }
  .cont-t b { font-size: 19px; }
}

/* first-time hint */
#numBox { position: relative; }
.coach svg { display: block; width: 100%; height: 100%; }
.coach { position: absolute; left: 0; top: 0; width: 30px; height: 40px; pointer-events: none; z-index: 3; transition: transform .45s ease; filter: drop-shadow(0 3px 0 rgba(43, 35, 64, .35)); }
.coachtip { margin: 0 0 6px; text-align: center; font-weight: 800; color: var(--accent); }
.key.tapme { background: #fff3a8; transform: translateY(3px); box-shadow: none; }

/* grown-ups tabs, backup */
.atabs { position: sticky; top: 0; z-index: 2; background: var(--bg); padding: 8px 0; margin-top: 0; }
.atabs .tab { font-size: 14px; min-height: 42px; padding: 0 6px; }
.filebtn { position: relative; overflow: hidden; display: inline-flex; align-items: center; margin: 0; font-weight: 700; }
.filebtn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.filebtn:focus-within { outline: 3px solid var(--sel); outline-offset: 2px; }

/* home jump links */
.jump { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 2px; margin-top: 12px; scrollbar-width: none; }
.jump a { flex: none; padding: 7px 12px; border: 2px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 14px; }
.jump a:hover { border-color: var(--ink); }
.opbadge { position: absolute; top: 6px; right: 6px; min-width: 30px; height: 30px; padding: 0 6px; display: grid; place-items: center; border-radius: 999px; background: #fff; border: 2px solid var(--ink); font-weight: 900; font-size: 15px; }
.tile.locked .opbadge { display: none; }
.newpic .tile-art { display: grid; place-items: center; aspect-ratio: 1 / 1; border: 3px dashed #c9bfd8; border-radius: 12px; background: #fff; }
.newpic .plus { font-size: 64px; font-weight: 900; color: var(--accent); line-height: 1; }
.tilewrap { position: relative; display: flex; }
.tilewrap .tile { flex: 1; }
.editpic { position: absolute; top: 12px; left: 12px; min-height: 34px; padding: 0 12px; border-radius: 999px; border: 2px solid var(--ink); background: #fff; font-weight: 800; cursor: pointer; }
.listbtn.builtin { background: #e6f4ff; }

/* telling the time */
.copts { display: grid; gap: 8px; }
.copts.words { grid-template-columns: 1fr; }
.copts.faces { grid-template-columns: repeat(3, 1fr); }
.copt { min-height: 56px; padding: 8px 12px; font-size: 20px; font-weight: 800; border: 2px solid var(--ink); border-radius: 16px; background: #fff; box-shadow: 0 4px 0 var(--ink); cursor: pointer; touch-action: manipulation; }
.copt.dig { font-size: 30px; font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.copt.face { padding: 6px; }
.copt.face svg { display: block; width: 100%; height: auto; }
.copt:active { transform: translateY(4px); box-shadow: none; }
.copt.right { background: #c8ecc0; }
.copt.wrong { background: #ffd0dc; opacity: .6; }
.setnow { text-align: center; font-size: 22px; font-weight: 800; margin: 2px 0 8px; }
.steppers { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stepper { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; text-align: center; }
.stepper span { grid-column: 1 / -1; font-weight: 700; color: var(--muted); font-size: 14px; }
.stepper .btn { font-size: 26px; min-height: 52px; }
#clockSet .row .btn { min-width: 160px; min-height: 52px; font-size: 18px; }

/* picture maker */
.maker { display: grid; gap: 16px; }
.mgridwrap { width: 100%; max-width: 480px; margin: 0 auto; }
.mgrid { display: block; width: 100%; height: auto; border: 2px solid var(--ink); border-radius: 12px; touch-action: none; background: #fff; cursor: crosshair; }
.mgrid rect { stroke: rgba(43, 35, 64, .25); stroke-width: .6; }
.mpal { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 8px; }
.mcol { aspect-ratio: 1 / 1; min-height: 44px; border: 2px solid var(--ink); border-radius: 12px; cursor: pointer; }
.mcol.on { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--ink); }
.row.left { justify-content: flex-start; }
@media (min-width: 860px) { .maker { grid-template-columns: minmax(0, 480px) 1fr; align-items: start; } }

/* accessibility options */
html.easyread body { font-family: Verdana, Tahoma, "Trebuchet MS", system-ui, sans-serif; letter-spacing: .03em; word-spacing: .12em; line-height: 1.6; }
html.easyread .q { letter-spacing: .06em; }
html.easyread .fb, html.easyread .muted, html.easyread .tile-s { font-size: 16px; }
.art .patt { display: none; pointer-events: none; stroke: none; }
html.patterns .art .patt { display: inline; }
html.calm *, html.calm *::before, html.calm *::after { animation: none !important; transition: none !important; }
html.calm #confetti { display: none; }
h3.sub { font-size: 15px; margin: 14px 0 2px; }

/* race clock */
.timer { max-width: 1040px; margin: 0 auto 8px; padding: 0 16px; display: flex; align-items: center; gap: 10px; }
.timer-track { flex: 1; height: 14px; border: 2px solid var(--ink); border-radius: 999px; background: #fff; overflow: hidden; }
.timer-fill { height: 100%; background: var(--go); transform-origin: left center; transition: transform .1s linear, background .3s; }
.timer-text { font-weight: 800; font-variant-numeric: tabular-nums; min-width: 4.2em; text-align: right; }
.timer.low .timer-fill { background: var(--no); }
.timer.low .timer-text { color: var(--no); }
.countdown { position: fixed; inset: 0; display: grid; place-items: center; z-index: 9; font-size: clamp(90px, 30vw, 200px); font-weight: 900; color: var(--accent); -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; pointer-events: none; text-shadow: 0 6px 0 var(--ink); }
.countdown.beat { animation: beat .7s ease-out; }
@keyframes beat { from { transform: scale(1.6); opacity: 0; } 30% { opacity: 1; } to { transform: scale(1); } }
.tile.race .tile-art::after { content: ""; position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='13' r='8' fill='none' stroke='%232b2340' stroke-width='2.4'/%3E%3Cpath d='M12 13V9M10 3h4' stroke='%232b2340' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E") center / 18px no-repeat; border: 2px solid var(--ink); }
.tile.race.locked .tile-art::after { display: none; }

/* done overlay */
.overlay { position: fixed; inset: 0; background: rgba(43, 35, 64, .45); display: grid; place-items: center; padding: 16px; z-index: 10; }
.card { background: var(--card); border: 2px solid var(--ink); border-radius: var(--r); padding: 18px; margin-bottom: 16px; }
.card h2 { font-size: 20px; margin-bottom: 6px; }
.donecard { position: relative; text-align: center; max-width: 380px; width: 100%; overflow: hidden; margin: 0; }
.donecard p { margin: 6px 0 12px; }
.doneart { width: min(220px, 60vw); margin: 0 auto 6px; border: 2px solid var(--ink); border-radius: 14px; overflow: hidden; }
.doneart svg, #doneNextArt svg { display: block; width: 100%; height: auto; }
.donenext { display: flex; align-items: center; gap: 10px; text-align: left; background: #fff3c4; border-radius: 14px; padding: 8px; margin: 0 0 8px; }
#doneNextArt { width: 52px; flex: none; border-radius: 8px; overflow: hidden; border: 2px solid var(--ink); }
.donenext small { display: block; color: var(--muted); font-weight: 700; }
.donenext b { font-size: 17px; }
.donecard .stars.big { font-size: 36px; }
.overlay { overflow-y: auto; }
.stars { color: #f5a400; letter-spacing: .1em; }
.stars.big { font-size: 44px; margin: 0 !important; }
.row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }
#confetti { position: absolute; inset: 0; pointer-events: none; }
#confetti i { position: absolute; top: -12px; width: 8px; height: 12px; border-radius: 2px; animation: fall 1.6s ease-in forwards; }
@keyframes fall { to { transform: translateY(420px) rotate(540deg); opacity: 0; } }

/* grown-ups */
.muted { color: var(--muted); margin: 0 0 12px; }
.small { font-size: 14px; }
label { display: block; font-weight: 700; margin: 10px 0; }
label input, label select, label textarea { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; border: 2px solid var(--ink); border-radius: 12px; background: #fff; font-weight: 400; }
textarea { resize: vertical; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 15px; }
label.check { display: flex; align-items: center; gap: 10px; }
label.check input { width: 22px; height: 22px; margin: 0; flex: none; }
.gatewords { font-size: 22px; font-weight: 800; margin: 4px 0 12px; }
.lrow { display: flex; align-items: center; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.lrow span { flex: 1; min-width: 0; }
.lrow small { color: var(--muted); }
#editor { margin-top: 8px; }
#adultBody .btn.go { margin-top: 6px; }

/* print sheet: off-screen until printing */
#print { position: absolute; left: -10000px; top: 0; width: 760px; visibility: hidden; }
.sheet-art { display: block; }
.sheet-art .rg { fill: #fff; stroke: #000; stroke-width: 1.6; }
.sheet-art .lb { fill: #fff; stroke: #000; stroke-width: .8; }
.sheet-art .lt { font: 700 8.5px system-ui, sans-serif; text-anchor: middle; fill: #000; }
.sheet-art .lt.pt { font-size: 8px; font-weight: 600; }
.sheet-art.pix .rg { stroke: #777; stroke-width: .6; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  @page { margin: 12mm; }
  body { background: #fff; }
  #app { display: none; }
  #print { position: static; visibility: visible; width: auto; color: #000; font-family: system-ui, sans-serif; }
  .sheet { page-break-after: always; break-after: page; }
  .sheet:last-child { page-break-after: auto; break-after: auto; }
  .sh-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; border-bottom: 2px solid #000; padding-bottom: 6px; }
  .sh-head h1, .answers h1 { font-size: 22px; letter-spacing: -0.01em; }
  .sh-head h1 span { display: block; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #555; }
  .sh-head p { margin: 0; font-size: 13px; }
  .sh-sub { font-size: 13px; margin: 6px 0 10px; }
  .sh-body { display: flex; gap: 16px; align-items: flex-start; }
  .sheet:not(.answers) .sh-body { display: block; }
  .sh-pic { width: 128mm; margin: 0 auto 8px; }
  .sh-pic2 { flex: 0 0 70mm; }
  .sh-pic .sheet-art, .sh-pic2 .sheet-art { width: 100%; height: auto; border: 1px solid #000; }
  .sh-pic2 .sheet-art .rg { stroke-width: 1.4; }
  .sh-qs { list-style: none; padding: 0; margin: 0; flex: 1; columns: 3; column-gap: 14px; font-size: 13px; }
  .sh-qs li { break-inside: avoid; padding: 3px 0; }
  .sh-qs li b { display: inline-block; min-width: 18px; height: 18px; border: 1px solid #000; border-radius: 50%; text-align: center; font-size: 10px; line-height: 16px; margin-right: 4px; }
  .blank { display: inline-block; width: 34px; border-bottom: 1px solid #000; height: 12px; }
  .blank.wide { width: 80px; }
  .sh-key h2 { font-size: 15px; margin: 12px 0 4px; }
  .sh-key { border: 2px solid #000; border-radius: 10px; padding: 4px 10px 8px; margin-top: 10px; }
  .sh-key ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 16px; font-size: 13px; }
  .sh-key i { display: inline-block; width: 14px; height: 14px; border: 1px solid #000; vertical-align: -2px; margin-right: 6px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sh-key b { margin-right: 6px; }
  .sh-foot { font-size: 10px; color: #444; margin-top: 12px; }
  .answers .sheet-art .rg { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .answers .sh-qs { columns: 3; }
  .keys .sheet.answers.compact { page-break-after: auto; break-after: auto; break-inside: avoid; margin-bottom: 7mm; padding-bottom: 5mm; border-bottom: 1px dashed #999; }
  .answers.compact h1 { font-size: 14px; margin-bottom: 4px; }
  .answers.compact .sh-pic2 { flex: 0 0 42mm; }
  .answers.compact .sh-qs { columns: 4; font-size: 11px; }
  .answers.compact .sh-qs li { padding: 1px 0; }
  .pixsheet .sh-pic { width: 120mm; }
  .cert { height: 255mm; display: flex; padding: 6mm; break-after: page; }
  .cert-in { flex: 1; border: 4px double #2b2340; border-radius: 18px; padding: 16mm 14mm; text-align: center; display: flex; flex-direction: column; justify-content: center; gap: 4mm; }
  .cert-k { letter-spacing: .2em; text-transform: uppercase; font-size: 13px; margin: 0; color: #555; }
  .cert h1 { font-size: 40px; margin: 0; color: #c94e1f; }
  .cert p { margin: 0; font-size: 17px; }
  .cert-name { font-size: 34px !important; font-weight: 800; border-bottom: 2px solid #2b2340; min-height: 14mm; margin: 2mm 18mm !important; }
  .cert-pics { display: flex; justify-content: center; gap: 4mm; margin: 6mm 0; }
  .cert-pics svg { width: 26mm; height: 26mm; border: 1.5px solid #2b2340; border-radius: 6px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cert-pics .rg, .cert-pics .shade { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cert-sign { display: flex; justify-content: space-around; margin-top: 8mm; }
  .cert-sign span { border-top: 1.5px solid #2b2340; padding-top: 2mm; min-width: 55mm; font-size: 15px; }
  .report .rep-stats { grid-template-columns: repeat(3, 1fr); }
  .report .heat td.ok, .report .heat td.seen, .report .heat td.tk, .report .chips span { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* free demo: locked paid items and the "ask a grown-up" message (js/paid.js) */
.tile.paidlock { cursor: pointer; }
.askgrown { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 140%); max-width: calc(100% - 32px); background: var(--ink); color: #fff; font-weight: 800; padding: 14px 20px; border-radius: 16px; text-align: center; transition: transform .25s; z-index: 50; }
.askgrown.on { transform: translate(-50%, 0); }
.calm .askgrown { transition: none; }
