:root {
  --bg-0: #060810;
  --bg-1: #0b0f1c;
  --panel: #10152480;
  --panel-solid: #10152a;
  --border: #ffffff14;
  --text: #eef1fb;
  --text-dim: #8d94ad;
  --accent: #2dd4bf;
  --accent-2: #7c6cff;
  --gold: #f5c04d;
  --danger: #ff6b6b;
  --radius: 20px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg-0);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

.scene {
  position: relative;
  min-height: 100dvh;
  background:
    radial-gradient(1200px 600px at 50% -10%, #182043 0%, transparent 60%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 100%);
  overflow: hidden;
}

.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}
.glow-a { width: 320px; height: 320px; top: -80px; left: -60px; background: var(--accent-2); }
.glow-b { width: 280px; height: 280px; bottom: -60px; right: -40px; background: var(--accent); }

/* ── Shell layout ── */
.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* ── Top bar ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-logo {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  cursor: pointer;
  user-select: none;
}
.topbar-logo .deep { color: var(--text); }
.topbar-logo .catch { color: var(--accent); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.balance-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 999px;
  background: #ffffff0d;
  border: 1px solid var(--border);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: background .15s;
}
.balance-pill:active { background: #ffffff18; }
.balance-icon { color: var(--gold); font-size: 13px; }
.balance-currency { color: var(--text-dim); font-size: 12px; font-weight: 500; }

.profile-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  transition: opacity .15s;
}
.profile-btn:active { opacity: .7; }
.profile-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ── Page body ── */
.page-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Bottom nav bar ── */
.navbar {
  display: flex;
  background: var(--panel-solid);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 10;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 0 8px;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  transition: color .15s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.nav-item .nav-icon { font-size: 20px; line-height: 1; }
.nav-item.active { color: var(--accent); }
.nav-item.active .nav-icon { filter: drop-shadow(0 0 6px var(--accent)); }

/* ── Modal overlay ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #00000090;
  backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal-sheet {
  width: 100%;
  background: var(--panel-solid);
  border-top: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 20px;
  transform: translateY(40px);
  transition: transform .2s;
}
.modal-overlay.open .modal-sheet { transform: translateY(0); }

.modal-handle {
  width: 40px;
  height: 4px;
  border-radius: 99px;
  background: var(--border);
  margin: -8px auto 4px;
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
  margin: 0;
}

/* ── Common components ── */
.section-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: -8px;
}

.card {
  padding: 18px 16px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--border);
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
}
.btn:active { opacity: .8; transform: scale(.98); }
.btn-accent { background: var(--accent); color: var(--bg-0); }
.btn-dim { background: #ffffff10; color: var(--text-dim); }

.badge-wip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #ffffff0a;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.stat-row:last-child { border-bottom: none; }
.stat-row .label { color: var(--text-dim); }
.stat-row .value { font-weight: 700; }

/* ── Loading screen ── */
#screen-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  gap: 28px;
  text-align: center;
  position: relative;
  z-index: 1;
}
.logo-big { font-size: 34px; font-weight: 800; }
.logo-big .deep { color: var(--text); }
.logo-big .catch { color: var(--accent); }
.loader-ring {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 3px solid #ffffff1a;
  border-top-color: var(--accent);
  border-right-color: var(--accent-2);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: var(--text-dim); font-size: 14px; margin: 0; }

/* ── Error screen ── */
#screen-error {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 24px;
  position: relative;
  z-index: 1;
}
.error-box {
  max-width: 320px;
  text-align: center;
  padding: 28px 22px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--border);
}
.error-icon { font-size: 34px; margin-bottom: 10px; }
.error-box h2 { margin: 0 0 8px; font-size: 18px; }
.error-box p { margin: 0; color: var(--text-dim); font-size: 14px; line-height: 1.5; }

/* ── Game card ── */
.game-card {
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: background .15s, transform .1s;
  padding: 16px;
}
.game-card:active { background: #ffffff14; transform: scale(.98); }
.game-card-icon { font-size: 36px; flex-shrink: 0; }
.game-card-info { flex: 1; min-width: 0; }
.game-card-name { font-size: 16px; font-weight: 700; }
.game-card-desc { color: var(--text-dim); font-size: 13px; margin-top: 3px; line-height: 1.4; }
.game-card-arrow { font-size: 22px; color: var(--text-dim); flex-shrink: 0; }
