:root {
  --ink: #302952;
  --muted: #716b8c;
  --purple: #7257e8;
  --purple-dark: #563bcf;
  --yellow: #ffd75e;
  --cream: #fffaf1;
  --white: #ffffff;
  --mint: #dff8ed;
  --shadow: 0 18px 45px rgba(72, 55, 128, .13);
  --soft-shadow: 0 8px 24px rgba(72, 55, 128, .1);
  font-family: "Nunito", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--cream);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 300px; min-height: 100vh; overflow-x: hidden; background: radial-gradient(circle at 10% 15%, #fff3c8 0 12rem, transparent 12.1rem), var(--cream); }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
button:focus-visible, a:focus-visible { outline: 4px solid #20bca5; outline-offset: 4px; }
[hidden] { display: none !important; }

.topbar {
  height: 78px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font: 800 1.35rem "Baloo 2", sans-serif; }
.brand-blocks { display: flex; transform: rotate(-2deg); }
.brand-blocks i { width: 31px; height: 34px; margin-right: -3px; display: grid; place-items: center; border: 3px solid white; border-radius: 9px; color: white; font: 800 1rem "Baloo 2", sans-serif; box-shadow: 0 4px 7px #5944a52b; font-style: normal; }
.brand-blocks i:nth-child(1) { background: #ff6b6b; transform: rotate(-8deg); }
.brand-blocks i:nth-child(2) { background: #4dabf7; transform: translateY(-2px); }
.brand-blocks i:nth-child(3) { background: #8ed45b; transform: rotate(7deg); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.round-button, .parent-button, .install-button { border: 0; cursor: pointer; color: var(--ink); box-shadow: var(--soft-shadow); transition: transform .18s ease, box-shadow .18s ease; }
.round-button:hover, .parent-button:hover, .install-button:hover { transform: translateY(-2px); box-shadow: 0 10px 24px #4837802b; }
.round-button { width: 46px; height: 46px; border-radius: 50%; background: var(--white); font-size: 1.25rem; }
.round-button .sound-off { display: none; }
.round-button.muted .sound-on { display: none; }
.round-button.muted .sound-off { display: inline; }
.parent-button { min-height: 46px; padding: 0 17px; border-radius: 22px; background: white; font-weight: 800; }

main { max-width: 1280px; margin: 0 auto; padding: 0 28px 40px; }
.hero { min-height: 430px; position: relative; overflow: hidden; display: grid; place-items: center; border-radius: 40px; background: #b9effc url('/images/hero-garden.png') center / cover no-repeat; box-shadow: var(--shadow); isolation: isolate; }
.hero-overlay { position: absolute; inset: 0; z-index: -1; background: radial-gradient(ellipse at center, rgba(255,255,255,.85) 0%, rgba(255,255,255,.3) 36%, transparent 68%); }
.hero-copy { width: min(560px, 70%); padding: 54px 16px; text-align: center; }
.eyebrow, .section-kicker { color: var(--purple-dark); font-weight: 900; font-size: .79rem; letter-spacing: .1em; text-transform: uppercase; }
.hero h1 { margin: 9px 0 3px; font: 800 clamp(3.2rem, 7vw, 5.8rem)/.9 "Baloo 2", sans-serif; letter-spacing: -.055em; color: var(--purple); text-wrap: balance; text-shadow: 0 4px 0 rgba(255,255,255,.9); }
.hero p { margin: 16px 0 22px; color: #554d72; font-weight: 800; font-size: clamp(1rem, 2vw, 1.25rem); }
.primary-button, .secondary-button, .listen-button { border: 0; border-radius: 999px; font-weight: 900; cursor: pointer; transition: transform .18s ease, box-shadow .18s ease; }
.primary-button { padding: 15px 25px; color: #352d4f; background: var(--yellow); box-shadow: 0 7px 0 #e6ae29, 0 14px 26px #c58d3444; }
.primary-button:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 9px 0 #e6ae29, 0 16px 30px #c58d3455; }
.primary-button:active { transform: translateY(4px); box-shadow: 0 3px 0 #e6ae29; }
.floating-letter { position: absolute; display: grid; place-items: center; width: 62px; height: 67px; color: white; border: 5px solid white; border-radius: 18px; font: 800 2rem "Baloo 2", sans-serif; box-shadow: 0 12px 20px #51416f30; animation: float 4s ease-in-out infinite; }
.letter-a { top: 14%; left: 21%; background: #ff6b6b; transform: rotate(-12deg); }
.letter-b { top: 15%; right: 18%; background: #4dabf7; animation-delay: -.8s; transform: rotate(8deg); }
.letter-c { right: 29%; bottom: 12%; background: #8ed45b; animation-delay: -1.6s; transform: rotate(-5deg); }
@keyframes float { 50% { translate: 0 -11px; } }

.ad-slot { margin: 24px auto; border: 2px dashed #c9c4d9; border-radius: 16px; color: #9a95aa; background: rgba(255,255,255,.55); display: flex; align-items: center; justify-content: center; flex-direction: column; text-align: center; }
.ad-slot span { font-size: .65rem; letter-spacing: .14em; text-transform: uppercase; }
.ad-slot small { font-size: .7rem; }
.ad-slot-wide { width: min(100%, 728px); height: 90px; }
.ad-slot-box { width: min(100%, 360px); min-height: 110px; }

.progress-card { width: min(100%, 850px); margin: 28px auto; padding: 22px 27px; border: 1px solid #eee9fa; border-radius: 24px; background: rgba(255,255,255,.88); box-shadow: var(--soft-shadow); backdrop-filter: blur(10px); }
.progress-heading, .reward-row, .game-heading, .panel-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.progress-heading h2, .game-heading h2, .panel-title h3, .grownup-note h2 { margin: 2px 0 0; font: 800 1.55rem/1.1 "Baloo 2", sans-serif; }
.progress-heading strong { color: var(--purple); font: 800 1.35rem "Baloo 2", sans-serif; }
.progress-track { height: 14px; margin: 16px 0 10px; overflow: hidden; border-radius: 20px; background: #eeeaf7; }
.progress-track > div { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #f8bf3f, #ff7d77, #7257e8); transition: width .45s cubic-bezier(.2,.8,.2,1); }
.reward-row { color: var(--muted); font-size: .82rem; font-weight: 800; }

.game-shell { padding: 36px; border-radius: 34px; background: white; box-shadow: var(--shadow); }
.game-heading { margin-bottom: 20px; }
.game-heading h2 { font-size: clamp(1.8rem, 4vw, 2.3rem); }
.install-button { min-height: 42px; padding: 0 16px; border-radius: 20px; background: var(--mint); font-weight: 900; }
.mode-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.mode-tab { min-height: 92px; padding: 14px; display: grid; grid-template-columns: auto 1fr; grid-template-rows: 1fr 1fr; column-gap: 11px; align-items: center; text-align: left; border: 2px solid #ece9f4; border-radius: 20px; background: #fbfaff; color: var(--ink); cursor: pointer; transition: .18s ease; }
.mode-tab > span { grid-row: 1 / 3; font-size: 1.8rem; }
.mode-tab b { align-self: end; font: 800 1.15rem "Baloo 2", sans-serif; }
.mode-tab small { align-self: start; color: var(--muted); font-weight: 700; }
.mode-tab:hover { transform: translateY(-2px); border-color: #cfc5f4; }
.mode-tab.active { border-color: var(--purple); color: var(--purple-dark); background: #f0edff; box-shadow: inset 0 0 0 1px var(--purple); }

.play-area { display: grid; grid-template-columns: minmax(300px, .8fr) minmax(430px, 1.2fr); gap: 25px; align-items: stretch; }
.play-area.challenge-only { grid-template-columns: minmax(0, 1fr); }
.play-area.challenge-only .challenge-card { min-height: 520px; }
.letter-stage, .challenge-card { min-height: 490px; position: relative; overflow: hidden; padding: 30px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; border-radius: 28px; color: white; background: linear-gradient(145deg, color-mix(in srgb, var(--card-color, #ff6b6b), white 8%), var(--card-color, #ff6b6b)); transition: background .3s ease; }
.letter-stage, .challenge-card, .alphabet-panel { scroll-margin-top: 82px; }
.letter-stage::before { content: ""; position: absolute; width: 300px; height: 300px; top: -130px; left: -100px; border-radius: 50%; background: rgba(255,255,255,.12); }
.letter-stage::after { content: ""; position: absolute; width: 250px; height: 250px; right: -125px; bottom: -120px; border: 30px solid rgba(255,255,255,.09); border-radius: 50%; }
.letter-display { display: flex; align-items: baseline; filter: drop-shadow(0 7px 0 rgba(57,39,70,.14)); }
.big-letter { font: 800 clamp(7.5rem, 14vw, 10rem)/.74 "Baloo 2", sans-serif; }
.small-letter { margin-left: 4px; font: 800 clamp(3.2rem, 6vw, 4.8rem)/1 "Baloo 2", sans-serif; opacity: .8; }
.word-picture { margin: 15px 0 1px; font-size: 4.8rem; line-height: 1; filter: drop-shadow(0 7px 4px rgba(57,39,70,.18)); animation: gentleBounce 2.4s ease-in-out infinite; }
@keyframes gentleBounce { 50% { transform: translateY(-6px) rotate(2deg); } }
.word-copy h3 { margin: 12px 0 0; font: 800 1.7rem "Baloo 2", sans-serif; }
.word-copy h3 strong { color: #fff8c7; }
.word-copy p { margin: 0 0 17px; color: rgba(255,255,255,.9); font-size: .86rem; font-weight: 800; }
.listen-button { min-height: 44px; padding: 0 18px; color: var(--ink); background: white; box-shadow: 0 6px 15px rgba(55,30,70,.17); }
.listen-button:hover { transform: translateY(-2px); }
.sparkle { position: absolute; opacity: .7; }
.sparkle-one { left: 10%; top: 15%; font-size: 2rem; }
.sparkle-two { right: 12%; top: 24%; font-size: 1.2rem; }

.challenge-card { --card-color: #7257e8; }
.challenge-mascot { font-size: 6rem; filter: drop-shadow(0 8px 5px rgba(44,27,95,.2)); }
.challenge-card h3 { margin: 8px 0 2px; font: 800 clamp(2rem, 5vw, 3.1rem) "Baloo 2", sans-serif; }
.challenge-card p { margin: 0 0 22px; font-weight: 800; opacity: .88; }
.challenge-card .section-kicker { color: #fff6a8; }
.match-options { width: 100%; max-width: 440px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; margin-bottom: 18px; }
.match-choice { min-height: 105px; border: 4px solid rgba(255,255,255,.65); border-radius: 22px; background: rgba(255,255,255,.94); color: var(--ink); font-size: 3rem; cursor: pointer; box-shadow: 0 8px 18px rgba(43,30,76,.16); transition: transform .16s ease; }
.match-choice:hover { transform: translateY(-4px) scale(1.03); }
.match-choice.correct { background: #c9f7d8; border-color: #6cda91; }
.match-choice.wrong { animation: shake .35s ease; background: #ffe0e0; }
@keyframes shake { 25% { transform: translateX(-7px); } 75% { transform: translateX(7px); } }

.challenge-card.float-mode { justify-content: flex-start; padding-top: 22px; background: linear-gradient(165deg, #7561e8, #50bfe0); }
.challenge-card.float-mode .challenge-mascot { position: absolute; right: 20px; top: 15px; font-size: 3.2rem; opacity: .9; }
.challenge-card.float-mode h3 { margin-top: 3px; font-size: clamp(1.9rem, 4vw, 2.6rem); }
.challenge-card.float-mode p { margin-bottom: 6px; }
.floating-game { width: 100%; max-width: 720px; height: 300px; position: relative; margin: 2px auto 8px; overflow: hidden; border: 2px solid rgba(255,255,255,.3); border-radius: 26px; background: linear-gradient(rgba(255,255,255,.13), rgba(255,255,255,.05)); box-shadow: inset 0 0 30px rgba(255,255,255,.12); }
.floating-game::before, .floating-game::after { content: ""; position: absolute; width: 95px; height: 30px; border-radius: 50%; background: rgba(255,255,255,.15); filter: blur(1px); }
.floating-game::before { left: 7%; top: 15%; }
.floating-game::after { right: 8%; bottom: 18%; width: 70px; }
.letter-bubble { width: 68px; height: 68px; position: absolute; left: var(--bubble-x); top: var(--bubble-y); z-index: 2; display: grid; place-items: center; border: 4px solid rgba(255,255,255,.9); border-radius: 50% 50% 46% 54%; color: white; background: var(--bubble-color); box-shadow: inset -7px -8px 0 rgba(60,35,90,.1), 0 10px 18px rgba(43,30,76,.22); font: 800 2rem "Baloo 2", sans-serif; cursor: pointer; transform: translate(-50%, -50%); animation: bubbleFloat var(--bubble-speed) ease-in-out var(--bubble-delay) infinite alternate; }
.letter-bubble::before { content: ""; position: absolute; width: 14px; height: 9px; left: 13px; top: 10px; border-radius: 50%; background: rgba(255,255,255,.65); transform: rotate(-30deg); }
.letter-bubble:hover { animation-play-state: paused; filter: brightness(1.08); }
.letter-bubble.correct { animation: bubblePop .48s ease forwards; }
.letter-bubble.wrong { animation: bubbleWiggle .4s ease; }
@keyframes bubbleFloat { from { transform: translate(-50%, -50%) rotate(-3deg); } to { transform: translate(calc(-50% + var(--bubble-drift)), calc(-50% - 18px)) rotate(4deg); } }
@keyframes bubblePop { 45% { transform: translate(-50%, -50%) scale(1.3); opacity: 1; } to { transform: translate(-50%, -50%) scale(.1); opacity: 0; } }
@keyframes bubbleWiggle { 25% { transform: translate(calc(-50% - 7px), -50%); } 75% { transform: translate(calc(-50% + 7px), -50%); } }

.alphabet-panel { min-width: 0; padding: 25px; border-radius: 28px; background: #f8f6ff; }
.panel-title { margin-bottom: 18px; }
.panel-title h3 { font-size: 1.4rem; }
.panel-title span { color: var(--muted); font-size: .78rem; font-weight: 800; }
.alphabet-grid { display: grid; grid-template-columns: repeat(5, minmax(54px, 1fr)); gap: 10px; }
.letter-tile { position: relative; min-height: 70px; padding: 5px; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 3px solid transparent; border-radius: 17px; color: var(--ink); background: white; box-shadow: 0 5px 13px #4a397218; cursor: pointer; transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; }
.letter-tile::before { content: ""; position: absolute; inset: auto 0 0; height: 6px; background: var(--tile-color); }
.letter-tile span { font: 800 1.7rem/1 "Baloo 2", sans-serif; }
.letter-tile small { font-size: 1rem; line-height: 1; }
.letter-tile:hover { transform: translateY(-3px) rotate(-1deg); box-shadow: 0 9px 17px #4a397225; }
.letter-tile.selected { border-color: var(--tile-color); background: color-mix(in srgb, var(--tile-color), white 90%); }
.letter-tile.explored::after { content: "★"; position: absolute; top: 2px; right: 5px; color: #f6b916; font-size: .65rem; }
.letter-tile.wrong { animation: shake .35s ease; border-color: #ff6767; }
.letter-tile.correct { animation: pop .45s ease; border-color: #40c878; }
@keyframes pop { 50% { transform: scale(1.18) rotate(4deg); } }

.grownup-note { margin: 35px 0 25px; padding: 24px 30px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 20px; border-radius: 25px; background: #e9f8ef; border: 1px solid #caead8; }
.note-icon { width: 62px; height: 62px; display: grid; place-items: center; border-radius: 18px; background: white; font-size: 2rem; box-shadow: var(--soft-shadow); }
.grownup-note h2 { font-size: 1.4rem; }
.grownup-note ul { margin: 0; padding: 0; display: grid; gap: 5px; list-style: none; color: #4d675a; font-size: .8rem; font-weight: 800; }
.grownup-note li span { color: #25a961; }

footer { min-height: 120px; padding: 25px; display: flex; align-items: center; justify-content: center; gap: 14px; text-align: left; color: #eeeaff; background: #382c67; }
footer p { margin: 0; font-size: .78rem; line-height: 1.5; }
footer strong { font: 800 1.05rem "Baloo 2", sans-serif; color: white; }
.footer-mark { font-size: 2.5rem; }

.parent-dialog { width: min(92vw, 480px); padding: 0; border: 0; border-radius: 28px; color: var(--ink); box-shadow: 0 30px 90px #24164f66; }
.parent-dialog::backdrop { background: rgba(30,20,60,.58); backdrop-filter: blur(4px); }
.parent-dialog form { position: relative; padding: 38px; text-align: center; }
.parent-dialog h2 { margin: 5px 0; font: 800 2rem "Baloo 2", sans-serif; }
.parent-dialog p { color: var(--muted); line-height: 1.6; }
.dialog-icon { font-size: 3.5rem; }
.dialog-close { position: absolute; top: 14px; right: 16px; width: 38px; height: 38px; border: 0; border-radius: 50%; background: #f1eef8; color: var(--ink); cursor: pointer; font-size: 1.5rem; }
.secondary-button { margin-top: 8px; padding: 12px 18px; color: #9b3f4f; background: #ffe4e8; }
.voice-setting { margin: 20px 0 12px; padding: 16px; border-radius: 18px; text-align: left; background: #f5f2ff; }
.voice-setting label { display: block; margin-bottom: 7px; color: var(--purple-dark); font-weight: 900; }
.voice-setting > div { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.voice-setting select, .voice-setting button { min-height: 44px; border: 2px solid #ddd5f8; border-radius: 13px; font: 800 .82rem "Nunito", sans-serif; }
.voice-setting select { min-width: 0; padding: 0 10px; color: var(--ink); background: white; }
.voice-setting button { padding: 0 13px; color: white; background: var(--purple); cursor: pointer; }
.voice-setting small { display: block; margin-top: 7px; color: var(--muted); font-size: .7rem; line-height: 1.35; }

.toast { position: fixed; left: 50%; bottom: 22px; z-index: 80; min-width: 190px; max-width: calc(100vw - 32px); padding: 12px 20px; border-radius: 25px; color: white; background: #302952; box-shadow: var(--shadow); text-align: center; font-weight: 900; opacity: 0; transform: translate(-50%, 20px); pointer-events: none; transition: .25s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.celebration { position: fixed; inset: 0; z-index: 70; overflow: hidden; pointer-events: none; }
.confetti { position: absolute; top: 40%; left: 50%; width: 14px; height: 14px; border-radius: 4px; background: var(--confetti); animation: burst 1s cubic-bezier(.15,.7,.3,1) forwards; }
@keyframes burst { to { transform: translate(var(--x), var(--y)) rotate(760deg); opacity: 0; } }

@media (max-width: 900px) {
  .hero { min-height: 400px; }
  .floating-letter { display: none; }
  .play-area { grid-template-columns: 1fr; }
  .letter-stage, .challenge-card { min-height: 445px; }
  .alphabet-grid { grid-template-columns: repeat(7, 1fr); }
  .grownup-note { grid-template-columns: auto 1fr; }
  .grownup-note ul { grid-column: 2; }
}

@media (max-width: 640px) {
  .topbar { height: 68px; padding: 0 16px; }
  .brand { gap: 8px; font-size: 1.05rem; }
  .brand-blocks i { width: 25px; height: 28px; border-width: 2px; font-size: .8rem; }
  .parent-button { width: 46px; padding: 0; font-size: 0; }
  .parent-button span { font-size: 1.2rem; }
  main { padding: 0 12px 28px; }
  .hero { min-height: 375px; border-radius: 28px; background-position: center; }
  .hero-overlay { background: rgba(255,255,255,.69); }
  .hero-copy { width: 100%; padding: 38px 20px; }
  .hero h1 { font-size: clamp(3rem, 17vw, 4.6rem); }
  .ad-slot-wide { height: 70px; }
  .progress-card { padding: 18px; border-radius: 20px; }
  .reward-row { align-items: start; flex-direction: column; gap: 3px; }
  .game-shell { padding: 18px 12px; border-radius: 27px; }
  .game-heading { padding: 0 5px; }
  .mode-tabs { gap: 7px; }
  .mode-tab { min-height: 85px; padding: 9px 6px; grid-template-columns: 1fr; grid-template-rows: auto auto; justify-items: center; text-align: center; }
  .mode-tab > span { grid-row: auto; font-size: 1.45rem; }
  .mode-tab b { font-size: 1rem; }
  .mode-tab small { display: none; }
  .letter-stage, .challenge-card { min-height: 430px; padding: 22px 16px; border-radius: 24px; }
  .big-letter { font-size: 8rem; }
  .word-picture { font-size: 4.2rem; }
  .alphabet-panel { padding: 15px 10px; border-radius: 23px; }
  .alphabet-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .letter-tile { min-height: 64px; border-radius: 15px; }
  .letter-tile span { font-size: 1.5rem; }
  .match-options { gap: 7px; }
  .match-choice { min-height: 88px; font-size: 2.5rem; }
  .floating-game { height: 270px; border-radius: 22px; }
  .letter-bubble { width: 62px; height: 62px; font-size: 1.8rem; }
  .challenge-card.float-mode .challenge-mascot { display: none; }
  .grownup-note { padding: 22px; grid-template-columns: 1fr; text-align: center; }
  .note-icon { margin: auto; }
  .grownup-note ul { grid-column: 1; text-align: left; justify-self: center; }
  .parent-dialog form { padding: 34px 22px 26px; }
  .voice-setting > div { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
