/* Остров Пыха — базовые стили каркаса. Временные: после выбора стиля героев палитра и фактура поменяются.
   Планшет в альбомной ориентации — основной экран; телефон — запасной. */
:root {
  /* палитра стиля Б «книжка 60-х»: бумага, листовой зелёный, томатный, охра, ультрамарин */
  --c-sky: #f3ecd8; --c-ink: #22304a; --c-muted: #5d687c; --c-card: #fffaf0;
  --c-pyh: #5b9a38; --c-pyh-dark: #3e7322; --c-sova: #8a5a32; --c-mysh: #8a93a3; --c-ezh: #9a7a3a; --c-kot: #e0762c;
  --c-ok: #3f8f4a; --c-oops: #d2452f; --c-accent: #e2741f; /* выделение и перо обводки: не зелёный (это «верно» и Пых) и не томатный (это «ой») */ --c-line: rgba(34, 48, 74, .18);
  --z-sound: #e2ebc9; --z-number: #f4e3b2; --z-letter: #e3ddef; --z-reading: #d9e3ef; --z-workshop: #f1d9c8; --z-freeze: #dcedda;
  --f-ui: "Golos Text", "PT Sans", system-ui, -apple-system, sans-serif;
  --f-title: "Yeseva One", "PT Serif", Georgia, serif;
  --tap: 88px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body { background: var(--c-sky); color: var(--c-ink); font-family: var(--f-ui); font-size: 18px; user-select: none; -webkit-user-select: none; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 3px solid var(--c-pyh); outline-offset: 3px; }
.app { height: 100%; }

/* карта */
.map { min-height: 100%; padding: max(20px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) 32px max(24px, env(safe-area-inset-left)); display: grid; gap: 24px; align-content: start; }
.map-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.pyh-badge { --hero: var(--c-pyh); display: flex; align-items: center; gap: 14px; font-weight: 700; }
.pyh-badge .hero-body { width: 64px; height: 64px; }
.pyh-badge[data-stage="egg"] .hero-body { border-radius: 50% 50% 46% 46% / 60% 60% 40% 40%; background: #f3e7d3; }
.parent-gate { background: none; border: 1.5px solid var(--c-line); padding: 8px 14px; font-size: 14px; color: var(--c-muted); }
.parent-gate.is-holding { background: var(--c-line); }
.today { display: grid; gap: 4px; text-align: left; padding: 24px 28px; background: var(--c-pyh); color: #fff; border: 0; box-shadow: 0 6px 0 var(--c-pyh-dark); min-height: 120px; }
.today:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--c-pyh-dark); }
.today-label { font-size: 16px; opacity: .9; }
.today-title { font-family: var(--f-title); font-size: 34px; line-height: 1.1; }
.today-empty { font-size: 20px; }
.zones { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.zone { padding: 18px; display: grid; gap: 14px; border: 1.5px solid var(--c-line); }
.zone h2 { margin: 0; font-family: var(--f-title); font-weight: 400; font-size: 24px; }
.zone[data-locked] { opacity: .55; }
.zone-advs { display: flex; flex-wrap: wrap; gap: 14px; }
.adv { width: var(--tap); height: var(--tap); border: 0; background: var(--c-card); font-size: 30px; font-weight: 700; box-shadow: 0 4px 0 var(--c-line); }
.adv.is-done { background: var(--c-ok); color: #fff; }
.zone-soon { color: var(--c-muted); }
.zone-sound-grove, .stage-bg.zone-sound-grove { background-color: var(--z-sound); }
.zone-number-path, .stage-bg.zone-number-path { background-color: var(--z-number); }
.zone-letter-mountain { background-color: var(--z-letter); }
.zone-reading-cave { background-color: var(--z-reading); }
.zone-ezh-workshop { background-color: var(--z-workshop); }
.zone-freeze-meadow { background-color: var(--z-freeze); }

/* сцена */
.play { height: 100%; }
.stage { position: relative; height: 100%; overflow: hidden; display: grid; grid-template-rows: auto 1fr auto; padding: max(16px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); gap: 12px; }
.stage-bg { position: absolute; inset: 0; background-size: cover; background-position: center; z-index: 0; }
.stage > :not(.stage-bg) { position: relative; z-index: 1; }
.bubble { justify-self: center; max-width: min(760px, 92%); background: var(--c-card); padding: 14px 20px; display: grid; gap: 2px; border: 2px solid var(--c-ink); box-shadow: 4px 4px 0 var(--c-ink); }
.bubble-who { font-size: 14px; color: var(--c-muted); }
.bubble-text { font-size: 22px; line-height: 1.35; }
.stage-task { display: grid; place-items: center; min-height: 0; }
.stage-cast { position: absolute !important; left: max(20px, env(safe-area-inset-left)); bottom: max(16px, env(safe-area-inset-bottom)); display: flex; gap: 12px; align-items: flex-end; }
.stage-controls { display: flex; justify-content: flex-end; min-height: var(--tap); }
.next { width: var(--tap); height: var(--tap); border: 0; background: var(--c-pyh); color: #fff; box-shadow: 0 5px 0 var(--c-pyh-dark); display: grid; place-items: center; }
.next svg { width: 48px; height: 48px; }
.next:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--c-pyh-dark); }

/* герой-заглушка: силуэт с глазами и ртом, рот открывается, пока говорит */
.hero { display: grid; justify-items: center; gap: 4px; }
.hero-body { width: 96px; height: 96px; border-radius: 46% 54% 50% 50%; background: var(--hero, var(--c-pyh)); position: relative; }
.hero-eye { position: absolute; top: 32%; width: 12%; height: 15%; border-radius: 50%; background: var(--c-ink); }
.hero-eye:first-child { left: 28%; } .hero-eye:nth-child(2) { right: 28%; }
.hero-mouth { position: absolute; left: 39%; bottom: 24%; width: 22%; height: 6%; border-radius: 0 0 12px 12px; background: var(--c-ink); transform-origin: top; }
.hero.is-talking .hero-mouth { animation: talk .22s infinite alternate; }
.hero.is-talking .hero-body { animation: bob .5s infinite alternate ease-in-out; }
.hero-name { font-size: 13px; color: var(--c-muted); background: var(--c-card); padding: 0 6px; }
@keyframes talk { to { transform: scaleY(2.4); } }
@keyframes bob { to { transform: translateY(-4px); } }

/* задания */
.choices { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: 24px; width: min(860px, 100%); }
.choices[data-count="2"] { --n: 2; } .choices[data-count="4"] { --n: 4; }
.choice { min-height: 150px; min-width: var(--tap); background: var(--c-card); border: 3px solid var(--c-ink); box-shadow: 0 6px 0 var(--c-ink); display: grid; place-items: center; gap: 8px; padding: 14px; }
.choice img { max-width: 100%; max-height: 160px; pointer-events: none; }
.choice-label { font-size: 40px; font-weight: 700; }
.choice:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--c-ink); }
.choice.is-right { background: var(--c-ok); color: #fff; border-color: var(--c-ok); box-shadow: 0 6px 0 #2b7347; }
.choice.is-wrong { animation: nope .5s; border-color: var(--c-oops); }
@keyframes nope { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.reward img { max-height: 46vh; }
.reward-star { width: 200px; height: 200px; background: var(--c-kot); clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.offline-card { background: var(--c-card); border: 2px solid var(--c-ink); padding: 20px 24px; max-width: 640px; display: grid; gap: 8px; }
.offline-card p { margin: 0; font-size: 20px; line-height: 1.4; }

/* родительская зона */
.parent { padding: max(20px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) 32px max(24px, env(safe-area-inset-left)); max-width: 820px; margin: 0 auto; display: grid; gap: 20px; user-select: text; -webkit-user-select: text; }
.parent header { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.parent h1 { font-family: var(--f-title); font-weight: 400; margin: 0; }
.parent h2 { font-size: 20px; margin: 0 0 8px; }
.parent button { min-height: 48px; padding: 0 16px; border: 1.5px solid var(--c-ink); background: var(--c-card); }
.offline-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.offline-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; background: var(--c-card); border: 1px solid var(--c-line); }

@media (max-width: 700px) {
  :root { --tap: 76px; }
  .choices { gap: 16px; }
  .choice { min-height: 110px; }
  .choice-label { font-size: 30px; }
  .bubble-text { font-size: 19px; }
  .stage-cast { transform: scale(.75); transform-origin: left bottom; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* карта острова (стиль Б «книжка 60-х»): подписи зон — бумажные ярлычки с жёсткой тенью */
.island { position: relative; width: 100%; max-width: 1180px; justify-self: center; aspect-ratio: 3 / 2; border: 2px solid var(--c-ink); overflow: hidden; background: #efe6cf; }
.island img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.spot { position: absolute; transform: translate(-50%, -50%); min-width: var(--tap); min-height: 56px; padding: 10px 16px; display: grid; justify-items: center; gap: 2px; background: #fbf6e8; border: 2px solid var(--c-ink); box-shadow: 4px 4px 0 var(--c-ink); font-family: var(--f-title); font-size: 20px; line-height: 1.1; color: var(--c-ink); }
.spot:active { transform: translate(-50%, -50%) translate(3px, 3px); box-shadow: 1px 1px 0 var(--c-ink); }
.spot.is-locked { opacity: .78; box-shadow: none; border-style: dashed; cursor: default; }
.spot-soon { font-family: var(--f-ui); font-size: 13px; color: var(--c-muted); }
@media (max-width: 700px) { .spot { font-size: 14px; min-height: 44px; min-width: 64px; padding: 6px 8px; } .spot-soon { font-size: 11px; } }

/* «мир оживает»: пока зона не спасена, фон приглушён; после награды наливается цветом */
.stage-bg { transition: filter 1.6s ease; }
.stage-bg.is-faded { filter: saturate(.22) contrast(.92) brightness(1.06); }

/* герои с листа стиля Б */
.hero-img { display: block; height: clamp(120px, 24vh, 220px); width: auto; filter: drop-shadow(0 3px 0 rgba(34, 48, 74, .18)); transform-origin: 50% 100%; }
.hero.is-talking .hero-img { animation: hop .42s infinite alternate ease-in-out; }
@keyframes hop { from { transform: translateY(0) rotate(-1deg); } to { transform: translateY(-6px) rotate(1deg); } }
.today-hero.has-img { background: none; border: 0; display: grid; place-items: end center; }
.today-hero.has-img img { height: 84px; width: auto; }
.pyh-badge .pyh-img { height: 64px; width: auto; }
@media (max-width: 700px) { .hero-img { height: 110px; } .today-hero.has-img img { height: 64px; } }

/* бесплатная версия: новые приключения сверх лимита — «завтра» (без цен и слова «купи» в детской зоне) */
.adv.is-tomorrow { background: transparent; border: 2px dashed var(--c-line); box-shadow: none; color: var(--c-muted); }
.sleep-card.is-rest { background: var(--c-card); }
