/* ================================================================
 * Jump Master — современный тёмный дизайн (v1.1)
 * ================================================================ */

:root {
  --bg: #0b0e22;
  --bg-2: #11152e;
  --card: #181d3d;
  --card-2: #1f2548;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --text: #f2f4ff;
  --muted: #8b93c4;
  --primary: #6366f1;
  --primary-2: #8b5cf6;
  --accent: #fbbf24;
  --accent-2: #f59e0b;
  --cyan: #22d3ee;
  --danger: #ef4444;
  --ok: #22c55e;
  --radius: 20px;
  --nav-h: 72px;
  --top-h: 50px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
  user-select: none; -webkit-user-select: none; overscroll-behavior: none;
}

body::before {
  content: ''; position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(900px 500px at 75% -5%, rgba(99,102,241,0.30), transparent 60%),
    radial-gradient(700px 500px at 10% 105%, rgba(139,92,246,0.22), transparent 60%),
    linear-gradient(180deg, #0c1027, #0a0d20);
}

#app { position: fixed; inset: 0; display: flex; flex-direction: column; }

/* ---------- SVG-иконки ---------- */
.ico, .nav-icon, .up-icon, .shop-icon, .ach-icon, .stats-k, .lead-rank { display: inline-flex; }
.ico svg, .nav-icon svg, [data-ico] svg { width: 1em; height: 1em; display: block; }
.stats-k svg, .switch-row svg { width: 19px; height: 19px; margin-right: 9px; color: var(--muted); }
.btn svg { width: 1.05em; height: 1.05em; }

/* ---------- ВЕРХНЯЯ ПАНЕЛЬ ---------- */
#topbar {
  height: calc(var(--top-h) + var(--safe-t)); padding-top: var(--safe-t);
  display: flex; align-items: center; justify-content: center; gap: 8px; z-index: 5;
}
.stat {
  display: flex; align-items: center; gap: 7px;
  background: rgba(255,255,255,0.06); border: 1px solid var(--line);
  padding: 7px 14px; border-radius: 999px; font-weight: 800; font-size: 14px;
  backdrop-filter: blur(10px);
}
.stat .ico { font-size: 16px; }
.stat-coin { color: var(--accent); }
.stat-gem { color: var(--cyan); }
.stat-best { color: var(--accent); }
.stat-trophy { color: var(--accent); }

/* ---------- ОБЛАСТЬ ЭКРАНА ---------- */
#screen {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 8px 16px calc(var(--nav-h) + var(--safe-b) + 20px);
  -webkit-overflow-scrolling: touch;
}
#screen.full { padding: 0; overflow: hidden; }
#screen::-webkit-scrollbar { width: 0; }

