:root {
  color-scheme: light;
  --ink: #214f46;
  --muted: #6c7d76;
  --paper: #fffdf7;
  --line: #dfd3ba;
  --green: #3d936f;
  --green-dark: #2c7359;
  --coral: #df715d;
  --gold: #e5b44f;
  --shadow: 0 16px 34px #294a3d1a;
}

* { box-sizing: border-box; }
html { min-width: 0; background: #edf4e8; }
body { margin: 0; overflow-x: hidden; color: var(--ink); background: radial-gradient(circle at 18px 18px, #d4dfcc 1px, transparent 1.5px) 0 0 / 34px 34px, #edf4e8; font-family: "Segoe UI", Arial, sans-serif; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
button:focus-visible, a:focus-visible { outline: 4px solid #f3c358; outline-offset: 3px; }
.app { width: min(1120px, calc(100% - 32px)); margin: 42px auto 44px; border: 1px solid #dfd7c4; border-radius: 34px; background: var(--paper); box-shadow: var(--shadow); overflow: hidden; }
.game-bar { display: flex; min-height: 82px; align-items: center; justify-content: space-between; gap: 20px; padding: 15px 26px; border-bottom: 1px solid var(--line); background: #fff; }
.game-brand { display: inline-flex; min-width: 0; align-items: center; gap: 13px; color: var(--ink); text-decoration: none; border-radius: 16px; }
.game-brand:hover strong { color: var(--green); }
.game-brand:hover .game-icon { transform: translateY(-2px); box-shadow: 0 7px 14px #4b70552a; }
.game-icon { display: grid; flex: 0 0 48px; width: 48px; height: 48px; place-items: center; border-radius: 15px; color: #9c7224; background: #fff0bd; transition: .18s ease; }
.game-icon svg { width: 36px; height: 31px; }
.game-icon path:first-child { fill: #f6cf69; stroke: #9c7224; stroke-width: 2; stroke-linejoin: round; }
.game-icon circle { fill: #9c7224; }
.game-icon path:last-child { fill: none; stroke: #4b8d69; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.game-brand > span:last-child { display: grid; gap: 2px; min-width: 0; }
.game-brand strong { font-size: 20px; line-height: 1.1; transition: color .18s ease; }
.game-brand small { color: var(--muted); font-size: 12px; }
.age-pill, .counter, .riddle-head > span { flex: none; padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); background: #fff; font-size: 13px; font-weight: 800; }
.screen { display: none; }
.screen.is-active { display: block; }
.eyebrow { margin: 0 0 8px; color: #4c9371; font-family: Georgia, serif; font-size: 12px; font-weight: 900; letter-spacing: 1.3px; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1, h2, h3 { margin: 0; font-family: Georgia, "Times New Roman", serif; line-height: 1.04; }
h1 { max-width: 600px; font-size: clamp(34px, 4.5vw, 58px); }
h2 { font-size: clamp(29px, 3.7vw, 43px); }
h3 { font-size: clamp(23px, 2.5vw, 31px); }
.hero-copy > p:not(.eyebrow), .result-screen > div > p:not(.eyebrow) { max-width: 600px; margin: 20px 0 0; color: var(--muted); font-size: 18px; line-height: 1.55; }
.home-screen { position: relative; display: none; grid-template-columns: minmax(0, 1.08fr) minmax(370px, .92fr); min-height: 610px; background: linear-gradient(124deg, #fff4d7 0 48%, #e7f1df 48%); }
.home-screen.is-active { display: grid; }
.hero-copy { align-self: center; padding: 58px 24px 155px 50px; }
.hero-scene { align-self: center; margin: 40px 34px 120px 12px; overflow: hidden; border-radius: 28px; box-shadow: 0 18px 28px #263f3228; aspect-ratio: 3 / 2; background: #e8ddc5; }
.hero-scene img { display: block; width: 100%; height: 100%; object-fit: cover; }
.hero-facts { display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0 26px; }
.hero-facts span { padding: 10px 15px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-weight: 800; }
.primary-button, .secondary-button, .route-card button, .check-button, .next-button { min-height: 50px; border: 0; border-radius: 15px; font-weight: 900; cursor: pointer; }
.primary-button { padding: 14px 24px; color: #fff; background: var(--green); box-shadow: 0 6px 0 var(--green-dark); }
.primary-button:hover { background: #48a07c; transform: translateY(-1px); }
.how-strip { position: absolute; right: 30px; bottom: 28px; left: 30px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.how-strip article { display: flex; min-width: 0; min-height: 88px; align-items: center; gap: 15px; padding: 14px; border: 1px solid var(--line); border-radius: 20px; background: #fffdfaeb; }
.how-strip b { display: grid; flex: 0 0 48px; width: 48px; height: 48px; place-items: center; border-radius: 15px; color: #fff; background: var(--coral); font-size: 24px; }
.how-strip span { display: grid; gap: 4px; min-width: 0; }
.how-strip strong { font-size: 15px; }
.how-strip small { color: var(--muted); line-height: 1.3; }
.routes-screen { padding: 44px 32px 36px; }
.section-title { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.section-title > p { margin: 0 0 5px; color: var(--muted); font-weight: 800; }
.route-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; gap: 18px; }
.route-card { display: grid; grid-template-rows: 130px auto auto 64px auto auto 52px; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 24px; background: #fff; box-shadow: 0 9px 18px #36524116; }
.route-art { display: grid; place-items: center; overflow: hidden; border-radius: 17px; background: #eef3df; }
.route-art img { width: 116px; height: 108px; object-fit: contain; }
.route-card > p { margin: 15px 4px 4px; color: var(--route); font-size: 11px; font-weight: 900; letter-spacing: .7px; }
.route-card h3 { margin: 0 4px; font-size: 24px; }
.route-card > span { display: block; margin: 8px 4px 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
.route-meta { display: flex; align-items: end; justify-content: space-between; margin: 13px 4px 7px; color: var(--muted); font-size: 12px; }
.route-meta b { color: var(--ink); }
.route-bar { height: 7px; margin: 0 4px 13px; overflow: hidden; border-radius: 99px; background: #ece8dd; }
.route-bar i { display: block; height: 100%; background: var(--route); }
.route-card button { display: flex; align-items: center; justify-content: space-between; padding: 0 16px; color: #fff; background: var(--route); }
.route-card button:hover { filter: brightness(1.07); }
.back-link { display: block; margin: 26px auto 0; padding: 8px 12px; border: 0; color: var(--green); background: transparent; font-weight: 900; cursor: pointer; }
.play-screen { padding: 26px 28px 30px; }
.task-head { display: flex; align-items: center; gap: 14px; }
.task-head > div { min-width: 0; flex: 1; }
.task-head h2 { font-size: 32px; }
.round-button { display: grid; flex: 0 0 46px; width: 46px; height: 46px; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--ink); background: #fff; font-size: 22px; cursor: pointer; }
.progress-line { height: 8px; margin: 17px 0 20px; overflow: hidden; border-radius: 99px; background: #e9e5da; }
.progress-line i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #4a9a72, #e0b64e); transition: width .25s ease; }
.riddle-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 17px 19px; border: 1px solid #d9dfc7; border-radius: 20px; background: #f0f5df; }
.riddle-head h3 { font-size: 27px; }
.logic-board { display: grid; grid-template-columns: minmax(280px, .83fr) minmax(0, 1.55fr); gap: 16px; margin-top: 16px; }
.ladder-panel, .clue-pool-panel, .answer-panel, .control-card { border: 1px solid var(--line); border-radius: 22px; background: #fff; }
.ladder-panel, .clue-pool-panel { padding: 15px; }
.ladder-panel > header, .clue-pool-panel > header, .answer-panel > header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.ladder-panel header span, .clue-pool-panel header span, .answer-panel header > span { color: var(--muted); font-size: 12px; font-weight: 700; }
.clue-ladder { display: grid; align-items: end; min-height: 284px; gap: 8px; padding: 8px 4px 0; }
.ladder-step { display: grid; min-height: 78px; align-content: center; gap: 4px; padding: 12px 15px; border: 2px dashed #d7caa8; border-radius: 14px 14px 8px 8px; background: #fff9e8; }
.ladder-step:nth-child(1) { width: 72%; margin-left: auto; background: #eef5de; }
.ladder-step:nth-child(2) { width: 86%; margin-left: auto; background: #f7efd3; }
.ladder-step:nth-child(3) { width: 100%; background: #fff1dc; }
.ladder-step.is-current { border-style: solid; border-color: #e2a93e; box-shadow: 0 0 0 4px #ffe6a34d; }
.ladder-step.is-filled { border-style: solid; border-color: #8cbe8e; }
.ladder-step b { font-size: 12px; color: #916722; }
.ladder-step span { font-size: 14px; line-height: 1.35; }
.clue-pool { display: grid; gap: 10px; }
.clue-card { position: relative; display: grid; width: 100%; min-height: 82px; grid-template-columns: 46px minmax(0, 1fr); align-items: center; gap: 12px; padding: 12px 14px; border: 2px solid #ded5c3; border-radius: 17px; color: var(--ink); background: #fffdf8; text-align: left; cursor: pointer; }
.clue-card > b { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 13px; color: #a5722b; background: #fff0c8; font-size: 17px; }
.clue-card span { line-height: 1.4; }
.clue-card:hover:not(:disabled) { border-color: #75a987; transform: translateY(-1px); }
.clue-card.is-selected { border-color: var(--green); background: #edf7ef; box-shadow: 0 0 0 4px #4d9e7540; }
.clue-card.is-used { opacity: .54; border-style: dashed; }
.clue-card.is-protected { opacity: .58; border-color: #d0a354; background: #fff7df; }
.answer-panel { margin-top: 16px; padding: 17px; background: #fffdfa; }
.answer-panel[hidden] { display: none; }
.answer-panel h3 { font-size: 25px; }
.option-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.option-card { position: relative; display: grid; min-width: 0; min-height: 168px; grid-template-rows: 108px auto auto; place-items: center; gap: 3px; padding: 10px; border: 2px solid #ded5c3; border-radius: 18px; color: var(--ink); background: #fff; cursor: pointer; }
.option-card img { display: block; width: 96px; height: 96px; object-fit: contain; }
.option-card strong { font-size: 15px; text-align: center; }
.option-card small { color: var(--muted); font-size: 11px; text-align: center; }
.option-card:hover:not(:disabled) { border-color: #77a987; transform: translateY(-1px); }
.option-card.is-selected { border-color: var(--green); background: #edf7ef; box-shadow: 0 0 0 4px #4d9e753c; }
.option-card.is-protected { opacity: .58; border-color: #d0a354; background: #fff7df; }
.option-card.is-answer { border-color: #72a879; background: #eaf6df; }
.control-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 15px; margin-top: 16px; padding: 14px 16px; background: #fff9ec; }
.feedback { min-height: 54px; display: grid; align-content: center; gap: 3px; padding-left: 13px; border-left: 4px solid #6da880; }
.feedback b { font-size: 15px; }
.feedback span { color: var(--muted); font-size: 13px; line-height: 1.35; }
.feedback[data-tone="error"] { border-color: #dc6a58; }
.feedback[data-tone="hint"] { border-color: #e1ad41; }
.feedback[data-tone="success"] { border-color: #4e9c70; }
.actions { display: flex; flex-wrap: wrap; justify-content: end; gap: 8px; }
.actions button { min-height: 44px; padding: 10px 14px; border-radius: 13px; font-weight: 900; cursor: pointer; }
.hint-button { border: 0; color: #765313; background: #ffe39a; }
.restart-button { border: 2px solid #77a88b; color: var(--ink); background: #fff; }
.check-button, .next-button { padding-inline: 18px !important; color: #fff; background: var(--green); }
.check-button:disabled { cursor: not-allowed; opacity: .45; }
.task-tabs { grid-column: 1 / -1; display: flex; justify-content: center; gap: 8px; }
.task-tabs button { width: 32px; height: 32px; border: 1px solid #cfccb9; border-radius: 10px; color: var(--ink); background: #fff; font-weight: 900; cursor: pointer; }
.task-tabs button.is-active { color: #fff; border-color: var(--green); background: var(--green); }
.task-tabs button.is-done { color: #2f795a; border-color: #75ad86; background: #e8f4e5; }
.result-screen { display: none; grid-template-columns: minmax(300px, .82fr) minmax(0, 1.18fr); align-items: center; gap: 38px; padding: 58px 48px; }
.result-screen.is-active { display: grid; }
.result-screen h2 { font-size: clamp(36px, 4.7vw, 55px); }
.result-scene { position: relative; display: grid; min-height: 330px; place-items: center; overflow: hidden; border-radius: 28px; background: linear-gradient(#dff1dc 0 58%, #d9bc82 58%); }
.result-scene > span { position: absolute; right: 28px; top: 28px; width: 80px; height: 80px; border-radius: 50%; background: #ffd064; }
.result-scene > img:not(.reward-art) { z-index: 1; width: 210px; height: 220px; object-fit: contain; }
.reward-art { position: absolute; right: 28px; bottom: 22px; z-index: 2; width: 92px; height: 92px; object-fit: contain; filter: drop-shadow(0 8px 8px #234c3b38); }
.result-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.secondary-button { padding: 14px 20px; border: 2px solid var(--green); color: var(--ink); background: #fff; }
[hidden] { display: none !important; }

@media (max-width: 900px) {
  .home-screen { grid-template-columns: 1fr; min-height: 0; }
  .hero-copy { padding: 46px 38px 22px; }
  .hero-scene { width: min(600px, calc(100% - 76px)); margin: 10px auto 146px; }
  .how-strip { right: 24px; left: 24px; }
  .logic-board { grid-template-columns: 1fr; }
  .clue-ladder { min-height: 242px; }
  .ladder-step { min-height: 64px; }
  .route-card { grid-template-rows: 110px auto auto 76px auto auto 52px; }
  .route-art img { height: 92px; }
  .result-screen { grid-template-columns: 1fr; }
  .result-scene { min-height: 270px; }
}

@media (max-width: 700px) {
  .app { width: min(1120px, calc(100% - 16px)); margin: 12px auto 24px; border-radius: 24px; }
  .game-bar { min-height: 70px; padding: 11px 13px; }
  .game-icon { flex-basis: 42px; width: 42px; height: 42px; }
  .game-brand strong { font-size: 16px; }
  .game-brand small { display: none; }
  .age-pill { padding: 7px 9px; font-size: 11px; }
  .hero-copy { padding: 36px 22px 16px; }
  h1 { font-size: 36px; }
  .hero-copy > p:not(.eyebrow) { font-size: 16px; }
  .hero-scene { width: calc(100% - 44px); margin-bottom: 288px; }
  .how-strip { grid-template-columns: 1fr; gap: 7px; bottom: 18px; }
  .how-strip article { min-height: 72px; }
  .routes-screen, .play-screen { padding: 24px 14px; }
  .section-title { display: block; }
  .section-title > p { margin-top: 10px; }
  .route-grid { grid-template-columns: 1fr; }
  .route-card { grid-template-rows: 126px auto auto auto auto auto 52px; }
  .task-head { align-items: start; }
  .task-head h2 { font-size: 25px; }
  .counter { padding: 7px 9px; font-size: 11px; }
  .riddle-head { align-items: start; }
  .riddle-head h3 { font-size: 23px; }
  .riddle-head > span { padding: 7px 9px; font-size: 11px; }
  .ladder-panel > header, .clue-pool-panel > header, .answer-panel > header { align-items: start; }
  .clue-pool-panel header span, .answer-panel header > span { max-width: 120px; text-align: right; }
  .option-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .option-card { min-height: 156px; grid-template-rows: 96px auto auto; }
  .option-card img { width: 88px; height: 88px; }
  .control-card { grid-template-columns: 1fr; }
  .actions { justify-content: stretch; }
  .actions button { flex: 1 1 42%; }
  .task-tabs { grid-column: auto; }
  .result-screen { gap: 24px; padding: 34px 22px; }
  .result-scene { min-height: 240px; }
  .result-screen > div > p:not(.eyebrow) { font-size: 16px; }
}

@media (max-width: 420px) {
  .game-brand { gap: 8px; }
  .game-brand strong { font-size: 14px; }
  .hero-facts span { padding: 8px 11px; font-size: 12px; }
  .clue-card { grid-template-columns: 38px minmax(0, 1fr); padding: 10px; }
  .clue-card > b { width: 36px; height: 36px; }
  .ladder-step { padding: 10px; }
  .ladder-step span { font-size: 12px; }
  .riddle-head { gap: 8px; padding: 14px 12px; }
  .riddle-head h3 { font-size: 20px; }
}
