:root {
  color-scheme: light;
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", Arial, sans-serif;
  --ink: #2d504d;
  --muted: #6b817d;
  --paper: #fffdf7;
  --cream: #fff5d8;
  --line: #ddd5b9;
  --green: #62b486;
  --green-dark: #35795f;
  --gold: #f2bc49;
  --coral: #ef7468;
  --blue: #62acd6;
  --purple: #8b73bd;
  --pink: #df78a8;
  --shadow: 0 20px 48px rgba(57, 82, 73, .14);
  --soft-shadow: 0 10px 25px rgba(57, 82, 73, .1);
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: #f5f8ef; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: clip;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 7%, rgba(242, 188, 73, .2) 0 116px, transparent 118px),
    radial-gradient(circle at 94% 11%, rgba(223, 120, 168, .16) 0 150px, transparent 152px),
    linear-gradient(145deg, #f2f9ee 0%, #fffaf1 53%, #f4effb 100%);
}
body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: .14;
  background-image: radial-gradient(#73968a 1px, transparent 1px);
  background-size: 27px 27px;
  content: "";
  pointer-events: none;
}
button { color: inherit; font: inherit; }
button:not(:disabled) { cursor: pointer; }
button:focus-visible, [role="button"]:focus-visible { outline: 4px solid rgba(242, 188, 73, .8); outline-offset: 4px; }
h1, h2, h3, p { margin-top: 0; }

.app { width: min(1120px, calc(100% - 32px)); min-height: 100vh; margin: 0 auto; padding: 22px 0 50px; }
.loading-card { display: grid; width: min(410px, 100%); min-height: 250px; margin: 20vh auto 0; place-items: center; align-content: center; gap: 10px; text-align: center; background: var(--paper); border: 3px solid var(--line); border-radius: 37px; box-shadow: var(--shadow); }
.loading-card span { font-size: 64px; animation: float 1.3s ease-in-out infinite alternate; }
.loading-card p { margin: 0; font-size: 19px; font-weight: 900; }

.topbar, .topbar-actions, .brand, .album-button, .sound-button, .game-head, .board-toolbar, .feedback, .result-actions, .result-stats { display: flex; align-items: center; }
.topbar { min-height: 66px; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.brand { min-width: 0; gap: 12px; padding: 0; text-align: left; background: none; border: 0; }
.brand-mark { display: grid; flex: 0 0 auto; width: 56px; height: 56px; place-items: center; font-size: 29px; background: #fff1cd; border: 3px solid #dfd2a8; border-radius: 19px; box-shadow: 0 7px 16px rgba(67, 87, 78, .12); transform: rotate(-5deg); }
.brand strong, .brand small, .album-button strong, .album-button small { display: block; }
.brand strong { overflow: hidden; font-size: 25px; font-weight: 1000; line-height: 1.05; text-overflow: ellipsis; white-space: nowrap; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.topbar-actions { flex: 0 0 auto; gap: 8px; }
.album-button, .sound-button, .back-button { min-height: 49px; color: var(--ink); font-weight: 900; background: rgba(255, 253, 247, .95); border: 2px solid var(--line); border-radius: 17px; box-shadow: 0 7px 16px rgba(65, 83, 76, .08); }
.album-button { gap: 8px; padding: 5px 12px; text-align: left; }
.album-button > span:first-child, .sound-button > span:first-child { font-size: 20px; }
.album-button strong { font-size: 12px; }
.album-button small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.sound-button { display: inline-flex; align-items: center; gap: 7px; padding: 0 14px; font-size: 12px; }
.back-button { width: 49px; padding: 0 0 3px; font-size: 23px; }

.eyebrow { margin: 0 0 9px; color: #3c7e66; font-family: Georgia, serif; font-size: 12px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.primary-button, .secondary-button, .hint-button { display: inline-flex; min-height: 53px; align-items: center; justify-content: center; gap: 8px; padding: 0 21px; font-weight: 1000; border-radius: 17px; transition: transform 150ms ease, box-shadow 150ms ease; }
.primary-button { color: #fff; background: #3e9875; border: 0; box-shadow: 0 8px 0 #2f785e, 0 16px 27px rgba(49, 122, 94, .2); }
.secondary-button { color: var(--ink); background: #fffdf6; border: 2px solid #d7d2b9; box-shadow: 0 6px 0 #ddd7c4; }
.hint-button { min-height: 48px; color: #715418; background: #fff3c5; border: 2px solid #e7bd50; box-shadow: 0 5px 0 #d8aa39; }
.primary-button:not(:disabled):hover, .secondary-button:not(:disabled):hover, .hint-button:not(:disabled):hover, .album-button:hover, .sound-button:hover { transform: translateY(-2px); }
.primary-button:not(:disabled):active, .secondary-button:not(:disabled):active, .hint-button:not(:disabled):active { transform: translateY(3px); box-shadow: none; }

.hero { position: relative; display: grid; min-height: 420px; grid-template-columns: minmax(0, 1fr) minmax(390px, .93fr); align-items: center; gap: 38px; overflow: hidden; padding: 48px 51px; background: radial-gradient(circle at 96% 3%, rgba(98, 172, 214, .22) 0 107px, transparent 109px), linear-gradient(120deg, #fffaf0, #f7eff8 69%, #ecf8ef); border: 3px solid #ded6ba; border-radius: 42px; box-shadow: var(--shadow); }
.hero::after { position: absolute; right: -53px; bottom: -90px; width: 210px; height: 210px; background: rgba(98, 180, 134, .16); border-radius: 50%; content: ""; }
.hero-copy { position: relative; z-index: 2; }
.hero h1 { margin: 0 0 16px; font-size: clamp(47px, 5.1vw, 68px); font-weight: 1000; line-height: .95; letter-spacing: -.045em; }
.hero h1 span { color: #d66d9e; }
.hero-copy > p:not(.eyebrow) { max-width: 520px; margin-bottom: 25px; color: var(--muted); font-size: 17px; font-weight: 700; line-height: 1.5; }
.hero-scene { position: relative; z-index: 2; min-height: 318px; }
.hero-sheet { position: absolute; inset: 8px 15px 14px; overflow: hidden; background: #fffefa; border: 6px solid #fff; border-radius: 32px; box-shadow: 0 20px 34px rgba(62, 80, 74, .18); transform: rotate(2deg); }
.hero-sheet::before { position: absolute; inset: 0; opacity: .25; background-image: radial-gradient(#89a99e 1px, transparent 1px); background-size: 18px 18px; content: ""; }
.hero-sheet svg { position: absolute; inset: 7% 7%; width: 86%; height: 86%; }
.hero-dash { fill: none; stroke: #cad0c6; stroke-width: 4; stroke-dasharray: 8 12; }
.hero-line { fill: none; stroke: #df78a8; stroke-width: 10; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 520; animation: drawHero 3.2s ease-in-out infinite alternate; }
.hero-dot { fill: #fffdf7; stroke: #3f7667; stroke-width: 4; }
.hero-num { fill: #2d504d; font-size: 20px; font-weight: 1000; text-anchor: middle; dominant-baseline: central; }
.hero-pencil { position: absolute; z-index: 3; right: 20px; bottom: 29px; font-size: 51px; filter: drop-shadow(0 7px 5px rgba(55, 75, 69, .18)); transform: rotate(-31deg); }
.hero-note { position: absolute; z-index: 4; left: 16px; bottom: 8px; padding: 8px 13px; color: #fff; font-size: 11px; font-weight: 900; background: #4f8775; border-radius: 13px; transform: rotate(-2deg); }

.how-section, .levels-section, .album-section { margin-top: 54px; scroll-margin-top: 20px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.section-heading h2 { margin: 0; font-size: 39px; font-weight: 1000; line-height: 1; letter-spacing: -.035em; }
.section-heading > p { max-width: 430px; margin: 0; color: var(--muted); font-size: 13px; font-weight: 800; line-height: 1.45; text-align: right; }
.steps-grid, .levels-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.step-card { display: flex; min-width: 0; min-height: 132px; align-items: center; gap: 16px; padding: 23px; background: rgba(255, 253, 247, .94); border: 2px solid var(--line); border-radius: 29px; box-shadow: var(--soft-shadow); }
.step-number { display: grid; flex: 0 0 auto; width: 62px; height: 62px; place-items: center; padding-bottom: 3px; color: #fff; font-family: Georgia, serif; font-size: 27px; font-weight: 900; background: var(--green); border: 8px solid #dcf1e5; border-radius: 50%; }
.step-card:nth-child(2) .step-number { background: var(--gold); border-color: #fff0c7; }
.step-card:nth-child(3) .step-number { background: var(--pink); border-color: #fae4ee; }
.step-card strong, .step-card small { display: block; }
.step-card strong { margin-bottom: 6px; font-size: 18px; font-weight: 1000; }
.step-card small { color: var(--muted); font-size: 13px; font-weight: 700; line-height: 1.45; }

.level-card { position: relative; min-width: 0; overflow: hidden; padding: 27px; background: var(--paper); border: 3px solid color-mix(in srgb, var(--accent) 42%, #e2dbc4); border-radius: 31px; box-shadow: var(--soft-shadow); }
.level-card::before { position: absolute; right: -40px; top: -46px; width: 145px; height: 145px; background: color-mix(in srgb, var(--accent) 14%, transparent); border-radius: 50%; content: ""; }
.level-icon { position: relative; display: grid; width: 64px; height: 64px; margin-bottom: 19px; place-items: center; color: #fff; font-size: 25px; font-weight: 1000; background: var(--accent); border: 8px solid color-mix(in srgb, var(--accent) 19%, white); border-radius: 22px; transform: rotate(-4deg); }
.level-card h3 { position: relative; margin: 0 0 8px; font-size: 23px; font-weight: 1000; }
.level-card p { min-height: 62px; margin-bottom: 17px; color: var(--muted); font-size: 13px; font-weight: 700; line-height: 1.5; }
.level-progress { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.progress-track { flex: 1; height: 11px; overflow: hidden; background: #eee9d8; border-radius: 99px; }
.progress-track i { display: block; width: var(--value); height: 100%; background: var(--accent); border-radius: inherit; transition: width .3s ease; }
.level-progress b { min-width: 34px; font-size: 12px; }
.level-card .secondary-button { width: 100%; min-height: 49px; }
.adult-note { display: flex; align-items: center; gap: 16px; margin-top: 18px; padding: 18px 22px; background: rgba(255, 246, 217, .8); border: 2px dashed #ddc581; border-radius: 23px; }
.adult-note span { font-size: 29px; }
.adult-note p { margin: 0; color: #715f3d; font-size: 13px; font-weight: 800; line-height: 1.45; }

.game-shell { min-height: 760px; padding: 28px; background: rgba(255, 253, 247, .96); border: 3px solid var(--line); border-radius: 40px; box-shadow: var(--shadow); }
.game-head { justify-content: space-between; gap: 22px; margin-bottom: 18px; }
.game-head-copy { min-width: 0; }
.game-head h1 { margin: 0 0 6px; font-size: clamp(28px, 4vw, 43px); font-weight: 1000; line-height: 1; letter-spacing: -.035em; }
.game-head p { margin: 0; color: var(--muted); font-size: 14px; font-weight: 800; }
.game-counter { flex: 0 0 auto; padding: 11px 15px; color: #fff; font-size: 13px; font-weight: 1000; background: var(--accent); border-radius: 16px; }
.board-card { position: relative; overflow: hidden; padding: 18px; background: linear-gradient(#fffefa, #fffaf0); border: 3px solid #e2dac4; border-radius: 32px; }
.board-card::before { position: absolute; inset: 0; opacity: .22; background-image: radial-gradient(#91ac9f 1px, transparent 1px); background-size: 19px 19px; content: ""; pointer-events: none; }
.board-toolbar { position: relative; z-index: 2; justify-content: space-between; gap: 12px; margin-bottom: 11px; padding: 0 4px; }
.task-chip { display: inline-flex; min-height: 43px; align-items: center; gap: 9px; padding: 0 14px; color: #3c6f60; font-size: 13px; font-weight: 1000; background: #edf8f0; border: 2px solid #b8dbc6; border-radius: 15px; }
.task-chip b { font-size: 18px; }
.board-actions { display: flex; gap: 8px; }
.board-actions button { min-height: 43px; padding: 0 13px; font-size: 12px; }
.dots-board { position: relative; z-index: 1; display: block; width: 100%; height: auto; max-height: 510px; aspect-ratio: 800 / 520; overflow: visible; touch-action: none; user-select: none; }
.guide-path { fill: none; stroke: #c8c9bd; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 6 12; opacity: .48; }
.drawn-path { fill: none; stroke: var(--accent); stroke-width: 10; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 4px 2px rgba(57, 81, 73, .11)); transition: d .15s ease; }
.finish-fill { opacity: 0; transform-origin: center; transition: opacity .35s ease, transform .35s ease; transform: scale(.92); }
.dots-board.is-complete .finish-fill { opacity: .2; transform: scale(1); }
.point-hit { fill: transparent; }
.point-circle { fill: #fffdf7; stroke: #456f65; stroke-width: 4; transition: fill .15s ease, stroke .15s ease, transform .15s ease; transform-box: fill-box; transform-origin: center; }
.point-label { fill: var(--ink); font-size: 22px; font-weight: 1000; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.point.is-done .point-circle { fill: var(--accent); stroke: #fff; }
.point.is-done .point-label { fill: #fff; }
.point.is-next .point-circle { stroke: var(--gold); stroke-width: 7; animation: pointPulse 1s ease-in-out infinite alternate; }
.point.is-wrong .point-circle { fill: #ffe4e0; stroke: var(--coral); animation: shake .32s ease; }
.point.is-hinted .point-circle { fill: #fff1aa; stroke: #d79b22; animation: hintPulse .7s ease-in-out 3; }
.point:focus { outline: none; }
.point:focus .point-circle { stroke: #256aaf; stroke-width: 7; }
.reveal-title { opacity: 0; transition: opacity .3s ease .1s; }
.dots-board.is-complete .reveal-title { opacity: 1; }
.reveal-title rect { fill: #fffdf7; stroke: var(--accent); stroke-width: 4; }
.reveal-title text { fill: var(--ink); font-size: 27px; font-weight: 1000; text-anchor: middle; dominant-baseline: central; }
.confetti { opacity: 0; transition: opacity .2s ease; }
.dots-board.is-complete .confetti { opacity: 1; }
.confetti circle { fill: var(--gold); }
.confetti circle:nth-child(2n) { fill: var(--pink); }
.confetti circle:nth-child(3n) { fill: var(--blue); }

.feedback { min-height: 82px; justify-content: space-between; gap: 15px; margin-top: 14px; padding: 15px 17px; background: #f3f7f0; border: 2px solid #d4dfd4; border-radius: 22px; }
.feedback.is-error { background: #fff1ef; border-color: #f0b3ac; }
.feedback.is-hint { background: #fff7d9; border-color: #e7ca72; }
.feedback.is-success { background: #e9f7ee; border-color: #a9d6b9; }
.feedback-copy { display: flex; min-width: 0; align-items: center; gap: 12px; }
.feedback-icon { display: grid; flex: 0 0 auto; width: 45px; height: 45px; place-items: center; font-size: 23px; background: #fff; border-radius: 15px; box-shadow: 0 5px 12px rgba(55, 78, 70, .1); }
.feedback strong, .feedback small { display: block; }
.feedback strong { margin-bottom: 3px; font-size: 15px; font-weight: 1000; }
.feedback small { color: var(--muted); font-size: 12px; font-weight: 800; line-height: 1.35; }
.feedback .primary-button { min-height: 48px; white-space: nowrap; }

.result-card { position: relative; overflow: hidden; min-height: 560px; padding: 54px; text-align: center; background: radial-gradient(circle at 50% 0, rgba(242, 188, 73, .25), transparent 35%), var(--paper); border: 3px solid var(--line); border-radius: 42px; box-shadow: var(--shadow); }
.result-card::before, .result-card::after { position: absolute; width: 180px; height: 180px; border-radius: 50%; content: ""; }
.result-card::before { left: -85px; top: -75px; background: rgba(98, 172, 214, .14); }
.result-card::after { right: -85px; bottom: -80px; background: rgba(223, 120, 168, .14); }
.result-badge { display: grid; width: 105px; height: 105px; margin: 0 auto 23px; place-items: center; font-size: 50px; background: #fff2c9; border: 9px solid #fff8e3; border-radius: 34px; box-shadow: 0 13px 24px rgba(66, 84, 75, .13); transform: rotate(-4deg); }
.result-card h1 { margin-bottom: 13px; font-size: clamp(40px, 6vw, 65px); font-weight: 1000; line-height: .95; letter-spacing: -.045em; }
.result-card > p { max-width: 620px; margin: 0 auto 28px; color: var(--muted); font-size: 16px; font-weight: 700; line-height: 1.5; }
.result-stats { max-width: 600px; justify-content: center; gap: 12px; margin: 0 auto 31px; }
.result-stats div { min-width: 150px; padding: 15px; background: #f7f3e8; border: 2px solid #e5dcc4; border-radius: 20px; }
.result-stats b, .result-stats span { display: block; }
.result-stats b { margin-bottom: 3px; font-size: 25px; }
.result-stats span { color: var(--muted); font-size: 11px; font-weight: 900; text-transform: uppercase; }
.result-actions { justify-content: center; gap: 12px; }

.album-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.album-card { min-width: 0; padding: 15px; background: var(--paper); border: 2px solid var(--line); border-radius: 25px; box-shadow: var(--soft-shadow); }
.album-picture { position: relative; overflow: hidden; aspect-ratio: 4 / 3; background: #f7f5eb; border-radius: 18px; }
.album-picture svg { width: 100%; height: 100%; }
.album-picture polyline { fill: color-mix(in srgb, var(--accent) 12%, transparent); stroke: var(--accent); stroke-width: 8; stroke-linecap: round; stroke-linejoin: round; }
.album-picture.is-locked { display: grid; place-items: center; color: #8a958f; font-size: 33px; background: repeating-linear-gradient(135deg, #f4f1e8 0 12px, #faf8f1 12px 24px); }
.album-card strong { display: block; margin: 12px 3px 3px; font-size: 16px; }
.album-card small { display: block; margin: 0 3px; color: var(--muted); font-size: 11px; font-weight: 800; }
.album-summary { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; padding: 19px 23px; background: #fff4d6; border: 2px solid #e5ca81; border-radius: 25px; }
.album-summary p { margin: 0; color: #6c5c37; font-size: 14px; font-weight: 800; line-height: 1.45; }
.album-summary b { flex: 0 0 auto; font-size: 29px; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 24px; max-width: calc(100% - 32px); padding: 12px 18px; color: #fff; font-size: 13px; font-weight: 900; text-align: center; background: #315f55; border-radius: 14px; box-shadow: 0 10px 25px rgba(36, 66, 59, .25); opacity: 0; pointer-events: none; transform: translate(-50%, 18px); transition: opacity .2s ease, transform .2s ease; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@keyframes drawHero { from { stroke-dashoffset: 500; } to { stroke-dashoffset: 0; } }
@keyframes float { to { transform: translateY(-10px) rotate(4deg); } }
@keyframes pointPulse { to { transform: scale(1.14); } }
@keyframes hintPulse { 50% { transform: scale(1.22); } }
@keyframes shake { 25% { transform: translateX(-7px); } 75% { transform: translateX(7px); } }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding: 39px; }
  .hero-copy { max-width: 660px; }
  .hero-scene { min-height: 300px; }
  .steps-grid { grid-template-columns: 1fr; }
  .step-card { min-height: 104px; }
  .levels-grid, .album-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .game-shell { min-height: 0; }
}

@media (max-width: 650px) {
  .app { width: min(100% - 20px, 1120px); padding-top: 12px; }
  .topbar { min-height: 57px; margin-bottom: 13px; }
  .brand-mark { width: 49px; height: 49px; font-size: 25px; border-radius: 16px; }
  .brand strong { font-size: 18px; }
  .brand small { display: none; }
  .album-button { width: 48px; justify-content: center; padding: 0; }
  .album-button div, .sound-button span:last-child { display: none; }
  .sound-button { width: 48px; justify-content: center; padding: 0; }
  .hero { min-height: 0; gap: 24px; padding: 30px 22px 25px; border-radius: 31px; }
  .hero h1 { font-size: clamp(41px, 13vw, 57px); }
  .hero-copy > p:not(.eyebrow) { font-size: 15px; }
  .hero-scene { min-height: 245px; }
  .hero-sheet { inset: 4px 4px 14px; }
  .how-section, .levels-section, .album-section { margin-top: 38px; }
  .section-heading { display: block; }
  .section-heading h2 { font-size: 32px; }
  .section-heading > p { margin-top: 9px; text-align: left; }
  .levels-grid, .album-grid { grid-template-columns: 1fr; }
  .level-card p { min-height: 0; }
  .adult-note { align-items: flex-start; }
  .game-shell { padding: 14px; border-radius: 28px; }
  .game-head { align-items: flex-start; gap: 10px; }
  .game-head h1 { font-size: 27px; }
  .game-counter { padding: 9px 11px; font-size: 11px; }
  .board-card { padding: 9px; border-radius: 23px; }
  .board-toolbar { align-items: stretch; }
  .task-chip { min-height: 39px; padding: 0 10px; font-size: 11px; }
  .board-actions button { width: 42px; min-height: 42px; padding: 0; font-size: 0; }
  .board-actions button span { font-size: 18px; }
  .dots-board { min-height: 270px; }
  .point-hit { r: 58px; }
  .point-circle { r: 30px; }
  .point-label { font-size: 40px; }
  .feedback { align-items: flex-start; flex-direction: column; min-height: 105px; }
  .feedback .primary-button { width: 100%; }
  .result-card { min-height: 0; padding: 40px 18px; border-radius: 31px; }
  .result-stats { align-items: stretch; flex-direction: column; }
  .result-stats div { min-width: 0; }
  .result-actions { align-items: stretch; flex-direction: column; }
  .album-summary { align-items: flex-start; flex-direction: column; }
}

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