:root {
  color-scheme: light;
  --ink: #173f35;
  --muted: #62776f;
  --paper: #fffaf0;
  --green: #4a8870;
  --green-dark: #285f4d;
  --teal: #4b7f83;
  --mustard: #dfaa43;
  --coral: #c96a54;
  --line: rgba(41, 96, 72, .16);
  --shadow: 0 18px 45px rgba(48, 72, 61, .13);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { overflow-x: hidden; }

body {
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 6% 2%, rgba(223,170,67,.2), transparent 25rem),
    radial-gradient(circle at 96% 18%, rgba(75,127,131,.17), transparent 30rem),
    #f4ecdc;
  font-family: "Segoe UI", Arial, sans-serif;
}

button { font: inherit; }
button:focus-visible, a:focus-visible { outline: 4px solid rgba(224,167,57,.62); outline-offset: 3px; }

.app {
  width: min(1120px, calc(100% - 32px));
  margin: 28px auto 46px;
}

.game-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 13px 18px;
  border: 1px solid rgba(255,255,255,.84);
  border-radius: 24px;
  background: rgba(255,250,240,.91);
  box-shadow: 0 10px 28px rgba(58,75,62,.09);
  backdrop-filter: blur(9px);
}

.game-brand { display: flex; align-items: center; min-width: 0; gap: 13px; }
.game-brand > span:last-child { display: grid; min-width: 0; gap: 2px; }
.game-brand strong { font-size: clamp(18px,2vw,24px); line-height: 1.12; }
.game-brand small { color: var(--muted); font-size: 13px; }
.game-icon { display: grid; flex: 0 0 auto; place-items: center; width: 54px; height: 54px; border-radius: 18px; color: #fff; background: linear-gradient(145deg,#568d8d,#346867); box-shadow: inset 0 1px rgba(255,255,255,.32),0 8px 18px rgba(45,103,101,.2); }
.game-icon svg { width: 42px; fill: none; stroke: currentColor; stroke-width: 2.7; stroke-linejoin: round; stroke-linecap: round; }
.age-pill { flex: 0 0 auto; padding: 9px 14px; border-radius: 999px; color: #694b22; background: #ffe2a2; font-size: 14px; font-weight: 850; }

.screen { display: none; border: 1px solid rgba(255,255,255,.88); border-radius: 34px; background: rgba(255,251,243,.95); box-shadow: var(--shadow); }
.screen.is-active { display: grid; }
.eyebrow { margin: 0 0 7px; color: var(--green-dark); font-size: 12px; font-weight: 900; letter-spacing: .11em; }
.hero-copy h1, .section-title h2, .task-head h2, .result-copy h2 { margin: 0; color: var(--ink); line-height: 1.07; letter-spacing: -.035em; }

.home-screen { grid-template-columns: minmax(0,.92fr) minmax(0,1.08fr); gap: 28px 34px; padding: clamp(26px,4vw,48px); overflow: hidden; }
.hero-copy { align-self: center; }
.hero-copy h1 { max-width: 510px; font-size: clamp(34px,4.5vw,53px); }
.hero-copy > p:not(.eyebrow) { max-width: 540px; margin: 18px 0 0; color: var(--muted); font-size: 18px; line-height: 1.58; }
.hero-facts, .result-facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 25px; }
.hero-facts span, .result-facts span { padding: 8px 12px; border-radius: 999px; color: #3e6257; background: #edf4e8; font-size: 14px; font-weight: 850; }

.primary-button, .secondary-button, .hint-button, .next-button, .route-card button { border: 0; border-radius: 15px; cursor: pointer; font-weight: 900; transition: transform .16s ease, box-shadow .16s ease, filter .16s ease; }
.primary-button, .next-button { padding: 14px 20px; color: #fff; background: linear-gradient(145deg,#538e78,#2f6e59); box-shadow: 0 9px 20px rgba(38,104,79,.22); }
.primary-button:hover, .next-button:hover, .secondary-button:hover, .hint-button:hover, .route-card button:hover { transform: translateY(-2px); filter: saturate(1.06); }

.hero-desk {
  position: relative;
  align-self: center;
  min-width: 0;
  aspect-ratio: 1.16;
  overflow: hidden;
  border: 1px solid rgba(49,113,82,.14);
  border-radius: 30px;
  background:
    linear-gradient(180deg,rgba(255,255,255,.62),transparent 52%),
    repeating-linear-gradient(0deg,transparent 0 31px,rgba(74,127,131,.075) 31px 33px),
    linear-gradient(180deg,#e6efeb 0 56%,#cfaa78 56% 62%,#a9794b 62% 100%);
  box-shadow: inset 0 1px rgba(255,255,255,.78),0 15px 35px rgba(45,85,65,.12);
}

.hero-desk::before { content: ""; position: absolute; top: 7%; left: 8%; width: 52%; height: 31%; border: 8px solid #c9965c; border-radius: 12px; background: #477a62; box-shadow: inset 0 0 0 2px rgba(255,255,255,.15); }
.hero-object { position: absolute; z-index: 2; object-fit: contain; filter: drop-shadow(0 8px 8px rgba(48,55,42,.16)); }
.hero-backpack { right: -3%; bottom: 0; width: 36%; }
.hero-pencil { left: -4%; bottom: 0; width: 31%; transform: rotate(-9deg); }
.hero-abacus { top: 4%; right: -1%; width: 28%; }
.hero-word { position: absolute; z-index: 4; left: 16%; bottom: 20%; display: flex; gap: 4px; padding: 12px; border-radius: 15px; background: rgba(255,249,229,.88); box-shadow: 0 8px 20px rgba(70,54,37,.15); transform: rotate(-3deg); }
.hero-word span, .hero-word i { display: grid; place-items: center; width: 34px; height: 42px; border: 2px solid #c7b27f; border-radius: 9px; color: #285a48; background: #fff9e4; font-style: normal; font-size: 18px; font-weight: 950; }
.hero-word i { color: #fff; border-color: #c16b52; background: #c96f57; box-shadow: 0 4px 0 #a8533e; }

.how-strip { grid-column: 1/-1; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.how-strip article { display: flex; align-items: center; min-width: 0; gap: 12px; padding: 15px; border: 1px solid rgba(48,104,79,.12); border-radius: 18px; background: rgba(255,255,255,.65); }
.how-strip article > b { display: grid; flex: 0 0 auto; place-items: center; width: 36px; height: 36px; border-radius: 12px; color: #fff; background: var(--teal); }
.how-strip span { display: grid; gap: 3px; }
.how-strip strong { font-size: 15px; }
.how-strip small { color: var(--muted); line-height: 1.38; }

.routes-screen, .play-screen { padding: clamp(22px,3.4vw,38px); }
.section-title, .task-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.section-title h2 { font-size: clamp(30px,4vw,44px); }
.section-title > p { margin: 0; color: var(--muted); font-weight: 750; }
.route-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; margin-top: 26px; }

.route-card { display: grid; grid-template-rows: 126px auto 1fr auto; min-width: 0; padding: 18px; border: 1px solid color-mix(in srgb,var(--accent),transparent 76%); border-radius: 25px; background: linear-gradient(160deg,#fff 0 46%,var(--soft) 100%); box-shadow: 0 12px 26px rgba(49,75,61,.1); }
.route-preview { position: relative; display: flex; align-items: end; justify-content: center; }
.route-preview::before { content: ""; position: absolute; right: 5%; bottom: 2px; left: 5%; height: 34%; border-radius: 10px; background: repeating-linear-gradient(0deg,rgba(255,255,255,.65) 0 13px,color-mix(in srgb,var(--accent),transparent 78%) 13px 15px); }
.route-preview span { z-index: 1; display: grid; place-items: center; width: 38%; aspect-ratio: 1; margin: 0 -8px; border: 2px solid #fff; border-radius: 20px; background: var(--soft); box-shadow: 0 7px 14px rgba(50,64,52,.1); }
.route-preview span:nth-child(2) { z-index: 2; width: 44%; }
.route-preview img { width: 94%; height: 94%; object-fit: contain; }
.route-copy { margin-top: 10px; text-align: center; }
.route-copy h3 { margin: 0; font-size: 23px; }
.route-copy p { margin: 7px 0 0; color: var(--muted); line-height: 1.45; }
.route-progress { align-self: end; display: grid; gap: 7px; margin: 18px 0 14px; }
.route-progress > span { height: 8px; overflow: hidden; border-radius: 999px; background: rgba(35,79,62,.1); }
.route-progress i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.route-progress b { color: var(--muted); font-size: 13px; text-align: center; }
.route-card button { align-self: end; width: 100%; padding: 12px 14px; color: #fff; background: var(--accent); box-shadow: 0 8px 16px color-mix(in srgb,var(--accent),transparent 72%); }
.text-button { justify-self: start; margin-top: 22px; padding: 8px 2px; border: 0; color: var(--green-dark); background: transparent; cursor: pointer; font-weight: 850; }

.task-head { justify-content: flex-start; }
.task-head > div { flex: 1; min-width: 0; }
.task-head h2 { font-size: clamp(24px,3vw,34px); }
.round-button { display: grid; flex: 0 0 auto; place-items: center; width: 48px; height: 48px; border: 1px solid var(--line); border-radius: 15px; color: var(--green-dark); background: #fff; cursor: pointer; font-size: 24px; font-weight: 900; }
.counter { flex: 0 0 auto; padding: 9px 12px; border-radius: 999px; color: var(--green-dark); background: #edf4e8; font-weight: 900; }
.task-progress { height: 8px; margin: 17px 0 22px; overflow: hidden; border-radius: 999px; background: rgba(45,105,80,.1); }
.task-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg,#dba342,#4a8586); transition: width .25s ease; }

.crossword-workspace { display: grid; grid-template-columns: minmax(0,1.25fr) minmax(285px,.75fr); align-items: start; gap: 18px; }
.clue-banner, .grid-card, .vowel-panel { min-width: 0; border: 1px solid rgba(46,102,78,.13); border-radius: 26px; background: #fffdf7; box-shadow: 0 12px 28px rgba(49,72,60,.1); }

.clue-banner { grid-column: 1/-1; display: grid; grid-template-columns: 155px minmax(0,1fr) minmax(255px,.72fr); align-items: center; gap: 18px; padding: 16px 19px; background: linear-gradient(100deg,#fffdf7,#f1f6ed); }
.clue-picture { display: grid; place-items: center; height: 138px; overflow: hidden; border-radius: 20px; background: radial-gradient(circle at 50% 80%,rgba(219,190,127,.4),transparent 45%),linear-gradient(160deg,#f7edda,#e9f2e7); }
.clue-picture img { width: 92%; height: 132px; object-fit: contain; filter: drop-shadow(0 7px 6px rgba(52,62,47,.16)); }
.clue-copy h3 { margin: 0; font-size: 24px; }
.clue-copy > p:not(.eyebrow) { margin: 8px 0 0; color: var(--muted); font-size: 16px; line-height: 1.48; }
.word-skeleton { align-self: stretch; display: grid; align-content: center; gap: 9px; padding: 13px 15px; border: 1px dashed #c8b489; border-radius: 18px; background: rgba(255,249,229,.75); }
.word-skeleton > span { color: var(--muted); font-size: 12px; font-weight: 850; text-transform: uppercase; letter-spacing: .06em; }
.word-skeleton > div { display: flex; flex-wrap: wrap; gap: 4px; }
.pattern-cell { display: grid; place-items: center; width: 29px; height: 36px; border: 2px solid #cdbb8e; border-radius: 9px; color: #285847; background: #fffaf0; font-size: 17px; font-weight: 950; }
.pattern-cell.is-gap { color: #a65a43; border-color: #d7a06e; border-style: dashed; background: #fff0dc; }
.pattern-cell.is-filled { color: #fff; border-color: #b95c47; border-style: solid; background: #c96a54; box-shadow: 0 3px 0 #a84f3b; }
.pattern-cell.is-known { color: #205943; border-color: #5e9a79; border-style: solid; background: #dff0df; }

.grid-card { padding: clamp(12px,2.3vw,22px); }
.crossword-grid-wrap { display: grid; place-items: center; min-height: 438px; padding: 10px; border-radius: 20px; background: linear-gradient(rgba(255,255,255,.62),rgba(255,255,255,.25)),repeating-linear-gradient(0deg,transparent 0 24px,rgba(66,121,103,.05) 24px 25px),repeating-linear-gradient(90deg,transparent 0 24px,rgba(66,121,103,.05) 24px 25px),#eaf2ea; }
.crossword-grid { display: grid; grid-template-columns: repeat(var(--cols),minmax(0,1fr)); grid-template-rows: repeat(var(--rows),minmax(0,1fr)); gap: 3px; width: min(100%,calc(var(--cols) * 50px)); }
.crossword-gap { aspect-ratio: 1; }
.crossword-cell { position: relative; display: grid; aspect-ratio: 1; place-items: center; min-width: 0; padding: 0; border: 2px solid #c9b98f; border-radius: 8px; color: var(--ink); background: #fff9e9; box-shadow: inset 0 -3px rgba(134,102,55,.08),0 3px 7px rgba(53,70,57,.08); }
.crossword-cell.is-active { border-color: #6f9e91; background: #f0f6eb; }
.crossword-cell.is-consonant { color: #4d685f; background: #eef2e9; }
.crossword-cell.is-vowel { color: #fff; border-color: #be624d; background: #cc7259; }
.crossword-cell.is-locked { color: #215844; border-color: #589574; background: #dff0df; }
.crossword-cell small { position: absolute; top: 2px; left: 3px; color: #7b6c4e; font-size: clamp(7px,.8vw,10px); line-height: 1; }
.crossword-cell b { font-size: clamp(11px,1.8vw,21px); line-height: 1; }
.clue-tabs { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 7px; margin-top: 15px; }
.clue-tab { position: relative; display: grid; place-items: center; min-width: 0; padding: 5px; border: 2px solid transparent; border-radius: 14px; background: #f3ead8; cursor: pointer; }
.clue-tab span { display: grid; place-items: center; width: 100%; aspect-ratio: 1.2; }
.clue-tab img { width: 94%; height: 94%; object-fit: contain; }
.clue-tab b { position: absolute; top: 3px; right: 3px; display: grid; place-items: center; width: 23px; height: 23px; border-radius: 50%; color: #fff; background: #6f7d72; font-size: 12px; }
.clue-tab.is-active { border-color: var(--teal); background: #e4efec; }
.clue-tab.is-solved { background: #dff0df; }
.clue-tab.is-solved b { background: var(--green); }
.clue-tab:disabled { opacity: 1; cursor: default; }

.vowel-panel { display: grid; gap: 17px; padding: 21px; background: linear-gradient(160deg,#fffdf7,#f7ebd8); }
.vowel-title h3 { margin: 0; font-size: 24px; line-height: 1.15; }
.vowel-palette { display: grid; grid-template-columns: repeat(3,minmax(58px,1fr)); gap: 10px; }
.vowel-button { min-height: 62px; border: 1px solid #d5b772; border-radius: 16px; color: #285a47; background: #fff5d5; box-shadow: 0 6px 0 #d2b36e; cursor: pointer; font-size: 25px; font-weight: 950; transition: transform .14s ease,background .14s ease; }
.vowel-button:hover { transform: translateY(-2px); background: #ffecb2; }
.vowel-button:active { transform: translateY(2px); box-shadow: 0 2px 0 #d2b36e; }
.vowel-button.is-wrong { color: #a94738; background: #ffd8cb; animation: soft-shake .32s ease; }
.feedback { display: grid; min-height: 73px; gap: 3px; padding: 12px 14px; border: 1px solid rgba(47,105,81,.13); border-radius: 15px; background: #f1f5e9; }
.feedback b { font-size: 15px; }
.feedback span { color: var(--muted); font-size: 13px; line-height: 1.4; }
.feedback.is-wrong { border-color: rgba(190,89,70,.24); background: #fff0e8; }
.feedback.is-wrong b { color: #a64f3f; }
.feedback.is-right { background: #eaf4e6; }
.feedback.is-hint { border-color: rgba(198,144,42,.28); background: #fff5cf; }
.feedback.is-success { border-color: rgba(44,127,87,.27); background: #def1e1; }
.clue-actions { display: grid; grid-template-columns: 1fr; align-self: end; gap: 10px; }
.hint-button, .secondary-button { padding: 12px 16px; color: #72521e; background: #ffe4a1; box-shadow: 0 7px 15px rgba(154,111,31,.13); }
.next-button { padding: 12px 17px; }

.result-screen { grid-template-columns: minmax(0,.96fr) minmax(0,1.04fr); align-items: center; gap: 32px; padding: clamp(28px,5vw,58px); overflow: hidden; }
.result-desk { display: flex; align-items: end; justify-content: center; min-height: 340px; padding: 25px; border-radius: 29px; background: repeating-linear-gradient(0deg,transparent 0 31px,rgba(75,127,131,.07) 31px 33px),linear-gradient(160deg,#eef4e9,#dce9e4); }
.result-desk span { position: relative; display: grid; place-items: center; width: 36%; margin: 0 -9px; }
.result-desk span:nth-child(2) { z-index: 2; width: 43%; }
.result-desk img { width: 100%; height: 235px; object-fit: contain; filter: drop-shadow(0 9px 8px rgba(45,65,50,.16)); }
.result-desk b { position: absolute; right: 4px; bottom: 3px; display: grid; place-items: center; width: 34px; height: 34px; border: 3px solid #fff; border-radius: 50%; color: #fff; background: var(--green); font-size: 18px; }
.result-copy h2 { font-size: clamp(34px,4.3vw,51px); }
.result-copy > p:not(.eyebrow) { margin: 17px 0 0; color: var(--muted); font-size: 18px; line-height: 1.55; }
.result-facts b { font-size: 17px; }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.secondary-button { padding: 14px 18px; }

@keyframes soft-shake { 0%,100% { transform: translateX(0); } 35% { transform: translateX(-4px); } 70% { transform: translateX(4px); } }

@media (max-width: 900px) {
  .home-screen { grid-template-columns: 1fr; }
  .hero-copy { text-align: center; }
  .hero-copy h1, .hero-copy > p:not(.eyebrow) { margin-right: auto; margin-left: auto; }
  .hero-facts { justify-content: center; }
  .hero-desk { justify-self: center; width: min(100%,570px); }
  .crossword-workspace { grid-template-columns: 1fr; }
  .clue-banner { grid-template-columns: 145px minmax(0,1fr); }
  .word-skeleton { grid-column: 1/-1; }
  .grid-card { grid-row: 2; }
  .vowel-panel { grid-row: 3; }
  .vowel-palette { grid-template-columns: repeat(6,minmax(50px,1fr)); }
  .clue-actions { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 780px) {
  .app { width: min(1120px,calc(100% - 22px)); margin-top: 16px; }
  .route-grid { grid-template-columns: 1fr; }
  .route-card { grid-template-columns: 150px 1fr; grid-template-rows: auto 1fr auto auto; column-gap: 18px; }
  .route-preview { grid-row: 1/5; }
  .route-copy { text-align: left; }
  .route-progress b { text-align: left; }
  .how-strip { grid-template-columns: 1fr; }
  .section-title { align-items: flex-start; flex-direction: column; }
  .result-screen { grid-template-columns: 1fr; text-align: center; }
  .result-desk { min-height: 280px; }
  .result-facts, .result-actions { justify-content: center; }
}

@media (max-width: 540px) {
  .game-head { padding: 10px 12px; border-radius: 20px; }
  .game-icon { width: 46px; height: 46px; border-radius: 15px; }
  .game-icon svg { width: 36px; }
  .game-brand small { display: none; }
  .age-pill { padding: 7px 10px; font-size: 12px; }
  .screen { border-radius: 25px; }
  .home-screen, .routes-screen, .play-screen, .result-screen { padding: 18px; }
  .hero-copy h1 { font-size: 34px; }
  .hero-copy > p:not(.eyebrow), .result-copy > p:not(.eyebrow) { font-size: 16px; }
  .hero-desk { aspect-ratio: 1.05; }
  .hero-word { left: 8%; bottom: 22%; gap: 2px; padding: 8px; }
  .hero-word span, .hero-word i { width: 27px; height: 35px; border-radius: 7px; font-size: 15px; }
  .route-card { grid-template-columns: 112px 1fr; column-gap: 12px; padding: 14px; }
  .route-copy h3 { font-size: 20px; }
  .route-preview span { border-radius: 14px; }
  .task-head { gap: 10px; }
  .task-head h2 { font-size: 21px; }
  .round-button { width: 42px; height: 42px; }
  .counter { padding: 7px 9px; }
  .clue-banner { grid-template-columns: 105px minmax(0,1fr); gap: 12px; padding: 13px; }
  .clue-picture { height: 120px; }
  .clue-picture img { height: 116px; }
  .clue-copy h3 { font-size: 20px; }
  .clue-copy > p:not(.eyebrow) { font-size: 14px; }
  .word-skeleton { padding: 11px; }
  .pattern-cell { width: 27px; height: 34px; font-size: 16px; }
  .crossword-grid-wrap { min-height: 326px; padding: 6px; }
  .grid-card { padding: 10px; }
  .crossword-grid { gap: 2px; }
  .crossword-cell { border-width: 1.5px; border-radius: 5px; }
  .crossword-cell small { top: 1px; left: 2px; font-size: 6px; }
  .crossword-cell b { font-size: clamp(10px,3.4vw,15px); }
  .clue-tabs { gap: 4px; }
  .clue-tab { padding: 2px; border-radius: 10px; }
  .clue-tab b { width: 19px; height: 19px; font-size: 10px; }
  .vowel-panel { padding: 15px; }
  .vowel-palette { grid-template-columns: repeat(3,minmax(58px,1fr)); }
  .vowel-button { min-height: 54px; font-size: 23px; }
  .clue-actions { grid-template-columns: 1fr; }
  .result-desk { min-height: 230px; padding: 15px; }
  .result-desk img { height: 180px; }
  .result-copy h2 { font-size: 34px; }
}

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