:root {
  --ink: #2a2140;
  --paper: #fff6e2;
  --card: #fffdf7;
  --sun: #ffc83d;
  --coral: #ff6b5e;
  --mint: #27c4a8;
  --sky: #4aa8ff;
  --grape: #8b5cf6;
  --pink: #ff85c0;
  --line: 3px solid var(--ink);
  --blob: #8b5cf6;
  --r: 22px;
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; overscroll-behavior: none; }
body {
  font-family: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", system-ui, sans-serif;
  font-weight: 650;
  color: var(--ink);
  background-color: var(--paper);
  background-image: radial-gradient(#e9dcc0 1.6px, transparent 1.7px);
  background-size: 22px 22px;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  overflow: hidden;
  position: fixed;
  inset: 0;
}
#app { position: absolute; inset: 0; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
.spacer { flex: 1; }
.row { display: flex; gap: 12px; align-items: center; justify-content: center; }
.row.wrap { flex-wrap: wrap; }
img { -webkit-user-drag: none; display: block; }

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: max(10px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  gap: 10px;
}
.screen.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; display: block; }
.screen.scroll > * + * { margin-top: 14px; }

/* Buttons feel like pressable stickers */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 52px;
  padding: 0 20px;
  border: var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 4px 0 var(--ink);
  font-weight: 800;
  font-size: 18px;
  cursor: pointer;
  transition: transform .06s, box-shadow .06s;
  white-space: nowrap;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn:disabled { opacity: .38; }
