:root {
  --tg-bg: var(--tg-theme-bg-color, #081019);
  --tg-secondary-bg: var(--tg-theme-secondary-bg-color, rgba(12, 18, 31, 0.92));
  --tg-text: var(--tg-theme-text-color, #f4f7fb);
  --tg-hint: var(--tg-theme-hint-color, #9fb1c9);
  --tg-link: var(--tg-theme-link-color, #7ce9ff);
  --tg-button: var(--tg-theme-button-color, #12d6f4);
  --tg-button-text: var(--tg-theme-button-text-color, #041118);

  --bg: #071018;
  --bg-elev: rgba(9, 17, 28, 0.92);
  --panel: rgba(14, 24, 39, 0.82);
  --panel-soft: rgba(10, 18, 30, 0.76);
  --line: rgba(166, 201, 255, 0.12);
  --line-strong: rgba(166, 201, 255, 0.22);
  --text: var(--tg-text);
  --muted: var(--tg-hint);
  --muted-2: #7f92ac;
  --accent: #7ce9ff;
  --accent-2: #35ffb6;
  --accent-3: #ffc857;
  --success: #6effb0;
  --danger: #ff7a99;
  --shadow: 0 22px 58px rgba(0, 0, 0, 0.34);
  --radius-2xl: 28px;
  --radius-xl: 24px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --maxw: 1120px;
  --font: "Manrope", "Aptos", "Segoe UI", system-ui, sans-serif;

  --app-height: 100dvh;
  --app-stable-height: 100dvh;
  --safe-top: 0px;
  --safe-right: 0px;
  --safe-bottom: 0px;
  --safe-left: 0px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at 12% 0%, rgba(124, 233, 255, 0.12), transparent 30%),
    radial-gradient(circle at 100% 10%, rgba(53, 255, 182, 0.10), transparent 28%),
    linear-gradient(180deg, #06111b 0%, #081019 42%, #09131e 100%);
  color: var(--text);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: var(--app-stable-height);
  font-family: var(--font);
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(6, 16, 25, 0.72), rgba(6, 16, 25, 0.96)),
    radial-gradient(circle at 15% 10%, rgba(124, 233, 255, 0.08), transparent 24%),
    radial-gradient(circle at 85% 16%, rgba(53, 255, 182, 0.08), transparent 20%),
    #06111b;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
.button {
  font: inherit;
}

.page {
  position: relative;
  min-height: var(--app-stable-height);
  overflow-x: hidden;
  overflow-y: auto;
}

.page::before,
.page::after {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: -1;
  inset: auto;
}

.page::before {
  width: 420px;
  height: 420px;
  left: -120px;
  top: -150px;
  background: radial-gradient(circle, rgba(124, 233, 255, 0.14), transparent 70%);
}

.page::after {
  width: 380px;
  height: 380px;
  right: -120px;
  top: 100px;
  background: radial-gradient(circle, rgba(53, 255, 182, 0.10), transparent 68%);
}

.shell {
  width: min(100% - 28px, var(--maxw));
  margin: 0 auto;
  padding:
    calc(14px + var(--safe-top) + env(safe-area-inset-top, 0px))
    0
    calc(34px + var(--safe-bottom) + env(safe-area-inset-bottom, 0px));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(8, 15, 24, 0.72);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  object-fit: contain;
  background: rgba(7, 12, 20, 0.84);
  border: 1px solid rgba(166, 201, 255, 0.12);
}

.brand-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.brand-name {
  font-size: 0.96rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-tag {
  font-size: 0.83rem;
  color: var(--muted);
  line-height: 1.35;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.nav a,
.nav button,
.pill,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 15px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease;
}

.nav a:hover,
.nav button:hover,
.button:hover,
.pill:hover {
  transform: translateY(-1px);
}

.nav a[aria-current="page"] {
  border-color: rgba(124, 233, 255, 0.22);
  background: rgba(124, 233, 255, 0.08);
}

.button.primary,
.button.cta {
  background: linear-gradient(135deg, var(--accent), #67ffd9);
  color: #041118;
  font-weight: 800;
  box-shadow: 0 14px 34px rgba(124, 233, 255, 0.18);
}

.button.secondary {
  border-color: var(--line-strong);
  background: rgba(9, 17, 28, 0.72);
}

.button.ghost {
  border-color: rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
}

.button:disabled,
.pill:disabled,
button:disabled {
  opacity: 0.56;
  cursor: default;
  transform: none !important;
}

.button[aria-busy="true"] {
  pointer-events: none;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(300px, 0.95fr);
  gap: 18px;
  align-items: stretch;
}

.hero--compact .hero-panel,
.hero--compact .stats {
  padding-top: 20px;
}

.hero-panel,
.stats,
.install-card,
.payment-card,
.device-card,
.plan-card,
.section-card {
  position: relative;
  overflow: clip;
  border-radius: var(--radius-2xl);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(12, 20, 33, 0.94), rgba(8, 14, 24, 0.80));
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow);
  padding: 20px;
}

.payment-card.is-selected,
.device-card.is-selected,
.plan-card.is-selected {
  border-color: rgba(124, 233, 255, 0.54);
  box-shadow: 0 20px 54px rgba(124, 233, 255, 0.14), var(--shadow);
}

.payment-card--disabled {
  opacity: 0.68;
  filter: saturate(0.72);
}

.payment-card--disabled::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(8, 14, 24, 0.10), rgba(8, 14, 24, 0.38));
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.76rem;
  font-weight: 800;
}

.kicker::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 18px rgba(124, 233, 255, 0.72);
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4.4rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.hero h1 .accent {
  color: var(--accent);
}

.hero p {
  margin: 16px 0 0;
  max-width: 58ch;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.66;
}

.hero-actions,
.card-actions,
.hero-meta,
.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-actions,
.card-actions {
  margin-top: 22px;
}

.checkout-summary {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid rgba(124, 233, 255, 0.16);
  border-radius: 18px;
  background: rgba(7, 12, 20, 0.48);
}

.checkout-summary div {
  display: grid;
  gap: 4px;
}

.checkout-summary span {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.checkout-summary strong {
  font-size: 1rem;
  line-height: 1.35;
}

.checkout-summary div:last-child strong {
  color: var(--accent-2);
}

.checkout-status {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
  padding: 13px 14px;
  border-radius: 18px;
  border: 1px solid rgba(124, 233, 255, 0.18);
  background: rgba(124, 233, 255, 0.08);
}

.checkout-status strong {
  color: var(--text);
}

.checkout-status span {
  color: var(--muted);
  line-height: 1.45;
}

.checkout-status--success {
  border-color: rgba(110, 255, 176, 0.26);
  background: rgba(110, 255, 176, 0.10);
}

.checkout-status--danger {
  border-color: rgba(255, 122, 153, 0.28);
  background: rgba(255, 122, 153, 0.10);
}

.checkout-status--pending {
  border-color: rgba(255, 200, 87, 0.28);
  background: rgba(255, 200, 87, 0.10);
}

.hero-meta {
  margin-top: 16px;
}

.meta-chip,
.route-badge,
.plan-label,
.pill-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(166, 201, 255, 0.14);
  background: rgba(8, 14, 24, 0.58);
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.03em;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.stat {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(166, 201, 255, 0.1);
  background: rgba(7, 12, 20, 0.54);
}

.stat strong {
  display: block;
  font-size: 1.35rem;
  line-height: 1;
}

.stat span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.stats-note {
  margin-top: 14px;
  padding: 13px 14px;
  border-radius: 18px;
  border: 1px solid rgba(124, 233, 255, 0.14);
  background: linear-gradient(135deg, rgba(124, 233, 255, 0.08), rgba(53, 255, 182, 0.06));
  color: var(--muted);
  line-height: 1.58;
}

.section {
  margin-top: 20px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.section-head h2 {
  margin: 0;
  font-size: 1.34rem;
  letter-spacing: -0.02em;
}

.section-head p {
  margin: 0;
  max-width: 60ch;
  color: var(--muted);
  line-height: 1.58;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.page-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.plan-price {
  margin: 12px 0 6px;
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.plan-price small {
  font-size: 0.98rem;
  color: var(--muted);
  font-weight: 600;
}

.plan-copy,
.list,
.muted {
  color: var(--muted);
}

.mini {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 9px;
}

.list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.list li::before {
  content: "•";
  color: var(--accent);
  line-height: 1.3;
}

.copy-target {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 13px 15px;
  margin-top: 14px;
  border-radius: 16px;
  border: 1px dashed rgba(124, 233, 255, 0.22);
  background: rgba(8, 13, 22, 0.76);
  color: #d9f4ff;
  word-break: break-all;
}

.copy-target code {
  color: #d9f4ff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88rem;
}

.stack {
  display: grid;
  gap: 10px;
}

.stack-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(166, 201, 255, 0.1);
}

.stack-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.stack-row strong {
  font-size: 0.98rem;
}

.stack-row span {
  color: var(--muted);
  font-size: 0.92rem;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tab {
  border: 1px solid rgba(166, 201, 255, 0.15);
  background: rgba(9, 14, 25, 0.54);
  color: var(--text);
}

.tab.is-active {
  border-color: rgba(124, 233, 255, 0.24);
  background: rgba(124, 233, 255, 0.08);
}

.install-advanced {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(166, 201, 255, 0.1);
}

.install-advanced summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 700;
  list-style: none;
}

.install-advanced summary::-webkit-details-marker {
  display: none;
}

.install-tools {
  margin-top: 12px;
}

.hidden {
  display: none !important;
}

.fade-in {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.fade-in.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast {
  position: fixed;
  right: max(18px, calc(18px + var(--safe-right)));
  bottom: max(18px, calc(18px + var(--safe-bottom)));
  z-index: 50;
  max-width: min(360px, calc(100vw - 24px));
  padding: 13px 14px;
  border-radius: 16px;
  background: rgba(9, 16, 27, 0.96);
  border: 1px solid rgba(124, 233, 255, 0.16);
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.footer {
  margin-top: 26px;
  padding: 16px 2px 0;
  color: var(--muted-2);
  font-size: 0.94rem;
  line-height: 1.6;
}

.page[data-page="install"] .hero-panel,
.page[data-page="install"] .stats,
.page[data-page="checkout"] .hero-panel,
.page[data-page="checkout"] .stats {
  min-height: unset;
}

.is-tg-miniapp .shell {
  width: min(100% - 18px, 980px);
}

.is-tg-miniapp .topbar {
  position: sticky;
  top: max(6px, var(--safe-top));
  z-index: 10;
}

.is-tg-miniapp .nav {
  display: none;
}

@media (max-width: 1100px) {
  .grid.cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .hero,
  .grid.cols-3,
  .grid.cols-2,
  .page-split {
    grid-template-columns: 1fr;
  }

  .topbar {
    border-radius: 20px;
    flex-direction: column;
    align-items: stretch;
  }

  .nav {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 16px, var(--maxw));
    padding-bottom: calc(26px + var(--safe-bottom) + env(safe-area-inset-bottom, 0px));
  }

  .hero-panel,
  .stats,
  .install-card,
  .payment-card,
  .device-card,
  .plan-card,
  .section-card {
    padding: 16px;
    border-radius: 20px;
  }

  .hero h1 {
    font-size: clamp(1.85rem, 10vw, 2.8rem);
  }

  .section-head {
    flex-direction: column;
    align-items: start;
  }

  .stats-grid,
  .grid.cols-4 {
    grid-template-columns: 1fr 1fr;
  }

  .stack-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .stack-row > :last-child {
    width: 100%;
  }

  .stack-row .button,
  .stack-row .pill,
  .stack-row .pill-label,
  .stack-row .route-badge {
    width: 100%;
  }

  .page[data-page="checkout"] .sticky-actions {
    position: sticky;
    bottom: max(10px, calc(10px + var(--safe-bottom)));
    z-index: 12;
    padding: 8px;
    margin-inline: -8px;
    border: 1px solid rgba(166, 201, 255, 0.12);
    border-radius: 18px;
    background: rgba(8, 15, 24, 0.86);
    backdrop-filter: blur(18px);
  }

  .page[data-page="checkout"] .sticky-actions .button {
    flex: 1 1 100%;
  }
}

@media (max-width: 620px) {
  .grid.cols-4 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .button,
  .pill,
  .nav a,
  .nav button {
    min-height: 42px;
    width: 100%;
  }

  .hero-actions,
  .card-actions,
  .hero-meta {
    flex-direction: column;
  }
}
