/* Тема берётся из переменных Telegram; значения после запятой — фолбэк
   для браузера, где telegram-web-app.js не загрузился. */
:root {
  --bg: var(--tg-theme-bg-color, #17212b);
  --card: var(--tg-theme-secondary-bg-color, #232e3c);
  --text: var(--tg-theme-text-color, #f4f6f8);
  --hint: var(--tg-theme-hint-color, #8b9bab);
  --button: var(--tg-theme-button-color, #5288c1);
  --button-text: var(--tg-theme-button-text-color, #ffffff);
  --accent: var(--tg-theme-accent-text-color, var(--tg-theme-link-color, #64b5ef));

  --stroke: rgba(127, 140, 155, 0.22);
  --track: rgba(127, 140, 155, 0.18);
  --radius: 20px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

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

body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Color Emoji", "Apple Color Emoji", sans-serif;
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  /* Запас снизу под фиксированную панель навигации, иначе она перекрывает
     нижние кнопки экрана. */
  padding: 16px 16px calc(88px + env(safe-area-inset-bottom));
}

/* ---------- экраны ---------- */

.screen {
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1 1 auto;
  min-height: 0;
}

.screen__title {
  margin: 8px 0 0;
  font-size: 26px;
  font-weight: 700;
}

/* ---------- уведомление об ошибке ---------- */

.notice {
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.35;
  background: rgba(255, 107, 107, 0.14);
  border: 1px solid rgba(255, 107, 107, 0.45);
  color: var(--text);
}

.notice[hidden] {
  display: none;
}

/* ---------- питомец ---------- */

.pet {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-top: 8px;
  text-align: center;
}

/* Контейнер держит аватар и спрайты одежды в одной системе координат.
   Анимация висит на нём, чтобы шляпа не отрывалась от качающегося кота. */
.pet-container {
  position: relative;
  width: 150px;
  height: 150px;
  animation: float 4s ease-in-out infinite;
}

.pet__avatar {
  display: block;
  width: 150px;
  height: 150px;
  object-fit: contain;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.03) 65%);
  box-shadow:
    inset 0 0 0 1px var(--stroke),
    0 14px 34px rgba(0, 0, 0, 0.28);
  cursor: grab;
  /* Палец должен гладить кота, а не скроллить страницу. */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

.pet__avatar.petting {
  cursor: grabbing;
  animation: purr 0.45s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes purr {
  0%, 100% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.04) rotate(-1.5deg); }
  75% { transform: scale(1.04) rotate(1.5deg); }
}

/* ---------- сердечки при поглаживании ---------- */

.heart {
  position: fixed;
  z-index: 20;
  pointer-events: none;
  font-size: 20px;
  line-height: 1;
  animation: heart-float 0.9s ease-out forwards;
}

@keyframes heart-float {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  20% { opacity: 1; transform: translate(-50%, -60%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -160%) scale(1.15); }
}

.pet__name {
  margin: 6px 0 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.2px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pet__level {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--hint);
}

/* ---------- одежда поверх аватара ---------- */

.pet-item {
  position: absolute;
  /* Выше аватара: одежда остаётся видимой и на грустном/грязном спрайте. */
  z-index: 2;
  height: auto;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

/* Позиции в процентах от .pet-container; подгоняются под реальные спрайты. */
#item-hat,
#friend-item-hat {
  top: -2%;
  left: 25%;
  width: 60%;
  transform: rotate(10deg);
  filter: drop-shadow(0px 5px 5px rgba(0, 0, 0, 0.5));
}

#item-glasses,
#friend-item-glasses {
  top: 35%;
  left: 15%;
  width: 70%;
}

#item-collar,
#friend-item-collar {
  top: 68%;
  left: 10%;
  width: 70%;
}

/* ---------- плашка баланса ---------- */

.balance-badge {
  margin-top: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: var(--card);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- карточка со статами ---------- */

.card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.16);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
}

.stat__label {
  color: var(--text);
  opacity: 0.9;
}

.stat__value {
  color: var(--hint);
  font-variant-numeric: tabular-nums;
}

/* Строка под полоской энергии: «Восстановление: +N в час». */
.stat__hint {
  margin: -2px 0 0;
  font-size: 13px;
  color: var(--hint);
}

.bar {
  height: 10px;
  border-radius: 999px;
  background: var(--track);
  overflow: hidden;
}

.bar__fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  transition: width 0.5s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.bar__fill--xp {
  background: linear-gradient(90deg, var(--accent), #a855f7);
}

.bar__fill--mood {
  background: linear-gradient(90deg, #f7b955, #f97316);
}

.bar__fill--hygiene {
  background: linear-gradient(90deg, #4cc2ff, #2f80ed);
}

.bar__fill--energy {
  background: linear-gradient(90deg, #4ade80, #16a34a);
}

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

.actions {
  margin-top: auto;
  display: grid;
  /* Одна колонка: подписи с ценой и эффектами шире половины экрана, в две
     колонки они переносились на вторую строку. */
  grid-template-columns: minmax(0, 1fr);
  grid-auto-rows: minmax(48px, auto);
  align-items: stretch;
  gap: 10px;
}

.actions .btn {
  width: 100%;
  height: 100%;
  /* Цена и эффекты должны оставаться в одну строку. */
  white-space: nowrap;
  padding: 12px 10px;
  font-size: 14px;
}

.btn {
  appearance: none;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 14px 12px;
  font: inherit;
  font-family: inherit;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.2s ease, background-color 0.2s ease;
}

.btn:active {
  transform: scale(0.97);
  opacity: 0.85;
}

.btn--primary {
  grid-column: 1 / -1;
  background: var(--button);
  color: var(--button-text);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
}

.btn--ghost {
  background: var(--card);
  color: var(--text);
  border-color: var(--stroke);
}

/* ---------- лимит поглаживания ---------- */

.pet-limit {
  margin: -8px 0 0;
  font-size: 13px;
  text-align: center;
  color: var(--hint);
  font-variant-numeric: tabular-nums;
}

/* ---------- магазин ---------- */

.shop-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(127, 140, 155, 0.12);
}

.shop-tab {
  appearance: none;
  flex: 1 1 0;
  min-width: 0;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--hint);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.shop-tab.is-active {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

.shop-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shop-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--stroke);
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(127, 140, 155, 0.16), rgba(127, 140, 155, 0.06));
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.14);
  overflow: hidden;
}

.shop-card__icon {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  font-size: 28px;
  line-height: 1;
  text-align: center;
  background: rgba(127, 140, 155, 0.16);
  box-shadow: inset 0 0 0 1px var(--stroke);
}

/* Цвет плитки подсказывает, какой стат поднимает расходник. */
.shop-card__icon--energy {
  background: linear-gradient(145deg, rgba(74, 222, 128, 0.34), rgba(22, 163, 74, 0.1));
}

.shop-card__icon--mood {
  background: linear-gradient(145deg, rgba(247, 185, 85, 0.34), rgba(249, 115, 22, 0.1));
}

.shop-card__icon--hygiene {
  background: linear-gradient(145deg, rgba(76, 194, 255, 0.34), rgba(47, 128, 237, 0.1));
}

.shop-card__info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.shop-card__name {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.shop-card__effect {
  margin: 0;
  font-size: 12px;
  color: var(--hint);
  font-variant-numeric: tabular-nums;
}

.shop-card__price {
  display: inline-flex;
  align-items: center;
  width: max-content;
  margin: 4px 0 0;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(255, 152, 0, 0.18);
  color: #ffb74d;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.shop-card__btn {
  flex: 0 0 auto;
  min-width: 88px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
}

/* Обмен бэриков на корм: поле ввода и кнопки быстрого обмена. */
.exchange {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.exchange__input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.exchange__input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.exchange__btn {
  flex: 0 0 auto;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
}

.exchange__quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.exchange__quick-btn {
  flex: 1 1 auto;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
}

/* ---------- заглушки «скоро» ---------- */

.shop-soon,
.soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 24px;
  border: 1px dashed var(--stroke);
  border-radius: var(--radius);
  background: rgba(127, 140, 155, 0.06);
  text-align: center;
}

/* На пустых экранах PvP/Друзья плашка стоит по центру свободного места. */
.soon {
  margin: auto 0;
}

.shop-soon__icon,
.soon__icon {
  font-size: 44px;
  line-height: 1;
}

.shop-soon__text,
.soon__text {
  margin: 0;
  font-size: 15px;
  color: var(--hint);
}

/* ---------- PvP ---------- */

.pvp-menu {
  display: flex;
  justify-content: center;
}

.pvp-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 28px 18px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.16);
  text-align: center;
}

.pvp-card__icon {
  font-size: 52px;
  line-height: 1;
}

.pvp-card__title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.pvp-card__desc {
  margin: 0;
  font-size: 14px;
  color: var(--hint);
}

.pvp-card__cost {
  margin: 2px 0 0;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 152, 0, 0.16);
  color: #ffb74d;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pvp-league {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 193, 7, 0.32);
  border-radius: 16px;
  background: linear-gradient(
    135deg,
    rgba(255, 193, 7, 0.14),
    rgba(255, 152, 0, 0.05)
  );
  text-align: left;
}

.pvp-league__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
}

