/* Tiny Fractions — sketchbook paper + potion colours */
@font-face { font-family: "Fredoka"; font-weight: 500; font-display: swap; src: url("../assets/fonts/fredoka-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Fredoka"; font-weight: 600; font-display: swap; src: url("../assets/fonts/fredoka-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Fredoka"; font-weight: 700; font-display: swap; src: url("../assets/fonts/fredoka-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 400; font-display: swap; src: url("../assets/fonts/nunito-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 600; font-display: swap; src: url("../assets/fonts/nunito-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 700; font-display: swap; src: url("../assets/fonts/nunito-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 800; font-display: swap; src: url("../assets/fonts/nunito-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "Patrick Hand"; font-weight: 400; font-display: swap; src: url("../assets/fonts/patrick-hand-latin-400-normal.woff2") format("woff2"); }
:root {
  --paper: #fbfdff;
  --ink: #1f2a33;
  --muted: #5d6b78;
  --line: #c9dbe8;
  --sky: #dff3fb;
  --orange: #F7A51C;
  --cyan: #30C5E8;
  --green: #5BC236;
  --purple: #9B6BE0;
  --red: #E85D5D;
  --yellow: #FFD23F;
  --font-hand: "Fredoka", "Chalkboard SE", "Comic Sans MS", "Trebuchet MS", sans-serif;
  --font-script: "Patrick Hand", "Chalkboard SE", "Comic Sans MS", cursive;
  --font: "Nunito", "Trebuchet MS", "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; background: var(--sky); color: var(--ink);
  overflow: hidden; overscroll-behavior: none; font-family: var(--font);
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
#backdrop {
  position: fixed; inset: 0;
  background: radial-gradient(circle at 30% 20%, #ffffff 0, var(--sky) 55%, #cfe9f5 100%);
}
#stage {
  position: fixed; left: 50%; top: 50%; transform-origin: center center;
  width: 1024px; height: 768px; overflow: hidden;
  background: #fff url("../assets/img/paper.jpg") center/480px 320px repeat;
  box-shadow: 0 0 0 4px #fff, 0 18px 50px rgba(30, 60, 90, .22);
  border-radius: 14px;
}
img { -webkit-user-drag: none; user-select: none; }
button { font-family: inherit; }

.screen { position: absolute; inset: 0; display: flex; flex-direction: column; }

/* ---------- boot ---------- */
#boot { align-items: center; justify-content: center; gap: 18px; }
.boot-chick { width: 180px; animation: bob 1.6s ease-in-out infinite; }
.boot-title { font-family: var(--font-hand); font-weight: 700; font-size: 44px; color: var(--ink); letter-spacing: 1px; }
.boot-bar { width: 260px; height: 14px; border: 3px solid var(--ink); border-radius: 9px; overflow: hidden; background: #fff; }
.boot-bar > i { display: block; height: 100%; width: 0; background: var(--green); transition: width .15s; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* ---------- shared chrome ---------- */
.topbar { display: flex; align-items: center; gap: 14px; padding: 16px 22px 6px; flex: none; }
.topbar-mid { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.topbar-title { font-family: var(--font-hand); font-weight: 600; font-size: 32px; color: var(--ink); letter-spacing: .5px; }
.icon-btn {
  width: 56px; height: 56px; border-radius: 16px; border: 3px solid var(--ink); background: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer; flex: none;
  box-shadow: 0 4px 0 var(--ink); transition: transform .08s, box-shadow .08s;
}
.icon-btn svg { width: 30px; height: 30px; fill: var(--ink); }
.icon-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.icon-btn.off svg { fill: #b0bcc6; }
.icon-btn .bulb { width: 32px; height: 32px; overflow: visible; }
.bulb-glass { fill: var(--yellow); stroke: var(--ink); stroke-width: 1.6; }
.bulb-fil { stroke: var(--ink); stroke-width: 1.4; stroke-linecap: round; }
.bulb-base { fill: var(--ink); }
.bulb-ray { stroke: #f08a00; stroke-width: 1.6; stroke-linecap: round; }
.icon-spacer { width: 56px; flex: none; }
.screen-lead { text-align: center; margin: 4px 30px 10px; font-family: var(--font-script); font-size: 24px; color: var(--muted); }

.btn {
  font-family: var(--font-hand); font-weight: 600; font-size: 26px; padding: 12px 30px; border-radius: 18px;
  border: 3px solid var(--ink); background: #fff; color: var(--ink); cursor: pointer;
  box-shadow: 0 5px 0 var(--ink); transition: transform .08s, box-shadow .08s, filter .15s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.btn:disabled { opacity: .45; cursor: default; box-shadow: 0 5px 0 var(--ink); transform: none; }
.btn-primary { background: var(--yellow); }
.btn-small { font-size: 28px; padding: 2px 20px; border-radius: 14px; box-shadow: 0 4px 0 var(--ink); line-height: 1.2; }

.progress { display: flex; gap: 5px; }
.progress i { width: 34px; height: 12px; border-radius: 6px; background: #fff; border: 2px solid var(--ink); }
.progress i.ok { background: var(--green); }
.progress i.bad { background: var(--red); }

/* stacked fractions */
.frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; font-family: var(--font-hand); font-weight: 600; line-height: 1; margin: 0 6px; font-size: 26px; }
.frac b { font-weight: 700; padding: 0 6px 3px; border-bottom: 3px solid currentColor; }
.frac i { font-style: normal; padding: 3px 6px 0; }
.frac.small { font-size: 22px; }
.frac.med { font-size: 30px; }
.frac.big { font-size: 40px; }
.frac.huge { font-size: 56px; }
.frac.huge b { border-bottom-width: 4px; }

/* ---------- home ---------- */
.screen-home { flex-direction: row; align-items: center; justify-content: flex-end; padding: 0 60px 0 0; }
.home-chick { position: absolute; left: 4%; bottom: 0; height: 88%; max-width: 40%; object-fit: contain; object-position: bottom; animation: bob 2.4s ease-in-out infinite; }
.home-topright { position: absolute; right: 22px; top: 16px; }
.home-card { width: 520px; max-width: 56%; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.home-kicker { font-size: 16px; font-weight: 800; letter-spacing: 3px; text-transform: uppercase; color: var(--muted); }
.home-title { font-family: var(--font-hand); font-weight: 700; font-size: 84px; line-height: .95; margin: 0; color: var(--ink); }
.home-title span { color: var(--orange); -webkit-text-stroke: 1px #c57a00; }
.home-sub { font-size: 21px; color: var(--muted); margin: 0 0 8px; line-height: 1.35; }
.home-btns { display: flex; flex-direction: column; gap: 14px; width: 100%; }
.btn-big { display: flex; align-items: center; gap: 18px; padding: 10px 24px; font-size: 34px; text-align: left; width: 100%; }
.btn-big img { height: 56px; width: 72px; object-fit: contain; }
.play-icon { width: 60px; height: 60px; border-radius: 50%; background: var(--ink); display: flex; align-items: center; justify-content: center; flex: none; }
.play-icon svg { width: 34px; height: 34px; fill: var(--yellow); margin-left: 4px; }
.btn-play { animation: pulse 1.8s ease-in-out infinite; }
.btn-play:hover { animation: none; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03); } }
.home-bubbles { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.home-bubbles i { position: absolute; bottom: -40px; border-radius: 50%; border: 3px solid rgba(91, 194, 54, .55); background: rgba(91, 194, 54, .12); animation: floatup linear infinite; }
@keyframes floatup { 0% { transform: translateY(0) scale(.8); opacity: 0; } 10% { opacity: 1; } 100% { transform: translateY(-820px) scale(1.2); opacity: 0; } }
.btn-big.btn-story img { width: 72px; height: 54px; object-fit: cover; border-radius: 8px; border: 2px solid var(--ink); }
.btn-big.btn-learn img { width: 72px; height: 54px; }
.btn-play { background: var(--yellow); }
.btn-learn { background: #e4f6ff; }
.btn-story { background: #fff; }
.home-stars { font-family: var(--font-hand); font-size: 22px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.home-stars img { height: 28px; }

/* ---------- story / tutorial ---------- */
.story-panel { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 6px 30px; }
.story-panel img { max-height: 100%; max-width: 100%; border: 3px solid var(--ink); border-radius: 12px; box-shadow: 6px 6px 0 rgba(31, 42, 51, .12); background: #fff; }
.story-caption { font-family: var(--font-script); font-size: 32px; text-align: center; padding: 6px 60px; min-height: 48px; }
.story-nav { display: flex; align-items: center; justify-content: center; gap: 26px; padding: 8px 20px 18px; flex: none; }
.story-count { font-family: var(--font-hand); font-size: 24px; color: var(--muted); min-width: 90px; text-align: center; }
.slide-frame { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 8px 30px; }
.slide-frame img { max-height: 100%; max-width: 100%; aspect-ratio: 3/2; border: 3px solid var(--ink); border-radius: 10px; background: #fff; box-shadow: 6px 6px 0 rgba(31, 42, 51, .12); }

.tut-grid { flex: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; padding: 6px 40px 24px; align-content: start; overflow: hidden; }
.tut-card {
  background: #fff; border: 3px solid var(--ink); border-radius: 16px; padding: 10px; cursor: pointer; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 4px; box-shadow: 0 5px 0 var(--ink); transition: transform .08s, box-shadow .08s; position: relative;
}
.tut-card:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.tut-card img { width: 100%; height: 96px; object-fit: contain; }
.tut-name { font-family: var(--font-hand); font-weight: 500; font-size: 20px; line-height: 1.1; }
.tut-count { font-size: 14px; color: var(--muted); }
.tut-card.done::after { content: "✓"; position: absolute; right: 8px; top: 6px; background: var(--green); color: #fff; border-radius: 50%; width: 28px; height: 28px; font-weight: 700; display: flex; align-items: center; justify-content: center; }

/* ---------- lab (modes) ---------- */
.mode-grid { flex: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 16px; padding: 6px 36px 26px; align-content: center; }
.mode-card {
  --mc: var(--orange);
  background: #fff; border: 3px solid var(--ink); border-radius: 20px; padding: 12px 10px 12px; cursor: pointer; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 6px; box-shadow: 0 6px 0 var(--ink); transition: transform .08s, box-shadow .08s;
  min-height: 300px;
}
.mode-card:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--ink); }
.mode-pic { height: 150px; width: 100%; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--mc) 18%, #fff); border-radius: 14px; border: 2px dashed var(--mc); }
.mode-icon { display: flex; align-items: center; justify-content: center; gap: 4px; height: 130px; }
.mode-icon .vial { width: 48px; }
.mode-icon .shape.pizza { width: 110px; }
.mode-icon .shape.choco { width: 60px; }
.mi-sign { font-family: var(--font-hand); font-size: 34px; margin: 0 2px; }
.mode-name { font-family: var(--font-hand); font-weight: 600; font-size: 28px; color: var(--ink); }
.mode-blurb { font-size: 15px; color: var(--muted); line-height: 1.25; }
.mode-stars { margin-top: auto; font-family: var(--font-hand); font-size: 20px; display: flex; align-items: center; gap: 6px; }
.mode-stars img { height: 26px; }

/* ---------- difficulty ---------- */
.diff-row { flex: 1; display: flex; align-items: center; justify-content: center; gap: 30px; padding: 0 40px; }
.diff-card {
  --mc: var(--orange);
  width: 250px; background: #fff; border: 3px solid var(--ink); border-radius: 22px; padding: 14px 14px 18px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px; box-shadow: 0 6px 0 var(--ink); transition: transform .08s, box-shadow .08s;
}
.diff-card:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--ink); }
.diff-chick { height: 130px; }
.diff-card:nth-child(2) .diff-chick { filter: hue-rotate(-20deg); }
.diff-card:nth-child(3) .diff-chick { filter: hue-rotate(20deg) saturate(1.2); }
.diff-name { font-family: var(--font-hand); font-weight: 600; font-size: 34px; }
.diff-sub { font-size: 14px; letter-spacing: 2px; text-transform: uppercase; color: var(--mc); font-weight: 800; }
.diff-stars { display: flex; gap: 4px; margin-top: 6px; }
.diff-stars img { height: 34px; filter: grayscale(1) opacity(.35); }
.diff-stars img.on { filter: none; }
.diff-best { font-size: 15px; color: var(--muted); }
.diff-hint { text-align: center; color: var(--muted); font-family: var(--font-script); font-size: 22px; padding: 0 60px 22px; }

/* ---------- game ---------- */
.game-screen .topbar { padding-bottom: 0; }
.game-body { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; transition: padding .25s; }
.prompt { font-family: var(--font-hand); font-weight: 500; font-size: 28px; text-align: center; padding: 6px 40px 4px; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px; min-height: 60px; }
.play-area { flex: 1; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; gap: 30px; padding: 0 30px; }
.game-foot { flex: none; display: flex; justify-content: center; align-items: flex-end; padding: 6px 0 16px; min-height: 110px; }
.toast {
  position: absolute; left: 50%; top: 110px; transform: translate(-50%, -10px); background: var(--ink); color: #fff; padding: 12px 22px; border-radius: 14px;
  font-size: 19px; max-width: 70%; text-align: center; opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none; z-index: 5;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* feedback card */
.feedback {
  display: flex; align-items: center; justify-content: center; gap: 18px; background: #fff; border: 3px solid var(--ink); border-radius: 20px; padding: 10px 20px;
  box-shadow: 0 6px 0 var(--ink); animation: rise .25s ease-out; max-width: 94%; margin-bottom: 6px;
}
.feedback.ok { background: #effbe9; }
.feedback.bad { background: #fff0f0; }
.fb-head { display: flex; align-items: center; gap: 12px; }
.fb-head img { height: 48px; }
.fb-text { display: flex; flex-direction: column; gap: 2px; }
.fb-text b { font-family: var(--font-hand); font-weight: 600; font-size: 28px; }
.fb-explain { font-size: 18px; color: var(--muted); display: flex; align-items: center; flex-wrap: wrap; gap: 2px; }
.fb-explain .frac { color: var(--ink); }
.next-btn { margin-left: 8px; white-space: nowrap; }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* vial */
.vial { width: 150px; position: relative; display: inline-block; }
.vial-svg { width: 100%; height: auto; display: block; overflow: visible; touch-action: none; }
.vial-live .vial-svg { cursor: pointer; }
.vial-glass { fill: rgba(255, 255, 255, .85); }
.vial-outline { fill: none; stroke: var(--ink); stroke-width: 4; }
.vial-lip { fill: #fff; stroke: var(--ink); stroke-width: 4; }
.vial-shine { fill: none; stroke: rgba(255, 255, 255, .9); stroke-width: 5; stroke-linecap: round; }
.vial-surface { fill: rgba(255, 255, 255, .45); }
.vial-liquid { transition: y .18s ease-out, height .18s ease-out; }
.vial-surface { transition: cy .18s ease-out; }
.tick { stroke: var(--ink); stroke-width: 2.5; }
.tick.major { stroke-width: 3.5; }
.tick-label { font-family: var(--font-hand); font-weight: 500; font-size: 17px; fill: var(--ink); }
.vial-name { font-family: var(--font-hand); font-size: 20px; fill: var(--muted); }
.bub { fill: rgba(255, 255, 255, .55); animation: bubble 2.4s linear infinite; }
.bub1 { animation-delay: .6s; } .bub2 { animation-delay: 1.2s; } .bub3 { animation-delay: 1.8s; }
@keyframes bubble { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: .9; } 100% { transform: translateY(-120px); opacity: 0; } }
.vial.empty .bub { animation: none; }
.marker-line { stroke: var(--ink); stroke-width: 2; stroke-dasharray: 6 5; }
.marker { cursor: grab; }
.marker-arrow { fill: var(--yellow); stroke: var(--ink); stroke-width: 3; stroke-linejoin: round; }
.marker-text { font-size: 14px; fill: var(--ink); font-weight: 700; }
.vial-live:not(.locked) .marker { animation: wiggle 1.2s ease-in-out infinite; transform-origin: 0 0; }
@keyframes wiggle { 0%, 100% { translate: 0 0; } 50% { translate: -4px 0; } }
.flash-ok .vial-outline { stroke: var(--green); stroke-width: 6; }
.flash-bad .vial-outline { stroke: var(--red); stroke-width: 6; }

/* identify layout */
.identify-holder { display: flex; align-items: center; justify-content: center; }
.identify-holder.pizza .shape { width: min(380px, 44vh); }
.identify-holder.choco .shape { width: 560px; max-width: 100%; }
.identify-holder.vial .vial { width: 220px; }
.identify-side { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 150px; }
.identify-holder.vial .vial { width: 240px; }
.side-label { font-family: var(--font-script); font-size: 24px; color: var(--muted); }
.shape svg { width: 100%; height: auto; display: block; overflow: visible; }
.shape.choco svg { max-height: 300px; }
.pizza-shadow { fill: rgba(31, 42, 51, .12); transform: translate(6px, 8px); }
.slice { fill: rgba(255, 255, 255, .5); stroke: var(--ink); stroke-width: 4; cursor: pointer; transition: transform .15s, fill .15s; }
.slice.on { fill: rgba(255, 255, 255, 0); stroke: #f08a00; stroke-width: 6; filter: drop-shadow(0 0 5px rgba(240, 138, 0, .8)); }
.shape.locked .slice, .shape.locked .square { cursor: default; }
.choco-base { fill: #3f2212; }
.choco-base-inner { fill: #5a3119; }
.square { cursor: pointer; }
.sq-foil { opacity: 0; transition: opacity .15s; }
.sq-shine { stroke: rgba(255, 255, 255, .85); stroke-width: 3; stroke-linecap: round; opacity: 0; transition: opacity .15s; }
.sq-ring { fill: none; stroke: transparent; stroke-width: 3; transition: stroke .15s; }
.square.on .sq-foil { opacity: 1; }
.square.on .sq-shine { opacity: 1; }
.square.on .sq-ring { stroke: #b88900; }

/* compare / equivalent */
.compare-wrap, .equiv-wrap { display: flex; align-items: center; justify-content: center; gap: 50px; }
.cmp-side { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.cmp-side .vial { width: 190px; }
.cmp-mid { display: flex; flex-direction: column; gap: 16px; }
.btn-sign { font-size: 40px; width: 90px; padding: 4px 0; font-family: var(--font-hand); font-weight: 700; }
.btn-sign.chosen { background: var(--yellow); }
.btn-sign:disabled:not(.chosen) { opacity: .3; }
.equiv-eq { font-family: var(--font-hand); font-size: 70px; }
.nudge { display: flex; gap: 12px; margin-top: 2px; }

/* reorder */
.play-area:has(.reorder-row) { flex-direction: column; gap: 6px; }
.reorder-row { display: flex; align-items: flex-end; justify-content: center; gap: 24px; touch-action: none; }
.vial-card { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 10px 6px; border-radius: 18px; border: 3px solid transparent; cursor: grab; transition: transform .12s; background: rgba(255, 255, 255, .5); }
.vial-card .vial { width: 128px; }
.vial-card.picked { border-color: var(--yellow); background: #fff8d6; }
.vial-card.dragging { z-index: 3; transition: none; box-shadow: 0 10px 20px rgba(0, 0, 0, .15); background: #fff; }
.reorder-row.locked .vial-card { cursor: default; }
.reorder-arrow { font-family: var(--font-script); font-size: 26px; color: var(--muted); }

/* arithmetic */
.arith-wrap { display: flex; align-items: center; justify-content: center; gap: 50px; }
.equation { display: flex; align-items: center; gap: 8px; }
.equation .op { font-family: var(--font-hand); font-size: 54px; margin: 0 6px; }
.answer-frac { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ans-field { width: 110px; height: 72px; border: 3px dashed var(--muted); border-radius: 12px; background: #fff; font-family: var(--font-hand); font-size: 44px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.ans-field.active { border-style: solid; border-color: var(--cyan); box-shadow: 0 0 0 4px rgba(48, 197, 232, .25); }
.ans-bar { width: 120px; height: 4px; background: var(--ink); border-radius: 2px; }
.keypad { display: grid; grid-template-columns: repeat(3, 78px); gap: 10px; }
.key { font-family: var(--font-hand); font-weight: 600; font-size: 30px; height: 64px; border-radius: 14px; border: 3px solid var(--ink); background: #fff; box-shadow: 0 4px 0 var(--ink); cursor: pointer; }
.key:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.key-ok { background: var(--yellow); }
.key-del { background: #ffe2e2; font-size: 26px; }

/* ---------- results ---------- */
.screen-results { align-items: center; justify-content: center; flex-direction: row; gap: 30px; }
.res-chick { height: 70%; max-width: 34%; object-fit: contain; animation: bob 2s ease-in-out infinite; }
.res-chick.sad { filter: saturate(.7); animation: none; transform: rotate(-6deg); }
.res-card { background: #fff; border: 3px solid var(--ink); border-radius: 24px; padding: 20px 36px 24px; display: flex; flex-direction: column; align-items: center; gap: 8px; box-shadow: 0 8px 0 var(--ink); min-width: 360px; }
.res-mode { font-size: 15px; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }
.res-grade { height: 110px; }
.res-score.good { color: #2d55fd; } .res-score.bad { color: #fb0007; }
.res-stars { display: flex; gap: 6px; }
.res-stars img { height: 54px; filter: grayscale(1) opacity(.3); transform: scale(.8); transition: transform .3s cubic-bezier(.2, 1.6, .4, 1), filter .3s; }
.res-stars img.on.pop { filter: none; transform: scale(1.1) rotate(-8deg); }
.res-line { font-family: var(--font-hand); font-size: 20px; color: var(--muted); min-height: 24px; }
.res-btns { display: flex; gap: 16px; margin-top: 6px; }

/* ---------- narrow stages (phones, stage width < 700) ---------- */
html.narrow .topbar { padding: 12px 14px 4px; gap: 8px; }
html.narrow .topbar-title { font-size: 26px; }
html.narrow .icon-btn { width: 48px; height: 48px; }
html.narrow .icon-spacer { width: 48px; }
html.narrow .progress i { width: 22px; height: 10px; }
html.narrow .screen-lead { font-size: 17px; margin: 2px 16px 8px; }
html.narrow .screen-home { flex-direction: column; justify-content: flex-start; padding: 56px 24px 0; }
html.narrow .home-card { width: 100%; max-width: 100%; align-items: center; text-align: center; }
html.narrow .home-title { font-size: 60px; }
html.narrow .home-sub { font-size: 17px; }
html.narrow .home-chick { left: auto; right: 4%; bottom: 0; height: 38%; max-width: 46%; z-index: 0; }
html.narrow .home-btns { width: 86%; position: relative; z-index: 1; gap: 10px; }
html.narrow .btn-big { font-size: 26px; padding: 8px 18px; }
html.narrow .btn-big img { height: 44px; width: 86px; }
html.narrow .home-stars { position: relative; z-index: 1; }
html.narrow .prompt { font-size: 22px; padding: 4px 16px; min-height: 48px; }
html.narrow .play-area { gap: 14px; padding: 0 12px; }
html.narrow .cmp-side .vial { width: 140px; }
html.narrow .compare-wrap, html.narrow .equiv-wrap { gap: 16px; }
html.narrow .btn-sign { width: 72px; font-size: 32px; }
html.narrow .arith-wrap { flex-direction: column; gap: 18px; }
html.narrow .equation .frac.huge { font-size: 44px; }
html.narrow .ans-field { width: 90px; height: 60px; font-size: 36px; }
html.narrow .keypad { grid-template-columns: repeat(3, 84px); gap: 8px; }
html.narrow .key { height: 54px; font-size: 26px; }
html.narrow .vial-card { padding: 4px 4px 2px; }
html.narrow .vial-card .vial { width: 78px; }
html.narrow .vial-card .frac.med { font-size: 24px; }
html.narrow .reorder-row { gap: 4px; }
html.narrow .identify-holder.pizza .shape { width: 290px; }
html.narrow .identify-holder.choco .shape { width: 300px; }
html.narrow .identify-holder.vial .vial { width: 180px; }
html.narrow .identify-side { min-width: 110px; }
html.narrow .diff-row { gap: 10px; padding: 0 10px; }
html.narrow .diff-card { width: 150px; padding: 10px 6px 12px; }
html.narrow .diff-chick { height: 90px; }
html.narrow .diff-name { font-size: 26px; }
html.narrow .diff-stars img { height: 26px; }
html.narrow .diff-hint { font-size: 15px; padding: 0 20px 14px; }
html.narrow .mode-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 0 12px 14px; align-content: start; }
html.narrow .mode-card { min-height: 0; padding: 8px 6px; gap: 3px; }
html.narrow .mode-pic { height: 92px; }
html.narrow .mode-icon { height: 84px; }
html.narrow .mode-icon .vial { width: 32px; }
html.narrow .mode-icon .shape.pizza { width: 76px; }
html.narrow .mode-icon .shape.choco { width: 44px; }
html.narrow .mi-sign { font-size: 24px; }
html.narrow .mode-name { font-size: 22px; }
html.narrow .mode-blurb { display: none; }
html.narrow .mode-stars { font-size: 17px; }
html.narrow .tut-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0 12px 12px; }
html.narrow .tut-card { padding: 6px; }
html.narrow .tut-card img { height: 56px; }
html.narrow .tut-name { font-size: 16px; }
html.narrow .story-caption { font-size: 20px; padding: 4px 16px; }
html.narrow .story-nav { gap: 12px; }
html.narrow .story-nav .btn { font-size: 22px; padding: 10px 20px; }
html.narrow .screen-results { flex-direction: column; gap: 6px; }
html.narrow .res-chick { height: 28%; max-width: 60%; }
html.narrow .res-card { min-width: 300px; padding: 12px 20px 16px; }
html.narrow .res-grade { height: 84px; }
html.narrow .feedback { gap: 8px 14px; padding: 8px 12px; flex-wrap: wrap; justify-content: center; }
html.narrow .fb-head img { height: 36px; }
html.narrow .fb-explain { font-size: 16px; }
html.narrow .fb-text b { font-size: 22px; }
html.narrow .next-btn { font-size: 22px; padding: 8px 18px; }
html.narrow .game-foot .btn { font-size: 24px; }
