/* ============================================================
   «Дневник наблюдений» — стили
   Тон раздела тот же, что у «Дороги в школу»: карточка на светлом
   фоне, крупный кегль, ответы кнопками во всю ширину на телефоне.
   ============================================================ */

:root {
  --accent: #3F9E5B;
  --accent2: #8CC63F;
  --ok: #3BC97D;
  --bad: #FF5A6E;
  --ink: #23331F;
  --card: #FFFFFF;
  --soft: #EFF7E9;
  /* фон и акцент погоды — переопределяются из game.js при смене темы */
  --bg1:#EAF6E8; --bg2:#F3F8E4; --bg3:#FFF7E2;
  --theme-accent:#4E9A57;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  font-family: "Naukino Emoji", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 18px;
  color: var(--ink);
  background: linear-gradient(160deg, var(--bg1), var(--bg2) 55%, var(--bg3));
  transition: background .6s ease;
  background-attachment: fixed;
  padding: 72px 12px 40px;
  -webkit-text-size-adjust: 100%;
}

.wrap { max-width: 980px; position: relative; z-index: 1; margin: 0 auto; }

.hidden { display: none !important; }

/* ---------- Карточка-экран ---------- */
.card {
  background: var(--card);
  border-radius: 28px;
  padding: clamp(14px, 3.5vw, 30px);
  box-shadow: 0 14px 34px rgba(35, 51, 31, 0.14);
}

.title {
  font-size: clamp(28px, 6vw, 42px);
  margin: 0 0 10px;
  text-align: center;
  color: var(--accent);
}

.subtitle {
  font-size: clamp(17px, 3.4vw, 21px);
  line-height: 1.45;
  text-align: center;
  margin: 0 0 18px;
}

.section-title {
  font-size: clamp(19px, 3.6vw, 24px);
  text-align: center;
  margin: 20px 0 12px;
}

/* ---------- Наум ---------- */
.hero-panel {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--soft);
  border-radius: 22px;
  padding: 12px 16px;
  margin: 14px 0 6px;
}

.hero-art {
  flex: 0 0 auto;
  width: clamp(64px, 14vw, 96px);
  font-size: clamp(40px, 9vw, 60px);
  line-height: 1;
  text-align: center;
}

.hero-art svg { width: 100%; height: auto; display: block; }

.bubble {
  background: #fff;
  border-radius: 18px;
  padding: 10px 14px;
  font-size: clamp(15px, 3vw, 18px);
  line-height: 1.4;
  box-shadow: 0 4px 12px rgba(35, 51, 31, .1);
}

.hero-panel.compact { padding: 8px 12px; }
.hero-panel.compact .hero-art { width: clamp(52px, 11vw, 74px); }

/* Настроение: качаем слот, лица не трогаем (правило №15). */
.hero-jump { animation: hero-jump .5s ease; }
.hero-shake { animation: hero-shake .4s ease; }
@keyframes hero-jump {
  0%, 100% { transform: translateY(0); }
  40% { transform: translateY(-14px); }
}
@keyframes hero-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  75% { transform: translateX(7px); }
}
@media (prefers-reduced-motion: reduce) {
  .hero-jump, .hero-shake { animation: none; }
}

/* ---------- Выбор маршрута ---------- */
.levels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.level-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: #fff;
  border: 3px solid #DCE9D4;
  border-radius: 20px;
  padding: 14px 12px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color .15s, transform .15s;
}

.level-btn:hover { transform: translateY(-2px); }
.level-btn.active { border-color: var(--accent); background: var(--soft); }
.level-emoji { font-size: 30px; }
.level-name { font-weight: 700; font-size: clamp(17px, 3.2vw, 20px); }
.level-desc { font-size: 14px; text-align: center; opacity: .8; line-height: 1.35; }

/* ---------- Кнопки ---------- */
.big-btn {
  display: block;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 15px 22px;
  font: inherit;
  font-size: clamp(19px, 3.6vw, 23px);
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 0 rgba(0, 0, 0, .13);
}

