:root {
  --pink: #FF6B9E; --purple: #996BF2; --blue: #4599FF; --teal: #21BDAD; --green: #52C761;
  --yellow: #FFC72E; --orange: #FF9438; --red: #F25C5C; --ink: #3D2E61; --paper: #FFFCF7;
  --font: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Nunito", system-ui, -apple-system, sans-serif;
  --top: env(safe-area-inset-top, 0px);
  --bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none;
  background: #FFEBF5; color: var(--ink); font-family: var(--font);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  touch-action: manipulation; -webkit-text-size-adjust: 100%;
}

button { font: inherit; color: inherit; border: 0; background: none; padding: 0; margin: 0; cursor: pointer; }
button:disabled { cursor: default; }

#app { position: fixed; inset: 0; overflow: hidden; }

/* ---------- Screens ---------- */

.screen {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  padding: calc(var(--top) + 10px) 16px calc(var(--bottom) + 18px);
  background: linear-gradient(#FFEBF5, #E0EBFF);
  transition: opacity .3s ease, transform .3s ease;
  overflow: hidden;
}
.screen.enter { opacity: 0; transform: scale(1.04); }
.screen.leave { opacity: 0; pointer-events: none; }
.screen > * { position: relative; z-index: 1; }
.col { width: 100%; max-width: 620px; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 14px; }
.spacer { flex: 1; min-height: 4px; }
.center { display: flex; flex-direction: column; align-items: center; }

.bg-quiz { background: linear-gradient(#F2EBFF, #FFEEF5); }
.bg-spell { background: linear-gradient(#FFF2DB, #FFE6F0); }
.bg-trace { background: linear-gradient(#E0FFF5, #EBF0FF); }
.bg-cards { background: linear-gradient(#FFF2E0, #EBF0FF); }
.bg-memory { background: linear-gradient(#E6F2FF, #F7E6FF); }
.bg-song { background: linear-gradient(#EDE6FF, #FFF2D9); }
.bg-music { background: linear-gradient(#F2E6FF, #FFEBF2); }
.bg-party { background: linear-gradient(#FFF2CC, #FFE0F2); }
.bg-sky { background: linear-gradient(#80C7FF, #DBF2FF); }

/* ---------- Buttons ---------- */

.chunky {
  --c: var(--pink);
  position: relative; color: #fff; border-radius: 28px;
  background: linear-gradient(color-mix(in srgb, var(--c) 82%, #fff), var(--c));
  box-shadow: 0 6px 0 color-mix(in srgb, var(--c) 70%, #000),
              0 12px 22px color-mix(in srgb, var(--c) 38%, transparent),
              inset 0 0 0 3px rgba(255, 255, 255, .45);
  transition: transform .12s ease, box-shadow .12s ease, filter .2s;
}
.chunky:active:not(:disabled) {
  transform: translateY(4px) scale(.98);
  box-shadow: 0 2px 0 color-mix(in srgb, var(--c) 70%, #000), 0 4px 10px color-mix(in srgb, var(--c) 30%, transparent),
              inset 0 0 0 3px rgba(255, 255, 255, .45);
}
.chunky:disabled { filter: grayscale(.9) opacity(.55); }

.tile {
  width: 100%; display: flex; align-items: center; gap: 16px; padding: 0 22px; text-align: left;
  min-height: clamp(84px, 13.5dvh, 116px);
}
.tile-icon { font-size: clamp(40px, 6.5dvh, 54px); line-height: 1; filter: drop-shadow(0 2px 2px rgba(0,0,0,.15)); }
.tile-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.tile-title { font-size: clamp(26px, 4dvh, 32px); font-weight: 900; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-sub { font-size: 18px; font-weight: 700; opacity: .92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-arrow svg { width: 22px; height: 22px; opacity: .85; }
.tile.compact { justify-content: center; gap: 8px; padding: 0 10px; min-height: 86px; }
.tile.compact .tile-icon { font-size: 32px; }
.tile.compact .tile-title { font-size: 25px; }
.tile.small { min-height: 88px; }

.grid-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 165px; padding: 12px; }
.grid-icon { font-size: 58px; line-height: 1; }
.grid-title { font-size: 23px; font-weight: 900; text-align: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; width: 100%; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; width: 100%; }

.round-btn {
  width: 52px; height: 52px; border-radius: 50%; background: #fff; color: var(--ink); flex: none;
  display: grid; place-items: center; box-shadow: 0 3px 8px rgba(0,0,0,.13); transition: transform .12s;
}
.round-btn:active { transform: scale(.9); }
.round-btn svg { width: 24px; height: 24px; }

.speaker-btn {
  --c: var(--blue);
  flex: none; border-radius: 50%; color: #fff; display: grid; place-items: center;
  background: linear-gradient(color-mix(in srgb, var(--c) 80%, #fff), var(--c));
  border: 4px solid #fff; box-shadow: 0 6px 14px color-mix(in srgb, var(--c) 45%, transparent);
  transition: transform .12s;
}
.speaker-btn:active { transform: scale(.9); }
.speaker-btn svg { width: 46%; height: 46%; }
.speaker-btn .wave1 { animation: wave 1.6s ease-in-out infinite; }
.speaker-btn .wave2 { animation: wave 1.6s ease-in-out .25s infinite; }
@keyframes wave { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

.star-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px;
  background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.1); font-weight: 900; font-size: 22px;
}
.star-emoji { font-size: 22px; }

/* ---------- Headers & bars ---------- */

.screen-header, .top-bar, .home-top { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 620px; }
.screen-header .header-title { flex: 1; text-align: center; font-size: 32px; font-weight: 900; }
.home-top { justify-content: space-between; }
.lock-btn { width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,.7); color: rgba(61,46,97,.45); display: grid; place-items: center; }
.lock-btn svg { width: 18px; height: 18px; }

.note-progress {
  flex: 1; display: flex; justify-content: center; gap: 6px; padding: 5px 12px;
  background: rgba(255,255,255,.85); border-radius: 999px; font-size: 27px; font-weight: 900; line-height: 1.2;
}
.note-progress.small { gap: 2px; font-size: 19px; }
.pnote { color: rgba(128,128,128,.28); transition: transform .3s cubic-bezier(.3,1.8,.5,1), color .3s; }
.pnote.latest { transform: scale(1.3); }

.prompt-row { display: flex; align-items: center; gap: 14px; width: 100%; }
.prompt-text { font-size: 27px; font-weight: 900; line-height: 1.15; }

/* ---------- Home ---------- */

.home-title { font-size: clamp(36px, 6dvh, 48px); font-weight: 900; text-align: center; margin: 0; }
.menu-stack { display: flex; flex-direction: column; gap: 18px; width: 100%; max-width: 560px; }
.splash-btn { font-size: 34px; font-weight: 900; padding: 22px 46px; }

/* ---------- Mascot ---------- */

.mascot { display: block; overflow: visible; max-height: 22dvh; width: auto; }
.mascot .head { transform-box: view-box; transform-origin: 100px 165px; }
.mascot.dance .head { animation: sway 1.1s ease-in-out infinite alternate; }
.mascot.cheer .head { animation: hop .32s ease-in-out infinite alternate; }
.mascot .petals { transform-box: view-box; transform-origin: 100px 100px; animation: spin 30s linear infinite; }
.mascot .eyes { transform-box: view-box; transform-origin: 100px 94px; animation: blink 4.2s infinite; }
.mascot .mouth { display: none; }
.mascot.happy .m-happy, .mascot.cheer .m-cheer, .mascot.oops .m-oops { display: inline; }
@keyframes sway { from { transform: rotate(-6deg) translateY(0); } to { transform: rotate(6deg) translateY(-6px); } }
@keyframes hop { from { transform: rotate(-9deg) translateY(0); } to { transform: rotate(9deg) translateY(-16px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 0%, 95%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }

/* ---------- Effects ---------- */

.floating-notes { position: absolute !important; inset: 0; pointer-events: none; z-index: 0 !important; overflow: hidden; }
.floating-notes span { position: absolute; bottom: -60px; font-weight: 900; opacity: 0; animation: float-up linear infinite; }
@keyframes float-up {
  0% { transform: translateY(0) translateX(0); opacity: 0; }
  10% { opacity: .35; }
  50% { transform: translateY(-55dvh) translateX(16px); }
  90% { opacity: .35; }
  100% { transform: translateY(-115dvh) translateX(-10px); opacity: 0; }
}
.confetti { position: absolute !important; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50 !important; }

.shake { animation: shake .4s ease; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-10px); } 40% { transform: translateX(10px); } 60% { transform: translateX(-7px); } 80% { transform: translateX(7px); } }
.bounce { animation: pop-in .45s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes pop-in { 0% { transform: scale(.85); } 100% { transform: scale(1); } }
.pulse { animation: pulse .7s ease-in-out infinite alternate; }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.14); } }

/* ---------- Ten-frames ---------- */

.ten-frames { display: flex; flex-direction: column; gap: calc(var(--cell) * .25); align-items: center; }
.ten-frame { display: grid; grid-template-columns: repeat(5, var(--cell)); grid-auto-rows: var(--cell); border: 2.5px solid rgba(61,46,97,.6); background: #fff; }
.tf-cell { border: 1px solid rgba(61,46,97,.3); display: grid; place-items: center; }
.tf-dot { width: 72%; height: 72%; border-radius: 50%; background: var(--dot); }
.tf-emoji { font-size: calc(var(--cell) * .68); line-height: 1; }

/* ---------- Flashcards ---------- */

.flip-card { width: 100%; height: min(420px, 48dvh); perspective: 1400px; cursor: pointer; }
.flip-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .55s cubic-bezier(.3, 1.3, .5, 1); }
.flip-card.flipped .flip-inner { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0; border-radius: 36px; background: #fff; border: 10px solid var(--c);
  box-shadow: 0 12px 28px color-mix(in srgb, var(--c) 35%, transparent);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 16px;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.face.back { transform: rotateY(180deg); }
.big-word { font-weight: 900; line-height: 1; color: color-mix(in srgb, var(--c) 88%, #000); white-space: nowrap; }
.tap-hint { position: absolute; bottom: 20px; font-size: 19px; font-weight: 800; color: rgba(61,46,97,.4); }
.sentence { font-size: 27px; font-weight: 800; text-align: center; line-height: 1.3; }
.sentence mark { background: none; color: color-mix(in srgb, var(--c) 88%, #000); font-weight: 900; text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 4px; }
.number-name { font-size: 30px; font-weight: 800; opacity: .8; }
.pill-btn { color: #fff; font-weight: 900; font-size: 20px; padding: 10px 20px; border-radius: 999px; background: var(--teal); box-shadow: 0 4px 10px rgba(33,189,173,.4); }
.controls { display: flex; gap: 16px; align-items: center; width: 100%; }
.controls > .tile { flex: 1; }

/* ---------- Quiz: options ---------- */

.options { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; width: 100%; }
.option { min-height: clamp(96px, 15dvh, 130px); font-size: 62px; font-weight: 900; display: grid; place-items: center; padding: 0 8px; }
.option.right { --c: var(--green) !important; transform: scale(1.06); }
.option.wrong { filter: grayscale(1) opacity(.45); }
.option .check { position: absolute; top: -10px; right: -6px; font-size: 32px; }
.count-box { background: rgba(255,255,255,.85); border-radius: 24px; padding: 14px; align-self: center; }

/* ---------- Spelling ---------- */

.slots { display: flex; gap: 8px; justify-content: center; padding: 14px; border-radius: 24px; background: rgba(255,255,255,.6); align-self: center; }
.slot {
  width: var(--w); height: 84px; border-radius: 16px; background: #fff; border: 2px solid rgba(61,46,97,.15);
  display: grid; place-items: center; font-size: calc(var(--w) * .78); font-weight: 900; position: relative;
}
.slot.current { border: 4px solid var(--orange); }
.slot.empty::after { content: ""; position: absolute; bottom: 14px; width: 50%; height: 5px; border-radius: 3px; background: rgba(61,46,97,.25); }
.slots.done .slot { background: color-mix(in srgb, var(--green) 25%, #fff); color: color-mix(in srgb, var(--green) 60%, #000); animation: pop-in .45s cubic-bezier(.3,1.8,.5,1); }
.tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.letter-tile { width: 78px; height: 78px; border-radius: 22px; font-size: 46px; font-weight: 900; display: grid; place-items: center; }
.letter-tile.used { opacity: .12; }

/* ---------- Writing ---------- */

.pad-wrap { position: relative; flex: 1; min-height: 220px; width: 100%; max-width: 520px; align-self: center; border-radius: 30px; background: var(--paper); box-shadow: 0 8px 20px rgba(33,189,173,.25); border: 4px dashed rgba(33,189,173,.45); overflow: hidden; }
.pad-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.pad-result { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.pad-result > div { background: rgba(255,255,255,.88); border-radius: 26px; padding: 14px 28px; text-align: center; animation: pop-in .45s cubic-bezier(.3,1.8,.5,1); }
.pad-result .num { font-size: 120px; font-weight: 900; line-height: 1; }
.model-number { font-size: 54px; font-weight: 900; background: #fff; border-radius: 18px; padding: 4px 18px; margin-left: auto; }

/* ---------- Balloons ---------- */

.balloon-field { position: absolute !important; inset: 0; overflow: hidden; z-index: 1; }
.cloud { position: absolute; width: 140px; height: 60px; opacity: .85; }
.cloud::before, .cloud::after { content: ""; position: absolute; background: #fff; border-radius: 50%; }
.cloud::before { width: 90px; height: 46px; left: 0; top: 14px; box-shadow: 46px -10px 0 6px #fff, 80px 4px 0 -4px #fff; }
.balloon { position: absolute; left: 0; top: 0; width: var(--bw); will-change: transform; touch-action: none; }
.balloon-body {
  width: var(--bw); height: calc(var(--bw) * 1.18); border-radius: 50% 50% 48% 48% / 55% 55% 45% 45%;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 60%, #fff), var(--c) 60%, color-mix(in srgb, var(--c) 85%, #000));
  display: grid; place-items: center; color: #fff; font-weight: 900; font-size: calc(var(--bw) * .36);
  text-shadow: 0 1px 2px rgba(0,0,0,.25); position: relative;
}
.balloon-body::before { content: ""; position: absolute; left: 18%; top: 16%; width: 16%; height: 24%; border-radius: 50%; background: rgba(255,255,255,.45); }
.balloon-knot { width: 14px; height: 10px; margin: -2px auto 0; background: color-mix(in srgb, var(--c) 85%, #000); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.balloon-string { width: 2px; height: calc(var(--bw) * .5); margin: 0 auto; background: rgba(61,46,97,.35); }
.balloon.popped { transition: transform .45s ease-out, opacity .45s; opacity: 0; }
.balloon.wobble .balloon-body { animation: shake .45s; }
.burst { position: absolute; font-size: 30px; font-weight: 900; pointer-events: none; animation: burst .7s ease-out forwards; z-index: 2; }
@keyframes burst { from { transform: translate(-50%, -50%) scale(.6); opacity: 1; } to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.2); opacity: 0; } }
.pop-label { font-size: 30px; font-weight: 900; color: #fff; text-shadow: 0 2px 4px rgba(61,46,97,.35); }

/* ---------- Memory ---------- */

.memory-grid { display: grid; gap: 14px; width: 100%; flex: 1; min-height: 0; }
.mcard { perspective: 1000px; cursor: pointer; min-height: 0; }
.mcard-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .5s cubic-bezier(.3,1.3,.5,1); }
.mcard.up .mcard-inner { transform: rotateY(180deg); }
.mface { position: absolute; inset: 0; border-radius: 22px; display: grid; place-items: center; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; }
.mface.mback { font-size: 52px; font-weight: 900; color: rgba(255,255,255,.88); }
.mface.mfront { transform: rotateY(180deg); background: #fff; border: 5px solid var(--c); color: color-mix(in srgb, var(--c) 85%, #000); font-weight: 900; }
.mcard.matched .mfront { border-color: var(--green); background: color-mix(in srgb, var(--green) 16%, #fff); }
.mcard.matched .mcard-inner { transform: rotateY(180deg) scale(.94); }

/* ---------- Song keys ---------- */

.song-title { font-size: 25px; font-weight: 900; text-align: center; }
.song-dots { display: flex; gap: 8px; justify-content: center; }
.song-dot { width: 20px; height: 20px; border-radius: 50%; background: rgba(128,128,128,.22); transition: background .3s; }
.song-dot.current { box-shadow: 0 0 0 3px var(--ink); }
.xylo { display: flex; align-items: flex-end; gap: 8px; width: 100%; flex: 0 1 min(250px, 34dvh); min-height: 120px; }
.xkey { flex: 1; border-radius: 18px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 18px 2px 12px; font-size: 30px; font-weight: 900; transition: filter .15s, transform .15s; }
.xkey .peg { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,.7); }
.xkey.lit { filter: brightness(1.2); transform: translateY(4px) scale(.96); }
.xkey.hint { box-shadow: 0 0 0 5px var(--ink), 0 6px 0 color-mix(in srgb, var(--c) 70%, #000); }
.xkey-label { white-space: nowrap; max-width: 100%; overflow: hidden; text-shadow: 0 1px 2px rgba(0,0,0,.25); }

/* ---------- Music room ---------- */

.instruments { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; width: 100%; }
.inst { border-radius: 20px; min-height: 108px; padding: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 14px; font-weight: 800; text-align: center; }
.inst .emoji { font-size: 42px; line-height: 1; }
.inst.locked { --c: #C9C9D6 !important; color: rgba(61,46,97,.6); }
.inst.locked .emoji { filter: grayscale(1); opacity: .45; }
.inst.selected { outline: 4px solid var(--ink); outline-offset: 2px; }
.next-unlock { font-size: 18px; font-weight: 800; opacity: .7; text-align: center; }
.bars { display: flex; align-items: center; gap: 6px; flex: 0 1 200px; min-height: 96px; width: 100%; }
.bar { flex: 1; border-radius: 12px; display: flex; flex-direction: column; justify-content: space-between; align-items: center; padding: 12px 0; transition: transform .1s, filter .1s; box-shadow: 0 3px 6px rgba(0,0,0,.12); }
.bar .peg { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,.7); }
.bar.lit { transform: scale(.92); filter: brightness(1.15); }

/* ---------- Celebration ---------- */

.party { width: 100%; max-width: 620px; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.party-title { font-size: clamp(32px, 5.5dvh, 42px); font-weight: 900; text-align: center; margin: 0; }
.party-msg { font-size: 23px; font-weight: 800; opacity: .75; text-align: center; }
.party-stars { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; }
.party-stars span { font-size: 44px; transform: scale(0); opacity: 0; transition: transform .35s cubic-bezier(.3,1.9,.5,1), opacity .2s; }
.party-stars span.on { transform: scale(1); opacity: 1; }
.party-plus { font-size: 26px; font-weight: 900; color: var(--orange); opacity: 0; transition: opacity .3s; }
.party-plus.on { opacity: 1; }
.unlock { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-radius: 22px; color: #fff; animation: pop-in .5s cubic-bezier(.3,1.8,.5,1); }
.unlock .emoji { font-size: 44px; }
.unlock small { display: block; font-size: 17px; font-weight: 800; }
.unlock b { font-size: 25px; font-weight: 900; }
.party-buttons { width: 100%; opacity: 0; transform: translateY(30px); transition: opacity .4s, transform .4s; pointer-events: none; }
.party-buttons.on { opacity: 1; transform: none; pointer-events: auto; }

/* ---------- Grown-up area ---------- */

.sheet {
  position: fixed; inset: 0; z-index: 100; background: #F2F2F7; color: #1c1c1e;
  font-family: -apple-system, system-ui, sans-serif; -webkit-user-select: text; user-select: text;
  display: flex; flex-direction: column; animation: sheet-in .3s ease;
}
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } }
.sheet-bar { display: flex; align-items: center; gap: 8px; padding: calc(var(--top) + 10px) 14px 10px; background: rgba(242,242,247,.95); border-bottom: 1px solid #d8d8de; }
.sheet-bar h2 { flex: 1; margin: 0; font-size: 19px; text-align: center; }
.sheet-bar button { color: #7a4fe0; font-size: 17px; font-weight: 600; min-width: 64px; padding: 6px; }
.sheet-bar button.left { text-align: left; }
.sheet-bar button.right { text-align: right; }
.sheet-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 16px 16px calc(var(--bottom) + 40px); overscroll-behavior: contain; }
.sheet-body > * { max-width: 640px; margin-left: auto; margin-right: auto; }
.group-title { font-size: 13px; text-transform: uppercase; color: #6d6d72; margin: 22px 14px 7px; letter-spacing: .02em; }
.group { background: #fff; border-radius: 12px; overflow: hidden; }
.group-foot { font-size: 13px; color: #6d6d72; margin: 7px 14px 0; line-height: 1.4; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 48px; border-bottom: 1px solid #e5e5ea; font-size: 17px; }
.row:last-child { border-bottom: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .muted { color: #8e8e93; font-size: 15px; }
.row .sub { color: #8e8e93; font-size: 13px; margin-top: 2px; }
.row.link { cursor: pointer; }
.row.link::after { content: "›"; color: #c4c4c7; font-size: 24px; line-height: 1; }
.row button.action { color: #7a4fe0; font-size: 17px; text-align: left; flex: 1; }
.row button.danger { color: #ff3b30; font-size: 17px; text-align: left; flex: 1; }
.row input[type=text], .row input[type=number], .row textarea, .row select {
  font: inherit; font-size: 17px; border: 0; outline: 0; background: transparent; color: inherit; width: 100%; -webkit-user-select: text; user-select: text;
}
.row select { text-align: right; color: #8e8e93; }
.row input[type=range] { width: 100%; accent-color: #996BF2; }
.sound-log { font: 13px/1.5 ui-monospace, Menlo, monospace; display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow-y: auto; width: 100%; }
.sound-log .muted { font-family: -apple-system, system-ui, sans-serif; }
.item-word { font-size: 20px; font-weight: 700; font-family: var(--font); }
.item-word.off { color: #aeaeb2; }
.stepper { display: flex; align-items: center; border-radius: 9px; background: #eeeef0; }
.stepper button { width: 44px; height: 32px; font-size: 22px; color: #1c1c1e; }
.stepper span { min-width: 30px; text-align: center; font-weight: 600; }
.toggle { position: relative; width: 51px; height: 31px; flex: none; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle span { position: absolute; inset: 0; border-radius: 31px; background: #e3e3e8; transition: background .2s; cursor: pointer; }
.toggle span::after { content: ""; position: absolute; left: 2px; top: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform .2s; }
.toggle input:checked + span { background: #34c759; }
.toggle input:checked + span::after { transform: translateX(20px); }
.dots { display: flex; gap: 3px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: #e0e0e5; }
.dots i.on { background: var(--green); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 14px; }
.chip { padding: 7px 13px; border-radius: 999px; background: #efe8ff; color: #6a3fd6; font-size: 16px; font-weight: 600; font-family: var(--font); }
.chip:active { background: #dccdff; }
.del { color: #ff3b30; font-size: 15px; padding: 6px 4px; }
.notice { color: #248a3d; font-size: 15px; padding: 10px 14px; }
.gate { display: flex; flex-direction: column; align-items: center; gap: 16px; padding-top: 20px; }
.gate h3 { margin: 0; font-size: 26px; }
.gate .q { font-size: 22px; }
.gate .entry { width: 160px; height: 64px; border-radius: 14px; background: #fff; display: grid; place-items: center; font-size: 40px; font-weight: 700; font-family: var(--font); }
.keypad { display: grid; grid-template-columns: repeat(3, 84px); gap: 14px; }
.keypad button { height: 60px; border-radius: 14px; background: #fff; font-size: 24px; font-weight: 700; box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.keypad button.ok { background: #996BF2; color: #fff; }
.help-text { font-size: 15px; color: #3a3a3c; line-height: 1.5; padding: 12px 14px; }

/* ---------- Quiz extras ---------- */

.slide-in { animation: slide-in .35s ease; }
@keyframes slide-in { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
.cheer-float {
  position: absolute !important; right: 8px; bottom: calc(var(--bottom) + 6px); z-index: 5 !important;
  width: 90px !important; height: auto !important; pointer-events: none;
  transform: translateY(160%); transition: transform .4s cubic-bezier(.3, 1.5, .5, 1);
}
.cheer-float.on { transform: none; }

/* ---------- Short screens ----------
   Small iPhones, or Safari with its toolbars showing: tighten the roomiest layouts so
   everything fits on screen. */
@media (max-height: 700px) {
  .mascot { max-height: 17dvh; }
  .menu-stack { gap: 14px; }
  .tile.small { min-height: 76px; }
  .party { gap: 10px; }
  .party-stars span { font-size: 38px; }
  .tile.compact { min-height: 76px; }
  .instruments { gap: 10px; }
  .inst { min-height: 84px; }
  .inst .emoji { font-size: 34px; }
  .next-unlock { font-size: 16px; }
  .gate { gap: 10px; padding-top: 0; }
  .gate-lock { display: none; }
  .gate .entry { height: 54px; }
  .keypad { gap: 10px; }
  .keypad button { height: 52px; }
}
@media (max-height: 600px) {
  .mascot { max-height: 14dvh; }
  .menu-stack { gap: 12px; }
  .tile { min-height: 78px; }
  .tile.small, .tile.compact { min-height: 68px; }
  .party-title { font-size: 30px; }
  .party-msg { font-size: 19px; }
  .party-stars span { font-size: 32px; }
  .inst { min-height: 70px; font-size: 13px; }
  .inst .emoji { font-size: 28px; }
}
