/* Layout: one full-screen stage under a chunky top bar; each activity fills the stage. Single bright look on purpose. */
/* Fonts are served with the page (SIL Open Font License), so nothing is fetched from Google. */
@font-face { font-family: "Andika"; font-weight: 400; font-display: swap; src: url(../fonts/andika-400.woff2) format("woff2"); }
@font-face { font-family: "Andika"; font-weight: 700; font-display: swap; src: url(../fonts/andika-700.woff2) format("woff2"); }
@font-face { font-family: "Baloo 2"; font-weight: 400 800; font-display: swap; src: url(../fonts/baloo2.woff2) format("woff2"); }
:root {
  --sky: #CDEBFF;
  --ink: #1F2A44;
  --paper: #FFFFFF;
  --sun: #FFC83D;
  --berry: #FF4F7B;
  --tangerine: #FF8A1F;
  --leaf: #2FBF71;
  --ocean: #1E8BFF;
  --grape: #7B5CFF;
  --night: #26336E;
  --soft: rgba(31, 42, 68, .25);
  --display: "Baloo 2", "Comic Sans MS", system-ui, sans-serif;
  --letters: "Andika", "Trebuchet MS", system-ui, sans-serif;
  --cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44' viewBox='0 0 24 24'%3E%3Cpath d='M4 2l15 11-7 1 4 8-3 1.5-4-8-5 5z' fill='%23fff' stroke='%231F2A44' stroke-width='1.6' stroke-linejoin='round'/%3E%3C/svg%3E") 7 4, auto;
  color-scheme: light;
}
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  /* a soft sky with faint dots, so the screen feels playful without competing with the game */
  background: radial-gradient(circle, rgba(255, 255, 255, .6) 0 2.5px, transparent 3.5px) 0 0 / 54px 54px,
              radial-gradient(circle, rgba(255, 255, 255, .35) 0 2px, transparent 3px) 27px 27px / 54px 54px,
              linear-gradient(#D8F1FF, #C2E5FF) fixed, var(--sky);
  color: var(--ink); font-family: var(--letters);
  overflow: hidden; cursor: var(--cursor);
  user-select: none; -webkit-user-select: none;
}
button { cursor: var(--cursor); font: inherit; color: inherit; }
/* a few soft clouds drift slowly behind everything */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .75;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 60'%3E%3Cpath d='M28 52h66a18 18 0 0 0 2-36 26 26 0 0 0-48-6 18 18 0 0 0-22 16 14 14 0 0 0 2 26z' fill='%23fff'/%3E%3C/svg%3E") 6% 9% / 170px no-repeat, url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 60'%3E%3Cpath d='M28 52h66a18 18 0 0 0 2-36 26 26 0 0 0-48-6 18 18 0 0 0-22 16 14 14 0 0 0 2 26z' fill='%23fff'/%3E%3C/svg%3E") 78% 4% / 120px no-repeat,
              url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 60'%3E%3Cpath d='M28 52h66a18 18 0 0 0 2-36 26 26 0 0 0-48-6 18 18 0 0 0-22 16 14 14 0 0 0 2 26z' fill='%23fff'/%3E%3C/svg%3E") 92% 62% / 150px no-repeat, url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 60'%3E%3Cpath d='M28 52h66a18 18 0 0 0 2-36 26 26 0 0 0-48-6 18 18 0 0 0-22 16 14 14 0 0 0 2 26z' fill='%23fff'/%3E%3C/svg%3E") 18% 88% / 130px no-repeat;
  animation: drift 70s ease-in-out infinite alternate;
}
@keyframes drift { to { translate: 5vw 1vh; } }
.app { position: relative; z-index: 1; }
.app {
  height: 100%; box-sizing: border-box; display: flex; flex-direction: column; gap: 12px;
  padding-block: 12px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* Chunky, toy-like buttons that lift on hover so a touch kid learns what "hover" means */
.chunky {
  border: 4px solid var(--ink); border-radius: 22px; background: var(--paper);
  box-shadow: 0 6px 0 var(--soft); transition: transform .12s, box-shadow .12s;
}
.chunky:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 9px 0 var(--soft); }
.chunky:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--soft); }
.chunky:focus-visible { outline: 5px solid var(--grape); outline-offset: 3px; }
.chunky.on { background: var(--sun); }
.chunky:disabled { opacity: .35; transform: none; box-shadow: 0 2px 0 var(--soft); }
.nope { animation: nope .4s; }
@keyframes nope { 20%, 60% { translate: -10px 0; } 40%, 80% { translate: 10px 0; } }

