@font-face { font-family: "Baloo 2"; src: url(/fonts/baloo2.woff2) format("woff2"); font-weight: 400 800; font-display: swap; }
@font-face { font-family: "Nunito"; src: url(/fonts/nunito.woff2) format("woff2"); font-weight: 200 1000; font-display: swap; }

:root {
  --leaf-deep: #234A17; --leaf-dark: #356B1F; --leaf: #4F8F2A; --leaf-light: #86BE45;
  --bark-deep: #3A2010; --bark-dark: #52301A; --bark: #6E4223; --bark-light: #8F5A31;
  --plank-dark: #A9692F; --plank: #CF9150; --plank-light: #E8B878;
  --rope: #D2A866; --rope-dark: #94692F;
  --acorn-top: #F7A845; --acorn: #E07A1F; --acorn-deep: #B4561A; --acorn-edge: #7E3A12;
  --cream: #FFF6DF; --parchment: #F8E6BE; --parchment-deep: #E9CC92; --parchment-line: #D9B57A;
  --ink: #4A2812; --ink-muted: #7D5636; --on-wood: #FFF3D6; --outline: #4A2410;
  --gold-top: #FFF0A6; --gold: #FFCF4A; --gold-deep: #E9A21C;
  --correct: #4E9A2A; --correct-top: #8BCB4E; --wrong: #C2410C;
  --display: "Baloo 2", "Arial Rounded MT Bold", system-ui, sans-serif;
  --body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.45;
  background-color: var(--leaf-deep);
  min-height: 100vh;
}
body::before { content: ""; position: fixed; inset: 0; z-index: -1;
  background: var(--leaf-deep) url(/assets/canopy.webp) center top / cover no-repeat; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
[hidden] { display: none !important; }

.top { display: flex; justify-content: center; padding: 14px 16px 0; }
.sign {
  background: linear-gradient(var(--bark-light), var(--bark-dark));
  border: 3px solid var(--outline); border-radius: 18px; padding: 2px 26px 0;
  box-shadow: 0 4px 0 var(--bark-deep), 0 8px 16px rgba(0,0,0,.35);
}
.sign { display: flex; align-items: center; gap: 10px; padding-left: 10px; }
.sign img { width: 40px; height: 40px; border-radius: 10px; border: 2px solid var(--outline); }
.sign span { font-family: var(--display); font-weight: 800; font-size: 34px; color: var(--cream); letter-spacing: .5px;
  text-shadow: 0 2px 0 var(--bark-deep); }

main { max-width: 520px; margin: 0 auto; padding: 0 12px 24px; }
h1 { font-family: var(--display); font-weight: 800; color: var(--cream); text-align: center; font-size: 30px;
  margin: 10px 0 0; line-height: 1.1; text-shadow: 0 2px 0 var(--bark-deep), 0 0 12px rgba(0,0,0,.45); }
.lead { text-align: center; color: var(--cream); margin: 4px 0 12px; font-weight: 700; text-shadow: 0 1px 3px rgba(0,0,0,.7); }

/* --- game card --- */
.game {
  position: relative; background: linear-gradient(var(--bark), var(--bark-dark));
  border: 3px solid var(--outline); border-radius: 26px; padding: 12px 10px 12px;
  box-shadow: 0 10px 24px rgba(0,0,0,.4); min-height: 300px;
}
.loading { color: var(--on-wood); text-align: center; padding: 40px 0; font-weight: 700; }
.game-head { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 8px; position: relative; }
.badge-num { font-family: var(--display); font-weight: 800; font-size: 22px; color: var(--cream);
  background: var(--bark-deep); border-radius: 14px; padding: 2px 18px 0; border: 2px solid var(--outline); }
.timer { position: absolute; right: 4px; background: var(--cream); color: var(--ink); border-radius: 999px;
  padding: 2px 12px; font-weight: 800; font-variant-numeric: tabular-nums; font-size: 15px; border: 2px solid var(--parchment-line); }

.board { position: relative; padding: 4px 4px 2px 34px;
  background: linear-gradient(90deg, transparent 22px, var(--rope) 22px, var(--rope-dark) 30px, transparent 30px) left/34px 100% no-repeat; }
.pip-climb { position: absolute; left: -6px; width: 52px; height: auto; transition: top .35s ease; pointer-events: none; z-index: 2; }
.ladder { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rung {
  height: 46px; border-radius: 12px; border: 2px solid var(--outline);
  background: linear-gradient(var(--plank-light), var(--plank) 55%, var(--plank-dark));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 2px 0 var(--bark-deep);
  display: flex; align-items: center; justify-content: center; gap: 4px;
  font-family: var(--display); font-weight: 800; font-size: 24px; letter-spacing: 1.5px; color: var(--ink);
  text-transform: uppercase; position: relative;
}
.rung.end { background: linear-gradient(var(--cream), var(--parchment) 60%, var(--parchment-deep)); }
.rung.hidden { background: linear-gradient(var(--plank), var(--plank-dark)); }
.rung.found { animation: pop .35s ease; }
.rung.active { background: linear-gradient(var(--gold-top), var(--gold) 55%, var(--gold-deep));
  box-shadow: 0 0 0 3px rgba(255, 207, 74, .45), 0 2px 0 var(--bark-deep); }
.rung.shake { animation: shake .35s ease; }
.cell { width: 30px; height: 34px; border-radius: 7px; background: var(--cream); border: 2px solid var(--parchment-line);
  display: flex; align-items: center; justify-content: center; font-size: 21px; line-height: 1; padding-top: 3px; }
.cell.given { color: var(--acorn-deep); }
.cell.cur { border-color: var(--acorn); }
.rung.long .cell { width: 25px; font-size: 18px; }
@keyframes pop { 0% { transform: scale(.96); } 60% { transform: scale(1.04); } 100% { transform: none; } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.dir { display: flex; background: var(--bark-deep); border-radius: 999px; padding: 3px; margin: 10px 0 8px; }
.dir button { flex: 1; border: 0; background: transparent; color: var(--on-wood); border-radius: 999px; padding: 7px 4px;
  font-weight: 800; font-size: 15px; }
.dir button.on { background: var(--cream); color: var(--ink); }

.clues { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.clue { display: flex; gap: 10px; align-items: center; background: var(--cream); border: 2px solid var(--parchment-line);
  border-radius: 14px; padding: 7px 10px; font-weight: 700; font-size: 15px; line-height: 1.3; }
.clue .med { flex: none; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--parchment); border: 2px solid var(--ink-muted); color: var(--ink); font-size: 14px; font-weight: 900; }
.clue.used { opacity: .5; text-decoration: line-through; text-decoration-color: var(--ink-muted); }
.clue.pointed { border-color: var(--acorn); background: #FFF1C9; box-shadow: 0 0 0 3px rgba(224, 122, 31, .35); }
.clue b { letter-spacing: .5px; }

.dock { position: sticky; bottom: 0; z-index: 3; margin: 10px -10px -12px; padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  background: linear-gradient(var(--bark), var(--bark-dark)); border-radius: 18px 18px 22px 22px;
  box-shadow: 0 -6px 14px rgba(0,0,0,.3); }
.entry-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 4px 8px; }
.entry { display: flex; gap: 4px; min-height: 34px; flex-wrap: nowrap; overflow: hidden; }
.entry .cell { width: 27px; height: 32px; font-family: var(--display); font-weight: 800; font-size: 19px; color: var(--ink); }
.entry .cell.cur { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
.acorn-btn {
  border: 2px solid var(--acorn-edge); border-radius: 999px; color: var(--cream);
  background: linear-gradient(var(--acorn-top), var(--acorn) 55%, var(--acorn-deep));
  box-shadow: inset 0 2px 0 rgba(255,255,255,.35), 0 3px 0 var(--acorn-edge);
  font-family: var(--display); font-weight: 800; font-size: 21px; padding: 4px 34px 1px; text-shadow: 0 1px 0 var(--acorn-edge);
  display: inline-flex; align-items: center; gap: 8px;
}
.acorn-btn:active { transform: translateY(2px); box-shadow: inset 0 2px 0 rgba(255,255,255,.35), 0 1px 0 var(--acorn-edge); }
.acorn-btn.big { font-size: 24px; padding: 6px 40px 2px; }
.acorn-btn.small { font-size: 17px; padding: 3px 20px 0; }
.acorn-ico { width: 14px; height: 17px; border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%; background: var(--cream);
  box-shadow: inset 0 6px 0 var(--bark-light); display: inline-block; margin-top: -3px; }

.kbd { display: flex; flex-direction: column; gap: 6px; background: var(--bark-deep); border-radius: 16px; padding: 7px 4px; }
.krow { display: flex; gap: 5px; justify-content: center; }
.key { flex: 1; max-width: 42px; height: 50px; border: 0; border-radius: 9px; background: linear-gradient(var(--cream), var(--parchment));
  box-shadow: 0 3px 0 var(--parchment-line); color: var(--ink); font-family: var(--display); font-weight: 800; font-size: 21px;
  padding: 3px 0 0; touch-action: manipulation; user-select: none; }
.key:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--parchment-line); }
.key.wide { max-width: 64px; flex: 1.5; font-size: 18px; }
.key.ok { background: linear-gradient(var(--correct-top), var(--correct)); color: #fff; box-shadow: 0 3px 0 #2F6B17; }

/* --- solved --- */
.solved { text-align: center; color: var(--on-wood); padding: 12px 6px 4px; }
.solved img { width: 110px; height: auto; }
.solved h2 { font-family: var(--display); font-weight: 800; font-size: 32px; margin: 0 0 6px; color: var(--cream); }
.stats { display: flex; justify-content: center; gap: 10px; margin: 0 0 14px; }
.stats div { background: var(--cream); color: var(--ink); border-radius: 14px; min-width: 84px; padding: 6px 10px; }
.stats b { display: block; font-family: var(--display); font-size: 24px; line-height: 1.1; }
.stats span { font-size: 13px; font-weight: 700; color: var(--ink-muted); }
.copied { font-weight: 800; margin: 8px 0 0; }
.note { background: var(--parchment); color: var(--ink); border-radius: 14px; padding: 10px 12px; font-weight: 700; margin: 14px 0 8px; text-align: left; }
.note:empty { display: none; }
.next { margin: 6px 0 0; font-weight: 700; }
.next b { font-variant-numeric: tabular-nums; }

/* --- app promo --- */
.app-promo { margin-top: 16px; background: linear-gradient(var(--cream), var(--parchment)); border: 3px solid var(--outline);
  border-radius: 22px; padding: 14px; }
.promo-head { display: flex; gap: 12px; align-items: center; }
.app-icon { flex: none; width: 64px; height: 64px; border-radius: 15px; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.app-name { margin: 2px 0 0; font-weight: 700; color: var(--ink-muted); font-size: 14px; }
.app-promo h2 { font-family: var(--display); font-weight: 800; font-size: 24px; margin: 0; line-height: 1.15; }
.app-promo ul { margin: 10px 0 12px; padding-left: 20px; font-weight: 700; }
.shots { display: flex; gap: 8px; margin: 0 0 14px; }
.shots img { flex: 1; min-width: 0; width: 100%; height: auto; border-radius: 12px; border: 2px solid var(--outline);
  box-shadow: 0 3px 8px rgba(0,0,0,.25); }
.stores { display: flex; gap: 8px; flex-wrap: wrap; }
.stores { justify-content: center; }
.store { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; background: #111; color: #fff; border-radius: 10px;
  padding: 6px 14px 7px 12px; min-width: 150px; line-height: 1.1; border: 1px solid #555; }
.store-txt { display: flex; flex-direction: column; }
.store-ico { width: 24px; height: 24px; flex: none; }
.store-small { font-size: 11px; font-weight: 700; opacity: .85; }
.store-big { font-size: 18px; font-weight: 800; }
.store[aria-disabled="true"] { background: #6b5a4a; pointer-events: none; }

/* --- text --- */
.text { margin-top: 16px; background: var(--cream); border: 3px solid var(--outline); border-radius: 22px; padding: 14px 16px; }
.text h2 { font-family: var(--display); font-weight: 800; font-size: 24px; margin: 0 0 6px; line-height: 1.15; }
.text ul { padding-left: 20px; }
.text li { margin-bottom: 4px; }
.faq details { border-top: 2px solid var(--parchment-line); padding: 8px 0; }
.faq details:first-of-type { border-top: 0; }
.faq summary { font-weight: 800; cursor: pointer; }
.faq p { margin: 6px 0 0; }

footer { text-align: center; color: var(--cream); font-weight: 700; font-size: 14px; padding: 8px 16px 28px;
  text-shadow: 0 1px 2px rgba(0,0,0,.6); }
footer p { margin: 4px 0; }

/* --- hint sheet, consent --- */
.sheet { position: fixed; inset: 0; background: rgba(30, 15, 5, .55); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet-card { width: 100%; max-width: 520px; background: linear-gradient(var(--cream), var(--parchment)); border-radius: 24px 24px 0 0;
  border: 3px solid var(--outline); border-bottom: 0; padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 8px; }
.sheet-card h2 { font-family: var(--display); font-weight: 800; margin: 0; font-size: 26px; }
.sheet-card img { width: 64px; height: auto; }
.plank-btn { width: 100%; max-width: 340px; border: 2px solid var(--outline); border-radius: 14px; padding: 10px;
  background: linear-gradient(var(--plank-light), var(--plank)); font-weight: 800; font-size: 17px; color: var(--ink); }
.link-btn { border: 0; background: none; font-weight: 800; color: var(--ink-muted); padding: 8px 12px; }
.consent { position: fixed; left: 12px; right: 12px; bottom: 12px; max-width: 520px; margin: 0 auto; z-index: 9;
  background: var(--cream); border: 3px solid var(--outline); border-radius: 18px; padding: 10px 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4); font-weight: 700; font-size: 14px; }
.consent p { margin: 0 0 6px; }
.consent div { display: flex; justify-content: flex-end; gap: 6px; align-items: center; }

@media (max-width: 360px) {
  .key { height: 46px; font-size: 18px; }
  .rung { font-size: 21px; }
  .cell { width: 26px; }
}
@media (min-width: 700px) {
  h1 { font-size: 38px; }
  .game { padding: 16px 18px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