.screen { animation: fade 0.28s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.screen-h { font-size: 24px; font-weight: 800; margin: 10px 2px 14px; letter-spacing: -0.3px; }
.screen-desc { color: var(--muted); font-size: 13px; line-height: 1.5; margin: -6px 2px 18px; }

/* ---------- КНОПКИ ---------- */
.btn {
  border: none; border-radius: 14px; padding: 12px 18px; font-size: 14.5px; font-weight: 800;
  color: #fff; cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform 0.12s ease, filter 0.12s ease, opacity 0.12s;
}
.btn:active { transform: scale(0.95); }
.btn:disabled { opacity: 0.55; }
.btn-primary { background: linear-gradient(135deg, var(--primary-2), var(--primary)); box-shadow: 0 8px 22px rgba(99,102,241,0.4); }
.btn-buy { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #3a2400; box-shadow: 0 8px 22px rgba(245,158,11,0.35); }
.btn-buy svg { color: #3a2400; }
.btn-stars { background: linear-gradient(135deg, #3b82f6, #2563eb); width: 100%; }
.btn-stars svg { color: #fde68a; }
.btn-ghost { background: rgba(255,255,255,0.08); border: 1px solid var(--line-2); }
.btn-danger { background: linear-gradient(135deg, #f87171, var(--danger)); width: 100%; }
.btn-danger svg { color: #fff; }
.btn-big { padding: 16px 24px; font-size: 16px; border-radius: 16px; }

/* ---------- НИЖНЯЯ НАВИГАЦИЯ ---------- */
#navbar {
  position: absolute; left: 12px; right: 12px; bottom: calc(10px + var(--safe-b));
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(20,24,52,0.72);
  border: 1px solid var(--line-2);
  border-radius: 24px;
  backdrop-filter: blur(20px) saturate(140%);
  box-shadow: 0 12px 40px rgba(0,0,0,0.45);
  padding: 0 6px;
  z-index: 10;
}
.nav-btn {
  flex: 1; background: none; border: none; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 0; cursor: pointer; font-family: inherit;
  transition: color 0.18s; position: relative;
}
.nav-icon { font-size: 23px; line-height: 1; transition: transform 0.18s; }
.nav-label { font-size: 10px; font-weight: 700; letter-spacing: 0.2px; }
.nav-btn.active { color: var(--text); }
.nav-btn.active .nav-icon { transform: translateY(-2px); }
.nav-btn.active::after {
  content: ''; position: absolute; top: 2px; width: 5px; height: 5px; border-radius: 50%;
  background: var(--primary-2); box-shadow: 0 0 10px var(--primary-2);
}

/* центральная круглая кнопка */
.nav-play { flex: 0 0 auto; position: relative; margin: 0 4px; }
.nav-play-inner {
  width: 60px; height: 60px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-2), var(--primary));
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: #fff;
  box-shadow: 0 8px 24px rgba(99,102,241,0.6), inset 0 1px 2px rgba(255,255,255,0.5);
  border: 3px solid rgba(11,14,34,0.9);
  margin-top: -26px;
  transition: transform 0.18s;
}
.nav-play .nav-label { display: none; }
.nav-play::after { display: none; }
.nav-play.active .nav-play-inner, .nav-play:active .nav-play-inner {
  transform: translateY(-3px) scale(1.05);
}
.nav-play-inner::before {
  content: ''; position: absolute; inset: -7px; border-radius: 50%;
  border: 1.5px solid rgba(139,92,246,0.4); animation: pulse 2.2s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { transform: scale(1); opacity: 0.6; } 50% { transform: scale(1.12); opacity: 0; } }

/* ---------- ЭКРАН ИГРЫ ---------- */
.screen-play { position: relative; width: 100%; height: 100%; }
.game-canvas { display: block; width: 100%; height: 100%; touch-action: none; }

.play-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 38%, rgba(99,102,241,0.22), transparent 62%), rgba(11,14,34,0.92);
  backdrop-filter: blur(4px); transition: opacity 0.35s; padding: 24px;
}
.play-overlay.hidden { opacity: 0; pointer-events: none; }
.play-card { text-align: center; max-width: 330px; width: 100%; }

.play-mascot { position: relative; height: 120px; margin-bottom: 8px; }
.mascot-cube {
  width: 72px; height: 72px; margin: 0 auto; border-radius: 22px;
  background: linear-gradient(145deg, #a5b4fc, var(--primary));
  box-shadow: 0 16px 40px rgba(99,102,241,0.5), inset 0 2px 4px rgba(255,255,255,0.4);
  position: relative; animation: bob 1.8s ease-in-out infinite;
}
.mascot-cube::before, .mascot-cube::after {
  content: ''; position: absolute; top: 30px; width: 13px; height: 13px; border-radius: 50%; background: #0e1230;
}
.mascot-cube::before { left: 20px; }
.mascot-cube::after { right: 20px; }
.mascot-shadow {
  width: 60px; height: 12px; border-radius: 50%; margin: 6px auto 0;
  background: rgba(0,0,0,0.4); filter: blur(4px); animation: shadow 1.8s ease-in-out infinite;
}
@keyframes bob { 0%,100% { transform: translateY(0) scale(1,1); } 50% { transform: translateY(-16px) scale(0.97,1.03); } }
@keyframes shadow { 0%,100% { transform: scale(1); opacity: 0.4; } 50% { transform: scale(0.7); opacity: 0.2; } }

.play-title {
  font-size: 36px; font-weight: 900; margin: 4px 0 10px; letter-spacing: 1px;
  background: linear-gradient(135deg, #c7d2fe, #a78bfa, #67e8f9);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.play-sub { color: var(--muted); font-size: 13.5px; line-height: 1.55; margin: 0 auto 18px; max-width: 280px; }
.play-best {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.06); border: 1px solid var(--line-2);
  padding: 9px 18px; border-radius: 999px; font-weight: 700; margin-bottom: 20px; color: var(--muted);
}
.play-best .ico { font-size: 16px; color: var(--accent); }
.play-best b { color: var(--accent); font-size: 16px; }
.play-go { width: 100%; font-size: 17px; }
.play-go .ico { font-size: 18px; }

/* ---------- МОДАЛКА ---------- */
.modal-backdrop {
  position: absolute; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  background: rgba(7,9,22,0.78); backdrop-filter: blur(6px); animation: fade 0.2s ease; padding: 26px;
}
.modal {
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--line-2); border-radius: 26px; padding: 28px 22px; text-align: center;
  width: 100%; max-width: 340px; box-shadow: 0 28px 70px rgba(0,0,0,0.6);
  animation: pop 0.3s cubic-bezier(.2,1.2,.4,1);
}
@keyframes pop { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-badge {
  width: 72px; height: 72px; margin: 0 auto 8px; border-radius: 50%; font-size: 34px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.08); color: var(--muted);
}
.modal-badge.gold { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #3a2400; box-shadow: 0 10px 28px rgba(245,158,11,0.5); }
.modal h2 { margin: 6px 0 18px; font-size: 23px; font-weight: 800; }
.result-row {
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(255,255,255,0.05); padding: 12px 16px; border-radius: 14px; margin-bottom: 8px;
}
.result-row span { color: var(--muted); font-size: 13.5px; }
.result-row b { font-size: 16px; }
.gold-txt { color: var(--accent); }
.ach-unlocked {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: rgba(251,191,36,0.12); border: 1px solid rgba(251,191,36,0.4);
  color: var(--accent); padding: 11px; border-radius: 14px; font-size: 13px; font-weight: 700; margin: 10px 0;
}
.ach-unlocked .ico { font-size: 16px; }
.modal .btn { width: 100%; margin-top: 10px; }

/* ---------- ИНВЕНТАРЬ (примерочная) ---------- */
.inv-stage {
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--line); border-radius: 26px; padding: 22px; text-align: center; margin-bottom: 16px;
}
.inv-hero {
  position: relative; height: 180px; border-radius: 20px; overflow: hidden;
  display: flex; align-items: center; justify-content: center; margin-bottom: 16px;
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--c) 26%, transparent), transparent 70%);
}
.inv-glow {
  position: absolute; width: 150px; height: 150px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--c) 45%, transparent), transparent 70%);
  filter: blur(20px); animation: bob 2.4s ease-in-out infinite;
}
.inv-char {
  position: relative; width: 86px; height: 86px; border-radius: 28px;
  background: linear-gradient(145deg, var(--t), var(--c));
  box-shadow: 0 18px 40px color-mix(in srgb, var(--c) 55%, transparent), inset 0 2px 5px rgba(255,255,255,0.4);
  animation: bob 2.2s ease-in-out infinite; display: flex; align-items: center; justify-content: center; gap: 14px;
}
.inv-eye { width: 15px; height: 15px; border-radius: 50%; background: #0e1230; margin-top: 6px; }
.inv-badge {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 800; letter-spacing: 0.5px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #3a2400;
  padding: 5px 9px; border-radius: 8px;
}
.inv-badge svg { width: 12px; height: 12px; color: #3a2400; }
.inv-name { font-size: 22px; font-weight: 800; margin-bottom: 14px; }
.inv-action .btn { min-width: 160px; }

.inv-strip { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: none; }
.inv-strip::-webkit-scrollbar { display: none; }
.inv-thumb {
  flex: 0 0 auto; width: 64px; height: 64px; border-radius: 18px; cursor: pointer; position: relative;
  background: var(--card); border: 2px solid var(--line); display: flex; align-items: center; justify-content: center;
  transition: border-color 0.15s, transform 0.12s;
}
.inv-thumb:active { transform: scale(0.93); }
.inv-thumb.active { border-color: var(--primary-2); box-shadow: 0 0 0 3px rgba(139,92,246,0.22); }
.thumb-blob {
  width: 34px; height: 34px; border-radius: 12px;
  background: linear-gradient(145deg, var(--t), var(--c));
  box-shadow: 0 6px 14px color-mix(in srgb, var(--c) 50%, transparent);
}
.thumb-lock, .thumb-check {
  position: absolute; bottom: -2px; right: -2px; width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; border: 2px solid var(--bg);
}
.thumb-lock { background: var(--card-2); color: var(--muted); }
.thumb-lock svg { width: 12px; height: 12px; }
.thumb-check { background: var(--ok); color: #fff; }
.thumb-check svg { width: 12px; height: 12px; }

/* ---------- ПРОКАЧКА ---------- */
.upgrade-list { display: flex; flex-direction: column; gap: 12px; }
.upgrade-row {
  display: flex; align-items: center; gap: 13px;
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 15px;
}
.up-icon {
  font-size: 24px; width: 50px; height: 50px; flex: 0 0 auto; color: var(--primary-2);
  background: rgba(139,92,246,0.14); border-radius: 15px;
  display: flex; align-items: center; justify-content: center;
}
.up-main { flex: 1; min-width: 0; }
.up-name { font-weight: 800; font-size: 15.5px; display: flex; align-items: center; gap: 9px; }
.up-lvl { font-size: 11px; color: var(--muted); font-weight: 700; background: rgba(255,255,255,0.07); padding: 2px 7px; border-radius: 6px; }
.up-desc { color: var(--muted); font-size: 12px; margin: 4px 0 9px; line-height: 1.4; }
.up-dots { display: flex; gap: 4px; }
.dot { height: 5px; border-radius: 3px; background: rgba(255,255,255,0.1); flex: 1; transition: background 0.2s; }
.dot.on { background: linear-gradient(90deg, var(--primary-2), var(--primary)); }
.up-btn { flex: 0 0 auto; min-width: 84px; }

/* ---------- МАГАЗИН ---------- */
.shop-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.shop-card {
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 14px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
}
.shop-icon {
  font-size: 30px; width: 58px; height: 58px; margin-bottom: 6px; color: var(--cyan);
  background: rgba(34,211,238,0.12); border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
}
.shop-title { font-weight: 800; font-size: 14px; }
.shop-sub { color: var(--muted); font-size: 11.5px; margin-bottom: 12px; min-height: 28px; }
.shop-card .btn { margin-top: auto; }

/* ---------- ПРОЧЕЕ ---------- */
.tabs { display: flex; gap: 5px; background: rgba(255,255,255,0.05); padding: 5px; border-radius: 16px; margin-bottom: 16px; }
.tab {
  flex: 1; background: none; border: none; color: var(--muted);
  padding: 10px 4px; border-radius: 12px; font-size: 12.5px; font-weight: 800; cursor: pointer; font-family: inherit;
  transition: all 0.18s;
}
.tab.active { background: linear-gradient(135deg, var(--primary-2), var(--primary)); color: #fff; box-shadow: 0 6px 16px rgba(99,102,241,0.4); }

.stats-k { display: inline-flex; align-items: center; }

.lead-list { display: flex; flex-direction: column; gap: 8px; }
.lead-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line); padding: 13px 15px; border-radius: 14px;
}
.lead-row.me { border-color: var(--primary-2); background: rgba(99,102,241,0.14); }
.lead-rank {
  width: 26px; height: 26px; border-radius: 8px; font-size: 13px; font-weight: 800;
  align-items: center; justify-content: center; background: rgba(255,255,255,0.08); color: var(--muted);
}
.lead-rank.rank-1 { background: linear-gradient(135deg, #fde68a, #f59e0b); color: #3a2400; }
.lead-rank.rank-2 { background: linear-gradient(135deg, #e5e7eb, #9ca3af); color: #1f2937; }
.lead-rank.rank-3 { background: linear-gradient(135deg, #fdba74, #c2762f); color: #3a2400; }
.lead-name { flex: 1; font-weight: 700; font-size: 14px; }
.lead-score { font-weight: 800; color: var(--accent); }

.ach-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.ach-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 12px; text-align: center; opacity: 0.5;
}
.ach-card.got { opacity: 1; border-color: rgba(251,191,36,0.4); background: linear-gradient(180deg, rgba(251,191,36,0.08), var(--card)); }
.ach-icon { font-size: 30px; width: 54px; height: 54px; margin: 0 auto; border-radius: 16px; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.06); color: var(--muted); }
.ach-card.got .ach-icon { color: var(--accent); background: rgba(251,191,36,0.14); }
.ach-name { font-weight: 800; font-size: 13.5px; margin-top: 8px; }
.ach-desc { color: var(--muted); font-size: 11px; margin-top: 3px; line-height: 1.4; }

.stats-list { display: flex; flex-direction: column; gap: 8px; }
.stats-row {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--card); border: 1px solid var(--line); padding: 14px 16px; border-radius: 14px; font-size: 14px;
}
.stats-row .stats-k { color: var(--muted); font-weight: 600; }
.stats-row b { font-size: 17px; font-weight: 800; }

.settings-list { display: flex; flex-direction: column; gap: 12px; }
.switch-row {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--card); border: 1px solid var(--line); padding: 15px 16px; border-radius: 14px; font-weight: 700; cursor: pointer;
}
.switch-row input { width: 48px; height: 27px; appearance: none; -webkit-appearance: none; background: rgba(255,255,255,0.14); border-radius: 999px; position: relative; cursor: pointer; transition: background 0.2s; flex: 0 0 auto; }
.switch-row input:checked { background: var(--primary); }
.switch-row input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 50%; background: #fff; transition: transform 0.2s; }
.switch-row input:checked::after { transform: translateX(21px); }
.ver { color: var(--muted); font-size: 12px; text-align: center; margin-top: 6px; }
