:root {
  --bg: #E6F1FB;
  --ink: #042C53;
  --signs: #378ADD;
  --signs-ink: #E6F1FB;
  --words: #EF9F27;
  --words-ink: #412402;
  --numbers: #639922;
  --numbers-ink: #EAF3DE;
  --red: #E24B4A;
  --white: #FFFFFF;
  --radius: 24px;
  font-family: "Avenir Next", "Nunito", "Trebuchet MS", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); overscroll-behavior: none; }
body { user-select: none; -webkit-user-select: none; touch-action: manipulation; }
button { font: inherit; color: inherit; border: none; cursor: pointer; }
#app { min-height: 100%; max-width: 560px; margin: 0 auto; padding: max(12px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); }

.screen { display: flex; flex-direction: column; align-items: center; gap: 16px; min-height: calc(100vh - 32px); position: relative; }
.topbar { width: 100%; display: flex; justify-content: space-between; align-items: center; }
.icon-button { width: 64px; height: 64px; min-height: 64px; border-radius: 50%; background: var(--white); font-size: 32px; display: grid; place-items: center; box-shadow: 0 4px 0 rgba(4, 44, 83, 0.18); }
.icon-button:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(4, 44, 83, 0.18); }

.mascot { width: 120px; height: 120px; }
.mascot.small { width: 72px; height: 72px; }
.mascot.bounce { animation: bounce 0.6s ease 2; }
.mascot.tilt { animation: tilt 0.5s ease; }
h1 { font-size: 34px; margin: 0; }
.prompt { font-size: 26px; font-weight: 700; text-align: center; margin: 0; }

.big-button { width: 100%; min-height: 96px; border-radius: var(--radius); display: flex; align-items: center; gap: 16px; padding: 12px 20px; font-size: 32px; font-weight: 800; box-shadow: 0 6px 0 rgba(4, 44, 83, 0.25); }
.big-button:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(4, 44, 83, 0.25); }
.big-button .icon { font-size: 48px; width: 64px; text-align: center; }
.tile-signs { background: var(--signs); color: var(--signs-ink); }
.tile-words { background: var(--words); color: var(--words-ink); }
.tile-numbers { background: var(--numbers); color: var(--numbers-ink); }
.tile-red { background: var(--red); color: var(--white); }
.tile-white { background: var(--white); color: var(--ink); }
.lock { position: absolute; right: 0; bottom: 0; width: 64px; height: 64px; min-height: 64px; border-radius: 50%; background: transparent; font-size: 26px; opacity: 0.55; }
.hold-ring { position: absolute; inset: 4px; border-radius: 50%; border: 5px solid var(--signs); transform: scale(0); }
.lock.holding .hold-ring { transition: transform 3s linear; transform: scale(1); }

.choices { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.choice { min-height: 96px; border-radius: var(--radius); background: var(--white); display: grid; place-items: center; padding: 8px; font-size: 44px; font-weight: 800; box-shadow: 0 6px 0 rgba(4, 44, 83, 0.2); }
.choice img { width: 100%; max-height: 120px; object-fit: contain; }
.choice:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(4, 44, 83, 0.2); }
.choice.right { outline: 6px solid var(--numbers); }
.wiggle { animation: wiggle 0.4s ease; }

.card { width: 100%; background: var(--white); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; box-shadow: 0 6px 0 rgba(4, 44, 83, 0.15); }
.card img.sign { width: 70%; max-height: 260px; object-fit: contain; }
.glyph { font-size: 72px; font-weight: 900; line-height: 1; }
.picture { font-size: 64px; line-height: 1; }
.nav-row { width: 100%; display: flex; justify-content: space-between; }

.slots { display: flex; gap: 10px; }
.slot { width: 72px; height: 84px; border-radius: 16px; border: 4px dashed var(--signs); background: var(--white); display: grid; place-items: center; font-size: 52px; font-weight: 900; }
.slot.filled { border-style: solid; background: var(--words); color: var(--words-ink); }
.tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.letter-tile { width: 76px; height: 76px; min-height: 64px; border-radius: 18px; background: var(--signs); color: var(--signs-ink); font-size: 46px; font-weight: 900; box-shadow: 0 6px 0 rgba(4, 44, 83, 0.25); }
.read-word { display: flex; gap: 6px; }
.read-word span { display: grid; place-items: center;  min-width: 72px; min-height: 84px; border-radius: 16px; background: var(--white); font-size: 60px; font-weight: 900; }

.scene { width: 100%; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; background: var(--white); border-radius: var(--radius); padding: 12px; }
.thing { min-height: 64px; font-size: 40px; border-radius: 16px; background: transparent; display: grid; place-items: center; }
.thing.counted { background: #FAC775; transform: scale(1.08); }
.thing { position: relative; }
.thing.counted::after { content: attr(data-n); position: absolute; top: -8px; right: -8px; min-width: 30px; height: 30px; padding: 0 6px; border-radius: 15px; background: var(--white); color: var(--ink); font-size: 20px; font-weight: 900; line-height: 30px; text-align: center; box-shadow: 0 2px 0 rgba(4, 44, 83, 0.18); }
.topbar-spacer { width: 64px; }
.moves { font-size: 24px; font-weight: 800; }
.ten-frame { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; width: 100%; }
.ten-frame .cell { min-height: 64px; border-radius: 12px; border: 3px solid #85B7EB; background: var(--white); display: grid; place-items: center; font-size: 36px; }
.ten-frame .cell.added { border-color: var(--red); }
.drop-in { animation: drop 0.45s ease both; }
.number-sign { width: 140px; height: 140px; object-fit: contain; background: var(--white); border-radius: 20px; }

.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 12px; height: 18px; border-radius: 3px; animation: fall 1.3s ease-in forwards; }

.grown { width: 100%; display: flex; flex-direction: column; gap: 14px; font-size: 20px; }
.grown label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; }
.grown select, .grown .row-button { min-height: 56px; font-size: 20px; border-radius: 14px; padding: 8px 12px; border: 2px solid var(--signs); background: var(--white); }
.grown .credits { font-size: 14px; max-height: 240px; overflow: auto; background: var(--white); border-radius: 14px; padding: 10px; }
.soon { opacity: 0.5; }

@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-24px) scale(1.06); } }
@keyframes tilt { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-12deg); } 70% { transform: rotate(10deg); } }
@keyframes wiggle { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
@keyframes drop { from { transform: translateY(-60px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }
@media (prefers-reduced-motion: reduce) { * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }
