/* ===== BASE: tokenlar, fon, shell, pastki navigatsiya, toast ===== */
:root {
  --bg: #050a1f;
  --surface: rgba(13, 21, 50, .72);
  --surface-2: rgba(24, 36, 84, .58);
  --line: rgba(96, 132, 255, .22);
  --line-strong: rgba(96, 160, 255, .6);
  --primary: #2f6bff;
  --neon: #4b8dff;
  --violet: #7b5cff;
  --text: #eaf0ff;
  --muted: #8c9acb;
  --ok: #22d3a0;
  --warn: #ffb020;
  --danger: #ff5277;
  --r-card: 18px;
  --r-btn: 14px;
  --r-pill: 999px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --glow: 0 0 22px rgba(75, 141, 255, .45);
  --nav-h: 68px;
  /* iPhone notch/home indicator va Telegram safe-area */
  --safe-b: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --safe-t: max(env(safe-area-inset-top, 0px), calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)));
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.35;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; touch-action: manipulation; }
img { display: block; max-width: 100%; }
a { color: var(--neon); text-decoration: none; }
:focus-visible { outline: 2px solid var(--neon); outline-offset: 2px; border-radius: 10px; }

/* ---------- fon ---------- */
.bg {
  position: fixed; inset: 0; z-index: 0; overflow: hidden;
  background:
    radial-gradient(120% 70% at 12% 0%, #1b2f8f66 0%, transparent 60%),
    radial-gradient(90% 60% at 100% 30%, #6a3cff44 0%, transparent 60%),
    radial-gradient(100% 60% at 50% 110%, #0b3bb066 0%, transparent 60%),
    linear-gradient(180deg, #060c26, #04081a);
}
.bg video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: 0; transition: opacity .7s ease;
}
.bg video.on { opacity: 1; }
.bg-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(5, 10, 31, .74), rgba(5, 10, 31, .88));
}

/* ---------- shell ---------- */
.shell {
  position: relative; z-index: 1;
  width: 100%; max-width: 480px;
  height: var(--app-h, 100dvh);
  margin: 0 auto; overflow: hidden;
}
.view {
  position: absolute; inset: 0;
  overflow-x: hidden; overflow-y: auto;
  padding: calc(var(--safe-t) + 12px) 16px calc(var(--safe-b) + 28px);
  overscroll-behavior: contain;
  scrollbar-width: none;
  outline: none;
}
.view::-webkit-scrollbar { display: none; }
.shell.has-nav .view { padding-bottom: calc(var(--nav-h) + var(--safe-b) + 28px); }

/* Desktop: telefon ko'rinishidagi markaziy konteyner */
@media (min-width: 700px) {
  body { display: grid; place-items: center; }
  .shell {
    max-width: 500px;
    height: min(920px, calc(100dvh - 32px));
    border-radius: 32px;
    border: 1px solid var(--line);
    box-shadow: 0 30px 80px rgba(0, 0, 0, .6), 0 0 60px rgba(75, 141, 255, .12);
    background: rgba(5, 10, 31, .35);
    backdrop-filter: blur(6px);
  }
}

/* ---------- pastki navigatsiya ---------- */
.nav {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 20;
  display: none;
  grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-h) + var(--safe-b));
  padding: 0 6px var(--safe-b);
  background: linear-gradient(180deg, rgba(9, 15, 40, .82), rgba(6, 10, 28, .97));
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, .4);
}
.shell.has-nav .nav { display: grid; }
.nav-item {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  height: var(--nav-h); min-width: 44px;
  color: var(--muted); font-size: 11px; font-weight: 500;
  transition: color .2s;
}
.nav-item .ic { width: 23px; height: 23px; }
.nav-item.active { color: var(--neon); font-weight: 600; }
.nav-item.active .ic { filter: drop-shadow(0 0 6px rgba(75, 141, 255, .85)); }
.nav-center { justify-content: flex-end; padding-bottom: 9px; color: var(--text); }
.nav-plus {
  position: absolute; top: -26px; left: 50%; transform: translateX(-50%);
  width: 60px; height: 60px; border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 30% 25%, #7fb0ff, #2f6bff 55%, #2446c9);
  border: 3px solid #0a1232;
  box-shadow: 0 8px 24px rgba(47, 107, 255, .6), 0 0 26px rgba(75, 141, 255, .55);
  transition: transform .15s;
}
.nav-center:active .nav-plus { transform: translateX(-50%) scale(.94); }
.nav-plus .ic { width: 28px; height: 28px; color: #fff; stroke-width: 2.6; }

/* ---------- toast ---------- */
.toasts {
  position: absolute; z-index: 60; left: 12px; right: 12px;
  top: calc(var(--safe-t) + 10px);
  display: grid; gap: 8px; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 14px;
  background: rgba(10, 17, 44, .95); border: 1px solid var(--line);
  box-shadow: var(--shadow); font-size: 14px;
  animation: toastIn .25s ease both;
}
.toast .ic { width: 20px; height: 20px; flex: none; }
.toast-success { border-color: rgba(34, 211, 160, .5); } .toast-success .ic { color: var(--ok); }
.toast-error   { border-color: rgba(255, 82, 119, .55); } .toast-error .ic { color: var(--danger); }
.toast-warning { border-color: rgba(255, 176, 32, .55); } .toast-warning .ic { color: var(--warn); }
.toast-info .ic { color: var(--neon); }
.toast.out { opacity: 0; transform: translateY(-8px); transition: .25s; }

/* ---------- animatsiyalar ---------- */
@keyframes screenIn { from { opacity: 0; transform: translateY(10px); } }
@keyframes toastIn  { from { opacity: 0; transform: translateY(-10px); } }
@keyframes spin     { to { transform: rotate(360deg); } }
@keyframes shimmer  { to { background-position: -200% 0; } }
@keyframes pop      { from { opacity: 0; translate: 0 14px; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}