/* Списки и диалоги листаются пальцем и колесом без видимых полос. */
* { scrollbar-width: none; }
*::-webkit-scrollbar { display: none; width: 0; height: 0; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: #a8dcf5;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  font-family: "Trebuchet MS", "Segoe UI", Roboto, Arial, sans-serif;
}
#game { position: fixed; inset: 0; }
#game canvas { display: block; touch-action: none; }

#hud {
  position: fixed; left: 0; right: 0; top: 0;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 10px 12px 0;
  pointer-events: none;
}
#coins {
  background: rgba(0, 0, 0, .45); color: #fff; font-weight: 800; font-size: 24px;
  padding: 6px 16px 6px 10px; border-radius: 999px;
  display: flex; align-items: center; gap: 6px;
}
#coins.bump { animation: bump .18s ease-out; }
@keyframes bump { 50% { transform: scale(1.15); } }
#stars {
  background: rgba(0, 0, 0, .45); color: #ffd54a; font-weight: 800; font-size: 18px;
  padding: 6px 12px; border-radius: 14px; min-width: 110px; letter-spacing: 2px;
}
#right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
#btnRow { display: flex; gap: 8px; }
.roundBtn {
  pointer-events: auto; cursor: pointer; border: 0; border-radius: 50%;
  width: 44px; height: 44px; font-size: 20px; line-height: 44px; padding: 0;
  background: rgba(0, 0, 0, .45); color: #fff;
}
#starBar { height: 8px; background: rgba(255, 255, 255, .25); border-radius: 4px; margin-top: 4px; overflow: hidden; }
#starFill { height: 100%; width: 0; background: #ffd54a; transition: width .3s; }

#hint {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: rgba(255, 255, 255, .94); color: #2b3a1f; font-weight: 800; font-size: 20px;
  padding: 10px 18px; border-radius: 16px; box-shadow: 0 4px 0 rgba(0, 0, 0, .18);
  pointer-events: none; text-align: center; max-width: 86vw;
  opacity: 0; transition: opacity .25s;
}
#hint.on { opacity: 1; }

#labels, #fx { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.padLabel {
  position: absolute; left: 0; top: 0;
  background: rgba(255, 255, 255, .95); border-radius: 12px; padding: 3px 10px 4px;
  text-align: center; font-weight: 800; color: #333; box-shadow: 0 3px 0 rgba(0, 0, 0, .2);
  white-space: nowrap; font-size: 13px; line-height: 1.15;
}
.padLabel .ic { font-size: 22px; }
.padLabel .pr { color: #c77700; font-size: 16px; }
.padLabel.ok { background: #eaffe6; }
.padLabel.ok .pr { color: #1f9d2f; }

.float {
  position: absolute; font-weight: 900; font-size: 24px; color: #ffd54a;
  text-shadow: 0 2px 0 #7a4b00, 0 0 4px rgba(0, 0, 0, .4);
  transform: translate(-50%, -50%); white-space: nowrap;
  animation: rise .9s ease-out forwards;
}
.float.small { font-size: 16px; color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .5); }
@keyframes rise { from { opacity: 1; margin-top: 0; } to { opacity: 0; margin-top: -60px; } }

#joy {
  position: fixed; width: 110px; height: 110px; margin: -55px 0 0 -55px;
  border-radius: 50%; background: rgba(255, 255, 255, .18); border: 3px solid rgba(255, 255, 255, .5);
  pointer-events: none; display: none; box-sizing: border-box;
}
#joyKnob {
  position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; margin: -24px 0 0 -24px;
  border-radius: 50%; background: rgba(255, 255, 255, .8);
}

#toast {
  position: fixed; left: 50%; top: 66px;
  transform: translateX(-50%) scale(.9);
  background: #ffcf33; color: #4a2c00; font-weight: 900; font-size: 19px;
  padding: 10px 18px; border-radius: 16px; box-shadow: 0 4px 0 rgba(0, 0, 0, .2);
  opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none;
  text-align: center; max-width: 88vw;
}
#toast.on { opacity: 1; transform: translateX(-50%) scale(1); }

#modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: flex; align-items: center; justify-content: center; z-index: 10; }
#modal.hidden { display: none; }
#modal .box { background: #fff; border-radius: 20px; padding: 22px; max-width: 320px; margin: 0 16px; text-align: center; font-weight: 700; font-size: 18px; color: #333; }
#modal button {
  margin-top: 16px; font: inherit; font-weight: 900; background: #4caf50; color: #fff; border: 0;
  border-radius: 14px; padding: 12px 24px; font-size: 20px; box-shadow: 0 4px 0 #2e7d32; cursor: pointer;
}