.big-btn:active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(0, 0, 0, .13); }
.big-btn.ghost { background: #fff; color: var(--accent); border: 3px solid var(--accent); box-shadow: none; }

.mini-btn {
  background: #fff;
  border: 2px solid #DCE9D4;
  border-radius: 14px;
  padding: 7px 12px;
  font: inherit;
  font-size: 15px;
  cursor: pointer;
  color: inherit;
}

.top-buttons {
  position: fixed;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
  z-index: 5;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: #fff;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(35, 51, 31, .18);
}

.icon-btn.off { opacity: .45; }

.exit-btn--float {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 5;
  background: #fff;
  border: none;
  border-radius: 16px;
  padding: 10px 15px;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(35, 51, 31, .18);
}

/* ---------- Шапка раунда ---------- */
.game-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

/* Шапка держится одной строкой: полоса прогресса ужимается, а счёт
   остаётся рядом с ней. Основа в 180 пикселей ужиматься не давала, и на
   телефоне значок дневника сваливался в свой ряд — сорок восемь пустых
   точек по высоте там, где их не хватало на третий вариант ответа. */
.progress-info { flex: 1 1 120px; min-width: 0; font-size: 15px; }
.theme-chip { margin-left: 8px; opacity: .75; }

.progress-bar {
  height: 8px;
  background: #E6EFE0;
  border-radius: 6px;
  overflow: hidden;
  margin-top: 6px;
}

.progress-fill { height: 100%; width: 0; background: var(--accent2); transition: width .3s ease; }

.score-badge {
  background: var(--soft);
  border-radius: 14px;
  padding: 7px 13px;
  font-weight: 700;
  white-space: nowrap;
}

/* ---------- Тропа ---------- */
.route {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
  margin: 0 0 14px;
  padding: 8px 6px;
  background: var(--soft);
  border-radius: 16px;
}

.route-stop {
  flex: 1 1 0;
  text-align: center;
  font-size: clamp(14px, 3vw, 19px);
  opacity: .35;
  transition: opacity .25s, transform .25s;
}

.route-stop.done { opacity: 1; }
.route-stop.now { opacity: 1; transform: scale(1.35); }

/* ---------- Сцена наблюдения ---------- */
/* Ширина ограничена, а не высота: при `max-height` коробка становилась
   шире 16:9, рисунок в неё вписывался с полями по бокам — и нарисованная
   земля обрывалась, не доходя до края сцены. */
.scene {
  position: relative;
  width: 100%;
  margin: 0 auto 14px;
  aspect-ratio: 16 / 9;
  /* Шестьсот пикселей — это ещё и 338 по высоте, а всё остальное
     наблюдение требует 489: на окне ноутбука в 780–800 пикселей третий
     вариант ответа уходил под сгиб, и целиком влезало 11 наблюдений
     из 47. Ширина здесь привязана к высоте окна, а не ограничена
     `max-height`: сцена остаётся 16:9, и земля по-прежнему доходит
     до края. На экране в 1080 пикселей ничего не меняется — там
     шестьсот и так меньше. */
  max-width: min(600px, 60vh);
  border-radius: 22px;
  overflow: hidden;
  background: linear-gradient(180deg, #DCEEF7 0%, #DCEEF7 58%, #CFE3B4 58%, #B7D492 100%);
  /* Встреченный зверь и подпись под ним стоят колонкой, а не наложены
     друг на друга: подпись переносится по словам, и на телефоне
     четыре строки признаков ложились прямо на муравья. */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
}

/* Рисунок растения кладётся под колонку и занимает сцену целиком:
   отступы колонки на него не действуют, иначе земля не дошла бы
   до края. */
.scene svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* Нажимаемая часть растения: обводка появляется по наведению, а не
   постоянно — иначе рисунок читается схемой с пятью рамками. */
.part-zone { cursor: pointer; }
.part-zone .part-hit { fill: transparent; }
.part-zone:hover .part-ring, .part-zone:focus-visible .part-ring { opacity: 1; }
.part-ring { opacity: 0; transition: opacity .15s; pointer-events: none; }
.part-zone.picked .part-ring { opacity: 1; }

/* Встреченное животное: эмодзи стоит крупно, признаки читаются текстом */
.scene-critter {
  font-size: clamp(46px, 12vw, 100px);
  line-height: 1;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .18));
}

.scene-label {
  background: rgba(255, 255, 255, .92);
  border-radius: 14px;
  padding: 6px 14px;
  font-size: clamp(14px, 2.9vw, 17px);
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  /* Подпись переносится по словам: в одну строку признаки вроде
     «шесть ног, тело из трёх частей» на телефоне не влезают и
     обрезаются краем сцены. */
  max-width: 100%;
}

/* ---------- Вопрос и ответы ---------- */
.task-title {
  font-size: clamp(19px, 3.8vw, 25px);
  margin: 0 0 6px;
  text-align: center;
  color: var(--accent);
}

.quest {
  font-size: clamp(16px, 3.3vw, 20px);
  line-height: 1.45;
  text-align: center;
  margin: 0 0 14px;
}

.answers { display: grid; gap: 10px; margin-bottom: 12px; }

@media (min-width: 640px) {
  .answers.cols-2 { grid-template-columns: 1fr 1fr; }
}