/* Top bar */
.bar { display: flex; align-items: center; gap: 12px; flex: none; }
.bar .chunky { height: 68px; min-width: 68px; font-size: 34px; display: grid; place-items: center; padding: 0 14px; }
.logo { font-family: var(--display); font-weight: 800; font-size: clamp(28px, 4vw, 42px); line-height: 1; letter-spacing: .5px; }
.logo span:nth-child(1) { color: var(--berry); } .logo span:nth-child(2) { color: var(--tangerine); }
.logo span:nth-child(3) { color: var(--leaf); } .logo span:nth-child(4) { color: var(--ocean); }
.logo small { color: var(--ink); font-size: .5em; opacity: .55; margin-left: 2px; }
.logo span { display: inline-block; animation: hop 3s ease-in-out infinite; text-shadow: 0 3px 0 rgba(31, 42, 68, .18); }
.logo span:nth-child(2) { animation-delay: .15s; } .logo span:nth-child(3) { animation-delay: .3s; } .logo span:nth-child(4) { animation-delay: .45s; }
@keyframes hop { 0%, 70%, 100% { translate: 0 0; } 80% { translate: 0 -5px; } }
/* each top-bar button has its own soft color */
#homeBtn { background: #FFD6E0; } #gradeBtn { background: #FFF0B8; } #soundBtn { background: #CFF5DE; }
#bgmBtn { background: #E2DAFF; } #grownBtn { background: #FFE2C4; } #fullBtn { background: #D3F1FF; }
#bgmBtn.off { background: #EEF1F5; position: relative; }
#bgmBtn.off::after { content: ""; position: absolute; left: 22%; right: 22%; top: 50%; height: 5px; background: var(--berry); border-radius: 3px; rotate: -40deg; }
.spacer { flex: 1; }
#homeBtn { gap: 8px; display: flex; font-family: var(--display); font-weight: 800; font-size: 28px; }
#homeBtn b { font-size: 34px; }
#gradeBtn { font-family: var(--display); font-weight: 800; font-size: 26px; display: flex; gap: 6px; }

.stage { flex: 1; min-height: 0; position: relative; }
.view { position: absolute; inset: 0; display: flex; }

