:root {
  --paper: #fffdf6;
  --ink: #23483a;
  --muted: #66776e;
  --green: #3f8e67;
  --green-soft: #e7f4e8;
  --orange: #e99a4a;
  --orange-soft: #fff0e4;
  --gold: #e4bc55;
  --line: #e6dac4;
  --shadow: 0 20px 48px rgba(58, 73, 61, .12);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: light; scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: radial-gradient(circle at 14% 8%, #fff0c7 0 10%, transparent 35%), linear-gradient(145deg, #fffaf0, #f1f2e8); font-family: "Trebuchet MS", Arial, sans-serif; }
button, a { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible { outline: 4px solid rgba(228, 188, 85, .56); outline-offset: 3px; }

.app { width: min(1120px, calc(100% - 32px)); margin: 22px auto 38px; }
.game-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 15px; padding: 0 5px; }
.game-brand { display: inline-flex; min-width: 0; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.game-brand > span:last-child { display: grid; min-width: 0; gap: 2px; }
.game-brand strong { overflow: hidden; font-size: 22px; line-height: 1.06; text-overflow: ellipsis; white-space: nowrap; }
.game-brand small { color: var(--muted); font-size: 13px; }
.game-icon { display: grid; width: 57px; height: 57px; flex: none; place-items: center; border-radius: 18px; color: white; background: linear-gradient(145deg, #7c9f64, #477c59); box-shadow: 0 9px 18px rgba(66, 112, 80, .24); }
.game-icon svg { width: 39px; height: 39px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.4; }
.age-pill { flex: none; padding: 10px 14px; border: 2px solid #efd8a7; border-radius: 999px; color: #795e2d; background: #fff6dc; font-weight: 900; }

.screen { display: none; padding: 31px; overflow: hidden; border: 1px solid rgba(224, 211, 187, .86); border-radius: 34px; background: rgba(255, 253, 246, .97); box-shadow: var(--shadow); }
.screen.is-active { display: block; }
.eyebrow { margin: 0 0 8px; color: #a66d25; font-size: 12px; font-weight: 1000; letter-spacing: .12em; }
h1, h2, h3, p { text-wrap: pretty; }
h1, h2, h3 { margin-top: 0; line-height: 1.06; }
h1 { margin-bottom: 18px; font-size: clamp(42px, 5.5vw, 68px); letter-spacing: -.045em; }
h2 { margin-bottom: 7px; font-size: clamp(31px, 4vw, 46px); letter-spacing: -.035em; }
h3 { margin-bottom: 10px; font-size: 27px; }

.primary-button, .secondary-button, .route-button, .watch-button, .hint-button, .next-button, .round-button, .text-button { border: 0; cursor: pointer; font-weight: 1000; transition: transform .16s ease, box-shadow .16s ease, background .16s ease, opacity .16s ease; }
.primary-button, .route-button, .watch-button, .next-button { display: inline-flex; min-height: 50px; align-items: center; justify-content: center; gap: 9px; padding: 13px 18px; border-radius: 16px; color: white; background: linear-gradient(145deg, #4c9a71, #337b5a); box-shadow: 0 8px 17px rgba(51, 123, 90, .22); }
.primary-button:hover, .route-button:hover, .watch-button:hover, .next-button:hover { transform: translateY(-2px); box-shadow: 0 11px 23px rgba(51, 123, 90, .28); }
.secondary-button { min-height: 50px; padding: 12px 17px; border: 2px solid #cbded1; border-radius: 16px; background: #eff8f1; }
.text-button { padding: 12px 2px 0; color: #517064; background: transparent; }

.home-screen.is-active { display: grid; grid-template-columns: minmax(0, .88fr) minmax(420px, 1.12fr); gap: 24px 36px; align-items: center; }
.hero-copy > p:not(.eyebrow) { max-width: 520px; margin: 0 0 24px; color: var(--muted); font-size: 19px; line-height: 1.48; }
.hero-stage { min-width: 0; }
.hero-stage .memory-scene { box-shadow: 0 16px 30px rgba(45, 65, 51, .18); transform: rotate(1deg); }
.hero-stage .scene-object { pointer-events: none; }
.hero-stage .scene-object:nth-of-type(n+5) { display: none; }
.hero-stage .hedgehog-hero { left: 31% !important; top: 59% !important; }
.hero-stage .path-line { stroke-dasharray: 4 4; opacity: .72; }
.how-strip { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; padding-top: 8px; }
.how-strip article { display: flex; min-height: 98px; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: #fffdf8; }
.how-strip article > b { display: grid; width: 38px; height: 38px; flex: none; place-items: center; border-radius: 50%; color: white; background: var(--orange); }
.how-strip article span { display: grid; gap: 4px; }
.how-strip article strong { line-height: 1.1; }
.how-strip article small { color: var(--muted); line-height: 1.25; }

.section-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 23px; }
.section-title > p { margin: 0 0 5px; color: #587066; font-weight: 900; }
.route-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; align-items: stretch; }
.route-card { display: flex; min-width: 0; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 24px; background: white; box-shadow: 0 10px 25px rgba(62, 76, 62, .08); }
.route-preview { position: relative; min-height: 225px; overflow: hidden; background: var(--route-soft); }
.route-preview > .route-preview-bg { width: 100%; height: 100%; object-fit: cover; }
.route-preview::after { position: absolute; inset: 0; content: ""; background: linear-gradient(180deg, rgba(255,255,255,.1), rgba(34,63,46,.12)); }
.route-mini-item { position: absolute; z-index: 2; width: 22%; aspect-ratio: 1; object-fit: contain; filter: drop-shadow(0 5px 5px rgba(36, 52, 41, .2)); transform: translate(-50%, -50%); }
.route-mini-hero { position: absolute; z-index: 3; left: 49%; bottom: 7%; width: 25%; filter: drop-shadow(0 7px 5px rgba(35, 50, 39, .2)); transform: translateX(-50%); }
.route-badge { position: absolute; z-index: 4; top: 12px; right: 12px; display: grid; width: 54px; height: 54px; place-items: center; border: 4px solid rgba(255,255,255,.88); border-radius: 50%; color: white; background: var(--route-accent); font-size: 22px; font-weight: 1000; box-shadow: 0 5px 12px rgba(48,61,48,.16); }
.route-copy { display: flex; min-height: 292px; flex: 1; flex-direction: column; padding: 17px; }
.route-copy h3 { font-size: 25px; }
.route-copy > p:not(.eyebrow) { min-height: 76px; margin: 0 0 15px; color: var(--muted); line-height: 1.37; }
.route-progress { height: 9px; margin-top: auto; overflow: hidden; border-radius: 999px; background: #eee7da; }
.route-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #edaf45, var(--route-accent)); }
.route-meta { display: flex; justify-content: space-between; margin: 7px 1px 14px; color: #617269; font-size: 12px; font-weight: 900; }
.route-button { width: 100%; background: linear-gradient(145deg, color-mix(in srgb, var(--route-accent), white 9%), var(--route-accent)); }

.task-head { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 13px; }
.task-head h2 { margin: 0; font-size: clamp(28px, 4vw, 42px); }
.round-button { display: grid; width: 46px; height: 46px; place-items: center; border: 2px solid #d9e4d9; border-radius: 50%; background: #f4f8f2; font-size: 25px; }
.counter { padding: 9px 12px; border-radius: 999px; color: #476c59; background: var(--green-soft); font-weight: 1000; }
.task-progress { height: 8px; margin: 16px 0 20px; overflow: hidden; border-radius: 999px; background: #eee7d9; }
.task-progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #e8ad48, #4c9b72); transition: width .25s ease; }
.play-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); gap: 21px; align-items: start; }
.scene-card { padding: 12px; border: 1px solid #dcd3c2; border-radius: 27px; background: linear-gradient(150deg, #e7dfcf, #fffaf0); }
.memory-scene { position: relative; overflow: hidden; aspect-ratio: 16 / 10; border: 7px solid white; border-radius: 22px; background: #d8eadb; }
.scene-background { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scene-shade { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(31,64,42,.08)); }
.path-layer { position: absolute; z-index: 2; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.path-line { fill: none; stroke: rgba(255, 244, 197, .88); stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.2; vector-effect: non-scaling-stroke; filter: drop-shadow(0 2px 1px rgba(57,73,48,.25)); }
.scene-object { position: absolute; z-index: 4; display: grid; width: clamp(62px, 13%, 96px); aspect-ratio: 1; padding: 6px 4px 18px; place-items: center; border: 3px solid rgba(255,255,255,.88); border-radius: 22px; background: rgba(255,252,238,.84); box-shadow: 0 7px 15px rgba(38,58,44,.16); cursor: pointer; transform: translate(-50%, -50%); transition: transform .15s ease, border-color .15s ease, background .15s ease, opacity .15s ease; }
.scene-object:hover:not(:disabled) { z-index: 6; border-color: #f0cf74; transform: translate(-50%, -54%); }
.scene-object:disabled { cursor: default; }
.scene-object img { max-width: 90%; max-height: 78%; object-fit: contain; filter: drop-shadow(0 4px 4px rgba(44,55,45,.16)); }
.scene-object small { position: absolute; right: 4px; bottom: 5px; left: 4px; overflow: hidden; color: #405d50; font-size: 10px; font-weight: 1000; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.scene-object.is-watch, .scene-object.is-hint { z-index: 7; border-color: #f1c751; background: #fff4bd; box-shadow: 0 0 0 7px rgba(242,197,73,.24), 0 8px 18px rgba(40,58,44,.18); transform: translate(-50%, -56%) scale(1.04); }
.scene-object.is-correct { border-color: #62aa7a; background: rgba(231,248,232,.92); }
.scene-object.is-correct::after { position: absolute; top: -8px; right: -7px; display: grid; width: 27px; height: 27px; place-items: center; border-radius: 50%; color: white; background: #4d9c6e; content: "✓"; font-weight: 1000; }
.scene-object.is-wrong { border-color: #e7996c; background: #fff0e7; animation: object-wiggle .32s ease 2; }
.hedgehog-hero { position: absolute; z-index: 5; width: clamp(66px, 14%, 100px); pointer-events: none; transform: translate(-50%, -50%); transition: left .52s cubic-bezier(.2,.75,.25,1), top .52s cubic-bezier(.2,.75,.25,1); }
.hedgehog-hero img { display: block; width: 100%; height: auto; filter: drop-shadow(0 7px 6px rgba(31,47,35,.25)); transition: transform .14s ease; }
.hedgehog-hero.is-right img { transform: scaleX(-1); }
.hedgehog-hero.is-arrived::after { position: absolute; right: 2%; bottom: -4px; left: 8%; height: 12px; border-radius: 50%; background: rgba(255,244,194,.88); content: ""; filter: blur(1px); }
.scene-note { min-height: 38px; margin: 9px 8px 0; color: var(--muted); font-size: 14px; line-height: 1.35; text-align: center; }
@keyframes object-wiggle { 33% { transform: translate(-54%, -50%); } 66% { transform: translate(-46%, -50%); } }

.control-card { padding: 21px; border: 1px solid var(--line); border-radius: 24px; background: white; box-shadow: 0 10px 24px rgba(54,70,58,.08); }
.control-card h3 { font-size: 27px; }
.sequence-strip { display: flex; min-height: 61px; align-items: center; gap: 8px; margin: 13px 0 15px; padding: 10px; border-radius: 16px; background: #f3eee4; }
.sequence-step { position: relative; display: grid; width: 40px; height: 40px; flex: 1; max-width: 55px; place-items: center; border: 2px dashed #c9bda8; border-radius: 50%; color: #8c7c64; background: #fffaf0; font-weight: 1000; }
.sequence-step:not(:last-child)::after { position: absolute; left: calc(100% + 2px); width: 10px; height: 3px; border-radius: 999px; background: #d6cbb8; content: ""; }
.sequence-step.is-correct { border-style: solid; border-color: #61a878; color: white; background: #58a171; }
.sequence-step.is-current { border-style: solid; border-color: #e6b94b; color: #755b1f; background: #fff2b8; box-shadow: 0 0 0 4px rgba(230,185,75,.16); }
.feedback { display: grid; gap: 4px; min-height: 96px; padding: 14px; border-radius: 16px; color: #5d6f65; background: #f4f1e8; line-height: 1.3; }
.feedback b { color: var(--ink); }
.feedback.is-watch { color: #665421; background: #fff4cf; }
.feedback.is-warn { color: #835533; background: var(--orange-soft); }
.feedback.is-warn b { color: #974c25; }
.feedback.is-hint { color: #725c21; background: #fff6d2; }
.feedback.is-success { color: #31634a; background: var(--green-soft); }
.task-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 13px; }
.watch-button { grid-column: 1 / -1; background: linear-gradient(145deg, #c3874f, #a66a36); box-shadow: 0 8px 17px rgba(157,94,43,.22); }
.hint-button { display: inline-flex; min-height: 49px; align-items: center; justify-content: center; gap: 7px; padding: 11px 12px; border: 2px solid #ead69d; border-radius: 15px; background: #fff7dc; }
.hint-button svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.next-button { grid-column: 1 / -1; }
.task-actions button:disabled { cursor: default; opacity: .5; transform: none; }

.result-screen.is-active { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(300px, .75fr); gap: 30px; align-items: center; }
.result-scene .memory-scene { box-shadow: 0 16px 28px rgba(46,67,52,.18); transform: rotate(-1deg); }
.result-scene .scene-object { pointer-events: none; }
.result-copy > p:not(.eyebrow) { color: var(--muted); font-size: 18px; line-height: 1.5; }
.result-facts { display: flex; gap: 10px; margin: 18px 0; }
.result-facts span { padding: 10px 13px; border-radius: 13px; background: #f2eadb; }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; }

@media (max-width: 1024px) {
  .home-screen.is-active { grid-template-columns: minmax(0, .9fr) minmax(380px, 1.1fr); }
  .play-layout { grid-template-columns: minmax(0, 1.12fr) minmax(290px, .88fr); }
  .route-preview { min-height: 205px; }
  .route-copy { min-height: 310px; }
  .scene-object { width: clamp(64px, 15%, 96px); }
}

@media (max-width: 860px) {
  .home-screen.is-active, .result-screen.is-active { grid-template-columns: 1fr; }
  .hero-stage { width: min(100%, 650px); justify-self: center; }
  .play-layout { grid-template-columns: 1fr; }
  .control-card { display: grid; grid-template-columns: minmax(0, .82fr) minmax(270px, 1.18fr); gap: 0 14px; }
  .control-card .eyebrow, .control-card h3, .sequence-strip { grid-column: 1; }
  .feedback, .task-actions { grid-column: 2; }
  .feedback { grid-row: 1 / span 3; }
  .task-actions { align-self: end; }
}

@media (max-width: 760px) {
  .app { width: min(1120px, calc(100% - 20px)); margin-top: 16px; }
  .game-head { align-items: flex-start; }
  .game-brand small { display: none; }
  .game-icon { width: 48px; height: 48px; border-radius: 15px; }
  .screen { padding: 19px; border-radius: 25px; }
  .hero-copy h1 { font-size: clamp(38px, 11vw, 53px); }
  .how-strip { grid-template-columns: 1fr; }
  .how-strip article { min-height: 72px; }
  .route-grid { grid-template-columns: 1fr; }
  .route-card { display: grid; grid-template-columns: 210px minmax(0, 1fr); }
  .route-preview { min-height: 300px; }
  .route-copy { min-height: 300px; }
  .route-copy > p:not(.eyebrow) { min-height: 0; }
  .section-title { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 600px) {
  .route-card { display: flex; }
  .route-preview { min-height: 205px; }
  .route-copy { min-height: 285px; }
  .control-card { display: block; }
  .feedback { min-height: 84px; }
  .task-actions { grid-template-columns: 1fr; }
  .watch-button, .next-button { grid-column: auto; }
  .memory-scene { aspect-ratio: 10 / 12; }
  .scene-object { width: clamp(46px, 13vw, 52px); padding: 4px 3px 17px; border-radius: 15px; }
  .scene-object small { font-size: 8px; }
  .hedgehog-hero { width: clamp(48px, 14vw, 56px); }
}

@media (max-width: 430px) {
  .app { width: min(1120px, calc(100% - 14px)); }
  .game-head { gap: 7px; }
  .game-brand { gap: 8px; }
  .game-brand strong { font-size: 16px; }
  .age-pill { padding: 8px 9px; font-size: 12px; }
  .screen { padding: 13px; border-radius: 21px; }
  .hero-copy > p:not(.eyebrow) { font-size: 17px; }
  .task-head { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 8px; }
  .round-button { width: 39px; height: 39px; }
  .task-head h2 { font-size: 24px; }
  .counter { padding: 7px 8px; font-size: 12px; }
  .scene-card { padding: 7px; border-radius: 20px; }
  .memory-scene { border-width: 5px; border-radius: 18px; }
  .scene-note { font-size: 12px; }
  .control-card { padding: 14px; border-radius: 20px; }
  .control-card h3 { font-size: 23px; }
  .sequence-strip { gap: 5px; min-height: 54px; padding: 8px; }
  .sequence-step { width: 34px; height: 34px; font-size: 13px; }
  .sequence-step:not(:last-child)::after { width: 6px; }
  .feedback { font-size: 14px; }
  .hint-button, .watch-button, .next-button { width: 100%; }
}

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