:root {
  --bg: #07040b;
  --bg2: #12071c;
  --card: rgba(255,255,255,.065);
  --card2: rgba(255,255,255,.095);
  --line: rgba(255,255,255,.13);
  --text: #fbf7ff;
  --muted: #bba9cf;
  --muted2: #89769f;
  --violet: #8b2cff;
  --violet2: #c16cff;
  --blue: #67a9ff;
  --orange: #ff9d40;
  --green: #70ffc7;
  --shadow: 0 20px 60px rgba(0,0,0,.35);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 0%, rgba(139,44,255,.32), transparent 31%),
    radial-gradient(circle at 100% 14%, rgba(103,169,255,.14), transparent 24%),
    linear-gradient(180deg, var(--bg2), var(--bg) 48%, #050308);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .18;
  background-image:
    linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, black, transparent 70%);
}

button { font: inherit; }

.app {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 18px 14px calc(30px + env(safe-area-inset-bottom));
}

.topbar {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(255,255,255,.12), rgba(255,255,255,.045));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.topbar::after {
  content: "";
  position: absolute;
  width: 160px;
  height: 160px;
  right: -70px;
  top: -80px;
  background: radial-gradient(circle, rgba(193,108,255,.34), transparent 64%);
  pointer-events: none;
}

.brand-pair {
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 1;
}

.brand-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  border: 1px solid rgba(255,255,255,.16);
  font-size: 22px;
  box-shadow: 0 12px 30px rgba(139,44,255,.20);
}

.fox-icon {
  background: linear-gradient(135deg, #1a0d28, #6a19cf);
}

.lab-icon {
  background: linear-gradient(135deg, #101b3a, #7a2cff 60%, #1c0b2e);
  color: #fff;
  font-weight: 900;
}

.sync-mark {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #dcc6ff;
  background: rgba(255,255,255,.08);
  border: 1px solid var(--line);
  font-size: 13px;
}

.top-copy { position: relative; z-index: 1; min-width: 0; }

.eyebrow, .pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 5px 10px;
  border-radius: 999px;
  color: #eadcff;
  background: rgba(139,44,255,.18);
  border: 1px solid rgba(193,108,255,.26);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
}

h1, h2, h3, p { margin: 0; }

h1 {
  margin-top: 8px;
  font-size: clamp(25px, 6vw, 34px);
  line-height: .98;
  letter-spacing: -.035em;
}

h2 {
  font-size: clamp(22px, 5vw, 30px);
  line-height: 1.05;
  letter-spacing: -.03em;
}

h3 {
  font-size: 16px;
  letter-spacing: -.015em;
}

p {
  color: var(--muted);
  line-height: 1.45;
  font-size: 14px;
}

.top-copy p { margin-top: 8px; max-width: 620px; }

.quick-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 14px 0;
}

.quick-card {
  min-height: 92px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  padding: 13px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255,255,255,.085), rgba(255,255,255,.04));
  box-shadow: 0 10px 35px rgba(0,0,0,.18);
  cursor: pointer;
}

.quick-card:active, .tab:active, .primary:active { transform: scale(.985); }

.mini-icon, .feature-icon, .service-ico {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(139,44,255,.18);
  border: 1px solid rgba(255,255,255,.12);
  color: #f3e9ff;
  font-style: normal;
  font-size: 15px;
}

.quick-card b { font-size: 14px; line-height: 1.1; }
.quick-card em { color: var(--muted2); font-style: normal; font-size: 12px; }

.tabs {
  display: flex;
  gap: 8px;
  padding: 7px;
  margin-bottom: 14px;
  overflow-x: auto;
  scrollbar-width: none;
  position: sticky;
  top: 8px;
  z-index: 10;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(10,5,16,.72);
  backdrop-filter: blur(18px);
  box-shadow: 0 12px 40px rgba(0,0,0,.26);
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 13px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  white-space: nowrap;
  cursor: pointer;
}

.tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--violet), #5d19c9);
  box-shadow: 0 8px 24px rgba(139,44,255,.34);
}

.screen {
  display: none;
  animation: appear .18s ease both;
}

