html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0b0b12;
  font-family: -apple-system, "SF Pro Rounded", "Nunito", system-ui, sans-serif;
  color: #ffffff;
}

#game {
  display: block;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.hidden {
  display: none !important;
}

/* ---- Кнопки ---- */

.btn {
  min-height: 48px;
  min-width: 120px;
  padding: 0 20px;
  border: none;
  border-radius: 16px;
  background: #ffb703;
  color: #0b0b12;
  font: inherit;
  font-weight: 700;
  font-size: 17px;
  cursor: pointer;
  transition: transform 0.08s, opacity 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.94); }
.btn:disabled { opacity: 0.4; cursor: default; }

.btn-big { min-height: 56px; min-width: 220px; font-size: 19px; }
.btn-ghost { background: transparent; color: inherit; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.3); }
.btn-small { min-width: 0; min-height: 40px; font-size: 15px; }
.btn-on { background: #52e3a4; color: #0b0b12; }
.btn-off { background: rgba(255, 255, 255, 0.12); color: inherit; }
.btn-danger { background: #ff4d6d; color: #ffffff; }

/* ---- Меню ---- */

.screen.menu {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px;
  text-align: center;
}

.logo { margin: 0; font-size: 56px; letter-spacing: 6px; font-weight: 800; }
.subtitle { margin: 0 0 24px; opacity: 0.7; font-size: 17px; }
.menu-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---- HUD сверху ---- */

.hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 90px;
  padding: 0 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  font-weight: 700;
}

.icon-btn {
  pointer-events: auto;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: inherit;
  font-size: 22px;
  cursor: pointer;
}

.icon-btn:active { transform: scale(0.94); }

.hud-center { text-align: center; font-size: 17px; }
.hud-right { text-align: right; font-size: 16px; }
.hud-hearts { letter-spacing: 1px; }
.hud-coins { margin-top: 4px; }

/* ---- Панель бустеров снизу ---- */

.bottom {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 16px;
}

.booster {
  flex: 0 1 110px;
  height: 56px;
  min-width: 0;
  padding: 0 8px;
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
  font-size: 16px;
}

.booster.armed { box-shadow: 0 0 0 3px #ffffff; background: #ffb703; color: #0b0b12; }

/* ---- Модальные окна ---- */

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  padding: 16px;
  z-index: 10;
}

.card {
  width: min(360px, 100%);
  padding: 28px 24px;
  border-radius: 16px;
  background: #1b1b2a;
  color: #ffffff;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.card-title { margin: 0 0 12px; font-size: 28px; }
.card-text { margin: 8px 0; font-size: 17px; opacity: 0.85; }
.card-stars { font-size: 36px; letter-spacing: 6px; color: #ffb703; margin-bottom: 8px; }
.card-buttons { margin-top: 20px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.card-buttons .btn { flex: 1 1 100%; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 130px;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 12px;
  background: #1b1b2a;
  color: #ffffff;
  font-size: 15px;
  text-align: center;
  z-index: 20;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

/* ---- Полноэкранные панели: карта и настройки ---- */

.panel {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  background: rgba(11, 11, 18, 0.94);
  padding: 16px;
  z-index: 5;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-title { margin: 0; font-size: 24px; }

.level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 10px;
  max-width: 560px;
  margin: 0 auto;
}

.lvl {
  min-height: 64px;
  border: none;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
}

.lvl-num { font-size: 18px; font-weight: 700; }
.lvl-stars { font-size: 11px; color: #ffb703; letter-spacing: 1px; }
.lvl.done { background: rgba(82, 227, 164, 0.2); }
.lvl.current { box-shadow: 0 0 0 3px #ffb703; animation: pulse 1.2s ease-in-out infinite; }
.lvl.locked { opacity: 0.35; cursor: default; }

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.settings {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 360px;
  margin: 0 auto;
}

.settings .btn { width: 100%; }
.settings-label { margin: 12px 0 0; opacity: 0.7; font-size: 15px; }

@media (prefers-reduced-motion: reduce) {
  .lvl.current { animation: none; }
}

/* Переключатели музыки/звуков/эффектов в паузе */
.quick-toggles { justify-content: center; gap: 12px; margin: 4px 0 0; }
.quick-toggles .icon-btn.btn-off { opacity: 0.45; }
.quick-toggles .icon-btn.btn-on { background: #52e3a4; color: #0b0b12; }