/* окно загрузки (эскиз A, решение Сергея 29.11): бирюзовый фон и лучи как на обложке, логотип, монетки, полоска в цветах логотипа, советы */
#loading {
  position: fixed; inset: 0; z-index: 20; overflow: hidden; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 40%, #8af7fb 0%, #14e4eb 40%, #00b7cf 100%); transition: opacity .55s ease;
}
#loading.done { opacity: 0; pointer-events: none; }
.ldRays {
  position: absolute; left: 50%; top: 40%; width: 260vmax; height: 260vmax; margin: -130vmax 0 0 -130vmax;
  background: repeating-conic-gradient(rgba(255, 255, 255, .17) 0 8deg, rgba(255, 255, 255, 0) 8deg 16deg);
  -webkit-mask: radial-gradient(circle, #000 0 10%, transparent 42%); mask: radial-gradient(circle, #000 0 10%, transparent 42%);
  animation: ldSpin 50s linear infinite;
}
@keyframes ldSpin { to { transform: rotate(360deg); } }
.ldCoin {
  position: absolute; bottom: -60px; border-radius: 50%; opacity: .95; animation: ldRise linear infinite;
  background: radial-gradient(circle at 35% 30%, #fff6b0 0 18%, #ffd21f 19% 62%, #e89a00 63%);
  box-shadow: inset 0 -3px 0 rgba(160, 90, 0, .45), 0 3px 6px rgba(0, 60, 90, .25);
}
.ldCoin::after { content: ''; position: absolute; inset: 22%; border-radius: 50%; border: 2px solid rgba(190, 110, 0, .55); }
@keyframes ldRise { from { transform: translateY(0) rotate(0); } to { transform: translateY(-115vh) rotate(540deg); } }
.ldCenter { position: relative; display: flex; flex-direction: column; align-items: center; padding: 0 12px; }
.ldLogo {
  width: min(560px, 74vw, 62vh * 1.3); height: auto; user-select: none;
  filter: drop-shadow(0 16px 20px rgba(0, 70, 100, .35)); animation: ldBob 2.6s ease-in-out infinite;
}
@keyframes ldBob { 0%, 100% { transform: translateY(0) rotate(-1.2deg); } 50% { transform: translateY(-12px) rotate(1.2deg); } }
.ldTitle { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } /* название — в картинке; текст — для читалок */
.ldBar {
  position: relative; width: min(540px, 80vw); height: 38px; margin-top: 30px; box-sizing: border-box; padding: 6px;
  border-radius: 999px; background: #0f2b6e; box-shadow: 0 7px 0 rgba(0, 50, 90, .35);
}
.ldFill {
  height: 100%; width: 4%; border-radius: 999px; transition: width .25s ease;
  background: repeating-linear-gradient(-45deg, rgba(255, 255, 255, .22) 0 12px, rgba(255, 255, 255, 0) 12px 24px), linear-gradient(#ffe766, #ffc61f 55%, #ff9d0a);
  background-size: 34px 34px, 100% 100%; animation: ldStripes .7s linear infinite; box-shadow: inset 0 3px 0 rgba(255, 255, 255, .6);
}
@keyframes ldStripes { to { background-position: 34px 0, 0 0; } }
.ldPct { position: absolute; right: 18px; top: 0; bottom: 0; display: flex; align-items: center; color: #fff; font-weight: 900; font-size: 18px; text-shadow: 0 2px 0 #0f2b6e; }
.ldText { display: none; } /* слово «загрузка» не показываем — видно полоску и проценты; строка нужна для ошибки */
.ldText.err { display: block; margin-top: 12px; color: #c62828; background: #fff; padding: 6px 12px; border-radius: 10px; max-width: 80vw; text-align: center; font-size: 14px; font-weight: 700; }
.ldTip {
  margin-top: 24px; max-width: min(560px, 84vw); box-sizing: border-box; padding: 12px 20px; border-radius: 20px; min-height: 50px;
  background: rgba(255, 255, 255, .94); color: #0f2b6e; font-weight: 750; font-size: 18px; line-height: 1.3;
  box-shadow: 0 6px 0 rgba(0, 60, 90, .22); display: flex; align-items: center; gap: 12px; transition: opacity .3s;
}
.ldTip b { flex: none; font-size: 24px; }
@media (max-width: 600px), (max-height: 520px) {
  .ldBar { height: 30px; margin-top: 18px; padding: 5px; } .ldPct { font-size: 15px; right: 14px; }
  .ldTip { font-size: 15px; padding: 9px 14px; margin-top: 16px; }
}
#debug {
  position: fixed; left: 8px; bottom: 8px; color: #fff; background: rgba(0, 0, 0, .55);
  font: 12px monospace; padding: 4px 6px; border-radius: 6px; display: none; pointer-events: none;
}

/* окна поверх игры */
.overlay { position: fixed; inset: 0; background: rgba(20, 40, 20, .55); display: flex; align-items: center; justify-content: center; z-index: 12; }
.overlay.hidden, .hidden { display: none !important; }
.introBox {
  width: min(92vw, 440px); margin-top: 70px; background: #fffdf3; border-radius: 24px;
  padding: 14px 18px 20px; box-shadow: 0 8px 0 rgba(0, 0, 0, .2); text-align: center;
  animation: popin .35s ease-out; box-sizing: border-box;
}
.portrait {
  width: 132px; height: 132px; margin: -84px auto 6px; border-radius: 50%;
  border: 5px solid #fff; box-shadow: 0 4px 0 rgba(0, 0, 0, .2); overflow: hidden; background: #cdeec0;
}
.who { font-weight: 900; color: #33691e; font-size: 19px; margin-bottom: 10px; }
.speech {
  display: grid; text-align: left; font-size: 17px; line-height: 1.4; color: #333; font-weight: 700;
  background: #fff; border-radius: 16px; padding: 12px 14px; border: 2px solid #e6e0c8;
  white-space: pre-line;
}
.speech .ghost, .speech .typed { grid-area: 1 / 1; }
.speech .ghost { visibility: hidden; }
.caret { color: #7cb342; animation: blink .8s steps(1) infinite; }
.speech.done .caret { display: none; }
@keyframes blink { 50% { opacity: 0; } }
@keyframes popin { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.bigBtn {
  margin-top: 16px; font: inherit; font-weight: 900; font-size: 22px; color: #fff; cursor: pointer;
  background: #4caf50; border: 0; border-radius: 16px; padding: 13px 34px; box-shadow: 0 5px 0 #2e7d32;
}
.bigBtn:disabled { opacity: .45; filter: grayscale(.5); cursor: default; transform: none; box-shadow: 0 5px 0 #2e7d32; }
.bigBtn:not(:disabled):active, .midBtn:active { transform: translateY(3px); box-shadow: none; }
.menuBox { width: min(86vw, 320px); box-sizing: border-box; animation: popin .25s ease-out; background: #fff; border-radius: 20px; padding: 22px; text-align: center; }
.menuBox .title { font-size: 26px; font-weight: 900; color: #33691e; }
.menuBox .bigBtn { width: 100%; }
.midBtn {
  display: block; width: 100%; margin-top: 12px; font: inherit; font-weight: 800; font-size: 18px; cursor: pointer;
  color: #33402a; background: #eef3e6; border: 0; border-radius: 14px; padding: 11px; box-shadow: 0 4px 0 #c9d4b8;
}
.midBtn.danger { color: #fff; background: #e53935; box-shadow: 0 4px 0 #b71c1c; }
#resetConfirm .warn { margin: 14px 0 4px; font-size: 17px; color: #b71c1c; font-weight: 800; } /* только в меню паузы: у шкалы настроения тоже есть класс warn */

/* невысокие экраны (телефон с панелями браузера): окно смотрителя компактнее */
@media (max-height: 720px) {
  .introBox { margin-top: 52px; padding: 10px 14px 14px; }
  .portrait { width: 96px; height: 96px; margin-top: -62px; }
  .who { font-size: 17px; margin-bottom: 6px; }
  .speech { font-size: 15px; line-height: 1.32; padding: 9px 11px; }
  .bigBtn { margin-top: 12px; font-size: 20px; padding: 11px 28px; }
}

/* панель отладки (Tab) */
#dbg {
  position: fixed; left: 10px; top: 70px; z-index: 11; pointer-events: auto;
  background: rgba(20, 20, 30, .85); color: #fff; border-radius: 12px; padding: 10px 12px;
  font: 13px/1.4 "Segoe UI", Arial, sans-serif; max-width: 92vw;
}
#dbg .dbgTitle { font-weight: 800; margin-bottom: 6px; }
#dbg .dbgTitle span { font-weight: 400; opacity: .6; }
#dbg .dbgRow { margin: 6px 0; display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
#dbg button {
  font: inherit; font-weight: 700; color: #fff; background: #3a4a5c; border: 0; border-radius: 8px;
  padding: 5px 9px; cursor: pointer;
}
#dbg button.on { background: #f0a020; color: #222; }
#dbg button:active { transform: translateY(1px); }
#dbgInfo { margin-top: 6px; opacity: .85; white-space: pre-line; font-family: Consolas, monospace; font-size: 12px; }

/* таймер игры вверху по центру (для тестов прототипа) */
#timer {
  position: fixed; left: 50%; top: 12px; transform: translateX(-50%);
  background: rgba(0, 0, 0, .45); color: #fff; font-weight: 800; font-size: 18px;
  padding: 5px 14px; border-radius: 999px; pointer-events: none; font-variant-numeric: tabular-nums;
}
#timer .x { color: #ffb74d; margin-left: 6px; }

/* сколько корма в кормушке */
.feedLabel {
  position: absolute; left: 0; top: 0; white-space: nowrap;
  font-weight: 900; font-size: 13px; padding: 2px 7px; border-radius: 999px;
  background: rgba(255, 255, 255, .92); color: #2e7d32; box-shadow: 0 2px 0 rgba(0, 0, 0, .2);
}
.feedLabel.low { color: #c77700; }
.feedLabel.empty { color: #fff; background: #e53935; }

/* окно «С возвращением» и строка «Завтра» */
#welcomeText { display: block; }
#welcomeText .ln { margin: 4px 0; }
#welcomeText .big { font-size: 19px; color: #2e7d32; font-weight: 900; }
#welcomeText .note { color: #8a6d00; }
.tomorrow { margin: 10px 0 2px; padding: 8px 10px; border-radius: 12px; background: #fff7d6; color: #6d5200; font-weight: 800; font-size: 15px; }

/* шкала настроения гостей под часами */
#mood {
  position: fixed; left: 50%; top: 50px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px; pointer-events: none;
  background: rgba(0, 0, 0, .45); padding: 4px 10px 4px 6px; border-radius: 999px;
}
#moodFace { font-size: 20px; line-height: 1; }
#moodBar { width: 110px; height: 10px; border-radius: 5px; background: rgba(255, 255, 255, .25); overflow: hidden; }
#moodFill { height: 100%; width: 50%; background: #f2c230; transition: width .3s, background-color .3s; }
#moodVal { color: #fff; font-weight: 800; font-size: 14px; min-width: 34px; text-align: right; font-variant-numeric: tabular-nums; }
#mood.warn { animation: moodwarn .8s ease-in-out infinite; }
@keyframes moodwarn { 50% { background: rgba(200, 30, 30, .75); } }
.loseText { margin: 10px 0 4px; font-size: 16px; color: #444; font-weight: 700; }


/* подпись под значком 🍼 */
.babyLabel {
  position: absolute; left: 0; top: 0; white-space: nowrap;
  font-weight: 900; font-size: 12px; padding: 2px 8px; border-radius: 999px;
  background: #ffe4f0; color: #c2185b; box-shadow: 0 2px 0 rgba(0, 0, 0, .2);
}

/* плашка стройки над вольером */
.buildLabel {
  position: absolute; left: 0; top: 0; width: 150px; text-align: center;
  background: rgba(255, 255, 255, .95); border-radius: 12px; padding: 6px 8px 8px;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .2); font-weight: 900; color: #5d4037; font-size: 14px;
}
.buildLabel .bt span { color: #e65100; font-variant-numeric: tabular-nums; }
.buildLabel .bbar { height: 9px; margin: 5px 0 7px; border-radius: 5px; background: #ffe0b2; overflow: hidden; }
.buildLabel .bbar div { height: 100%; width: 0; background: #ff9800; }

/* реплики гостей под эмодзи */
.say {
  position: absolute; left: 0; top: 0; white-space: nowrap; pointer-events: none;
  background: #fff; color: #5d2a1a; font-weight: 800; font-size: 13px;
  padding: 3px 9px; border-radius: 10px; box-shadow: 0 2px 0 rgba(0, 0, 0, .2);
}
.say.good { color: #1b5e20; background: #f1ffe9; }

/* подсказка к шкале настроения: наведение мышью или касание */
#mood { pointer-events: auto; cursor: help; }
#moodTip {
  position: fixed; left: 50%; top: 88px; transform: translateX(-50%);
  z-index: 6; background: rgba(255, 255, 255, .97); border-radius: 12px; padding: 8px 12px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .2); font-size: 13px; font-weight: 700; color: #333;
  max-width: 86vw; text-align: left; pointer-events: none; line-height: 1.45;
}
#moodTip b { color: #33691e; font-size: 14px; }
#moodTip .down { color: #c62828; }
#moodTip .up { color: #2e7d32; }
#moodTip .warn0 { color: #6d4c41; font-size: 12px; margin-top: 2px; }

/* круг покупки, который пока нельзя купить (идёт другая стройка) */
.padLabel .note { display: none; font-size: 11px; color: #8d6e63; font-weight: 700; }
.padLabel.locked { background: #e0e0e0; color: #8a8a8a; }
.padLabel.locked .pr { color: #9e9e9e; }
.padLabel.locked .ic { filter: grayscale(1); opacity: .6; }
.padLabel.locked .note { display: block; }

/* версия игры — в правом нижнем углу на ПК */
#version {
  position: fixed; right: 8px; bottom: 6px; pointer-events: none; z-index: 3;
  font: 600 12px "Trebuchet MS", Arial, sans-serif; color: rgba(255, 255, 255, .85);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .5);
}
@media (pointer: coarse) { #version { display: none; } }

/* фоторежим (только ПК): игра на паузе, камеру можно крутить, интерфейс спрятан */
@media (pointer: coarse) { #photoBtn { display: none; } }
body.photo #hud, body.photo #timer, body.photo #mood, body.photo #moodTip, body.photo #labels,
body.photo #hint, body.photo #toast, body.photo #fx, body.photo #version, body.photo #dbg, body.photo #debug { display: none !important; }
#photoBar {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 15;
  display: flex; align-items: center; gap: 10px; background: rgba(0, 0, 0, .55); color: #fff;
  padding: 8px 12px; border-radius: 14px; font: 700 13px "Trebuchet MS", Arial, sans-serif; white-space: nowrap;
}
#photoBar button {
  font: inherit; font-size: 15px; font-weight: 900; border: 0; border-radius: 10px; padding: 8px 14px; cursor: pointer;
  background: #fff; color: #333; box-shadow: 0 3px 0 rgba(0, 0, 0, .3);
}
#photoBar #photoShot { background: #ffcf33; color: #4a2c00; }
#photoBar span { opacity: .8; font-weight: 600; }
#photoFlash { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 16; transition: opacity .35s; }
#photoFlash.on { opacity: .85; transition: none; }

/* звёзды зоопарка пока скрыты (механика работает: больше гостей, подарок дня × звёзды) */
#stars { display: none; }

/* ===== телефон: верх в три ряда (монеты · таймер · кнопки / настроение / уведомление), текст меньше, без наложений ===== */
@media (pointer: coarse), (max-width: 600px) {
  #hud { padding: 8px 8px 0; }
  #coins { font-size: 18px; padding: 4px 12px 4px 8px; }
  .roundBtn { width: 38px; height: 38px; font-size: 17px; line-height: 38px; }
  #btnRow { gap: 6px; }
  #timer { top: 12px; font-size: 14px; padding: 4px 10px; }
  #mood { top: 54px; padding: 3px 8px 3px 5px; }
  #moodBar { width: 90px; }
  #moodFace { font-size: 17px; }
  #moodVal { font-size: 12px; }
  #toast {
    top: 88px; font-size: 13px; padding: 5px 10px;
    border-radius: 10px; max-width: 72vw; box-shadow: 0 3px 0 rgba(0, 0, 0, .2);
  }
  #hint { font-size: 14px; padding: 6px 12px; border-radius: 12px; max-width: 78vw; bottom: calc(16px + env(safe-area-inset-bottom)); }
  #moodTip { top: 84px; }
}

/* интерфейс (монеты, таймер, кнопки, настроение, уведомления, подсказка) всегда поверх подписей над игровыми объектами */
#labels, #fx { z-index: 1; }
#hud, #timer, #mood, #moodTip, #toast, #hint, #version { z-index: 4; }
#btnRow, .roundBtn { position: relative; z-index: 4; }
@media (pointer: coarse), (max-width: 600px) {
  .padLabel { font-size: 11px; padding: 2px 8px 3px; border-radius: 10px; }
  .padLabel .ic { font-size: 17px; }
  .padLabel .pr { font-size: 13px; }
  .padLabel .note { font-size: 10px; white-space: normal; max-width: 140px; }
}

/* ПК: уведомление ниже шкалы настроения (раньше наезжало на неё) */
#toast { top: 84px; }
@media (pointer: coarse), (max-width: 600px) { #toast { top: 88px; } }

/* Саванна: крупная надпись «Лев в зоопарке!» и «Р-Р-Р!» */
#banner {
  position: fixed; left: 50%; top: 26%; transform: translate(-50%, -50%); text-align: center;
  pointer-events: none; opacity: 0; z-index: 8;
}
#banner.on { animation: ban 2.6s ease-out forwards; }
#banner .t { font-size: 46px; font-weight: 900; color: #ffd54a; text-shadow: 0 4px 0 #7a4b00, 0 0 14px rgba(0, 0, 0, .35); white-space: nowrap; }
#banner .s { font-size: 20px; font-weight: 800; color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .55); margin-top: 6px; }
@keyframes ban {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.4); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  20% { transform: translate(-50%, -50%) scale(1); }
  85% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}
.float.big { font-size: 40px; color: #fff3c4; text-shadow: 0 3px 0 #8d4a1a, 0 0 8px rgba(0, 0, 0, .4); }
@media (pointer: coarse), (max-width: 600px) {
  #banner .t { font-size: 30px; }
  #banner .s { font-size: 15px; }
}

/* выбор языка в меню паузы */
#langBtn { display: flex; align-items: center; justify-content: center; gap: 8px; }
#langBtn .flag { flex: none; }
.langPill {
  display: flex; align-items: center; gap: 8px; font: inherit; font-weight: 800; font-size: 15px; cursor: pointer;
  color: #33402a; background: #eef3e6; border: 2px solid transparent; border-radius: 999px; padding: 5px 10px 5px 5px;
  box-shadow: 0 3px 0 #c9d4b8; text-align: left; min-width: 0;
}
.langPill .flag { flex: none; }
.langPill.on { background: #fff; border-color: #4caf50; box-shadow: 0 3px 0 #2e7d32; }
.langPill:active { transform: translateY(2px); box-shadow: none; }

/* без таймера (у игрока; таймер — только с ?debug): шкала настроения встаёт на его место, уведомление и подсказка — выше */
body.noTimer #timer { display: none; }
body.noTimer #mood { top: 12px; }
body.noTimer #moodTip { top: 62px; }
body.noTimer #toast { top: 62px; }
@media (pointer: coarse), (max-width: 600px) { /* телефон: узкая шкала в верхнем ряду, между монетами и кнопками */
  body.noTimer #mood {
    top: 16px; left: calc(50% - 6px);
    gap: 4px; padding: 2px 6px 2px 4px;
  }
  body.noTimer #moodFace { font-size: 15px; }
  body.noTimer #moodBar { width: 40px; height: 8px; }
  body.noTimer #moodVal { font-size: 11px; min-width: 0; }
  body.noTimer #moodTip { top: 54px; }
  body.noTimer #toast { top: 54px; }
}

/* окно смотрителя: «Пропустить» и «Продолжить» в один ряд */
.introBtns { display: flex; gap: 10px; align-items: stretch; justify-content: center; margin-top: 16px; }
.introBtns .bigBtn { margin-top: 0; flex: 1.4; padding-left: 14px; padding-right: 14px; }
.introBtns .midBtn { margin-top: 0; width: auto; flex: 1; font-size: 17px; }
@media (max-height: 720px) { .introBtns { margin-top: 12px; } }

/* Компактные диалоги для невысоких экранов. */
@media (max-height: 540px) {
  .menuBox { padding: 14px 18px; }
  .menuBox .title { font-size: 22px; }
  .menuBox .bigBtn { margin-top: 10px; padding: 9px 20px; font-size: 20px; }
  .menuBox .midBtn { margin-top: 8px; padding: 8px; font-size: 16px; }
}

/* портрет смотрителя — картинка, обрезанная по кругу рамкой .portrait */
.portrait img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }

/* кнопка «Выйти» из джипа: справа внизу, под большой палец */
#jeepBtn {
  position: fixed; right: calc(20px + env(safe-area-inset-right)); bottom: calc(46px + env(safe-area-inset-bottom)); z-index: 5;
  width: 84px; height: 84px; border: 4px solid #fff; border-radius: 50%; cursor: pointer; padding: 0;
  background: #f9a825; color: #fff; box-shadow: 0 5px 0 rgba(0, 0, 0, .3); touch-action: manipulation;
  display: flex; flex-direction: column; align-items: center; justify-content: center; font: 800 13px "Trebuchet MS", Arial, sans-serif; text-shadow: 0 1px 2px rgba(0, 0, 0, .5);
}
#jeepBtn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, .3); }
#jeepBtn .jIc { font-size: 30px; line-height: 34px; }
#jeepBtn .jTx { max-width: 76px; overflow: hidden; white-space: nowrap; }
#jeepBtn .jKey { display: none; position: absolute; right: -6px; top: -6px; width: 26px; height: 26px; line-height: 26px; border-radius: 8px; background: #fff; color: #333; text-shadow: none; font-size: 15px; }
#jeepBtn.keys .jKey { display: block; }
body.photo #jeepBtn { display: none !important; }

/* питомник и альбом редких зверей */
.babyLabel.nur { background: #d7f5ef; color: #00695c; font-size: 13px; }
.nurBox { width: min(96vw, 660px); min-height: 340px; max-height: min(92vh, 620px); display: flex; flex-direction: column; background: #fffdf3; border-radius: 22px; overflow: hidden; box-shadow: 0 8px 0 rgba(0, 0, 0, .2); animation: popin .25s ease-out; }
.nurHead { display: flex; align-items: center; gap: 10px; padding: 10px 12px 8px 16px; background: #00897b; color: #fff; }
.nurHead b { flex: 1; font-size: 20px; font-weight: 900; }
#nurCoins { font-weight: 900; font-size: 16px; white-space: nowrap; font-variant-numeric: tabular-nums; }
#nurX { font: inherit; font-size: 20px; font-weight: 900; line-height: 1; width: 40px; height: 40px; border: 0; border-radius: 12px; background: rgba(255, 255, 255, .2); color: #fff; cursor: pointer; }
#nurTabs { display: flex; gap: 6px; padding: 8px 12px 0; background: #00897b; }
#nurTabs button { flex: 1; font: inherit; font-weight: 900; font-size: 16px; padding: 9px 4px; border: 0; border-radius: 12px 12px 0 0; background: #00695c; color: #cfeee8; cursor: pointer; }
#nurTabs button.on { background: #fffdf3; color: #00695c; }
#nurBody { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 12px 14px; touch-action: pan-y; overscroll-behavior: contain; }
#nurBody * { touch-action: pan-y; }
.nurNote { text-align: center; font-weight: 700; font-size: 14px; color: #6b6353; margin: 2px 6px 8px; }
.nurNest { display: flex; align-items: center; gap: 10px; background: #fff; border: 2px solid #e6e0c8; border-radius: 16px; padding: 8px 10px; margin-bottom: 8px; }
.nurNest.off { opacity: .6; }
.nurNest.full { background: #fff8dc; border-color: #f2d57a; }
.nurIc { width: 60px; text-align: center; font-size: 42px; line-height: 60px; flex: none; }
.nurIc.wob { animation: nurWob .5s ease-in-out infinite; }
@keyframes nurWob { 25% { transform: rotate(-10deg); } 75% { transform: rotate(10deg); } }
.nurImg { width: 60px; height: 60px; border-radius: 12px; background: #dff3d0; flex: none; display: block; }
.nurTx { flex: 1; min-width: 0; }
.nurTx b { font-size: 17px; font-weight: 900; color: #33402a; }
.nurSub { font-size: 13px; font-weight: 700; color: #6b6353; }
.nurBar { height: 9px; border-radius: 5px; background: #d7efe9; overflow: hidden; margin-top: 5px; }
.nurBar div { height: 100%; background: #26a69a; }
.nurBtn { flex: none; font: inherit; font-weight: 900; font-size: 15px; border: 0; border-radius: 12px; padding: 10px 12px; cursor: pointer; white-space: nowrap; color: #fff; background: #4caf50; box-shadow: 0 4px 0 #2e7d32; }
.nurBtn.back { display: block; color: #33402a; background: #eef3e6; box-shadow: 0 4px 0 #c9d4b8; margin-bottom: 12px; padding: 8px 16px; }
.nurBtn:disabled { opacity: .45; filter: grayscale(.5); cursor: default; }
.nurBtn:not(:disabled):active { transform: translateY(3px); box-shadow: none; }
.nurDots { display: flex; gap: 5px; margin: 3px 0 2px; }
.nurDots i { width: 14px; height: 14px; border-radius: 50%; box-sizing: border-box; border: 2px solid #cfc8b2; }
.nurDots i.c-ice.on { background: #9fb6dc; border-color: #6f8dbd; }
.nurDots i.c-gold.on { background: #ffc531; border-color: #d99800; }
.nurDots i.c-rainbow.on { background: linear-gradient(135deg, #ff5a5a, #ffd23f, #4cd07d, #4aa8ff, #b56bff); border-color: #8e5bd0; }
.nurLegend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-bottom: 10px; }
.nurLegend span, .nurTag { font-size: 13px; font-weight: 900; padding: 4px 10px; border-radius: 999px; background: #eee6cf; color: #5d4037; }
.nurLegend .c-ice, .nurTag.c-ice { background: #cfdcf2; color: #34507f; }
.nurLegend .c-gold, .nurTag.c-gold { background: #ffe08a; color: #7a5200; }
.nurLegend .c-rainbow, .nurTag.c-rainbow { background: linear-gradient(90deg, #ffc9c9, #fff0b0, #c9f5d8, #cfe6ff, #ead5ff); color: #5b2f8f; }
.nurGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.nurSp { background: #fff; border: 2px solid #e6e0c8; border-radius: 16px; padding: 6px 10px 10px; }
.nurSp.full { background: #fff8dc; border-color: #f2c94c; }
.nurName { font-weight: 900; font-size: 15px; color: #33402a; margin-bottom: 4px; }
.nurCards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.nurCards .nurImg { width: 100%; height: auto; aspect-ratio: 1; box-sizing: border-box; border: 3px solid #bfe3a8; }
.nurCards .nurImg.c-ice { border-color: #9fb6dc; }
.nurCards .nurImg.c-gold { border-color: #f2b705; }
.nurCards .nurImg.c-rainbow { border-color: #b56bff; }
.nurCards .nurImg.hid { filter: grayscale(1) contrast(.7) brightness(.7); opacity: .45; border-style: dashed; }
.nurReveal { min-height: 330px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; }
.nurEgg { font-size: 110px; line-height: 1; animation: nurWob .28s ease-in-out infinite; }
.nurCard { position: relative; animation: popin .4s ease-out; }
.nurCard .nurImg { width: 172px; height: 172px; border-radius: 26px; border: 6px solid #bfe3a8; box-sizing: border-box; }
.nurReveal.c-ice .nurImg { border-color: #9fb6dc; box-shadow: 0 0 36px #9fb6dc; }
.nurReveal.c-gold .nurImg { border-color: #f2b705; box-shadow: 0 0 44px #ffc531; }
.nurReveal.c-rainbow .nurImg { border-color: #b56bff; box-shadow: 0 0 50px #d58bff; }
.nurBig { font-size: 26px; font-weight: 900; color: #33402a; }
.nurReveal .nurTag { font-size: 17px; padding: 6px 16px; }
.nurReveal .nurSub { font-size: 15px; max-width: 420px; }
.nurReveal .nurBtn { margin-top: 8px; font-size: 20px; padding: 12px 40px; }
@media (max-width: 480px) {
  .nurBtn { font-size: 13px; padding: 9px 9px; }
  .nurNest { gap: 7px; padding: 7px 8px; }
  .nurImg, .nurIc { width: 50px; height: 50px; }
  .nurIc { font-size: 34px; line-height: 50px; }
  .nurTx b { font-size: 15px; }
  .nurSub { font-size: 12px; }
}

/* Верхняя панель располагается от верхнего края игрового WebView. */
#hud { padding-top: 8px; }
.roundBtn { width: 44px; height: 44px; line-height: 44px; }
@media (max-width: 430px) {
  #coins { max-width: 48vw; overflow-wrap: anywhere; }
  #coins .ico { flex: none; }
  body.noTimer #mood { top: 61px; left: 50%; }
  body.noTimer #moodTip, body.noTimer #toast { top: 91px; }
}
#lose .menuBox, #modal .box {
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  box-sizing: border-box;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
.menuBox button, #modal .box button { white-space: normal; overflow-wrap: anywhere; }
[hidden], [data-invite-replaced="1"] { display: none !important; }
.mobdev-invite-row { margin: 12px 0 4px; }
.mobdev-invite-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; max-width: 100%; padding: 8px 14px;
  border: 0; border-radius: 12px; box-shadow: 0 3px 0 #c0d8a8;
  color: #274618; background: #e5f1d9; font: inherit; font-weight: 800; cursor: pointer;
}
.mobdev-invite-button svg { flex: none; }
.ldLogo {
  display: block; width: min(620px, 85vw, 105dvh); height: auto;
  border-radius: 16px; animation: none;
}


/* Пауза. Высота карточки складывается из рядов кнопок и подсказки. */
#pause .menuBox {
  width: min(440px, calc(100vw - 20px));
  padding: 16px;
  overflow: hidden;
  overflow: clip;
  scale: var(--pause-scale, 1);
  touch-action: none;
}
#pause .title { margin-bottom: 10px; line-height: 1.15; }
#pauseMain, #resetConfirm, #langGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
#tomorrow, #resumeBtn, #pauseMain .mobdev-invite-row, #resetConfirm .warn {
  grid-column: 1 / -1;
}
#pause #tomorrow { margin: 0; padding: 6px 8px; }
#pause button {
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 7px 8px;
  font-size: 16px;
  line-height: 1.12;
}
#pause #resumeBtn { font-size: 19px; }
#pause #langBtn { gap: 5px; }
#langBtn span, .langPill span { min-width: 0; }
#pause #resetConfirm .warn { margin: 0; }
#pause #langBack { margin-top: 8px; }
#pauseMain .mobdev-invite-row { margin: 0; }
#pauseMain .mobdev-invite-button { width: 100%; }

@media (max-height: 490px) {
  #pause .menuBox { padding: 10px; }
  #pause .title { margin-bottom: 6px; }
  #pauseMain, #resetConfirm, #langGrid { gap: 6px; }
  #pause #tomorrow { font-size: 13px; }
}
@media (min-width: 390px) and (max-height: 490px) {
  #pause .menuBox { width: min(640px, calc(100vw - 24px)); }
  #pauseMain { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #langGrid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #pause #resumeBtn, #pauseMain .mobdev-invite-row { grid-column: auto; }
}
@media (min-width: 540px) and (max-height: 350px) {
  #pauseMain { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #langGrid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
