:root {
  --bg:     #f0f4ff;
  --card:   #ffffff;
  --text:   #2d2f5e;
  --sub:    #9a9dc4;
  --accent: #ff6b9d;
  --gold:   #ffb347;
  --blue:   #5b9cf6;
  --purple: #a78bfa;
  --green:  #4ecb71;
  --nav-h:  60px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: var(--bg); font-family: 'Nunito', sans-serif;
  touch-action: none; -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
canvas { display: block; }
button { -webkit-tap-highlight-color: transparent; cursor: pointer; }
input  { -webkit-appearance: none; }

/* ── ЭКРАНЫ ── */
.screen {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center;
  z-index: 100; background: var(--bg);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 8px);
}
.screen.off { display: none !important; }

/* ── НАВИГАЦИЯ ── */
#bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  display: flex; align-items: stretch;
  border-top: 1px solid rgba(91,156,246,0.1);
  box-shadow: 0 -2px 20px rgba(0,0,0,0.05);
}
#bottom-nav.off { display: none !important; }
.nav-btn {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; border: none; background: none;
  padding: 8px 0; transition: transform .12s;
}
.nav-btn:active { transform: scale(0.9); }
.nav-icon  { font-size: 20px; line-height: 1; color: var(--sub); transition: color .2s; display: flex; align-items: center; justify-content: center; }
.nav-btn.active .nav-icon { color: var(--blue); }
.nav-label { font-size: 9px; font-weight: 900; letter-spacing: 1.2px; color: var(--sub); transition: color .2s; }
.nav-dot   { width: 4px; height: 4px; border-radius: 50%; background: var(--blue); opacity: 0; transition: opacity .2s; }
.nav-btn.active .nav-label { color: var(--blue); }
.nav-btn.active .nav-dot   { opacity: 1; }

/* ── ГЛАВНАЯ ── */
#home-screen {
  justify-content: flex-start;
  padding-top: calc(var(--safe-t) + 14px);
  padding-left: 16px; padding-right: 16px;
  align-items: stretch;
}
/* Play button centered in remaining space */
.home-btns-wrap {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding-bottom: 16px;
}

/* Строка 1: название в карточке */
.home-logo-card {
  width: calc(100% + 32px);
  margin-left: -16px; margin-right: -16px;
  margin-top: calc(-14px - var(--safe-t));
  margin-bottom: 14px;
  background: var(--card);
  border-radius: 0;
  padding: 14px 20px;
  padding-top: calc(14px + var(--safe-t));
  box-shadow: 0 3px 14px rgba(0,0,0,.07);
  display: flex; justify-content: space-between; align-items: center;
}
.support-btn {
  font-size: 24px; line-height: 1;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: rgba(91,156,246,0.1);
  border: 1.5px solid rgba(91,156,246,0.2);
  display: flex; align-items: center; justify-content: center;
  text-decoration: none;
  transition: transform .12s, background .12s;
  flex-shrink: 0;
}
.support-btn:active { transform: scale(0.9); background: rgba(91,156,246,0.2); }
.logo {
  font-family: 'Fredoka One', sans-serif;
  font-size: clamp(26px, 7vw, 36px);
  color: var(--text); letter-spacing: 2px; line-height: 1;
}
.logo span { color: var(--accent); }

/* Строки 2-3: элементы слева + кнопка справа (только для строки 2) */
.home-row {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; margin-bottom: 10px;
}

/* Кнопка ящиков — правый угол строки 2 */
.home-box-btn {
  font-size: 24px; line-height: 1;
  width: 58px; height: 58px; border-radius: 16px;
  border: 2px solid rgba(255,179,71,.3);
  background: var(--card);
  box-shadow: 0 4px 16px rgba(255,179,71,.18);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  transition: transform .12s; flex-shrink: 0;
}
.home-box-btn:active { transform: scale(0.91); }
.home-box-icon { font-size: 22px; line-height: 1; }
.home-box-lbl  { font-size: 9px; font-weight: 900; letter-spacing: .8px; color: var(--sub); line-height: 1; }

