* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Arial', sans-serif;
  background: linear-gradient(180deg, #6ec6ff 0%, #9fe0d8 60%, #bdf0a4 100%);
  color: #fff;
}


#app {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* ─── Screens ─── */
.screen {
  display: none;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.screen.active { display: flex; }
.back-btn {
  position: absolute;
  top: 16px;
  left: 14px;
  z-index: 20;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(10,20,35,.55);
  color: #fff;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-shadow: 0 1px 3px rgba(0,0,0,.5);
}

/* ─── Splash ─── */
#splash {
  background:
    linear-gradient(rgba(10,25,45,.5), rgba(10,25,45,.7)),
    url('../assets2/backgrounds/default.png') center/cover no-repeat;
  gap: 20px;
}
#splash h1 {
  font-size: 2rem;
  font-weight: 800;
  text-shadow: 0 2px 10px rgba(0,0,0,.5);
}

/* ─── Telegram-only block ─── */
#blocked-screen {
  background:
    linear-gradient(rgba(10,25,45,.55), rgba(10,25,45,.75)),
    url('../assets2/backgrounds/default.png') center/cover no-repeat;
  gap: 16px;
  padding: 24px;
  text-align: center;
}
#blocked-screen h1 {
  font-size: 1.8rem;
  font-weight: 800;
  text-shadow: 0 2px 10px rgba(0,0,0,.5);
}
.logo-big { width: 100px; height: 100px; object-fit: contain; }
.blocked-text {
  font-size: 1rem;
  color: #e2e8f0;
  text-shadow: 0 1px 4px rgba(0,0,0,.5);
  max-width: 300px;
  line-height: 1.5;
}
#splash .best-score-label {
  font-size: 1rem;
  color: #cbd5e1;
  text-shadow: 0 1px 4px rgba(0,0,0,.5);
}
#splash .best-score-val {
  font-size: 2.5rem;
  font-weight: 700;
  color: #f5c518;
}
#splash .bird-preview {
  width: 112px;
  height: 112px;
  object-fit: contain;
}
.splash-boosts {
  display: flex;
  gap: 10px;
}
.boost-toggle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 14px;
  background: rgba(10,20,35,.55);
  border: 2px solid rgba(255,255,255,.15);
  border-radius: 14px;
  color: #cbd5e1;
  cursor: pointer;
}
.boost-toggle img { width: 28px; height: 28px; object-fit: contain; }
.boost-toggle-label { font-size: .7rem; font-weight: 600; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.boost-toggle-qty { font-size: .7rem; font-weight: 700; color: #f5c518; }
.boost-toggle.armed { border-color: #4ecdc4; background: rgba(78,205,196,.25); color: #fff; }
.boost-toggle:disabled { opacity: .4; cursor: default; }

.btn-primary {
  display: inline-block;
  text-decoration: none;
  margin-top: 10px;
  padding: 14px 50px;
  font-size: 1.2rem;
  font-weight: 700;
  background: linear-gradient(135deg, #e94560, #c23152);
  border: none;
  border-radius: 30px;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(233,69,96,.5);
  transition: transform .1s, box-shadow .1s;
}
.btn-primary:active { transform: scale(.95); box-shadow: none; }

/* ─── Game ─── */
#game-screen {
  background: #000;
}
#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
#game-hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}
#score-display {
  font-size: 2rem;
  font-weight: 900;
  text-shadow: 0 2px 8px rgba(0,0,0,.8);
}
#coins-display {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 1.1rem;
  font-weight: 700;
}
#coins-display img { width: 24px; height: 24px; }
#boost-display {
  display: flex;
  gap: 8px;
}
.boost-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  padding: 4px;
  object-fit: contain;
}
.boost-icon.active { background: rgba(255,200,0,.3); }