.pvp-league__label {
  color: var(--hint);
}

.pvp-league__rank {
  font-weight: 700;
  text-align: right;
}

.pvp-league__elo {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pvp-league__season {
  margin: 2px 0 0;
  color: var(--hint);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.pvp-stats {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--stroke);
  border-radius: 16px;
  background: rgba(127, 140, 155, 0.08);
  text-align: left;
}

.pvp-stats__title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.pvp-stats__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
}

.pvp-stats__value {
  color: var(--hint);
  font-variant-numeric: tabular-nums;
}

.pvp-stats__limit {
  display: block;
  font-size: 12px;
  opacity: 0.85;
}

.pvp-stats__train {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
}

.pvp-bets {
  display: flex;
  width: 100%;
  gap: 8px;
}

.pvp-bet {
  appearance: none;
  flex: 1 1 0;
  min-width: 0;
  padding: 10px 8px;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.pvp-bet.is-active {
  border-color: transparent;
  background: var(--button);
  color: var(--button-text);
}

.pvp-bet:disabled {
  opacity: 0.45;
  cursor: default;
}

.pvp-card__btn {
  min-width: 180px;
  margin-top: 6px;
}

.battlepass {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  padding: 14px;
  border: 1px solid var(--stroke);
  border-radius: 16px;
  background: rgba(127, 140, 155, 0.08);
  text-align: left;
}

.battlepass__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.battlepass__title {
  font-size: 15px;
  font-weight: 700;
}

.battlepass__elo {
  color: var(--hint);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.battlepass__bar {
  height: 8px;
  border-radius: 999px;
  background: var(--track);
  overflow: hidden;
}

.battlepass__fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffb74d, #ff7043);
  transition: width 0.25s ease;
}

.battlepass__scale {
  display: flex;
  justify-content: space-between;
  color: var(--hint);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.battlepass__list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Награда в списке: иконка, сумма с порогом, кнопка. Награда «в доступе»
   подсвечена, забранная приглушена, недостигнутая остаётся нейтральной. */
.battlepass__reward {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: rgba(127, 140, 155, 0.06);
}

.battlepass__reward.is-available {
  border-color: rgba(255, 193, 7, 0.45);
  background: rgba(255, 193, 7, 0.12);
}

.battlepass__reward.is-claimed {
  opacity: 0.6;
}

.battlepass__reward-icon {
  flex: 0 0 auto;
  font-size: 20px;
  line-height: 1;
}

.battlepass__reward-info {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.battlepass__reward-amount {
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.battlepass__reward-elo {
  color: var(--hint);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.battlepass__reward-btn {
  flex: 0 0 auto;
  padding: 8px 12px;
  font-size: 13px;
}

.pvp-match {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Карточку соперника заменили компактной строкой: имя, уровень и HP в одну
   строку, шанс победы — подсказкой под ней. */
.pvp-opponent {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  background: rgba(255, 107, 107, 0.12);
}

.pvp-opponent__line {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pvp-opponent__chance {
  margin: 0;
  font-size: 13px;
  color: var(--hint);
  font-variant-numeric: tabular-nums;
}

.pvp-battle {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Полоска HP соперника: ширину задаёт JS, поэтому переход обязателен. */
.pvp-hp {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 14px;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  background: rgba(127, 140, 155, 0.08);
}

.pvp-hp__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
}

.pvp-hp__value {
  color: var(--hint);
  font-variant-numeric: tabular-nums;
}

.pvp-hp__track {
  height: 12px;
  border-radius: 999px;
  background: var(--track);
  overflow: hidden;
}

.pvp-hp__fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4ade80, #16a34a);
  transition: width 0.2s ease-out;
}

.pvp-hp__fill.is-low {
  background: linear-gradient(90deg, #f87171, #dc2626);
}

/* Крупный таймер в правом верхнем углу боевого окна. */
.pvp-timer {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  font-size: 40px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: #ff7043;
}

.pvp-timer__unit {
  font-size: 16px;
  font-weight: 600;
  color: var(--hint);
}

/* Всплывающая цифра урона: создаётся в точке тапа и улетает вверх. */
.pvp-damage {
  position: absolute;
  z-index: 20;
  color: #ff5252;
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  animation: pvp-damage-float 0.8s ease-out forwards;
  will-change: transform, opacity;
}

@keyframes pvp-damage-float {
  0% {
    opacity: 0;
    transform: translate(-50%, 6px) scale(0.8);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -4px) scale(1.05);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -60px) scale(1);
  }
}

/* Большая зона тапа: палец должен попадать без прицеливания. */
.pvp-tap {
  appearance: none;
  height: 220px;
  border: 1px solid rgba(255, 107, 107, 0.5);
  border-radius: 20px;
  background: radial-gradient(circle at 50% 30%, rgba(255, 107, 107, 0.34), rgba(192, 57, 43, 0.16));
  color: var(--text);
  font: inherit;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 2px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: transform 0.06s ease, filter 0.06s ease;
}

.pvp-tap:active {
  transform: scale(0.97);
  filter: brightness(1.2);
}

/* ---------- мини-игра «Поймай мышку» ---------- */

.game-menu {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.game-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.16);
  text-align: center;
}

.game-card__image {
  width: 96px;
  height: 96px;
  object-fit: contain;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

.game-card__title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.game-card__desc {
  margin: 0;
  font-size: 14px;
  color: var(--hint);
  font-variant-numeric: tabular-nums;
}

.game-card__btn {
  min-width: 160px;
  margin-top: 6px;
}

.game-play {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.game-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  background: rgba(127, 140, 155, 0.08);
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.game-area {
  position: relative;
  height: 300px;
  background: #1e1e1e;
  border-radius: 10px;
  overflow: hidden;
  cursor: crosshair;
  touch-action: manipulation;
}

.game-mouse {
  position: absolute;
  width: 56px;
  height: 56px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  animation: mouse-appear 0.12s ease-out;
}

/* «Поймай еду»: кот внизу ходит за курсором, сверху падают вкусняшки. */
.game-area--catch {
  cursor: ew-resize;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.catch-cat {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 72px;
  height: 72px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

.catch-item {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  font-size: 28px;
  line-height: 1;
  pointer-events: none;
  will-change: transform;
}

@keyframes mouse-appear {
  from { opacity: 0; transform: scale(0.6); }
  to { opacity: 1; transform: scale(1); }
}

.score-popup {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  font-size: 18px;
  font-weight: 700;
  color: #4ade80;
  animation: score-popup 0.6s ease-out forwards;
}

.score-popup--miss {
  color: #f87171;
}

@keyframes score-popup {
  0% { opacity: 0; transform: translate(-50%, 0) scale(0.8); }
  20% { opacity: 1; transform: translate(-50%, -8px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -36px) scale(1); }
}

/* ---------- нижняя навигация ---------- */

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  display: flex;
  /* Пять вкладок: зазор минимальный, иначе подписи не влезут на узких экранах. */
  gap: 2px;
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  background: var(--card);
  border-top: 1px solid var(--stroke);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.25);
}

.bottom-nav__btn {
  appearance: none;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 2px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--hint);
  font: inherit;
  /* clamp не даёт подписям «Питомец»/«Магазин» вылезти из колонки на 320px. */
  font-size: clamp(10px, 2.8vw, 12px);
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease, transform 0.12s ease;
}

.bottom-nav__btn:active {
  transform: scale(0.94);
}

.bottom-nav__icon {
  font-size: 20px;
  line-height: 1;
}

.bottom-nav__btn.is-active {
  color: var(--accent);
  background: rgba(127, 140, 155, 0.12);
}

.stats-open {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
}

/* ---------- характеристики ---------- */

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

/* display: flex перебил бы атрибут hidden, поэтому правило нужно явно. */
.modal[hidden] {
  display: none;
}

.modal__card {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.modal__title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.modal__hint {
  margin: 0;
  font-size: 13px;
  text-align: center;
  color: var(--hint);
}

.statup {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--stroke);
  border-radius: 14px;
}

.statup__text {
  display: flex;
  flex-direction: column;
  font-size: 14px;
}

.statup__value {
  color: var(--hint);
  font-variant-numeric: tabular-nums;
}

.statup__btn {
  padding: 8px 14px;
  min-width: 64px;
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
}

/* ---------- доступность ---------- */

@media (prefers-reduced-motion: reduce) {
  .pet-container,
  .pet__avatar.petting,
  .heart {
    animation: none;
  }

  .bar__fill,
  .btn {
    transition: none;
  }
}

/* ---------- друзья ---------- */

.friends {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.friends-add {
  display: flex;
  gap: 8px;
}

.friends-add__input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 15px;
}

.friends-add__input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.friends-add__btn {
  flex: 0 0 auto;
  padding: 12px 16px;
}

.friends-pending {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}

.friends-pending:active {
  transform: scale(0.99);
}

.friends-pending__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--button);
  color: var(--button-text);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.friends-pending__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
}

/* display: flex перебивает атрибут hidden — правило нужно явно. */
.friends-pending__list[hidden] {
  display: none;
}

.pending-card {
  cursor: default;
}

.pending-card:active {
  transform: none;
}

.pending-card__accept {
  flex: 0 0 auto;
  padding: 10px 14px;
  font-size: 14px;
}

.friends-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
}

/* display: flex перебил бы атрибут hidden — правило нужно явно. */
.friends-list[hidden] {
  display: none;
}

.friend-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  background: var(--card);
  cursor: pointer;
}

.friend-card:active {
  transform: scale(0.99);
}

.friend-card__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.friend-card__name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.friend-card__meta {
  font-size: 13px;
  color: var(--hint);
  font-variant-numeric: tabular-nums;
}

.friend-card__arrow {
  color: var(--hint);
  font-size: 22px;
  line-height: 1;
}

.friends-empty {
  margin: 0;
  padding: 28px 16px;
  border: 1px dashed var(--stroke);
  border-radius: var(--radius);
  color: var(--hint);
  font-size: 14px;
  text-align: center;
}

/* ---------- гостевой профиль ---------- */

.friend-profile {
  position: relative;
  align-items: center;
  text-align: center;
}

.friend-profile__avatar {
  flex: 0 0 auto;
}

.friend-profile__name {
  font-size: 20px;
}

.friend-profile__meta {
  margin: 0;
  color: var(--hint);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.friend-profile__username {
  margin: 0;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.friend-profile__actions {
  display: flex;
  width: 100%;
  gap: 8px;
}

.friend-profile__actions .btn {
  flex: 1 1 0;
}

.modal__close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(127, 140, 155, 0.16);
  color: var(--text);
  font: inherit;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

/* ---------- туториал ---------- */

.tutorial__slide {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 6px 0 2px;
  text-align: center;
}

.tutorial__icon {
  font-size: 52px;
  line-height: 1;
}

.tutorial__text {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
}

/* ---------- уведомления «Пока тебя не было...» ---------- */

.notifications__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 50vh;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.notifications__item {
  padding: 10px 12px;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 14px;
  line-height: 1.4;
}

/* ---------- скрытые блоки ---------- */

/* Идёт последним: перебивает display: flex у .screen и .modal. */
.hidden {
  display: none;
}