/* Пилюли */
.pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border-radius: 50px;
  padding: 9px 18px;
  box-shadow: 0 3px 14px rgba(0,0,0,.07);
}
.pill-trophy { border: 1.5px solid rgba(255,179,71,.18); box-shadow: 0 3px 14px rgba(255,179,71,.22); }
.pill-coins  { border: 1.5px solid rgba(78,203,113,.18); box-shadow: 0 3px 14px rgba(78,203,113,.22); }
.pill-icon { font-size: 20px; line-height: 1; }
.pill-num  { font-family: 'Fredoka One', sans-serif; font-size: 22px; line-height: 1; }
.pill-trophy .pill-num { color: var(--gold); }
.pill-coins  .pill-num { color: var(--green); }
.pill-lbl  { font-size: 9px; color: var(--sub); font-weight: 900; letter-spacing: 1.5px; }

.home-btns { width: 100%; max-width: 260px; align-self: center; display: flex; flex-direction: column; gap: 10px; margin-top: 0; }
.play-btn {
  font-family: 'Fredoka One', sans-serif; font-size: 22px; letter-spacing: 3px; color: #fff;
  background: linear-gradient(135deg, #43b89c, #5b9cf6, #a78bfa);
  background-size: 200% 200%; animation: playGrad 4s ease infinite;
  border: none;
  padding: 15px 0; border-radius: 50px; width: 100%;
  box-shadow: 0 8px 28px rgba(91,156,246,.4); transition: transform .12s, box-shadow .12s;
}
@keyframes playGrad {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.play-btn:active { transform: scale(0.96); box-shadow: 0 4px 14px rgba(91,156,246,.3); }

/* ── ПРОФИЛЬ ── */
#profile-screen { justify-content: flex-start; padding-top: calc(var(--safe-t) + 20px); padding-left: 20px; padding-right: 20px; align-items: stretch; }
.profile-title { font-family: 'Fredoka One', sans-serif; font-size: 26px; color: var(--text); margin-bottom: 20px; }
.profile-hero { background: var(--card); border-radius: 24px; padding: 24px; margin-bottom: 14px; box-shadow: 0 4px 20px rgba(0,0,0,.07); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.avatar-wrap { position: relative; margin-bottom: 6px; }
.avatar-circle { width: 84px; height: 84px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: 'Fredoka One', sans-serif; font-size: 34px; color: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.14); }
.tg-badge { position: absolute; bottom: 0; right: 0; width: 24px; height: 24px; border-radius: 50%; background: #2AABEE; display: flex; align-items: center; justify-content: center; font-size: 12px; border: 2px solid #fff; }
.profile-name     { font-family: 'Fredoka One', sans-serif; font-size: 24px; color: var(--text); line-height: 1.1; }
.profile-username { font-size: 13px; color: var(--sub); font-weight: 700; }
.profile-id-badge { font-size: 10px; color: var(--sub); font-weight: 800; letter-spacing: .8px; background: var(--bg); border-radius: 50px; padding: 5px 14px; margin-top: 2px; }
.profile-stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.pstat { background: var(--card); border-radius: 18px; padding: 16px 12px; text-align: center; box-shadow: 0 3px 12px rgba(0,0,0,.06); }
.pstat-v { font-family: 'Fredoka One', sans-serif; font-size: 30px; color: var(--text); line-height: 1; }
.pstat-l { font-size: 9px; color: var(--sub); font-weight: 900; letter-spacing: 1.5px; margin-top: 4px; }

/* ── ПОИСК МАТЧА ── */
#mm-screen { justify-content: center; align-items: center; padding-left: 24px; padding-right: 24px; }
.mm-title { font-family: 'Fredoka One', sans-serif; font-size: 26px; color: var(--text); margin-bottom: 4px; }
.mm-sub { font-size: 10px; color: var(--sub); font-weight: 900; letter-spacing: 2px; margin-bottom: 22px; }
.slots { display: flex; gap: 7px; flex-wrap: wrap; justify-content: center; max-width: 280px; margin-bottom: 22px; }
.slot { width: 40px; height: 40px; border-radius: 50%; background: #e8eeff; border: 2px dashed #c8d0f0; display: flex; align-items: center; justify-content: center; font-size: 16px; transition: all .3s cubic-bezier(.34,1.56,.64,1); }
.slot.filled { background: var(--blue); border-color: var(--blue); box-shadow: 0 4px 14px rgba(91,156,246,.4); }
.slot.you    { background: var(--accent); border-color: var(--accent); box-shadow: 0 4px 14px rgba(255,107,157,.4); }
.mm-timer-box { background: var(--card); border-radius: 20px; padding: 16px 40px; text-align: center; box-shadow: 0 4px 16px rgba(0,0,0,.07); margin-bottom: 16px; }
.mm-timer-num { font-family: 'Fredoka One', sans-serif; font-size: 52px; color: var(--blue); line-height: 1; }
.mm-timer-lbl { font-size: 9px; color: var(--sub); font-weight: 900; letter-spacing: 2px; margin-top: 2px; }
.mm-status { font-size: 13px; color: var(--sub); font-weight: 700; animation: mmDots 1.4s ease-in-out infinite; }
@keyframes mmDots { 0%,100%{opacity:.4} 50%{opacity:1} }

/* ── HUD ── */
#timer-hud { position: fixed; top: 0; left: 50%; transform: translateX(-50%); font-family: 'Fredoka One', sans-serif; font-size: 20px; color: var(--text); background: rgba(255,255,255,.88); backdrop-filter: blur(12px); padding: 6px 22px; border-radius: 0 0 18px 18px; box-shadow: 0 4px 16px rgba(0,0,0,.07); z-index: 11; pointer-events: none; }
#timer-hud.off { display: none; }
#timer-hud.danger { color: var(--accent); animation: timerDanger .5s ease-in-out infinite; }
@keyframes timerDanger { 0%,100%{opacity:1} 50%{opacity:.5} }
#mass-hud { position: fixed; bottom: 22px; left: 16px; z-index: 10; pointer-events: none; background: rgba(255,255,255,.88); backdrop-filter: blur(12px); border-radius: 16px; padding: 8px 16px; box-shadow: 0 4px 20px rgba(0,0,0,.08); }
#mass-hud.off { display: none; }
#mass-val { font-family: 'Fredoka One', sans-serif; font-size: 32px; color: var(--text); line-height: 1; }
#mass-lbl { font-size: 9px; color: var(--sub); font-weight: 900; letter-spacing: 2px; margin-top: 1px; }
#lb { position: fixed; top: 52px; right: 12px; width: 140px; z-index: 10; pointer-events: none; background: rgba(255,255,255,.85); backdrop-filter: blur(12px); border-radius: 14px; padding: 10px 12px; box-shadow: 0 4px 20px rgba(0,0,0,.07); }
#lb.off { display: none; }
#lb h3  { font-size: 8px; color: var(--sub); letter-spacing: 2px; margin-bottom: 6px; font-weight: 900; }
.lbe    { display: flex; align-items: center; gap: 5px; padding: 3px 0; font-size: 11px; color: var(--text); font-weight: 700; border-bottom: 1px solid rgba(0,0,0,.04); }
.lbe:last-child { border-bottom: none; }
.lbe.me { color: var(--blue); }
.lbe-rk { width: 14px; font-size: 9px; color: var(--sub); font-weight: 900; }
.lbe-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.lbe-nm  { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lbe-ms  { font-size: 10px; color: var(--sub); }
#mm-cv { position: fixed; bottom: 16px; right: 16px; width: 100px; height: 100px; border-radius: 12px; z-index: 10; pointer-events: none; box-shadow: 0 4px 20px rgba(0,0,0,.1); border: 2px solid rgba(255,255,255,.9); }
#mm-cv.off { display: none; }
#combo-pop { position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%); font-family: 'Fredoka One', sans-serif; font-size: 50px; z-index: 50; pointer-events: none; opacity: 0; }

/* ── СМЕРТЬ ── */
#dead-modal { position: fixed; inset: 0; z-index: 400; background: rgba(30,32,80,.72); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); display: flex; align-items: center; justify-content: center; padding: 24px; }
#dead-modal.off { display: none !important; }
.dead-card { background: var(--card); border-radius: 28px; padding: 36px 28px 28px; text-align: center; box-shadow: 0 24px 60px rgba(0,0,0,.22); width: 100%; max-width: 320px; animation: deadPop .3s cubic-bezier(.34,1.56,.64,1); }
@keyframes deadPop { from{transform:scale(.8);opacity:0} to{transform:scale(1);opacity:1} }
.dead-emoji { font-size: 60px; line-height: 1; margin-bottom: 12px; }
.dead-title { font-family: 'Fredoka One', sans-serif; font-size: 32px; color: var(--accent); margin-bottom: 6px; }
.dead-sub   { font-size: 13px; color: var(--sub); font-weight: 700; margin-bottom: 10px; }
.dead-mass  { background: var(--bg); border-radius: 14px; padding: 10px 20px; font-size: 14px; font-weight: 800; color: var(--text); margin-bottom: 12px; }
.dead-mass span { color: var(--blue); font-family: 'Fredoka One', sans-serif; font-size: 18px; }

/* Блок наград при смерти: монеты и кубки */
.dead-rewards { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.dead-reward-item {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--bg); border-radius: 14px; padding: 10px 20px;
  font-size: 15px; font-weight: 800; color: var(--text);
  animation: deadPop .25s cubic-bezier(.34,1.56,.64,1);
}
.dead-reward-item span { font-family: 'Fredoka One', sans-serif; font-size: 19px; color: var(--gold); }
.dead-trophy-loss span { color: var(--accent); }

.dead-menu-btn { font-family: 'Fredoka One', sans-serif; font-size: 17px; letter-spacing: 1.5px; color: #fff; border: none; background: linear-gradient(135deg, #ff6b9d, #f97316); padding: 15px 0; border-radius: 50px; width: 100%; box-shadow: 0 8px 24px rgba(255,107,157,.38); transition: transform .12s; }
.dead-menu-btn:active { transform: scale(0.96); }

/* ── РЕЗУЛЬТАТЫ ── */
#results-screen { justify-content: flex-start; padding-top: calc(var(--safe-t) + 20px); padding-bottom: 40px; }
.results-header { width: 100%; padding: 0 20px; text-align: center; margin-bottom: 14px; }
.results-title  { font-family: 'Fredoka One', sans-serif; font-size: 32px; color: var(--text); }
.results-sub    { font-size: 10px; color: var(--sub); font-weight: 900; letter-spacing: 3px; margin-top: 2px; }
.trophy-gain { margin: 0 20px 14px; padding: 11px 24px; background: linear-gradient(135deg, rgba(255,179,71,.1), rgba(255,107,157,.1)); border: 2px solid rgba(255,179,71,.28); border-radius: 14px; font-family: 'Fredoka One', sans-serif; font-size: 17px; color: var(--gold); text-align: center; }
.trophy-gain.off { display: none; }
.rank-list { display: flex; flex-direction: column; gap: 8px; width: 100%; padding: 0 16px; margin-bottom: 18px; }
.rank-row  { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 14px; padding: 11px 14px; box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.rank-row.you-row { border: 2px solid var(--blue); }
.rank-medal { font-size: 22px; width: 28px; text-align: center; flex-shrink: 0; }
.rank-dot   { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.rank-name  { flex: 1; font-size: 13px; font-weight: 800; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-mass  { font-size: 11px; color: var(--sub); font-weight: 700; }
.rank-trph  { font-size: 11px; color: var(--gold); font-weight: 900; white-space: nowrap; }
.again-btn  { font-family: 'Fredoka One', sans-serif; font-size: 18px; letter-spacing: 2px; color: #fff; border: none; background: linear-gradient(135deg, #5b9cf6, #a78bfa); padding: 17px 0; border-radius: 50px; width: calc(100% - 32px); margin: 0 16px; display: block; box-shadow: 0 10px 30px rgba(91,156,246,.4); transition: transform .12s; }
.again-btn:active { transform: scale(0.96); }

/* ── ПЕРСОНАЖИ ── */
#characters-screen {
  justify-content: flex-start;
  padding-top: calc(var(--safe-t) + 20px);
  padding-left: 16px; padding-right: 16px;
  align-items: stretch;
}
.chars-title {
  font-family: 'Fredoka One', sans-serif;
  font-size: 26px; color: var(--text); margin-bottom: 16px;
}
#chars-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Базовая карточка */
.char-card {
  background: var(--card); border-radius: 22px;
  padding: 16px 12px 14px; text-align: center;
  border: 2px solid transparent;
  transition: transform .12s, box-shadow .2s, border-color .2s;
  cursor: pointer; position: relative; overflow: hidden;
}
.char-card:active { transform: scale(0.95); }

/* Фоновый градиент по редкости */
.char-card.rarity-common {
  background: linear-gradient(160deg, #fff 60%, #f0f4ff);
  border-color: rgba(154,157,196,.25);
  box-shadow: 0 3px 14px rgba(0,0,0,.07);
}
.char-card.rarity-rare {
  background: linear-gradient(160deg, #fff 50%, rgba(91,156,246,.08));
  border-color: rgba(91,156,246,.35);
  box-shadow: 0 4px 20px rgba(91,156,246,.18);
}
.char-card.rarity-epic {
  background: linear-gradient(160deg, #fff 50%, rgba(167,139,250,.1));
  border-color: rgba(167,139,250,.45);
  box-shadow: 0 4px 22px rgba(167,139,250,.22);
}

/* Выбран */
.char-card.selected {
  border-width: 2.5px;
  box-shadow: 0 0 0 3px rgba(91,156,246,.18), 0 6px 24px rgba(91,156,246,.22);
}
.char-card.rarity-common.selected { border-color: var(--blue); }
.char-card.rarity-rare.selected   { border-color: var(--blue); }
.char-card.rarity-epic.selected   { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(167,139,250,.2), 0 6px 24px rgba(167,139,250,.28); }

/* Заблокирован */
.char-card.locked { filter: grayscale(0.55); opacity: 0.75; }

/* Блестящая полоска сверху для epic */
.char-card.rarity-epic::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, #a78bfa, #ec4899, #a78bfa);
  background-size: 200%;
  animation: epicShine 2.4s linear infinite;
}
@keyframes epicShine { 0%{background-position:0%} 100%{background-position:200%} }

/* Полоска для rare */
.char-card.rarity-rare::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, #5b9cf6, #06b6d4, #5b9cf6);
  background-size: 200%;
  animation: epicShine 3s linear infinite;
}

/* Превью canvas */
.char-preview {
  width: 110px; height: 110px;
  margin: 0 auto 10px;
  position: relative;
}
.char-preview canvas { display: block; }

/* Круглый фон под превью по редкости */
.char-preview::before {
  content: '';
  position: absolute; inset: 0; border-radius: 50%;
  z-index: 0;
}
.rarity-common .char-preview::before { background: rgba(154,157,196,.08); }
.rarity-rare   .char-preview::before { background: rgba(91,156,246,.1); }
.rarity-epic   .char-preview::before { background: rgba(167,139,250,.12); }
.char-preview canvas { position: relative; z-index: 1; }

.char-rarity {
  font-size: 9px; font-weight: 900;
  letter-spacing: 1.8px; margin-bottom: 4px;
  text-transform: uppercase;
}
.char-name {
  font-family: 'Fredoka One', sans-serif;
  font-size: 17px; color: var(--text); margin-bottom: 4px; line-height: 1.1;
}
.char-desc {
  font-size: 10px; color: var(--sub); font-weight: 700;
  line-height: 1.3; margin-bottom: 8px; min-height: 28px;
}
.char-badge {
  font-size: 10px; font-weight: 900;
  border-radius: 50px; padding: 4px 12px; display: inline-block;
}
.selected-badge { background: rgba(91,156,246,.12); color: var(--blue); }
.locked-badge   { background: rgba(154,157,196,.1);  color: var(--sub); }

/* ── ЯЩИКИ ── */
#boxes-screen { justify-content: flex-start; padding-top: calc(var(--safe-t) + 20px); padding-left: 16px; padding-right: 16px; align-items: stretch; padding-bottom: 40px; }
.boxes-header { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.boxes-title  { font-family: 'Fredoka One', sans-serif; font-size: 26px; color: var(--text); }
.boxes-back   { font-size: 22px; cursor: pointer; background: none; border: none; padding: 4px; }
.boxes-balance { font-size: 13px; color: var(--sub); font-weight: 800; margin-bottom: 20px; }
.boxes-balance span { color: var(--green); font-family: 'Fredoka One', sans-serif; font-size: 16px; }
#boxes-list   { display: flex; flex-direction: column; gap: 14px; }
.box-card { background: var(--card); border-radius: 24px; padding: 24px 20px; box-shadow: 0 4px 20px rgba(0,0,0,.07); text-align: center; }
.box-emoji { font-size: 52px; line-height: 1; margin-bottom: 10px; }
.box-name  { font-family: 'Fredoka One', sans-serif; font-size: 22px; color: var(--text); margin-bottom: 6px; }
.box-odds  { font-size: 11px; margin-bottom: 12px; display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.box-price { font-family: 'Fredoka One', sans-serif; font-size: 18px; color: var(--green); margin-bottom: 14px; }
.box-buy-btn {
  font-family: 'Fredoka One', sans-serif; font-size: 17px; letter-spacing: 1.5px;
  color: #fff; border: none;
  background: linear-gradient(135deg, #4ecb71, #06b6d4);
  padding: 14px 0; border-radius: 50px; width: 100%;
  box-shadow: 0 8px 24px rgba(78,203,113,.35); transition: transform .12s;
}
.box-buy-btn:active  { transform: scale(0.96); }
.box-buy-btn.disabled { background: #ccc; box-shadow: none; }

/* ── МОДАЛКА РЕЗУЛЬТАТА ЯЩИКА ── */
#box-result-modal { position: fixed; inset: 0; z-index: 500; background: rgba(30,32,80,.75); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); display: flex; align-items: center; justify-content: center; padding: 24px; }
#box-result-modal.off { display: none !important; }
.box-result-card { background: var(--card); border-radius: 28px; padding: 36px 28px 28px; text-align: center; box-shadow: 0 24px 60px rgba(0,0,0,.22); width: 100%; max-width: 300px; animation: deadPop .35s cubic-bezier(.34,1.56,.64,1); }
.box-result-emoji  { font-size: 56px; margin-bottom: 10px; }
.box-result-rarity { font-size: 11px; font-weight: 900; letter-spacing: 2px; margin-bottom: 4px; }
.box-result-name   { font-family: 'Fredoka One', sans-serif; font-size: 28px; color: var(--text); margin-bottom: 6px; }
.box-result-desc   { font-size: 13px; color: var(--sub); font-weight: 700; margin-bottom: 6px; }
.box-result-dupe   { font-size: 12px; color: var(--green); font-weight: 800; margin-bottom: 14px; }
.box-result-close  { font-family: 'Fredoka One', sans-serif; font-size: 17px; letter-spacing: 1.5px; color: #fff; border: none; background: linear-gradient(135deg, #5b9cf6, #a78bfa); padding: 14px 0; border-radius: 50px; width: 100%; box-shadow: 0 8px 24px rgba(91,156,246,.38); }

/* ── ТОСТ ── */
.toast { position: fixed; bottom: calc(var(--nav-h) + var(--safe-b) + 14px); left: 50%; transform: translateX(-50%); background: var(--card); border-radius: 50px; padding: 10px 24px; font-size: 13px; font-weight: 800; color: var(--accent); z-index: 999; white-space: nowrap; box-shadow: 0 4px 20px rgba(255,107,157,.25); animation: toastIn .25s ease; }
@keyframes toastIn { from{opacity:0;transform:translateX(-50%) translateY(10px)} to{opacity:1;transform:translateX(-50%) translateY(0)} }

/* ── HUD ЭФФЕКТОВ (пикапы) ── */
#effect-hud {
  position: fixed; bottom: 70px; left: 50%;
  transform: translateX(-50%);
  z-index: 12; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
#effect-hud.off { display: none; }
.effect-pill {
  display: flex; align-items: center; gap: 8px;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  padding: 6px 14px; border-radius: 50px;
  border: 1px solid rgba(0,229,255,0.35);
  box-shadow: 0 2px 12px rgba(0,229,255,0.25);
  animation: effectIn .2s cubic-bezier(.34,1.56,.64,1);
}
@keyframes effectIn { from{opacity:0;transform:scale(.8)} to{opacity:1;transform:scale(1)} }
.effect-icon  { font-size: 16px; line-height: 1; }
.effect-bar-wrap {
  width: 72px; height: 5px;
  background: rgba(255,255,255,0.15);
  border-radius: 3px; overflow: hidden;
}
.effect-bar {
  height: 100%; background: #00e5ff;
  border-radius: 3px;
  transition: width 0.25s linear;
  box-shadow: 0 0 6px #00e5ff;
}
.effect-timer { font-family: 'Fredoka One', sans-serif; font-size: 14px; color: #00e5ff; min-width: 24px; text-align: right; }
/* ═══════════════════════════════════════════════════════
   MATCHMAKING SLOTS — добавь этот блок в конец style.css
═══════════════════════════════════════════════════════ */

/* Сетка слотов */
.slots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
}

/* Базовый слот */
.slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  width: 60px;
  min-height: 76px;
  border-radius: 16px;
  background: rgba(45, 47, 94, 0.06);
  border: 2px dashed rgba(154, 157, 196, 0.45);
  padding: 8px 4px 7px;
  box-sizing: border-box;
  transition: background 0.3s, border-color 0.3s;
}

/* Занятый слот (фейковый игрок) */
.slot-filled {
  background: #ffffff;
  border-style: solid;
  border-color: rgba(91, 156, 246, 0.35);
  box-shadow: 0 3px 12px rgba(91, 156, 246, 0.12);
}

/* Слот самого игрока */
.slot-me {
  background: #ffffff;
  border-style: solid;
  border-color: #5b9cf6;
  box-shadow: 0 3px 14px rgba(91, 156, 246, 0.3);
}

/* Анимация появления нового игрока */
.slot-pop {
  animation: slotPop 0.38s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes slotPop {
  from { transform: scale(0.4); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* Фото аватарки */
.slot-photo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

/* Заглушка без фото */
.slot-photo-emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: rgba(91, 156, 246, 0.12);
  border-radius: 50%;
  width: 40px;
  height: 40px;
}

/* Имя под аватаркой */
.slot-name {
  font-size: 9.5px;
  font-weight: 800;
  font-family: 'Nunito', sans-serif;
  color: var(--text);
  text-align: center;
  max-width: 56px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.1;
}

/* Пустой слот — пульсирующая точка */
.slot-empty {
  justify-content: center;
}

.slot-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(154, 157, 196, 0.5);
  animation: slotPulse 1.3s ease-in-out infinite;
}

@keyframes slotPulse {
  0%, 100% { opacity: 0.25; transform: scale(1); }
  50%       { opacity: 0.8;  transform: scale(1.45); }