.active-screen { display: block; }

@keyframes appear {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-card, .feature, .catalog-card, .service, .balance-card {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.085), rgba(255,255,255,.04));
  box-shadow: 0 14px 44px rgba(0,0,0,.20);
}

.hero-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 18px;
  border-radius: 28px;
  overflow: hidden;
}

.hero-card h2 { margin: 12px 0 8px; }

.orbit {
  position: relative;
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
}

.ring {
  position: absolute;
  inset: 8px;
  border: 1px dashed rgba(193,108,255,.45);
  border-radius: 50%;
  animation: spin 16s linear infinite;
}

.dot {
  position: absolute;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 17px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.08);
  box-shadow: 0 12px 30px rgba(139,44,255,.25);
}

.dot.fox { left: 4px; top: 20px; }
.dot.lab { right: 4px; bottom: 18px; font-weight: 900; }

@keyframes spin { to { transform: rotate(360deg); } }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 11px;
  margin-top: 12px;
}

.feature {
  min-height: 142px;
  padding: 14px;
  border-radius: 24px;
}

.feature b { display: block; margin: 10px 0 6px; }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  margin-bottom: 13px;
}

.section-head h2 { margin: 10px 0 6px; }

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 12px;
}

.catalog-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 26px;
  overflow: hidden;
}

.preview {
  height: 145px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background:
    radial-gradient(circle at 30% 25%, rgba(255,157,64,.26), transparent 26%),
    radial-gradient(circle at 75% 15%, rgba(103,169,255,.22), transparent 24%),
    linear-gradient(135deg, rgba(139,44,255,.45), rgba(255,255,255,.06));
  color: rgba(255,255,255,.94);
  font-size: 42px;
  overflow: hidden;
}

.preview img { width: 100%; height: 100%; object-fit: cover; }

.tag {
  width: fit-content;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(103,169,255,.13);
  border: 1px solid rgba(103,169,255,.20);
  color: #cfe3ff;
  font-size: 11px;
  font-weight: 700;
}

.meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  padding-top: 2px;
}

.hidden {
  color: #e1ccff;
  font-size: 12px;
  border-top: 1px dashed var(--line);
  padding-top: 9px;
}

.primary {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 16px;
  color: white;
  font-weight: 800;
  background: linear-gradient(135deg, var(--violet), var(--violet2));
  box-shadow: 0 12px 28px rgba(139,44,255,.26);
  cursor: pointer;
}

.service-list {
  display: grid;
  gap: 10px;
}

.service {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-radius: 23px;
}

.service p { margin-top: 3px; }
.service.muted { opacity: .76; }

.balance-card {
  padding: 18px;
  border-radius: 28px;
  background:
    radial-gradient(circle at 84% 10%, rgba(255,157,64,.20), transparent 26%),
    linear-gradient(135deg, rgba(139,44,255,.18), rgba(255,255,255,.045));
}

.balance-card strong {
  display: block;
  margin: 8px 0;
  font-size: 42px;
  line-height: 1;
  letter-spacing: -.04em;
}

.balance-label { color: var(--muted); font-size: 13px; }

