/* Игра «Стань кондитером»: мягкий, весёлый интерфейс.
   Ингредиенты стоят прямо в сцене (полки, холодильник, стол, доска с рецептами) — окон с кнопками нет.
   Компьютер: сцена и кнопки строкой под игрой.
   Телефон: игра открывается на весь экран отдельным окном (кнопка «Начать игру», закрыть — ✕). */

.game-head .lead { margin-bottom: 18px; }
.game-start { display: none; }
.game-close { display: none; }

.game-top { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.game-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.game-tabs button { border: 0; border-radius: 999px; padding: 11px 20px; font: 700 15px "Manrope", sans-serif; background: #fff; color: var(--navy); box-shadow: var(--shadow); cursor: pointer; transition: .2s; }
.game-tabs button.on { background: linear-gradient(135deg, #f29bb5, #b9a3e3); color: #fff; }

/* Сцена */
.game { position: relative; border-radius: 28px; overflow: hidden; box-shadow: var(--shadow); background: #fbf3ec; }
.game-scene { position: relative; }
.game-scene svg { display: block; width: 100%; height: auto; touch-action: manipulation; user-select: none; -webkit-user-select: none; }

/* Предметы в сцене: подсветка при наведении и у выбранного */
.g-obj { cursor: pointer; }
.g-obj .g-hl { transition: fill-opacity .15s; }
.g-obj:hover .g-hl { fill-opacity: .6; }
.g-obj.on .g-hl { fill-opacity: .5; stroke: #f29bb5; stroke-width: 3; }
.g-card:hover .g-hl { fill-opacity: 1; stroke: #f29bb5; }

/* Кнопки под игрой — одной строкой справа */
.game-bar { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 14px; }
#gMusic.on { background: #f29bb5; border-color: #f29bb5; color: #fff; }

/* Клубника: крупные кнопки «Макнуть!» и «В коробочку» в сцене (позицию задаёт game.js по точке сцены) */
.game-berry-act { position: absolute; z-index: 3; display: flex; flex-direction: column; gap: 10px; transform: translate(-50%, -50%); }
.game-berry-act[hidden] { display: none; }
.gbig { border: 0; border-radius: 999px; padding: 12px 22px; white-space: nowrap; font: 800 16px "Manrope", sans-serif; color: #fff; cursor: pointer;
  background: linear-gradient(135deg, #f29bb5, #b9a3e3); box-shadow: 0 8px 22px rgba(242, 155, 181, .45); transition: transform .15s, opacity .2s; }
.gbig:hover { transform: translateY(-2px) scale(1.03); }
.gbig { animation: gPulse 1.4s ease-in-out infinite; }
.gbig[hidden] { display: none; }
@keyframes gPulse { 0%, 100% { box-shadow: 0 8px 22px rgba(242, 155, 181, .45); } 50% { box-shadow: 0 0 0 8px rgba(242, 155, 181, .25), 0 8px 22px rgba(242, 155, 181, .45); } }

/* Подсказка — под тортом, между панелями */
.game-hint { position: absolute; z-index: 4; bottom: 2.2%; left: 50%; transform: translateX(-50%); width: max-content; max-width: 30%;
  padding: 8px 14px 8px 36px; border-radius: 16px; background: #fff; color: var(--navy); font-weight: 700; font-size: 13.5px; line-height: 1.3; text-align: center;
  box-shadow: 0 8px 26px rgba(42, 37, 69, .18); border: 2px solid #f29bb5; pointer-events: none; animation: gHint .4s ease; }
.game-hint::before { content: "💡"; position: absolute; left: 11px; top: 50%; transform: translateY(-50%); font-size: 16px; }
.game-hint:empty { display: none; }
@keyframes gHint { from { opacity: 0; transform: translate(-50%, 6px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Анимации: падающий снег/лепестки, пламя свечи, отсадка крема */
.g-fall circle, .g-fall ellipse { animation: gFall 8s linear infinite; }
@keyframes gFall { from { transform: translateY(-120px); } to { transform: translateY(260px); } }
.g-leaf { animation: gLeaf 6s ease-in infinite; transform-box: fill-box; transform-origin: center; }
@keyframes gLeaf { 0% { transform: translate(0, 0) rotate(0); opacity: 0; } 8% { opacity: 1; } 85% { opacity: 1; }
  100% { transform: translate(var(--dx, 10px), var(--dy, 80px)) rotate(240deg); opacity: 0; } }
.g-flame { animation: gFlame 1.2s ease-in-out infinite alternate; transform-origin: center bottom; transform-box: fill-box; }
@keyframes gFlame { from { transform: scaleY(1); } to { transform: scaleY(1.15) translateY(-1px); } }
.g-pipe { animation: gPipe .45s ease-out both; transform-box: fill-box; transform-origin: center bottom; }
@keyframes gPipe { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
.g-item { cursor: grab; }
.g-item:active { cursor: grabbing; }
@media (prefers-reduced-motion: reduce) { .g-fall circle, .g-fall ellipse, .g-leaf, .g-flame, .g-pipe, .gbig { animation: none; } }

/* ---------- Телефон и планшет ---------- */
@media (max-width: 900px), (orientation: landscape) and (max-height: 520px) {
  /* На странице — карточка «Начать игру»; сама игра скрыта, пока её не открыли */
  .game-start { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 28px 20px; border-radius: 24px; background: #fff; box-shadow: var(--shadow); }
  .game-start p { margin: 0; color: var(--muted); }
  .game-start .btn { font-size: 17px; padding: 15px 34px; background: linear-gradient(135deg, #f29bb5, #b9a3e3); border: 0; }
  .game-wrap { display: none; }

  /* Открытая игра — окно на весь экран поверх сайта; страница под ним не листается */
  body.game-open { overflow: hidden; }
  body.game-open .game-wrap { display: flex; flex-direction: column; position: fixed; z-index: 1000; inset: 0; height: 100vh; height: 100svh;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); gap: 6px; background: var(--bg); }
  .game-top { flex: none; margin: 0; }
  .game-tabs { flex: 1; min-width: 0; flex-wrap: nowrap; overflow-x: auto; gap: 6px; scrollbar-width: none; }
  .game-tabs::-webkit-scrollbar { display: none; }
  .game-tabs button { flex: none; padding: 8px 13px; font-size: 13px; box-shadow: none; border: 1.5px solid var(--line); }
  .game-close { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--navy); color: #fff; font-size: 18px; cursor: pointer; }

  .game { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; border-radius: 18px; }
  .game-scene { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; background: #fbf3ec; }
  .game-scene svg { flex: 1 1 auto; min-height: 0; width: 100%; height: 100%; }
  /* в открытой игре касания не листают страницу — украшения перетаскиваются пальцем */
  body.game-open .game-scene svg { touch-action: none; }
  .game-hint { position: relative; transform: none; left: auto; bottom: auto; width: auto; max-width: none; flex: none; border-radius: 0; border: 0;
    border-bottom: 2px solid #f29bb5; box-shadow: none; font-size: 12.5px; padding: 6px 10px 6px 32px; text-align: left; animation: none; }
  .game-hint::before { left: 9px; font-size: 14px; }
  .gbig { padding: 9px 16px; font-size: 14px; }
  .game-berry-act { gap: 8px; }
  /* Кнопки под игрой: одна строка, листается вбок */
  .game-bar { flex: none; flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; margin: 0; gap: 6px; scrollbar-width: none; }
  .game-bar::-webkit-scrollbar { display: none; }
  .game-bar .btn { flex: none; padding: 8px 13px; font-size: 13px; }

}
/* Телефон боком: кнопки чуть меньше */
@media (orientation: landscape) and (max-height: 520px) {
  .gbig { padding: 6px 12px; font-size: 12.5px; }
}