/* ─── Death Screen ─── */
#death-screen {
  background: rgba(0,0,0,.85);
  gap: 16px;
  padding: 24px;
  padding-bottom: 90px;
}
#death-screen h2 { font-size: 2rem; }
.score-panel {
  background: rgba(255,255,255,.08);
  border-radius: 16px;
  padding: 20px 30px;
  text-align: center;
  width: 100%;
  max-width: 320px;
}
.score-panel .label { color: #aaa; font-size: .9rem; }
.score-panel .value { font-size: 2rem; font-weight: 800; color: #f5c518; }
.score-panel .best-val { font-size: 1.3rem; font-weight: 600; color: #4ecdc4; }
.coins-earned { font-size: 1.1rem; color: #f5c518; }
.btn-secondary {
  padding: 12px 36px;
  font-size: 1rem;
  font-weight: 700;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 24px;
  color: #fff;
  cursor: pointer;
  transition: background .2s;
}
.btn-secondary:active { background: rgba(255,255,255,.2); }
.btn-coins {
  padding: 6px 16px;
  font-size: .8rem;
  font-weight: 700;
  background: linear-gradient(135deg, #b98a3d, #8a6423);
  border: none;
  border-radius: 14px;
  color: #fff;
  cursor: pointer;
  width: 100%;
}
#death-screen .btn-coins {
  width: auto;
  padding: 12px 32px;
  font-size: 1rem;
  border-radius: 24px;
}
.death-boosts {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 340px;
  justify-content: center;
}
.death-boost-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  width: auto;
}
.death-boost-btn img { width: 26px; height: 26px; object-fit: contain; }
.death-boost-label { font-size: .75rem; font-weight: 700; }
.death-boost-sub { font-size: .7rem; opacity: .9; }
.death-boost-btn:disabled { opacity: .4; cursor: default; }
.hit-badge {
  position: absolute;
  top: -8px;
  right: -6px;
  background: linear-gradient(135deg, #e94560, #c23152);
  color: #fff;
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .05em;
  padding: 4px 10px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(233,69,96,.5);
  transform: rotate(8deg);
}
/* Пакеты монет — крупнее, ярче, с лёгкой пульсацией, чтобы выгодный пакет
   реально бросался в глаза среди остальных карточек. */
.hit-badge-lg {
  top: -12px;
  right: -10px;
  font-size: .8rem;
  padding: 6px 14px;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(233,69,96,.8);
  animation: hitPulse 1.4s ease-in-out infinite;
}
@keyframes hitPulse {
  0%, 100% { transform: rotate(8deg) scale(1); }
  50% { transform: rotate(8deg) scale(1.08); }
}

/* ─── Boost catalog (наборы 1/3/5/10 на каждый буст) ─── */
.boost-catalog-card {
  grid-column: 1 / -1;
  align-items: stretch;
}
.boost-catalog-card img { align-self: center; }
.boost-catalog-card .item-name,
.boost-catalog-card .item-qty { text-align: center; }
.boost-pkg-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: 100%;
}
.boost-pkg-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 12px;
  color: #fff;
  cursor: pointer;
}
.boost-pkg-btn.hit {
  background: linear-gradient(135deg, rgba(233,69,96,.25), rgba(194,49,82,.25));
  border-color: #e94560;
}
.boost-pkg-qty { font-size: .8rem; font-weight: 800; }
.boost-pkg-price { font-size: .7rem; color: #f5c518; }
.boost-pkg-bonus { font-size: .65rem; font-weight: 700; color: #4ecdc4; }
.hit-badge-sm {
  position: absolute;
  top: -8px;
  right: -4px;
  font-size: .55rem;
  padding: 2px 6px;
  border-radius: 8px;
  transform: rotate(8deg);
}
.game-toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10,20,35,.9);
  border: 1px solid rgba(255,255,255,.15);
  color: #fff;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: .85rem;
  text-align: center;
  z-index: 200;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
}

/* ─── Bottom Nav ─── */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  display: flex;
  background: rgba(10,10,30,.95);
  border-top: 1px solid rgba(255,255,255,.08);
  z-index: 100;
}
.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px 12px;
  gap: 4px;
  border: none;
  background: transparent;
  color: #888;
  font-size: .65rem;
  cursor: pointer;
  transition: color .2s;
}
.nav-btn img { width: 28px; height: 28px; filter: brightness(.6); transition: filter .2s; }
.nav-btn.active { color: #e94560; }
.nav-btn.active img { filter: brightness(1); }

/* ─── Shop ─── */
#shop-screen {
  background:
    linear-gradient(rgba(10,25,45,.6), rgba(10,25,45,.8)),
    url('../assets2/backgrounds/default.png') center/cover no-repeat;
  flex-direction: column;
  justify-content: flex-start;
  padding-bottom: 70px;
  overflow-y: auto;
}
.screen-title {
  font-size: 1.4rem;
  font-weight: 800;
  padding: 10px 16px;
  margin: 10px 12px 4px;
  width: fit-content;
  border-radius: 14px;
  background: rgba(10,20,35,.55);
  text-shadow: 0 2px 6px rgba(0,0,0,.6);
}
.shop-balance {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  margin: 0 12px 10px;
  width: fit-content;
  border-radius: 14px;
  background: rgba(10,20,35,.55);
  font-size: 1rem;
  font-weight: 700;
  color: #f5c518;
  text-shadow: 0 1px 3px rgba(0,0,0,.5);
}
.shop-balance img { width: 20px; height: 20px; }
.tabs {
  display: flex;
  width: 100%;
  padding: 0 12px;
  gap: 8px;
  margin-bottom: 12px;
}
.tab-btn {
  flex: 1;
  padding: 8px;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 20px;
  background: rgba(10,20,35,.5);
  color: #e2e8f0;
  font-size: .85rem;
  font-weight: 600;
  text-shadow: 0 1px 3px rgba(0,0,0,.5);
  cursor: pointer;
  transition: all .2s;
}
.tab-btn.active {
  background: #e94560;
  border-color: #e94560;
  color: #fff;
}
.items-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 0 12px;
  width: 100%;
}
/* Вкладка Coins — список пакетов друг под другом, а не сеткой в 2 колонки. */
.items-grid.coin-list {
  grid-template-columns: 1fr;
}
.coin-pkg-row-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(10,20,35,.55);
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
  border-radius: 16px;
  padding: 10px 14px;
  border: 2px solid rgba(255,255,255,.08);
}
.coin-pkg-row-card.hit {
  border-color: #e94560;
  box-shadow: 0 4px 20px rgba(233,69,96,.35);
}
.coin-pkg-row-card img { width: 44px; height: 44px; object-fit: contain; flex-shrink: 0; }
.coin-pkg-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.coin-pkg-info .item-name { text-align: left; }
.coin-pkg-details { display: flex; align-items: center; gap: 10px; }
.coin-pkg-details .item-price { color: #f5c518; font-size: .85rem; }
.coin-pkg-row-card .coin-pkg-bonus { font-size: .8rem; font-weight: 700; color: #4ecdc4; }
.coin-pkg-row-card .btn-buy { flex-shrink: 0; }
.coin-pkg-row-card .hit-badge-lg { top: -10px; right: 8px; }
.item-card {
  background: rgba(10,20,35,.55);
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
  border-radius: 16px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  border: 2px solid rgba(255,255,255,.08);
  transition: border-color .2s;
}
.item-card.equipped { border-color: #4ecdc4; }
.item-card img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 10px;
}
.item-name { font-size: .85rem; font-weight: 600; text-align: center; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.item-price { font-size: .8rem; color: #f5c518; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.item-qty { font-size: .8rem; font-weight: 700; color: #4ecdc4; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.btn-buy {
  padding: 6px 16px;
  font-size: .8rem;
  font-weight: 700;
  background: linear-gradient(135deg, #f5c518, #e6a817);
  border: none;
  border-radius: 14px;
  color: #000;
  cursor: pointer;
}
.btn-equip {
  padding: 6px 16px;
  font-size: .8rem;
  font-weight: 700;
  background: #4ecdc4;
  border: none;
  border-radius: 14px;
  color: #000;
  cursor: pointer;
}
.btn-equipped {
  padding: 6px 16px;
  font-size: .8rem;
  background: rgba(78,205,196,.2);
  border: 1px solid #4ecdc4;
  border-radius: 14px;
  color: #4ecdc4;
}
.btn-free {
  padding: 6px 16px;
  font-size: .8rem;
  font-weight: 700;
  background: #4ecdc4;
  border: none;
  border-radius: 14px;
  color: #000;
  cursor: pointer;
}

/* ─── Leaderboard ─── */
#leaderboard-screen {
  background:
    linear-gradient(rgba(10,25,45,.6), rgba(10,25,45,.8)),
    url('../assets2/backgrounds/default.png') center/cover no-repeat;
  flex-direction: column;
  justify-content: flex-start;
  padding-bottom: 70px;
  overflow-y: auto;
}
.leaderboard-list {
  width: 100%;
  padding: 0 12px;
}
.lb-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  margin-bottom: 8px;
  background: rgba(10,20,35,.55);
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
  border: 1px solid rgba(255,255,255,.08);
}
.lb-entry.my-entry { background: rgba(233,69,96,.35); border: 1px solid rgba(233,69,96,.6); }
.lb-rank { width: 32px; text-align: center; font-size: 1.1rem; font-weight: 700; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.lb-medal { width: 28px; height: 28px; object-fit: contain; }
.lb-name { flex: 1; font-size: .95rem; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.lb-score { font-weight: 700; color: #f5c518; text-shadow: 0 1px 3px rgba(0,0,0,.5); }

/* ─── Profile Tab ─── */
#profile-screen {
  background:
    linear-gradient(rgba(10,25,45,.6), rgba(10,25,45,.8)),
    url('../assets2/backgrounds/default.png') center/cover no-repeat;
  flex-direction: column;
  justify-content: flex-start;
  padding-bottom: 70px;
  overflow-y: auto;
  padding-top: 20px;
  gap: 16px;
}
.profile-avatar { width: 90px; height: 90px; object-fit: contain; filter: drop-shadow(0 4px 10px rgba(0,0,0,.4)); }
.profile-name { font-size: 1.3rem; font-weight: 700; text-shadow: 0 2px 6px rgba(0,0,0,.6); }
.profile-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: 100%;
  padding: 0 16px;
}
.stat-card {
  background: rgba(10,20,35,.55);
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  padding: 14px;
  text-align: center;
}
.stat-label { font-size: .75rem; color: #cbd5e1; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.stat-value { font-size: 1.4rem; font-weight: 800; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.profile-owned-section { width: 100%; margin-top: 8px; }
.profile-owned-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 10px;
  padding: 0 16px;
  text-shadow: 0 1px 4px rgba(0,0,0,.5);
}

/* ─── Animations ─── */
@keyframes flash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}
.flash { animation: flash .15s ease 3; }

/* ─── RTL support ─── */
[dir="rtl"] .items-grid { direction: rtl; }
[dir="rtl"] .lb-entry { direction: rtl; }