.btn.primary { background: var(--sun); }
.btn.accent { background: var(--pink); }
.btn.ghost { background: var(--card); }
.btn.right { background: #8fe388; }
.btn.tool.on { background: var(--mint); color: #fff; }
.btn.icon { width: 52px; padding: 0; flex: none; }
.btn.icon.on { background: var(--mint); color: #fff; }
.ico { display: inline-flex; }

.topbar { display: flex; align-items: center; gap: 8px; flex: none; min-height: 58px; flex-wrap: nowrap; }
.topbar h1 { font-size: 22px; font-weight: 850; margin-left: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.star-badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 52px; padding: 0 16px; font-size: 21px; font-weight: 850;
  background: var(--card); border: var(--line); border-radius: 18px; box-shadow: 0 4px 0 var(--ink); flex: none;
}
.star { color: #f5a800; font-size: 24px; }

/* Mascot */
.mascot { width: 76px; height: 76px; flex: none; animation: bob 2.6s ease-in-out infinite; }
.mascot svg { width: 100%; height: 100%; display: block; overflow: visible; }
.mascot .blob { fill: var(--blob); }
.mascot .eyes { transform-origin: 60px 54px; animation: blink 4.4s infinite; }
@keyframes bob { 50% { transform: translateY(-5px) rotate(-2deg); } }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.08); } }

.speaker { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; }
.speaker .mascot { width: 60px; height: 60px; }
.bubble {
  position: relative; background: var(--card); border: var(--line); border-radius: 18px;
  padding: 10px 14px; font-size: 18px; line-height: 1.25; min-width: 0;
}
.bubble::before {
  content: ''; position: absolute; left: -11px; top: 50%; margin-top: -9px; width: 16px; height: 16px;
  background: var(--card); border-left: var(--line); border-bottom: var(--line); transform: rotate(45deg);
}
.bubble.pop-in { animation: pop .25s; }
@keyframes pop { 0% { transform: scale(.9); } 60% { transform: scale(1.03); } }

/* Home */
.home-top { display: flex; align-items: center; gap: 12px; }
.mascot-wrap .mascot { width: 88px; height: 88px; }
.hello { flex: 1; min-width: 0; }
.hello h1 { font-size: 34px; font-weight: 900; letter-spacing: -.3px; }
.hello p { font-size: 19px; }
.hello p span { opacity: .65; }
.tiles {
  display: grid; gap: 14px;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: minmax(158px, 1fr);
  grid-template-areas:
    "st st sc sc co co"
    "st st sc sc nu wo"
    "ga ga ga ga wa wa";
  height: calc(100% - 150px);
  min-height: 520px;
}
.tile {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden;
  border: var(--line); border-radius: 28px; box-shadow: 0 6px 0 var(--ink); padding: 16px 18px;
  transition: transform .08s, box-shadow .08s;
}
.tile:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--ink); }
.tile-art { position: absolute; top: 8px; right: 8px; width: 58%; max-width: 230px; }
.tile-art svg { width: 100%; display: block; overflow: visible; }
.tile-text { position: relative; display: flex; flex-direction: column; }
.tile b { font-size: 26px; font-weight: 900; line-height: 1.05; }
.tile small { font-size: 16px; opacity: .78; margin-top: 3px; }
.t-studio { grid-area: st; background: var(--sun); }
.t-studio .tile-art, .t-school .tile-art { width: 66%; max-width: 330px; top: 18px; right: 18px; }
.t-school { grid-area: sc; background: #9fe3d2; }
.t-coloring { grid-area: co; background: #ffc2dd; }
.t-num { grid-area: nu; background: #c7dcff; }
.t-world { grid-area: wo; background: #7cc8f5; }
.t-games { grid-area: ga; background: #d7c6ff; }
.t-gallery { grid-area: wa; background: #ffd3b5; }
.t-num .tile-art, .t-world .tile-art { width: 66%; }
.t-num b, .t-world b { font-size: 21px; }
.t-num small, .t-world small { font-size: 14px; }
.t-games .tile-art, .t-gallery .tile-art { width: auto; height: 86%; right: 18px; }
.t-games .tile-art svg, .t-gallery .tile-art svg { height: 100%; width: auto; }
.tile-prog { position: absolute; top: 14px; left: 16px; font-style: normal; background: #fff; border: var(--line); border-radius: 12px; padding: 2px 10px; font-size: 16px; }
.next-gift { display: block; text-align: center; font-size: 17px; opacity: .8; padding: 4px; }

/* Drawing stage */
.stage-host { flex: 1; position: relative; min-width: 0; min-height: 0; }
.stage { position: relative; overflow: hidden; touch-action: none; border-radius: 16px; }
.sheet { position: absolute; left: 0; top: 0; transform-origin: 0 0; isolation: isolate; box-shadow: 0 0 0 4px var(--ink); background: #fff; }
.sheet canvas { position: absolute; left: 0; top: 0; display: block; }
.paper { z-index: 0; }
.overlay { position: absolute; inset: 0; pointer-events: none; }
.overlay.under { z-index: 1; }
.overlay.over { z-index: 50; }
.sticker-ghost { position: absolute; left: 0; top: 0; font-family: "Apple Color Emoji", serif; }
.sym-guide { position: absolute; inset: 0; width: 100%; height: 100%; }
.sym-guide line { stroke: var(--sky); stroke-width: 3; stroke-dasharray: 14 14; opacity: .75; }

.studio-main { flex: 1; display: flex; gap: 10px; min-height: 0; }
.rail {
  width: 106px; flex: none; display: flex; flex-direction: column; gap: 6px;
  overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 2px; scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.brush {
  position: relative; flex: none; background: var(--card); border: var(--line); border-radius: 14px;
  padding: 2px 2px 3px; display: flex; flex-direction: column; align-items: center; cursor: pointer;
}
.brush canvas { width: 92px; height: 50px; }
.brush span { font-size: 13px; font-weight: 800; line-height: 1; }
.brush.on { background: var(--sun); transform: translateX(3px); }
.brush.locked canvas { opacity: .28; }
.brush.locked span { opacity: .55; }
.lock { position: absolute; top: 12px; font-style: normal; font-size: 22px; color: #f5a800; text-shadow: 0 0 0 var(--ink); }

.tools-foot { display: flex; align-items: center; gap: 12px; flex: none; }
.tools-foot.col { flex-direction: column; align-items: stretch; gap: 8px; }
.row-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-tools .size { flex: 1; min-width: 150px; }
.size { display: flex; align-items: center; gap: 8px; width: 210px; flex: none; }
.dotbox { width: 40px; height: 40px; display: grid; place-items: center; flex: none; }
.dot { display: block; border-radius: 50%; border: 2px solid var(--ink); }
input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 12px; border-radius: 8px;
  background: #eadfc9; border: 2px solid var(--ink); touch-action: none;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 32px; height: 32px; border-radius: 50%; background: var(--sun); border: var(--line);
}
.palette { display: flex; flex: 1; gap: 5px; flex-wrap: wrap; min-width: 0; }
.swatch {
  width: 38px; height: 38px; border-radius: 50%; border: var(--line); padding: 0; cursor: pointer; flex: none; position: relative; overflow: hidden;
}
.swatch.on { outline: 4px solid var(--ink); outline-offset: 2px; transform: scale(.82); }
.swatch.any { background: conic-gradient(red, orange, yellow, lime, cyan, blue, magenta, red); }
.swatch.any input { position: absolute; inset: -6px; opacity: 0; width: 200%; height: 200%; }

/* Popovers & modals */
.pop { position: fixed; z-index: 300; background: var(--card); border: var(--line); border-radius: 20px; box-shadow: 0 6px 0 var(--ink); padding: 12px; max-width: min(560px, 94vw); }
.pop-list { display: flex; flex-direction: column; gap: 6px; min-width: 190px; }
.pop-list.wide { min-width: 330px; }
.pick { min-height: 48px; border: 2px solid var(--ink); border-radius: 14px; background: #fff; padding: 0 16px; font-weight: 800; }
.pick.on { background: var(--sun); }
.paper-grid { display: grid; grid-template-columns: repeat(4, 96px); gap: 8px; }
.paper-chip { height: 70px; border: var(--line); border-radius: 12px; font-size: 13px; font-weight: 800; }
.paper-chip.on { outline: 3px solid var(--mint); outline-offset: 2px; }
.layer-row { display: flex; align-items: center; gap: 8px; border-radius: 14px; padding: 4px; }
.layer-row.on { background: #ffe9ae; }
.layer-pick { flex: 1; display: flex; align-items: center; gap: 10px; border: 0; background: none; font-size: 17px; }
.layer-pick canvas { width: 72px; height: 54px; background: #fff; border: 2px solid var(--ink); border-radius: 8px; }
.pop-stickers { width: min(520px, 90vw); }
.sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, 58px); gap: 4px; margin-top: 8px; max-height: 310px; overflow-y: auto; }
.sticker { font-size: 40px; height: 58px; background: none; border: 0; font-family: "Apple Color Emoji", serif; }

.tabs { display: flex; gap: 8px; }
.tabs.small { gap: 5px; flex-wrap: wrap; }
.tab {
  min-height: 50px; display: inline-flex; align-items: center; padding: 0 18px; font-size: 18px; font-weight: 800;
  background: var(--card); border: var(--line); border-radius: 16px;
}
.tabs.small .tab { min-height: 42px; padding: 0 12px; font-size: 15px; border-width: 2px; border-radius: 12px; }
.tab.on { background: var(--sun); }
.tab.dim { opacity: .45; }
.kinds { flex: none; }

.modal-back { position: fixed; inset: 0; background: rgba(42, 33, 64, .42); display: grid; place-items: center; z-index: 400; padding: 16px; }
.modal {
  background: var(--card); border: var(--line); border-radius: 28px; box-shadow: 0 8px 0 var(--ink);
  padding: 22px 28px; max-width: 460px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px;
  animation: pop .25s;
}
.modal.big { max-width: 540px; }
.modal h2 { font-size: 27px; font-weight: 900; }
.modal p { font-size: 19px; line-height: 1.3; }
.stars-row { display: flex; gap: 6px; }
.big-star { font-size: 62px; line-height: 1; color: #e6dcc6; }
.big-star.on { color: #f5a800; -webkit-text-stroke: 3px var(--ink); animation: star .5s backwards; }
@keyframes star { 0% { transform: scale(0) rotate(-40deg); } 70% { transform: scale(1.25); } }
.unlock { background: #ffe9ae; border: var(--line); border-radius: 14px; padding: 8px 16px; font-size: 18px; }
.toast {
  position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%); z-index: 500; background: var(--ink); color: #fff;
  padding: 12px 20px; border-radius: 16px; font-size: 17px; max-width: 86vw; text-align: center; pointer-events: none;
}
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 450; }

/* School */
.chapter { background: var(--card); border: var(--line); border-radius: 26px; padding: 16px 18px; border-top: 14px solid var(--ch); }
.chapter-head { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.chapter-head h2 { font-size: 25px; font-weight: 900; }
.chapter-head p { font-size: 16px; opacity: .78; }
.chapter-n { width: 48px; height: 48px; border-radius: 50%; background: var(--ch); border: var(--line); display: grid; place-items: center; font-size: 24px; font-weight: 900; flex: none; }
.lesson-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.lesson-card { position: relative; background: #fff; border: var(--line); border-radius: 18px; padding: 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; box-shadow: 0 4px 0 var(--ink); }
.lesson-card.next { background: #fff3cc; }
.art { width: 100%; display: block; }
.art path, .ref-art path { stroke: var(--ink); }
.lesson-card b { font-size: 18px; }
.mini-stars { font-size: 14px; color: #d89000; }
.tag { position: absolute; top: -10px; right: -6px; font-style: normal; background: var(--coral); color: #fff; border: var(--line); border-radius: 12px; padding: 1px 10px; font-size: 15px; transform: rotate(5deg); }

.intro-body { display: flex; gap: 20px; align-items: stretch; flex-wrap: wrap; }
.intro-art { flex: 1 1 380px; background: #fff; border: var(--line); border-radius: 24px; padding: 14px; }
.mode-list { flex: 1 1 340px; display: flex; flex-direction: column; gap: 12px; }
.lead { font-size: 20px; line-height: 1.3; }
.mode-card { display: flex; align-items: center; gap: 12px; background: var(--card); border: var(--line); border-radius: 20px; box-shadow: 0 5px 0 var(--ink); padding: 12px 16px; }
.mode-card b { display: block; font-size: 24px; font-weight: 900; }
.mode-card small { font-size: 16px; opacity: .75; }
.mode-card > div { flex: 1; }
.mode-n { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 50%; border: var(--line); font-size: 24px; font-weight: 900; }
.m0 .mode-n { background: #a7ecc0; }
.m1 .mode-n { background: var(--sun); }
.m2 .mode-n { background: var(--pink); }
.mode-stars { font-size: 24px; color: #f5a800; letter-spacing: 1px; }

.lesson-body { flex: 1; display: flex; gap: 10px; min-height: 0; }
.ref-card { flex: 0 0 34%; background: #fff; border: var(--line); border-radius: 20px; padding: 10px; position: relative; display: flex; align-items: center; justify-content: center; }
.ref-art { width: 100%; display: block; }
.ref-hidden { font-size: 24px; font-weight: 900; opacity: .4; }
.count { position: absolute; top: 8px; right: 8px; width: 56px; height: 56px; background: var(--coral); color: #fff; border: var(--line); border-radius: 50%; display: grid; place-items: center; font-size: 28px; font-weight: 900; }
.guide { position: absolute; inset: 0; width: 100%; height: 100%; }
.guide path, .ref-art path { fill: none; stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; }
.guide .g-old { stroke: #dcd6e6; }
.guide .g-cur { stroke: #7fb8ff; stroke-width: 12; }
.ref-art .g-old { stroke: #b3acc4; }
.ref-art .g-cur { stroke: #e0483a; stroke-width: 12; }
.guide .g-solid { stroke: var(--ink); }
.g-axis { stroke: var(--coral); stroke-width: 5; stroke-dasharray: 14 12; }
.step-dots { display: flex; gap: 6px; align-items: center; }
.step-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink); background: #fff; }
.step-dots i.on { background: var(--sun); transform: scale(1.3); }
.step-dots i.done { background: var(--mint); }
.lesson-foot { display: flex; align-items: center; gap: 8px; flex: none; }
.lesson-colors { display: flex; flex-direction: column; gap: 6px; flex: none; }

/* Coloring hub */
.hub .tabs { flex-wrap: wrap; }
.pages-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; padding-bottom: 20px; }
.page-card { position: relative; background: #fff; border: var(--line); border-radius: 20px; padding: 8px; box-shadow: 0 5px 0 var(--ink); display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.page-card canvas, .page-card img { width: 100%; height: auto; border-radius: 12px; }
.page-card b { font-size: 18px; }
.page-card small { font-size: 15px; opacity: .75; padding: 0 8px; }
.page-card.more { background: var(--sun); justify-content: center; min-height: 190px; font: inherit; color: inherit; cursor: pointer; }
.photo-card { background: #ffc2dd !important; }
.done-mark { position: absolute; top: 12px; right: 12px; background: var(--mint); color: #fff; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 20px; border: var(--line); }

.num-main { flex: 1; display: flex; min-height: 0; }
.num-palette { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; flex: none; }
.num-chip { width: 58px; height: 58px; border-radius: 16px; border: var(--line); font-size: 23px; font-weight: 900; box-shadow: 0 4px 0 var(--ink); }
.num-chip.on { transform: translateY(-5px) scale(1.08); outline: 4px solid var(--ink); }
.num-chip.complete b { opacity: 0; }
.num-chip.complete::after { content: '✓'; position: absolute; }
.num-chip.complete { position: relative; display: grid; place-items: center; }
.layer.hi { mix-blend-mode: multiply; }
.layer-wrap { position: absolute; inset: 0; isolation: isolate; pointer-events: none; }

/* World */
.world-wrap { flex: 1; position: relative; min-height: 0; }
.world-box { position: absolute; inset: 0; border: var(--line); border-radius: 24px; overflow: hidden; touch-action: none; }
.world-canvas { width: 100%; height: 100%; display: block; }
.world-hint { position: absolute; left: 20px; bottom: 20px; max-width: 460px; pointer-events: none; }
.silhouette svg { width: 100%; height: 100%; display: block; }
.silhouette path { fill: #f3effa; stroke: #c9bfe0; stroke-width: 5; stroke-dasharray: 16 14; }
.overlay.under { transition: opacity .2s; }

/* Games */
.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.game-card { background: var(--c); border: var(--line); border-radius: 24px; box-shadow: 0 6px 0 var(--ink); padding: 18px; min-height: 190px; display: flex; flex-direction: column; justify-content: flex-end; position: relative; overflow: hidden; }
.game-card b { font-size: 25px; font-weight: 900; line-height: 1.05; position: relative; }
.game-card small { font-size: 16px; opacity: .85; position: relative; }
.game-art { position: absolute; right: 8px; top: 6px; width: 110px; }
.game-art svg { width: 100%; display: block; fill: none; stroke: var(--ink); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.pix-card { align-items: center; text-align: center; }
.pix-count { font-style: normal; font-size: 12px; margin-left: 6px; padding: 1px 6px; border-radius: 8px; background: #efe6d2; }
.pix-count.full { background: var(--mint); color: #fff; }
.pix-card canvas { width: 100px; height: 100px; image-rendering: pixelated; margin-bottom: 4px; }

.dice-body { display: flex; flex-direction: column; align-items: center; gap: 16px; padding-top: 16px; }
.dice-body h2 { font-size: 30px; font-weight: 900; }
.reels { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.reel { width: 260px; height: 130px; display: grid; place-items: center; text-align: center; padding: 10px; background: #fff; border: var(--line); border-radius: 22px; box-shadow: 0 5px 0 var(--ink); font-size: 26px; font-weight: 900; }
.reel:nth-child(2) { background: #ffe9ae; }
.reel:nth-child(3) { background: #cdeeff; }

.lab-body { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.lab-body h2 { font-size: 30px; font-weight: 900; }
.lab-row { display: flex; align-items: center; gap: 22px; }
figure { margin: 0; text-align: center; font-size: 18px; }
.lab-circle { width: 200px; height: 200px; border-radius: 50%; border: 5px solid var(--ink); }
.lab-circle.plop { animation: plop .25s; }
@keyframes plop { 40% { transform: scale(1.06, .94); } }
.lab-match { width: 180px; text-align: center; font-size: 30px; font-weight: 900; }
.lab-meter { height: 22px; background: #fff; border: var(--line); border-radius: 12px; overflow: hidden; }
.lab-meter i { display: block; height: 100%; background: var(--mint); transition: width .25s; }
.tubes-count { min-height: 24px; font-size: 18px; }
.tubes { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.tube { background: var(--card); border: var(--line); border-radius: 18px; box-shadow: 0 4px 0 var(--ink); padding: 10px 14px; font-size: 17px; font-weight: 800; width: 118px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.tube:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.tube i { display: block; width: 54px; height: 54px; border-radius: 50% 50% 50% 8px; background: var(--t); border: var(--line); transform: rotate(-45deg); }

.pix-body { display: flex; gap: 20px; justify-content: center; align-items: flex-start; flex-wrap: wrap; }
.pix-canvas { width: min(70vh, 92vw); height: min(70vh, 92vw); border: 4px solid var(--ink); border-radius: 10px; touch-action: none; image-rendering: pixelated; }
.pix-ref { background: #fff; border: var(--line); border-radius: 16px; padding: 8px; text-align: center; }
.pix-ref canvas { width: 220px; height: 220px; display: block; image-rendering: pixelated; }

.guess-body { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.guess-top { display: flex; align-items: center; gap: 10px; }
.guess-top h2 { font-size: 26px; font-weight: 900; }
.guess-art { width: min(640px, 92vw, calc((100vh - 350px) * 1.33)); background: #fff; border: var(--line); border-radius: 24px; padding: 12px; }
.guess-opts .btn { white-space: normal; line-height: 1.1; }
.guess-opts { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 10px; }

/* Gallery */
.wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 24px 20px; padding: 12px 8px 24px; }
.frame { background: #fff; border: var(--line); border-radius: 8px; padding: 10px 10px 8px; box-shadow: 0 6px 0 var(--ink); transform: rotate(var(--r)); display: flex; flex-direction: column; gap: 6px; }
.frame img { width: 100%; border: 2px solid var(--ink); }
.frame span { text-align: center; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 60px 0; font-size: 22px; }
.art-view .art-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; position: relative; }
.art-full { max-width: 100%; max-height: 100%; border: 4px solid var(--ink); border-radius: 8px; background: #fff; }
.art-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; flex: none; }

/* Prizes & parents */
.prize-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.prize { display: flex; align-items: center; gap: 10px; background: var(--card); border: var(--line); border-radius: 18px; padding: 12px; opacity: .72; }
.prize.open { background: #d5f6e1; opacity: 1; }
.prize b { flex: 1; font-size: 18px; }
.prize small { font-size: 14px; }
.prize-at { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 50%; border: var(--line); background: var(--sun); font-weight: 900; font-size: 17px; flex: none; }
.note { text-align: center; opacity: .7; font-size: 17px; }

.gate { display: flex; flex-direction: column; gap: 14px; align-items: center; padding-top: 70px; }
.gate h2 { font-size: 26px; }
.gate-input, .field { min-height: 52px; font-size: 22px; border: var(--line); border-radius: 14px; padding: 0 14px; background: #fff; width: 200px; -webkit-user-select: text; user-select: text; }
.parents-body { display: flex; flex-direction: column; gap: 14px; max-width: 700px; margin: 0 auto; }
.parents-body section { background: var(--card); border: var(--line); border-radius: 20px; padding: 16px 20px; }
.parents-body h3 { font-size: 22px; font-weight: 900; margin-bottom: 8px; }
.parents-body p, .parents-body li { font-size: 18px; line-height: 1.35; }
.parents-body ol { margin: 0; padding-left: 22px; }
.set { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; font-size: 19px; }
.set input[type=checkbox] { width: 30px; height: 30px; accent-color: var(--mint); }

/* Portrait iPad */
@media (orientation: portrait) {
  .tiles {
    grid-template-columns: repeat(4, 1fr);
    grid-template-areas:
      "st st sc sc"
      "st st sc sc"
      "co co nu wo"
      "ga ga wa wa";
    height: calc(100% - 170px);
  }
  .lesson-body { flex-direction: column; }
  .ref-card { flex: 0 0 28%; }
  .ref-art { width: auto; height: 100%; max-width: 100%; }
  .swatch { width: 34px; height: 34px; }
  .topbar h1 { font-size: 19px; }
  .lesson-body .rail { flex-direction: row; width: 100%; overflow-x: auto; }
  .pix-ref canvas { width: 120px; height: 120px; }
  .pix-canvas { width: min(58vh, 92vw); height: min(58vh, 92vw); }
}
@media (max-width: 900px) {
  .size { width: 150px; }
  .topbar .btn:not(.icon) { padding: 0 12px; font-size: 16px; }
  .btn.icon { width: 46px; }
}

/* Level lists of the newer games */
.level-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 12px; padding-bottom: 20px; }
.level-card {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 2px; text-align: center;
  min-height: 150px; padding: 12px 8px 10px; background: var(--card); border: var(--line); border-radius: 20px; box-shadow: 0 5px 0 var(--ink);
  font: inherit; color: inherit; cursor: pointer;
}
.level-card:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.level-card.done { background: #e2f8ea; }
.level-card.locked { background: #efe9dc; opacity: .7; }
.level-card b { font-size: 17px; line-height: 1.1; }
.level-card small { font-size: 13px; opacity: .75; }
.level-n { position: absolute; top: 8px; left: 8px; min-width: 34px; height: 34px; padding: 0 6px; display: grid; place-items: center; border: var(--line); border-radius: 50%; background: var(--sun); font-weight: 900; font-size: 16px; }
.level-thumb { display: block; margin-bottom: 4px; }
.level-thumb > * { display: block; max-width: 110px; max-height: 84px; }
.level-stars { font-size: 20px; color: #f5a800; letter-spacing: 1px; }
.level-lock { opacity: .6; }
.levels .speaker { margin-bottom: 4px; }
.tag.fresh { top: 10px; left: 10px; right: auto; transform: rotate(-4deg); font-size: 13px; z-index: 1; }
.game-card .game-art { z-index: 0; }
.pix-sizes .tab { min-height: 44px; font-size: 16px; }
.shape-ghost { position: absolute; inset: 0; width: 100%; height: 100%; }