.loading { color: var(--muted); padding: 14px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(18px);
  opacity: 0;
  max-width: calc(100% - 30px);
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(255,255,255,.96);
  color: #160b22;
  box-shadow: 0 18px 48px rgba(0,0,0,.34);
  transition: .2s ease;
  pointer-events: none;
  font-weight: 700;
  text-align: center;
  z-index: 50;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 760px) {
  .app { padding: 12px 10px calc(26px + env(safe-area-inset-bottom)); }
  .topbar { border-radius: 24px; padding: 14px; align-items: start; }
  .brand-icon { width: 38px; height: 38px; border-radius: 14px; }
  .sync-mark { display: none; }
  .brand-pair { flex-direction: column; gap: 5px; }
  .quick-panel { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .quick-card { min-height: 86px; padding: 11px; border-radius: 20px; }
  .quick-card b { font-size: 12.5px; }
  .quick-card em { font-size: 11px; }
  .hero-card { grid-template-columns: 1fr; border-radius: 25px; }
  .orbit { display: none; }
  .feature-grid, .catalog-grid { grid-template-columns: 1fr; }
  .feature { min-height: auto; }
  .preview { height: 138px; }
}

@media (min-width: 761px) and (max-width: 980px) {
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .catalog-grid { grid-template-columns: repeat(2, 1fr); }
}


/* ===== FINAL TELEGRAM DESKTOP SCROLL FIX =====
   Telegram Desktop WebView is narrow and bad with hidden scrollbars.
   We force a real visible horizontal scrollbar and make every tab wider.
*/
.tabs {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 8px !important;

  overflow-x: scroll !important;
  overflow-y: hidden !important;
  overscroll-behavior-x: contain !important;

  padding: 7px 7px 13px 7px !important;
  border-radius: 24px !important;

  scrollbar-width: auto !important;
  scrollbar-color: #8b2cff rgba(255,255,255,.14) !important;
  -webkit-overflow-scrolling: touch !important;
}

.tabs::-webkit-scrollbar {
  display: block !important;
  height: 9px !important;
}

.tabs::-webkit-scrollbar-track {
  display: block !important;
  background: rgba(255,255,255,.12) !important;
  border-radius: 999px !important;
  margin: 0 14px !important;
}

.tabs::-webkit-scrollbar-thumb {
  display: block !important;
  background: linear-gradient(90deg, #8b2cff, #c16cff) !important;
  border-radius: 999px !important;
  border: 2px solid rgba(10,5,16,.85) !important;
}

.tab {
  flex: 0 0 auto !important;
  width: auto !important;
  min-width: 112px !important;
  max-width: none !important;
  justify-content: center !important;

  white-space: nowrap !important;
  overflow: visible !important;
  text-overflow: clip !important;

  padding: 10px 14px !important;
  font-size: 15px !important;
  line-height: 1.1 !important;
  gap: 7px !important;
}

.tab span {
  flex: 0 0 auto !important;
}

/* narrow Telegram Desktop / small phone */
@media (max-width: 520px) {
  .tabs {
    padding: 7px 7px 12px 7px !important;
  }

  .tab {
    min-width: 102px !important;
    font-size: 14px !important;
    padding: 10px 12px !important;
  }
}

/* make first and last tabs breathe inside scroll */
.tab:first-child { margin-left: 0 !important; }
.tab:last-child { margin-right: 2px !important; }


/* ===== TELEGRAM DESKTOP DYNAMIC SCALE SUPPORT ===== */
html {
  --tg-scale: 1;
}

body.tg-desktop-scaled .app {
  width: calc(100% / var(--tg-scale)) !important;
  max-width: calc(980px / var(--tg-scale)) !important;
  transform: scale(var(--tg-scale)) !important;
  transform-origin: top left !important;
}

/* Small Telegram Desktop window: make UI more compact before scale */
@media (max-width: 430px), (max-height: 720px) {
  .app {
    padding: 10px 8px calc(18px + env(safe-area-inset-bottom)) !important;
  }

  .topbar {
    padding: 12px !important;
    border-radius: 22px !important;
    gap: 10px !important;
  }

  .brand-icon {
    width: 34px !important;
    height: 34px !important;
    border-radius: 12px !important;
    font-size: 19px !important;
  }

  .eyebrow, .pill {
    font-size: 11px !important;
    min-height: 22px !important;
    padding: 4px 9px !important;
  }

  h1 {
    font-size: 30px !important;
  }

  h2 {
    font-size: 25px !important;
  }

  p {
    font-size: 13.5px !important;
  }

  .quick-panel {
    gap: 8px !important;
    margin: 12px 0 !important;
  }

  .quick-card {
    min-height: 78px !important;
    padding: 10px !important;
    border-radius: 18px !important;
  }

  .mini-icon, .feature-icon, .service-ico {
    width: 28px !important;
    height: 28px !important;
    border-radius: 11px !important;
  }

  .hero-card, .feature, .catalog-card, .service, .balance-card {
    border-radius: 22px !important;
  }

  .hero-card {
    padding: 15px !important;
  }

  .feature {
    padding: 12px !important;
  }
}