.ans {
  background: #fff;
  border: 3px solid #DCE9D4;
  border-radius: 18px;
  padding: 13px 16px;
  font: inherit;
  font-size: clamp(16px, 3.2vw, 19px);
  text-align: left;
  cursor: pointer;
  color: inherit;
  transition: border-color .15s, background .15s;
}

.ans:hover:not(:disabled) { border-color: var(--accent2); }
.ans:disabled { cursor: default; }
.ans.right { border-color: var(--ok); background: #E9FBF1; }
.ans.wrong { border-color: var(--bad); background: #FFECEF; }

/* Разбор ошибки: он и есть смысл задания, поэтому стоит в кнопке,
   а не всплывает подсказкой, которую можно не заметить. */
.ans-why {
  display: block;
  margin-top: 7px;
  font-size: 15px;
  line-height: 1.4;
  opacity: .9;
}

.how-line, .hint-line {
  text-align: center;
  font-size: 14px;
  opacity: .7;
  margin: 8px 0 0;
}

/* ---------- Невысокий экран ---------- */
/* Все варианты ответа обязаны быть видны до ответа: иначе третий вариант
   лежит под сгибом, а ребёнок выбирает из двух и не знает, что был
   третий. На 375×667 из сорока семи наблюдений целиком влезало пять —
   ответы кончались на 749 при высоте 667. Высоту сцены урезать нельзя
   (см. выше про `max-height`), поэтому ужимается всё вокруг неё:
   отступы между блоками, тропа и поля кнопок. Ничего не пропадает —
   уходит только воздух. */
@media (max-height: 700px) {
  body { padding-top: 64px; }
  .route { margin-bottom: 8px; padding: 5px 6px; }
  .route-stop { font-size: clamp(13px, 2.6vw, 17px); }
  .scene { margin-bottom: 8px; }
  .task-title { margin-bottom: 4px; }
  .quest { margin-bottom: 8px; }
  .answers { gap: 8px; }
  /* Не меньше 11 пикселей по вертикали: с десятью короткий вариант
     («Зверь») выходит ровно в 44 пикселя высотой — это нижняя граница
     размера, в который попадают пальцем, а игру эту трогают детские. */
  .ans { padding: 11px 14px; }
}

/* ---------- Дневник ---------- */
.coins-line { text-align: center; font-weight: 700; margin: 0 0 8px; }

.rules {
  list-style: none;
  padding: 0;
  margin: 0 auto;
  max-width: 640px;
  display: grid;
  gap: 6px;
}

.rules li {
  background: var(--soft);
  border-radius: 14px;
  padding: 9px 14px;
  font-size: clamp(15px, 3vw, 17px);
  line-height: 1.4;
}

.rules li.empty { background: none; text-align: center; opacity: .7; }

/* ---------- Результат ---------- */
.stars { text-align: center; font-size: 40px; letter-spacing: 4px; margin-bottom: 6px; }
.result-score { text-align: center; font-size: clamp(17px, 3.4vw, 21px); margin: 0 0 6px; }
.best-line { text-align: center; opacity: .8; font-size: 16px; margin: 6px 0 0; }

.result-buttons { display: grid; gap: 10px; margin-top: 16px; }

.parents { margin-top: 18px; }
.parents summary { cursor: pointer; font-weight: 700; }
.parents-body { font-size: 16px; line-height: 1.5; margin-top: 8px; }
.parents-body p { margin: 0 0 8px; }

/* ---------- Погода прогулки ---------- */
.theme-deco {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.drop {
  position: absolute;
  width: 2px;
  height: 16px;
  background: rgba(120, 170, 210, .55);
  animation: fall linear infinite;
}

.flake {
  position: absolute;
  color: #fff;
  font-size: 15px;
  animation: fall linear infinite;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .18);
}

@keyframes fall {
  from { transform: translateY(-40px); }
  to { transform: translateY(105vh); }
}

.haze {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, .38);
}

.sunray {
  position: absolute;
  top: -20%;
  width: 42vw;
  height: 140vh;
  background: linear-gradient(180deg, rgba(255, 236, 170, .5), rgba(255, 236, 170, 0));
  transform: rotate(14deg);
}

@media (prefers-reduced-motion: reduce) {
  .drop, .flake { animation: none; display: none; }
}

/* ---------- Конфетти ---------- */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 9; overflow: hidden; }

.conf {
  position: absolute;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  animation: conf-fall 1.5s linear forwards;
}

@keyframes conf-fall {
  to { transform: translateY(105vh) rotate(540deg); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) { .conf { display: none; } }
