:root {
  --ink: #214b43;
  --muted: #6c7d75;
  --paper: #fffdf7;
  --line: #ddceb1;
  --green: #438f69;
  --coral: #df745f;
  --accent: #4f956d;
  color: var(--ink);
  background: #ece8d9;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-width: 0; overflow-x: clip; }
body { background: radial-gradient(circle at 9% 8%,#fff,transparent 28rem),linear-gradient(145deg,#e3ecd9,#f3e8d5 55%,#e1e9dc); }
button, a { font: inherit; }
button { color: inherit; }
img { display: block; max-width: 100%; }

.app { width: min(1120px,calc(100% - 32px)); margin: 24px auto 34px; overflow: hidden; border: 1px solid #d5c7a8; border-radius: 34px; background: rgba(255,253,247,.98); box-shadow: 0 24px 60px rgba(65,73,51,.15); }
.game-bar { min-height: 86px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 24px; border-bottom: 1px solid var(--line); background: #fff; }
.game-brand { min-width: 0; display: inline-flex; align-items: center; gap: 13px; padding: 4px 8px 4px 4px; border-radius: 18px; color: inherit; text-decoration: none; transition: background .18s ease; }
.game-brand:hover { background: #eef5e7; }
.game-brand:focus-visible, button:focus-visible { outline: 4px solid rgba(67,143,105,.3); outline-offset: 3px; }
.game-brand > span:last-child { display: grid; gap: 2px; }
.game-brand strong { font-size: clamp(18px,2.3vw,25px); }
.game-brand small { color: var(--muted); font-size: 13px; }
.game-icon { flex: 0 0 56px; width: 56px; height: 54px; display: grid; place-items: center; border-radius: 17px; background: #efe0bc; }
.game-icon svg { width: 49px; height: 42px; fill: #fff9e8; stroke: #705b40; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.age-pill, .counter { padding: 10px 15px; border: 1px solid var(--line); border-radius: 99px; background: #fff; font-weight: 900; }

.screen { display: none; }
.screen.is-active { display: block; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 12px; font-weight: 900; letter-spacing: .12em; }
h1, h2, h3 { margin-top: 0; }
h1, h2, h3, p { overflow-wrap: anywhere; }
mark { padding: 0 2px; border-radius: 5px; color: inherit; background: #f5c968; box-shadow: 0 2px 0 rgba(176,112,40,.18); }

.home-screen { grid-template-columns: 1fr 1fr; gap: 28px 38px; padding: 48px 48px 36px; background: linear-gradient(110deg,#f8eed8 0 52%,#dfeeda 52%); }
.home-screen.is-active { display: grid; }
.hero-copy { align-self: center; }
.hero-copy h1 { margin-bottom: 18px; font-size: clamp(38px,4.8vw,56px); line-height: 1.02; letter-spacing: -.04em; }
.hero-copy > p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: clamp(18px,2vw,21px); line-height: 1.46; }
.hero-facts { display: flex; flex-wrap: wrap; gap: 9px; margin: 24px 0; }
.hero-facts span { padding: 9px 14px; border: 1px solid var(--line); border-radius: 99px; background: #fff; font-weight: 900; }
.primary-button, .secondary-button, .hint-button, .restart-button, .next-button, .check-button { min-height: 54px; padding: 13px 22px; border-radius: 17px; cursor: pointer; font-weight: 900; }
.primary-button, .next-button, .check-button { border: 0; color: #fff; background: var(--green); box-shadow: 0 7px 0 #2f7658; }
.primary-button:hover, .next-button:hover, .check-button:hover:not(:disabled) { filter: brightness(1.04); }
.hero-scene { position: relative; min-height: 355px; overflow: hidden; border: 1px solid #d7c9a8; border-radius: 32px; background: #dce8d0; }
.hero-scene img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.how-strip { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-top: 6px; }
.how-strip article { min-height: 114px; display: flex; align-items: center; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 24px; background: #fff; }
.how-strip b { flex: 0 0 52px; height: 52px; display: grid; place-items: center; border-radius: 16px; color: #fff; background: var(--coral); font-size: 23px; }
.how-strip span { display: grid; gap: 4px; }
.how-strip small { color: var(--muted); }

.routes-screen, .play-screen, .result-screen { padding: 38px 42px 44px; }
.section-title, .task-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.section-title h2, .task-head h2 { margin-bottom: 0; font-size: clamp(28px,4vw,44px); }
.section-title > p { color: var(--muted); font-weight: 900; }
.route-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); align-items: stretch; gap: 16px; margin-top: 28px; }
.route-card { min-width: 0; display: flex; flex-direction: column; padding: 15px; border: 1px solid var(--line); border-radius: 25px; background: #fff; box-shadow: 0 12px 28px rgba(72,66,47,.09); }
.route-art { height: 170px; display: grid; place-items: center; overflow: hidden; border-radius: 18px; background: linear-gradient(145deg,#edf4df,#f5e3cb); }
.route-art img { width: 66%; height: 86%; object-fit: contain; filter: drop-shadow(0 4px 4px rgba(0,0,0,.15)); }
.route-card > p { margin: 17px 0 7px; color: var(--accent); font-size: 12px; font-weight: 900; }
.route-card h3 { min-height: 50px; margin-bottom: 8px; font-size: 22px; }
.route-card > small { min-height: 66px; color: var(--muted); font-size: 16px; line-height: 1.4; }
.route-meta { display: flex; justify-content: space-between; margin-top: auto; padding-top: 16px; color: var(--muted); font-size: 13px; font-weight: 900; }
.route-progress { height: 8px; margin: 9px 0 16px; overflow: hidden; border-radius: 99px; background: #e8e4d7; }
.route-progress i { display: block; height: 100%; background: var(--accent); }
.route-card > button { min-height: 54px; display: flex; justify-content: space-between; align-items: center; padding: 13px 18px; border: 0; border-radius: 17px; color: #fff; background: var(--accent); cursor: pointer; font-weight: 900; }
.back-link { margin-top: 26px; border: 0; background: transparent; color: #2d7355; cursor: pointer; font-weight: 900; }

.task-head { justify-content: flex-start; }
.task-head > div { flex: 1; }
.round-button { width: 48px; height: 48px; border: 1px solid var(--line); border-radius: 50%; background: #fff; font-size: 23px; }
.progress-line { height: 8px; margin: 18px 0; overflow: hidden; border-radius: 99px; background: #e8e4d7; }
.progress-line i { display: block; height: 100%; background: var(--accent); }
.task-title { display: flex; align-items: baseline; gap: 12px; }
.task-title span { color: var(--accent); font-size: 11px; font-weight: 900; }
.task-title h3 { margin: 0; font-size: 27px; }

.clue-board { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.meaning-card, .rhyme-card { position: relative; min-width: 0; min-height: 210px; display: grid; align-items: center; gap: 16px; padding: 22px; border: 1px solid var(--line); border-radius: 25px; background: #fff; box-shadow: 0 10px 22px rgba(70,66,48,.07); }
.meaning-card { grid-template-columns: 58px 1fr; background: linear-gradient(145deg,#fffdf7,#f3ead8); }
.rhyme-card { grid-template-columns: 58px 130px 1fr; background: linear-gradient(145deg,#edf5e8,#fffdf7); }
.key-number { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 18px; color: #fff; background: var(--coral); font-size: 24px; font-weight: 900; box-shadow: 0 5px 0 #bf5e4d; }
.meaning-card h3, .rhyme-card h3 { margin-bottom: 8px; font-size: 21px; }
.meaning-card div > p:last-child { margin: 0; color: var(--muted); font-size: 18px; line-height: 1.45; }
.rhyme-card img { width: 126px; height: 145px; object-fit: contain; filter: drop-shadow(0 5px 4px rgba(0,0,0,.14)); }
.rhyme-card div > p:last-child { margin: 0; font-size: 30px; font-weight: 900; }
.rhyme-card.is-highlighted { border-color: #e3aa3f; box-shadow: 0 0 0 5px rgba(242,191,76,.22); }

.answer-panel, .control-card { margin-top: 15px; padding: 16px; border: 1px solid var(--line); border-radius: 23px; background: #fff; }
.answer-panel > header { display: flex; align-items: flex-end; justify-content: space-between; gap: 15px; }
.answer-panel h3 { margin: 0; }
.answer-panel header > span { color: var(--muted); font-size: 13px; font-weight: 900; }
.candidate-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin: 15px 0; }
.candidate-grid button { min-height: 190px; display: grid; grid-template-rows: 1fr auto auto; gap: 4px; padding: 10px; border: 2px solid #e1d5bd; border-radius: 20px; background: #fff; cursor: pointer; transition: transform .18s ease,border .18s ease; }
.candidate-grid button:not(:disabled):hover { transform: translateY(-3px); border-color: var(--accent); }
.candidate-grid button.is-selected { border-color: var(--accent); background: #edf7ed; box-shadow: 0 0 0 4px rgba(68,143,105,.16); }
.candidate-grid button.is-eliminated { opacity: .23; filter: grayscale(1); }
.candidate-grid button.is-tail-hint { border-color: #e1aa3f; box-shadow: 0 0 0 5px rgba(242,191,76,.22); }
.candidate-grid img { width: 100%; height: 132px; object-fit: contain; }
.candidate-grid b { font-size: 18px; }
.candidate-grid small { color: var(--muted); font-weight: 900; }

.key-meter { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 13px; }
.key-meter > span { min-height: 66px; display: grid; grid-template-columns: 38px auto 1fr; align-items: center; gap: 9px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 16px; background: #f4f1e8; }
.key-meter i { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; color: #fff; background: #9a9e94; font-style: normal; font-weight: 900; }
.key-meter small { justify-self: end; color: var(--muted); }
.key-meter > span[data-state="ready"] { background: #fff8e9; }
.key-meter > span[data-state="pass"] { border-color: #9ac29e; background: #e5f2df; }
.key-meter > span[data-state="pass"] i { background: #438f69; }
.key-meter > span[data-state="pass"] i::after { content: "✓"; }
.key-meter > span[data-state="pass"] i { font-size: 0; }
.key-meter > span[data-state="pass"] i::after { font-size: 16px; }
.key-meter > span[data-state="fail"] { border-color: #e2a07f; background: #fff0e4; }
.key-meter > span[data-state="fail"] i { background: #d8755f; }
.key-meter > span[data-state="fail"] i::after { content: "×"; }
.key-meter > span[data-state="fail"] i { font-size: 0; }
.key-meter > span[data-state="fail"] i::after { font-size: 18px; }
.check-button { width: 100%; }
.check-button:disabled { opacity: .42; cursor: not-allowed; box-shadow: none; }

.control-card { display: grid; grid-template-columns: 1fr auto; gap: 12px; }
.feedback { min-height: 65px; display: grid; align-content: center; gap: 4px; padding: 10px 13px; border-radius: 15px; background: #f3f1e8; }
.feedback span { color: var(--muted); font-size: 13px; }
.feedback[data-tone="good"], .feedback[data-tone="success"] { background: #e2f1df; }
.feedback[data-tone="soft"] { background: #fff0e4; }
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.hint-button { color: #2d7355; border: 2px solid #91bea2; background: #eef8ef; }
.restart-button { border: 1px solid var(--line); background: #fff; }
.task-tabs { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(5,1fr); gap: 7px; }
.task-tabs button { min-height: 36px; border: 1px solid var(--line); border-radius: 11px; background: #fff; font-weight: 900; }
.task-tabs .is-current { color: #fff; background: var(--accent); }
.task-tabs .is-done:not(.is-current) { background: #e4f1df; }

.result-screen.is-active { display: grid; grid-template-columns: .95fr 1.05fr; align-items: center; gap: 38px; min-height: 550px; }
.result-scene { position: relative; min-height: 380px; overflow: hidden; border: 1px solid var(--line); border-radius: 30px; background: linear-gradient(#dbeaca 0 68%,#cfb88c 68%); }
.result-sun { position: absolute; right: 9%; top: 9%; width: 88px; aspect-ratio: 1; border-radius: 50%; background: #f2cf75; box-shadow: 0 0 0 20px rgba(242,207,117,.22); }
.result-scene img { position: absolute; object-fit: contain; filter: drop-shadow(0 5px 5px rgba(0,0,0,.18)); }
.result-scene img:nth-child(2) { z-index: 2; left: 5%; bottom: 7%; width: 53%; height: 68%; }
.result-scene img:last-child { z-index: 3; right: 7%; bottom: 10%; width: 38%; height: 50%; }
.result-screen h2 { font-size: clamp(34px,5vw,56px); line-height: 1; }
.result-screen > div:last-child > p:not(.eyebrow) { color: var(--muted); font-size: 19px; }
.result-actions { display: flex; gap: 12px; }
.secondary-button { border: 2px solid #92bca3; background: #fff; }

@media (max-width: 900px) {
  .home-screen { grid-template-columns: 1fr; }
  .clue-board { grid-template-columns: 1fr; }
  .control-card { grid-template-columns: 1fr; }
  .actions { justify-content: flex-start; }
  .result-screen.is-active { grid-template-columns: 1fr; }
  .result-scene { min-height: 310px; }
}

@media (max-width: 720px) {
  .app { width: calc(100% - 16px); margin: 8px auto 20px; border-radius: 24px; }
  .game-bar { min-height: 76px; padding: 10px 13px; }
  .game-icon { width: 46px; height: 46px; flex-basis: 46px; }
  .game-brand small { display: none; }
  .home-screen { padding: 30px 16px 20px; }
  .hero-copy h1 { font-size: clamp(34px,9.5vw,48px); }
  .hero-scene { min-height: 255px; }
  .how-strip { grid-template-columns: 1fr; }
  .routes-screen, .play-screen, .result-screen { padding: 28px 16px 32px; }
  .section-title { align-items: flex-start; flex-direction: column; }
  .route-grid { grid-template-columns: 1fr; }
  .route-card h3, .route-card > small { min-height: 0; }
  .route-art { height: 160px; }
  .rhyme-card { grid-template-columns: 52px 110px 1fr; }
  .rhyme-card img { width: 106px; height: 125px; }
  .candidate-grid button { min-height: 150px; }
  .candidate-grid img { height: 96px; }
  .key-meter { grid-template-columns: 1fr; }
  .actions { display: grid; }
  .actions button { width: 100%; }
}

@media (max-width: 430px) {
  .game-brand strong { font-size: 15px; }
  .age-pill { display: none; }
  .hero-copy > p:not(.eyebrow) { font-size: 17px; }
  .hero-facts span { padding: 8px 10px; font-size: 13px; }
  .primary-button { width: 100%; }
  .hero-scene { min-height: 225px; }
  .how-strip article { min-height: 90px; padding: 13px; }
  .task-head { gap: 8px; }
  .task-head h2 { font-size: 22px; }
  .counter { padding: 7px 9px; font-size: 12px; }
  .task-title { display: block; }
  .task-title h3 { font-size: 23px; }
  .meaning-card, .rhyme-card { min-height: 0; padding: 14px; }
  .meaning-card { grid-template-columns: 46px 1fr; }
  .rhyme-card { grid-template-columns: 46px 88px 1fr; gap: 9px; }
  .key-number { width: 43px; height: 43px; border-radius: 14px; font-size: 19px; }
  .meaning-card div > p:last-child { font-size: 16px; }
  .rhyme-card img { width: 82px; height: 94px; }
  .rhyme-card div > p:last-child { font-size: 22px; }
  .answer-panel, .control-card { padding: 12px; }
  .answer-panel > header { display: block; }
  .candidate-grid { gap: 5px; }
  .candidate-grid button { min-height: 118px; padding: 4px; }
  .candidate-grid img { height: 73px; }
  .candidate-grid b { font-size: 12px; }
  .candidate-grid small { font-size: 9px; }
  .key-meter > span { grid-template-columns: 34px auto 1fr; padding: 8px; }
  .key-meter small { font-size: 11px; }
  .result-actions { display: grid; }
  .result-actions button { width: 100%; }
}