/* Home: 3 x 3 */
#home { flex-direction: column; gap: 12px; }
#home h1::before, #home h1::after { content: "✨"; font-size: .7em; margin: 0 .3em; display: inline-block; animation: twinkle 2.2s ease-in-out infinite; }
#home h1::after { animation-delay: 1.1s; }
@keyframes twinkle { 50% { scale: .7; rotate: 20deg; opacity: .6; } }
#home h1 { margin: 0; font-family: var(--display); font-weight: 800; font-size: clamp(26px, 4.4vh, 46px); text-align: center; line-height: 1.1; }
.tiles { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 16px; }
.tile {
  border-radius: 30px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  font-family: var(--display); font-weight: 800; color: var(--ink); min-height: 0; overflow: hidden; padding: 4px;
}
.tile .pic { font-size: clamp(36px, 7vh, 84px); line-height: 1.1; }
.tile .name { font-size: clamp(24px, 4.6vh, 50px); line-height: 1; }
.tile .how { font-family: var(--letters); font-weight: 700; font-size: clamp(13px, 1.9vh, 20px); opacity: .75; }
.tile.draw { background: #FFD6E0; } .tile.type { background: #FFF0B8; } .tile.space { background: var(--night); color: var(--paper); }
.tile.pop { background: #CFF5DE; } .tile.music { background: #E2DAFF; } .tile.words { background: #FFE2C4; }
.tile.shapes { background: #D3F1FF; } .tile.patterns { background: #F4D9FF; } .tile.memory { background: #DDF7C8; }
/* each tile sits on a darker edge of its own color, and breathes gently so it looks tappable */
.tile { box-shadow: 0 7px 0 var(--edge, var(--soft)); animation: bob 3.4s ease-in-out infinite; }
.tile:hover { box-shadow: 0 10px 0 var(--edge, var(--soft)); } .tile:active { box-shadow: 0 2px 0 var(--edge, var(--soft)); }
.tile.draw { --edge: #E795AA; } .tile.type { --edge: #DDBE4E; } .tile.space { --edge: #0E1638; } .tile.pop { --edge: #7FCB9F; }
.tile.music { --edge: #A694EB; } .tile.words { --edge: #E8AA72; } .tile.shapes { --edge: #7EC4E6; } .tile.patterns { --edge: #CC93E6; } .tile.memory { --edge: #9CCF78; }
.tile:nth-child(2) { animation-delay: -.5s; } .tile:nth-child(3) { animation-delay: -1s; } .tile:nth-child(4) { animation-delay: -1.5s; }
.tile:nth-child(5) { animation-delay: -2s; } .tile:nth-child(6) { animation-delay: -2.5s; } .tile:nth-child(7) { animation-delay: -3s; }
.tile:nth-child(8) { animation-delay: -.8s; } .tile:nth-child(9) { animation-delay: -1.8s; }
@keyframes bob { 50% { translate: 0 -4px; } }
.tile .pic { filter: drop-shadow(0 4px 0 rgba(31, 42, 68, .14)); }
.tip { text-align: center; font-size: clamp(15px, 2.2vh, 21px); margin: 0; }
.madeBy { text-align: center; margin: -6px 0 0; font-size: 13px; opacity: .65; }
.madeBy a { color: inherit; }
.tip b { background: var(--paper); border: 3px solid var(--ink); border-radius: 10px; padding: 0 8px; }

/* Grade picker */
.picker { position: fixed; inset: 0; z-index: 20; background: rgba(31, 42, 68, .55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.picker .panel { background: var(--sky); border: 4px solid var(--ink); border-radius: 30px; padding: 24px; display: flex; flex-direction: column; gap: 18px; align-items: center; max-width: 100%; box-sizing: border-box; }
.picker h2 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 40px; }
.picker .row { display: grid; grid-template-columns: repeat(2, minmax(0, 220px)); gap: 16px; }
.picker .chunky { height: 120px; font-family: var(--display); font-weight: 800; font-size: 30px; line-height: 1.1; padding: 8px; }
.picker .chunky small { display: block; font-family: var(--letters); font-size: 17px; opacity: .7; }
.picker .chunky.locked { opacity: .55; }
#gradeRow .chunky:nth-child(1) { background: #FFD6E0; } #gradeRow .chunky:nth-child(2) { background: #FFF0B8; } #gradeRow .chunky:nth-child(3) { background: #CFF5DE; }
#gradeRow .chunky:nth-child(4) { background: #D3F1FF; } #gradeRow .chunky:nth-child(5) { background: #E2DAFF; } #gradeRow .chunky.on { background: var(--sun); outline: 5px solid var(--ink); outline-offset: 3px; }
#gradeRow .chunky:last-child:nth-child(odd) { grid-column: span 2; }
.picker .chunky.locked::after { content: "🔒"; display: block; font-size: 22px; }

/* grown-ups area (app edition) */
.grownups { z-index: 30; align-items: stretch; }
.guPanel { position: relative; width: 560px; max-height: 100%; overflow-y: auto; align-items: stretch !important; gap: 14px !important; font-family: var(--letters); }
.guPanel h2 { font-size: 32px; text-align: center; padding: 0 44px; }
.guPanel h3 { margin: 0 0 8px; font-family: var(--display); font-size: 24px; }
.guPanel h3 small { font-family: var(--letters); font-size: 15px; opacity: .7; font-weight: 400; }
.guPanel h4 { margin: 12px 0 4px; font-size: 16px; }
.guPanel h4.good { color: #1D8A50; } .guPanel h4.mid { color: #B86A00; } .guPanel h4.low { color: #C2334F; } .guPanel h4.new { color: #556; }
.guClose.chunky { position: absolute; top: 14px; right: 14px; width: 48px; height: 48px; font-size: 22px; padding: 0; border-radius: 14px; }
#guBody { display: flex; flex-direction: column; gap: 14px; }
.guCard { background: var(--paper); border: 3px solid var(--ink); border-radius: 20px; padding: 14px 16px; }
.guCard ul { margin: 0 0 8px; padding-left: 22px; line-height: 1.5; }
.guNote { margin: 6px 0 0; font-size: 15px; opacity: .8; line-height: 1.4; }
.guLead { margin: 0; font-size: 22px; text-align: center; }
.guTyped { margin: 0 auto; min-width: 140px; text-align: center; font-family: var(--display); font-size: 40px; background: var(--paper); border: 3px solid var(--ink); border-radius: 16px; }
.guKeys { display: grid; grid-template-columns: repeat(3, 76px); gap: 10px; justify-content: center; }
.picker .guKeys .chunky { height: 64px; font-size: 26px; }
.picker .chunky.guBuy { height: 60px; width: 100%; font-size: 24px; background: var(--leaf); color: #fff; }
.guLink { background: none; border: 0; padding: 8px 0; font: inherit; font-size: 15px; color: var(--ocean); text-decoration: underline; cursor: pointer; display: block; }
.guSmall { display: flex; flex-direction: column; }
.guSkill { padding: 6px 0; }
.guSkillTop { display: flex; justify-content: space-between; gap: 8px; font-size: 16px; }
.guSkillTop span { opacity: .75; font-size: 14px; white-space: nowrap; }
.guBar { height: 10px; background: #E6EEF6; border-radius: 6px; overflow: hidden; margin: 4px 0; }
.guBar i { display: block; height: 100%; background: var(--leaf); border-radius: 6px; }
.guSkill small { font-size: 13px; opacity: .8; }
.guSkill em { font-style: normal; font-weight: 700; }
.guPanel em.up { color: #1D8A50; font-style: normal; font-weight: 700; } .guPanel em.down { color: #C2334F; font-style: normal; font-weight: 700; }
.guList { margin: 4px 0 8px; padding-left: 20px; font-size: 15px; line-height: 1.5; }
.guLog { font-size: 14px; opacity: .9; }
.guArtGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.guThumb { padding: 0; border: 3px solid var(--ink); border-radius: 12px; overflow: hidden; background: #fff; aspect-ratio: 4 / 3; cursor: pointer; }
.guThumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.guBig { width: 100%; border: 3px solid var(--ink); border-radius: 16px; background: #fff; }
.guRow { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: center; }
.picker .guRow .chunky { height: 60px; font-size: 22px; }
.guRow .guLink { grid-column: span 2; text-align: center; }

/* Draw */
#draw { gap: 12px; }
.tools { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; padding: 4px 6px 10px; flex: none; }
.tools .grid { display: grid; grid-template-columns: repeat(2, 64px); gap: 10px; }
.tools .chunky { width: 64px; height: 64px; font-size: 30px; display: grid; place-items: center; padding: 0; border-radius: 18px; }
.swatch { border-radius: 50% !important; }
.swatch.on { outline: 6px solid var(--ink); outline-offset: 3px; background: inherit; }
.size i { display: block; background: var(--ink); border-radius: 50%; }
.board { flex: 1; min-width: 0; border: 4px solid var(--ink); border-radius: 22px; overflow: hidden; background: var(--paper); box-shadow: 0 6px 0 var(--soft); }
#canvas { display: block; width: 100%; height: 100%; touch-action: none; }

/* Type */
#type { flex-direction: column; gap: 14px; }
.typeTop { display: flex; gap: 14px; flex: none; align-items: stretch; }
.card {
  background: var(--paper); border: 4px solid var(--ink); border-radius: 26px; box-shadow: 0 6px 0 var(--soft);
  display: flex; align-items: center; gap: 22px; padding: 6px 28px; flex: 1; min-width: 0; height: 170px; box-sizing: border-box;
}
.card .big { font-size: 120px; font-weight: 700; line-height: 1; min-width: 2.2ch; text-align: center; }
.card .pic { font-size: 96px; line-height: 1; }
.card .word { font-size: 52px; font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.card .hello { font-family: var(--display); font-size: 44px; font-weight: 800; }
.card.pulse { animation: pulse .25s; }
@keyframes pulse { 50% { transform: scale(1.04) rotate(-1deg); } }
.keys { display: flex; flex-direction: column; gap: 10px; justify-content: center; font-size: 20px; font-weight: 700; flex: none; }
kbd {
  display: inline-block; font-family: var(--letters); font-weight: 700; background: var(--paper);
  border: 3px solid var(--ink); border-bottom-width: 7px; border-radius: 10px; padding: 0 12px; margin-right: 8px; min-width: 1ch; text-align: center;
}
.paper {
  flex: 1; min-height: 0; background: var(--paper); border: 4px solid var(--ink); border-radius: 26px; box-shadow: 0 6px 0 var(--soft);
  padding: 20px 28px; overflow-y: auto; font-size: clamp(44px, 8vh, 80px); font-weight: 700; line-height: 1.35;
  white-space: pre-wrap; overflow-wrap: anywhere;
  background-image: repeating-linear-gradient(transparent 0 calc(1.35em - 3px), #BFE0F7 calc(1.35em - 3px) 1.35em);
  background-attachment: local; background-position: 0 20px;
}
.paper .ch { display: inline-block; animation: drop .25s ease-out; white-space: pre; }
@keyframes drop { from { transform: translateY(-.4em) scale(1.4); opacity: 0; } }
.caret { display: inline-block; width: .08em; height: 1em; background: var(--ink); vertical-align: -.12em; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* Pop */
#pop { border: 4px solid var(--ink); border-radius: 26px; overflow: hidden; box-shadow: 0 6px 0 var(--soft);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 60'%3E%3Cpath d='M28 52h66a18 18 0 0 0 2-36 26 26 0 0 0-48-6 18 18 0 0 0-22 16 14 14 0 0 0 2 26z' fill='%23fff'/%3E%3C/svg%3E") 12% 14% / 140px no-repeat, url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 60'%3E%3Cpath d='M28 52h66a18 18 0 0 0 2-36 26 26 0 0 0-48-6 18 18 0 0 0-22 16 14 14 0 0 0 2 26z' fill='%23fff'/%3E%3C/svg%3E") 80% 34% / 100px no-repeat,
              radial-gradient(circle at 88% 10%, #FFE27A 0 34px, rgba(255, 226, 122, .35) 35px 52px, transparent 53px),
              linear-gradient(#BFE6FF, #F2FAFF 70%, #DFF6E4); }
.balloon { display: grid; place-items: center; font-family: var(--display); font-weight: 800; color: #fff; -webkit-text-stroke: 2px var(--ink); padding-bottom: 8%; }
.popGoal { position: absolute; top: 14px; left: 18px; z-index: 2; font-family: var(--display); font-weight: 800; font-size: 34px; background: var(--paper); border: 4px solid var(--ink); border-radius: 20px; padding: 0 16px; display: flex; align-items: center; gap: 8px; }
.popGoal .dot { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--ink); display: inline-block; }
.popGoal.pulse { animation: pulse .5s 2; }
.boom.soft { color: #8A94A6; font-size: 34px; }
.score { position: absolute; top: 14px; right: 18px; font-family: var(--display); font-weight: 800; font-size: 40px; background: var(--paper); border: 4px solid var(--ink); border-radius: 20px; padding: 0 20px; z-index: 2; font-variant-numeric: tabular-nums; }
.balloon {
  position: absolute; left: 0; top: 0; border-radius: 50% 50% 50% 50% / 42% 42% 58% 58%;
  box-shadow: inset -12px -14px 0 rgba(0,0,0,.12), inset 10px 12px 0 rgba(255,255,255,.35);
  border: 4px solid var(--ink); box-sizing: border-box; will-change: transform;
}
.balloon::after { content: ""; position: absolute; left: 50%; top: 100%; width: 3px; height: 70%; background: var(--ink); transform: translateX(-50%); }
.balloon.popped { animation: popAnim .16s forwards; pointer-events: none; }
@keyframes popAnim { to { scale: 1.5; opacity: 0; } }
.boom { position: absolute; font-family: var(--display); font-weight: 800; font-size: 54px; color: var(--berry); pointer-events: none; animation: boom .6s forwards; -webkit-text-stroke: 2px var(--ink); }
@keyframes boom { from { scale: .4; } 40% { scale: 1.2; } to { scale: 1; opacity: 0; translate: 0 -40px; } }

/* Music */
#music { flex-direction: column; gap: 12px; }
#music p { margin: 0; text-align: center; font-size: 24px; font-weight: 700; }
.piano { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(8, 1fr); gap: 10px; }
.note {
  border: 4px solid var(--ink); border-radius: 24px; box-shadow: 0 8px 0 var(--soft); position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center; padding-bottom: 18px; transition: transform .08s, filter .08s;
}
.note:hover { filter: brightness(1.08); }
.note.hit { transform: translateY(8px); box-shadow: 0 0 0 var(--soft); filter: brightness(1.25); }
.note kbd { font-size: clamp(26px, 4vw, 44px); margin: 0; padding: 0 10px; }
.note.next { box-shadow: inset 0 0 0 7px #fff, 0 8px 0 var(--soft); transform: translateY(-8px); animation: glow .9s ease-in-out infinite alternate; z-index: 1; }
@keyframes glow { from { filter: brightness(1.05); } to { filter: brightness(1.3); } }
.note.soon { box-shadow: inset 0 0 0 4px rgba(255, 255, 255, .6), 0 8px 0 var(--soft); }
.note.nudge { animation: nudge .45s; }
@keyframes nudge { 30% { transform: translateY(-14px); } 60% { transform: translateY(4px); } }
.songBar { display: flex; gap: 10px; align-items: center; min-height: 64px; }
.songBar .chunky { height: 60px; font-family: var(--display); font-weight: 800; font-size: 24px; padding: 0 16px; flex: none; }
.songPick b { font-size: 28px; }
.songNow { flex: 1; min-width: 0; display: flex; gap: 10px; align-items: center; }
.songTitle { font-family: var(--display); font-weight: 800; font-size: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30%; }
.songStrip { flex: 1; min-width: 0; display: flex; gap: 3px; height: 34px; overflow-x: auto; scrollbar-width: none; background: #fff; border: 3px solid var(--ink); border-radius: 14px; padding: 4px; }
.songStrip i { min-width: 14px; border-radius: 6px; flex-shrink: 0; transition: opacity .2s, transform .2s; }
.songStrip i.done { opacity: .3; }
.songStrip i.now { transform: scaleY(1.25); outline: 3px solid var(--ink); }
.songMenu .songList { display: grid; grid-template-columns: repeat(2, minmax(0, 260px)); gap: 12px; }
.songMenu .songList .chunky { height: 84px; font-size: 22px; }
.note .fly { position: absolute; bottom: 90px; font-size: 44px; animation: fly 1s forwards; pointer-events: none; }
@keyframes fly { to { translate: 0 -260px; opacity: 0; rotate: 20deg; } }

/* Shared question layout: the ask bar on top, the play area under it */
.quiz { flex-direction: column; gap: 12px; }
.askbar {
  flex: none; display: flex; align-items: center; gap: 14px; min-height: 96px; box-sizing: border-box;
  background: var(--paper); border: 4px solid var(--ink); border-radius: 26px; box-shadow: 0 6px 0 var(--soft); padding: 6px 12px 6px 24px;
}
.ask { flex: 1; min-width: 0; font-size: clamp(26px, 4.2vw, 46px); font-weight: 700; line-height: 1.15; }
.ask b { font-size: 1.3em; color: var(--berry); }
.ask .pics { font-size: .8em; letter-spacing: 2px; overflow-wrap: anywhere; }
.stars { font-family: var(--display); font-weight: 800; font-size: 36px; white-space: nowrap; font-variant-numeric: tabular-nums; display: flex; flex-direction: column; align-items: center; line-height: 1; gap: 5px; }
.pips { display: flex; gap: 4px; }
.pips i { width: 10px; height: 10px; border-radius: 50%; background: #E3EAF2; border: 2px solid var(--ink); }
.pips i.on { background: var(--sun); }
.pips i.new { animation: pip .35s; }
@keyframes pip { 50% { scale: 1.6; } }
/* each game's ask bar carries its home-tile color */
#words .askbar { background: linear-gradient(90deg, #FFE2C4 0 16px, var(--paper) 16px); }
#shapes .askbar { background: linear-gradient(90deg, #D3F1FF 0 16px, var(--paper) 16px); }
#patterns .askbar { background: linear-gradient(90deg, #F4D9FF 0 16px, var(--paper) 16px); }
#memory .askbar { background: linear-gradient(90deg, #DDF7C8 0 16px, var(--paper) 16px); }
.askbar .chunky { width: 72px; height: 72px; font-size: 34px; flex: none; display: grid; place-items: center; padding: 0; }
.area { flex: 1; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center; }
.choices { display: flex; flex-wrap: wrap; gap: 22px; justify-content: center; align-items: center; max-width: 100%; }
.opt {
  min-width: 150px; height: 150px; padding: 10px 22px; box-sizing: border-box; display: grid; place-items: center;
  font-size: 64px; font-weight: 700; border-radius: 28px;
}
.opt svg { width: 120px; height: 120px; display: block; }
.chooser { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; z-index: 3; }
.chooser h2 { margin: 0; font-family: var(--display); font-weight: 800; font-size: clamp(30px, 5vw, 50px); text-align: center; }
.chooser .row { display: flex; gap: 24px; flex-wrap: wrap; justify-content: center; }
.chooser .chunky { width: 230px; height: 190px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-family: var(--display); font-weight: 800; color: var(--ink); }
.chooser .chunky b { font-size: 70px; line-height: 1; }
.chooser .chunky span { font-size: 32px; }
/* answers pop in one after another, a right answer bounces green, and a long pause gets a glowing hint */
.choices > *, .tilesRow > *, .seq > *, .memgrid > * { animation: popIn .3s backwards; }
.choices > :nth-child(2), .tilesRow > :nth-child(2), .seq > :nth-child(2), .memgrid > :nth-child(2) { animation-delay: .05s; }
.choices > :nth-child(3), .tilesRow > :nth-child(3), .seq > :nth-child(3), .memgrid > :nth-child(3) { animation-delay: .1s; }
.choices > :nth-child(4), .tilesRow > :nth-child(4), .seq > :nth-child(4), .memgrid > :nth-child(4) { animation-delay: .15s; }
.choices > :nth-child(n+5), .tilesRow > :nth-child(n+5), .seq > :nth-child(n+5), .memgrid > :nth-child(n+5) { animation-delay: .2s; }
@keyframes popIn { from { scale: .6; opacity: 0; } }
.choices .chunky.on { background: #C9F5D9; border-color: #1D8A50; animation: yay .5s; }
@keyframes yay { 40% { scale: 1.15; } 70% { scale: .97; } }
.hint { animation: hint 1.1s ease-in-out 3; }
@keyframes hint { 50% { scale: 1.12; box-shadow: 0 0 0 8px rgba(255, 200, 61, .85), 0 6px 0 var(--soft); } }
.levelUp {
  position: absolute; left: 50%; top: 40%; z-index: 12; pointer-events: none; white-space: nowrap;
  font-family: var(--display); font-weight: 800; font-size: clamp(34px, 7vw, 64px);
  background: var(--sun); border: 5px solid var(--ink); border-radius: 999px; padding: 4px 30px; box-shadow: 0 8px 0 var(--soft);
  translate: -50% -50%; animation: lvl 2s forwards;
}
@keyframes lvl { 0% { scale: .3; opacity: 0; } 14% { scale: 1.15; opacity: 1; } 24% { scale: 1; } 80% { opacity: 1; translate: -50% -50%; } 100% { opacity: 0; translate: -50% -110%; } }
.confetti { position: absolute; top: -20px; width: 14px; height: 14px; pointer-events: none; z-index: 10; animation: fall 1.4s ease-in forwards; }
@keyframes fall { to { translate: var(--dx) 110vh; rotate: 720deg; } }
.confetti.star { width: 20px; height: 20px; clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
/* light, rotating tints so a row of answers looks like a box of crayons */
.choices > :nth-child(5n+1), .tilesRow > :nth-child(5n+1) { background-color: #FFF2F6; }
.choices > :nth-child(5n+2), .tilesRow > :nth-child(5n+2) { background-color: #FFF8E3; }
.choices > :nth-child(5n+3), .tilesRow > :nth-child(5n+3) { background-color: #ECFAF1; }
.choices > :nth-child(5n+4), .tilesRow > :nth-child(5n+4) { background-color: #EDF5FF; }
.choices > :nth-child(5n), .tilesRow > :nth-child(5n) { background-color: #F4EFFF; }
.mcard:nth-child(3n+2):not(.up):not(.done) { background-color: var(--ocean); }
.mcard:nth-child(3n):not(.up):not(.done) { background-color: var(--berry); }

/* Rocket game */
.gamebox { flex: 1; min-height: 0; position: relative; border: 4px solid var(--ink); border-radius: 26px; overflow: hidden; box-shadow: 0 6px 0 var(--soft); background: #141E4A; }
#shootCanvas { display: block; width: 100%; height: 100%; }
.controls { position: absolute; left: 14px; bottom: 34px; color: var(--paper); font-size: 18px; font-weight: 700; pointer-events: none; opacity: .9; }
.controls kbd { color: var(--ink); margin-right: 4px; }
.gamebox .chooser { color: var(--paper); background: rgba(20, 30, 74, .55); }

/* Words */
.spell { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.spell .pic { font-size: clamp(80px, 16vh, 150px); line-height: 1; }
.slots { display: flex; gap: 12px; }
.slot {
  --w: min(86px, calc((100vw - 80px) / var(--n, 5) - 12px)); width: var(--w); height: 100px; border-bottom: 8px solid var(--ink); display: grid; place-items: center;
  font-size: calc(var(--w) * .88); font-weight: 700; line-height: 1; color: var(--ink);
}
.slot.ghost { color: rgba(31, 42, 68, .18); }
.slot.next { border-bottom-color: var(--berry); animation: blinkLine 1s ease-in-out infinite alternate; }
@keyframes blinkLine { to { border-bottom-color: var(--sun); } }
.tilesRow { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.tilesRow .chunky { width: 92px; height: 92px; font-size: 56px; font-weight: 700; padding: 0; }
.wordCard { font-size: clamp(48px, 7vw, 80px); min-width: 220px; }

/* Patterns */
.pattern { display: flex; flex-direction: column; align-items: center; gap: 30px; max-width: 100%; }
.seq { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.seq span {
  width: 104px; height: 104px; display: grid; place-items: center; font-size: 66px; font-weight: 700;
  background: var(--paper); border: 4px solid var(--ink); border-radius: 22px;
}
.seq span.q { background: var(--sun); border-style: dashed; }
.seq span.long { font-size: 44px; }   /* 3-digit numbers (3rd grade counting and doubling) */

/* Memory */
.memgrid { display: grid; gap: 16px; height: 100%; max-height: 100%; aspect-ratio: var(--ar); max-width: 100%; }
.mcard { font-size: clamp(30px, 6vh, 64px); font-weight: 700; padding: 0; border-radius: 22px; background: var(--grape); color: var(--paper); min-height: 0; overflow: hidden; }
.mcard.up { background: var(--paper); color: var(--ink); animation: flip .28s ease-out; }
@keyframes flip { from { rotate: y 90deg; } }
.mcard:not(.up):not(.done) { background-image: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, .25) 0 18%, transparent 19%); }
.mcard.done { background: #DDF7C8; color: var(--ink); }
.mcard .small { font-size: .78em; white-space: nowrap; }

@media (max-width: 760px) {
  #draw { flex-direction: column; }
  .tools { flex-direction: row; overflow-x: auto; overflow-y: hidden; padding: 4px; }
  .tools .grid { grid-template-columns: none; grid-auto-flow: column; grid-template-rows: 64px; }
  .tiles { gap: 10px; }
  .tile .how { display: none; }
  .typeTop { flex-direction: column; } .keys { flex-direction: row; flex-wrap: wrap; }
  .card .big { font-size: 80px; } .card .pic { font-size: 64px; } .card .word { font-size: 34px; }
  .piano { gap: 4px; } .logo small { display: none; }
  .opt { min-width: 100px; height: 100px; font-size: 44px; } .opt svg { width: 80px; height: 80px; }
  .slot { --w: min(52px, calc((100vw - 48px) / var(--n, 5) - 8px)); height: 70px; } .tilesRow .chunky { width: 64px; height: 64px; font-size: 38px; }
  .seq span { width: 64px; height: 64px; font-size: 40px; } .seq span.long { font-size: 26px; }
  .picker .row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
  .levelUp { animation: none !important; }   /* shown still for its two seconds instead of flashing past */
}
