:root {
  --paper: #fffaf0;
  --cream: #fff2d9;
  --ink: #23483a;
  --muted: #66776e;
  --green: #3d8a65;
  --green-soft: #e4f3e8;
  --orange: #e99c4b;
  --orange-soft: #fff0e2;
  --gold: #e2b84c;
  --line: #e8dcc7;
  --shadow: 0 20px 48px rgba(56, 75, 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 15% 8%, #fff1c9 0 12%, transparent 38%), linear-gradient(145deg, #fffaf0, #f4f2e7); font-family: "Trebuchet MS", Arial, sans-serif; }
button, a { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible, [role="button"]:focus-visible { outline: 4px solid rgba(226, 184, 76, .58); 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; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.game-brand > span:last-child { display: grid; gap: 2px; }
.game-brand strong { font-size: 22px; line-height: 1.05; }
.game-brand small { color: var(--muted); font-size: 13px; }
.game-icon { display: grid; width: 57px; height: 57px; place-items: center; border-radius: 18px; color: white; background: linear-gradient(145deg, #59a77e, #2f7958); box-shadow: 0 9px 18px rgba(44, 111, 79, .22); }
.game-icon svg { width: 39px; height: 39px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.3; }
.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, .96); 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.05; }
h1 { margin-bottom: 18px; font-size: clamp(42px, 5.4vw, 68px); letter-spacing: -.045em; }
h2 { margin-bottom: 7px; font-size: clamp(31px, 4vw, 46px); letter-spacing: -.035em; }
h3 { margin-bottom: 10px; font-size: 26px; }

.primary-button, .secondary-button, .route-button, .check-button, .next-button, .hint-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, .check-button, .next-button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 50px; 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, .check-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, .9fr) minmax(390px, 1.1fr); gap: 24px 36px; align-items: center; }
.hero-copy > p:not(.eyebrow) { max-width: 535px; margin: 0 0 24px; color: var(--muted); font-size: 19px; line-height: 1.48; }
.hero-board { position: relative; display: grid; min-width: 0; padding: 34px 34px 28px; place-items: center; border-radius: 30px; background: linear-gradient(150deg, #e5f1dd, #fff2c8); }
.hero-board::before, .hero-board::after { position: absolute; content: ""; border-radius: 50%; background: rgba(255, 255, 255, .56); }
.hero-board::before { top: 25px; left: 22px; width: 38px; height: 38px; }
.hero-board::after { right: 28px; bottom: 24px; width: 21px; height: 21px; }
.hero-note { position: absolute; z-index: 4; top: 16px; right: 18px; padding: 7px 10px; border: 2px solid white; border-radius: 12px; color: #7d642e; background: #fff0af; font-size: 12px; font-weight: 1000; transform: rotate(2deg); }
.hero-puzzle { width: min(100%, 430px); filter: drop-shadow(0 15px 13px rgba(38, 71, 51, .2)); transform: rotate(-2deg); }
.hero-puzzle svg, .route-puzzle svg, .round-puzzle svg, .result-puzzle svg { display: block; width: 100%; height: auto; }
.hero-arrow { position: absolute; z-index: 3; right: 4%; bottom: 5%; width: 76px; fill: none; stroke: #d27636; stroke-linecap: round; stroke-linejoin: round; stroke-width: 7; transform: rotate(12deg); }
.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; flex: none; width: 38px; height: 38px; 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; display: grid; min-height: 242px; padding: 15px; place-items: center; background: linear-gradient(145deg, #eaf3df, #fff0cd); }
.route-preview::after { position: absolute; right: 12px; bottom: 10px; padding: 5px 8px; border-radius: 9px; color: #72551d; background: rgba(255, 247, 214, .92); content: attr(data-rings); font-size: 11px; font-weight: 1000; }
.route-puzzle { width: min(100%, 210px); filter: drop-shadow(0 8px 8px rgba(33, 60, 46, .17)); }
.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: 74px; 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, #4c9b72); }
.route-meta { display: flex; justify-content: space-between; margin: 7px 1px 14px; color: #617269; font-size: 12px; font-weight: 900; }
.route-button { width: 100%; }

.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.22fr) minmax(300px, .78fr); gap: 21px; align-items: start; }
.puzzle-card { display: grid; padding: 14px 14px 11px; place-items: center; border: 1px solid #dcd3c2; border-radius: 27px; background: linear-gradient(150deg, #e9e2d3, #fffaf0); }
.round-puzzle { width: min(100%, 610px); overflow: hidden; border: 8px solid white; border-radius: 50%; background: #d8eadb; box-shadow: 0 14px 29px rgba(47, 67, 54, .2); }
.puzzle-ring { cursor: pointer; transform-box: fill-box; transform-origin: center; }
.ring-content { transition: transform .3s cubic-bezier(.2,.8,.2,1); }
.ring-divider { fill: none; stroke: rgba(255, 253, 244, .92); stroke-width: 7; vector-effect: non-scaling-stroke; }
.ring-hit { cursor: pointer; fill: none; stroke: transparent; }
.ring-hit:hover { stroke: rgba(255, 245, 190, .16); }
.ring-hit:focus { outline: none; stroke: rgba(255, 214, 92, .24); }
.ring-hit.is-correct { stroke: rgba(70, 156, 104, .28); }
.ring-hit.is-wrong { stroke: rgba(231, 139, 70, .25); animation: ring-wiggle .34s ease 2; }
.ring-hit.is-hint { stroke: rgba(238, 183, 53, .31); animation: ring-glow 1s ease-in-out infinite alternate; }
.ring-center-mark { pointer-events: none; fill: rgba(255, 255, 255, .76); stroke: #3d8a65; stroke-width: 3; }
.ring-center-mark path { fill: none; stroke: #3d8a65; stroke-linecap: round; stroke-width: 3; }
.turn-note { margin: 10px 7px 1px; color: var(--muted); font-size: 14px; line-height: 1.35; text-align: center; }
@keyframes ring-wiggle { 33% { transform: rotate(-1.2deg); } 66% { transform: rotate(1.2deg); } }
@keyframes ring-glow { from { opacity: .7; } to { opacity: 1; } }

.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; }
.ring-list { display: grid; gap: 7px; margin: 14px 0; padding: 0; list-style: none; }
.ring-list li { display: flex; align-items: center; gap: 9px; min-height: 39px; padding: 8px 10px; border-radius: 12px; color: #66756d; background: #f5f1e9; font-size: 13px; font-weight: 900; }
.ring-list li::before { display: grid; width: 23px; height: 23px; flex: none; place-items: center; border-radius: 50%; color: white; background: #9baca3; content: attr(data-number); font-size: 11px; }
.ring-list li.is-correct { color: #357252; background: #eaf6ec; }
.ring-list li.is-correct::before { content: "✓"; background: #4a9a6e; }
.ring-list li.is-wrong { color: #98542d; background: #fff0e7; }
.ring-list li.is-hint { color: #7c6222; background: #fff5c9; box-shadow: inset 0 0 0 2px #edca65; }
.feedback { display: grid; gap: 4px; min-height: 86px; padding: 13px 14px; border-radius: 15px; color: #5d6f65; background: #f4f1e8; line-height: 1.3; }
.feedback b { color: var(--ink); }
.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; }
.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; }
.check-button { background: linear-gradient(145deg, #eea550, #d67e39); box-shadow: 0 8px 17px rgba(190, 103, 42, .22); }
.task-actions button:disabled { cursor: default; opacity: .5; transform: none; }

.result-screen.is-active { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, .78fr); gap: 30px; align-items: center; }
.result-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; padding: 18px; border-radius: 28px; background: linear-gradient(145deg, #e9e0ce, #f8edca); transform: rotate(-1deg); }
.result-puzzle { overflow: hidden; border: 6px solid white; border-radius: 50%; background: #dcebdc; box-shadow: 0 8px 18px rgba(45, 67, 52, .16); }
.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, .92fr) minmax(350px, 1.08fr); }
  .hero-board { padding: 32px 26px 25px; }
  .play-layout { grid-template-columns: minmax(0, 1.12fr) minmax(290px, .88fr); }
  .route-preview { min-height: 218px; }
  .route-copy { min-height: 315px; }
}

@media (max-width: 860px) {
  .home-screen.is-active, .result-screen.is-active { grid-template-columns: 1fr; }
  .hero-board { min-height: 460px; }
  .play-layout { grid-template-columns: 1fr; }
  .round-puzzle { width: min(100%, 620px); }
  .control-card { display: grid; grid-template-columns: minmax(0, .85fr) minmax(260px, 1.15fr); gap: 0 14px; }
  .control-card .eyebrow, .control-card h3, .ring-list { 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: 292px; }
  .route-copy { min-height: 292px; }
  .route-copy > p:not(.eyebrow) { min-height: 0; }
  .section-title { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 600px) {
  .hero-board { min-height: 0; padding: 38px 16px 25px; }
  .hero-note { right: 8px; }
  .hero-arrow { width: 58px; }
  .route-card { display: flex; }
  .route-preview { min-height: 0; }
  .route-copy { min-height: 285px; }
  .control-card { display: block; }
  .feedback { min-height: 80px; }
  .task-actions { grid-template-columns: 1fr; }
  .next-button { grid-column: auto; }
}

@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; }
  .hero-board { padding: 38px 10px 20px; border-radius: 22px; }
  .how-strip article { padding: 11px; }
  .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; }
  .puzzle-card { padding: 7px; border-radius: 20px; }
  .round-puzzle { border-width: 5px; }
  .turn-note { font-size: 12px; }
  .control-card { padding: 14px; border-radius: 20px; }
  .control-card h3 { font-size: 23px; }
  .ring-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ring-list li { min-height: 36px; padding: 6px 7px; font-size: 11px; }
  .feedback { font-size: 14px; }
  .task-actions { gap: 7px; }
  .hint-button, .check-button, .next-button { width: 100%; }
  .result-gallery { gap: 7px; padding: 10px; }
}

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