:root {
  color-scheme: dark;
  --bg: #030a18;
  --panel: rgba(10, 21, 43, 0.82);
  --panel-strong: #0a1730;
  --border: rgba(129, 169, 232, 0.17);
  --text: #f5f8ff;
  --muted: #8e9ab1;
  --blue: #2d7bff;
  --blue-bright: #4c92ff;
  --cyan: #59d8ff;
  --green: #49e2a8;
  --danger: #ff6f91;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.38);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% -20%, rgba(32, 88, 185, 0.28), transparent 40%),
    linear-gradient(180deg, #061126 0%, var(--bg) 68%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

body.telegram-mini-app {
  padding-top: env(safe-area-inset-top, 0);
}

button, a { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }

.ambient {
  position: fixed;
  z-index: -1;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.16;
  pointer-events: none;
}

.ambient-one { top: 15%; right: -250px; background: #225dff; }
.ambient-two { bottom: 0; left: -300px; background: #045faf; }

.shell { width: min(1160px, calc(100% - 40px)); margin: 0 auto; }

.site-header {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand { display: inline-flex; align-items: center; gap: 13px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(105, 172, 255, .42);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(42, 122, 255, .45), rgba(10, 34, 76, .9));
  box-shadow: 0 14px 40px rgba(30, 103, 255, .22);
  font-weight: 900;
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; letter-spacing: .01em; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 11px; }

.ghost-button, .text-button {
  border: 0;
  background: transparent;
  cursor: pointer;
}
.ghost-button { color: var(--muted); padding: 10px 4px; }
.ghost-button:hover { color: var(--text); }

.hidden { display: none !important; }

.login-layout {
  min-height: calc(100vh - 170px);
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  align-items: center;
  gap: 80px;
  padding: 70px 0 110px;
}

.eyebrow {
  color: #77abeb;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .18em;
}

.hero-copy h1, .dashboard-heading h1 {
  margin: 18px 0;
  font-size: clamp(45px, 7vw, 78px);
  line-height: .99;
  letter-spacing: -.055em;
}
.hero-copy h1 span {
  background: linear-gradient(90deg, #6eb4ff, #397dff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-copy > p {
  max-width: 610px;
  color: #a5b1c8;
  font-size: 18px;
  line-height: 1.65;
}
.trust-row { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 32px; }
.trust-row span, .stage-note, .shield-chip, .step-chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(10, 24, 50, .66);
  color: var(--muted);
  font-size: 11px;
  padding: 8px 12px;
}

.glass-card {
  border: 1px solid var(--border);
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(12, 25, 50, .92), rgba(6, 14, 30, .78));
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.login-card { padding: 38px; }
.icon-orb {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  margin-bottom: 30px;
  border-radius: 18px;
  background: linear-gradient(145deg, #2c83ff, #174abe);
  box-shadow: 0 16px 40px rgba(32, 100, 255, .28);
  font-size: 25px;
}
.login-card h2 { margin: 13px 0; font-size: 28px; letter-spacing: -.03em; }
.login-card > p { color: var(--muted); line-height: 1.6; }

.primary-button, .secondary-button, .action-link {
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 15px;
  cursor: pointer;
  font-weight: 800;
  transition: transform .2s ease, filter .2s ease, border-color .2s ease;
}
.primary-button {
  width: 100%;
  margin-top: 16px;
  background: linear-gradient(135deg, #3187ff, #1f57dd);
  box-shadow: 0 15px 42px rgba(38, 105, 255, .28);
}
.primary-button:hover, .action-link:hover, .secondary-button:hover { transform: translateY(-2px); filter: brightness(1.08); }
.stage-note { margin-top: 22px; border-radius: 13px; text-align: center; line-height: 1.4; }

.login-progress {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
  color: #b9c7dc;
  font-size: 13px;
  line-height: 1.45;
}
.pulse-dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(73, 226, 168, .6);
  animation: pulse 1.8s infinite;
}
@keyframes pulse { 70% { box-shadow: 0 0 0 9px rgba(73, 226, 168, 0); } }
.error-text { color: var(--danger) !important; font-size: 13px; }

.dashboard { padding: 48px 0 100px; }
.dashboard-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 30px;
}
.dashboard-heading h1 { margin: 10px 0; font-size: clamp(38px, 6vw, 62px); }
.dashboard-heading p { margin: 0; color: var(--muted); }
.live-badge, .status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 11px;
  color: #9eefd0;
  background: rgba(48, 178, 131, .12);
  border: 1px solid rgba(73, 226, 168, .24);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  white-space: nowrap;
}
.live-badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }

.dashboard-grid { display: grid; grid-template-columns: 1fr; }
.subscription-card, .nodes-card, .devices-card, .help-card { padding: 30px; }
.card-topline, .section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}
.card-label { color: #7895bd; font-size: 10px; font-weight: 800; letter-spacing: .18em; }
.subscription-card h2, .nodes-card h2, .devices-card h2, .help-card h2 {
  margin: 18px 0 8px;
  font-size: 26px;
  letter-spacing: -.025em;
}
.subscription-card > p, .nodes-card > p, .help-card p { color: var(--muted); line-height: 1.55; }
.status-badge.expired { color: #ffb1c3; border-color: rgba(255,111,145,.26); background: rgba(255,111,145,.1); }
.status-badge.trial { color: #b8d8ff; border-color: rgba(78,145,255,.28); background: rgba(45,123,255,.12); }

.expiry-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 18px;
  margin: 25px 0 20px;
  padding: 17px 18px;
  border-radius: 17px;
  background: rgba(4, 13, 30, .62);
  border: 1px solid rgba(129,169,232,.12);
}
.expiry-panel span, .expiry-panel small { color: var(--muted); font-size: 11px; }
.expiry-panel strong { grid-row: span 2; align-self: center; font-size: 18px; }
.tariff-row { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.tariff-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: rgba(13, 29, 58, .72);
  text-align: left;
}
.tariff-button span b, .tariff-button span small { display: block; }
.tariff-button span small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.tariff-button:disabled { opacity: .58; }
.read-only-caption { margin-bottom: 0; font-size: 11px; }

.node-list { display: grid; gap: 9px; margin-top: 22px; }
.node-list > div { display: flex; align-items: center; gap: 13px; padding: 11px 13px; border-radius: 14px; background: rgba(5,14,31,.48); }
.node-list b, .node-list small { display: block; }
.node-list b { font-size: 13px; }
.node-list small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.node-dot { width: 9px; height: 9px; border-radius: 50%; background: #559aff; box-shadow: 0 0 16px rgba(85,154,255,.8); }
.node-dot.finland { background: #72ccff; }

.devices-card { margin-top: 22px; }
.section-title h2 { margin-top: 8px; }
.device-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 25px 0;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 17px;
  background: rgba(3, 11, 26, .58);
}
.device-tab {
  min-height: 43px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}
.device-tab.active { color: white; background: linear-gradient(135deg, rgba(48,131,255,.95), rgba(30,81,202,.92)); }

.install-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.install-step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  min-height: 220px;
  padding: 23px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(5, 15, 34, .54);
}
.accent-step { background: linear-gradient(145deg, rgba(22,65,138,.39), rgba(5,15,34,.58)); }
.step-number { color: #5797f7; font-size: 11px; font-weight: 900; letter-spacing: .12em; }
.install-step h3 { margin: 0 0 8px; font-size: 18px; }
.install-step p { min-height: 48px; margin: 0 0 18px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.button-row { display: flex; flex-wrap: wrap; gap: 9px; }
.action-link, .secondary-button {
  min-height: 43px;
  padding: 0 15px;
  border: 1px solid rgba(89,145,235,.25);
  background: rgba(31,82,174,.22);
  font-size: 12px;
}
.action-link.primary { border: 0; background: linear-gradient(135deg, #2d7bff, #2057d6); }
.action-link.disabled { pointer-events: none; opacity: .4; }
.text-button { margin-top: 15px; padding: 4px 0; color: #81b5ff; font-size: 12px; }
.connection-notice { margin: 17px 0 0; color: var(--muted); font-size: 11px; }

.help-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  margin-top: 22px;
}
.help-card h2 { margin-top: 8px; }
.help-card p { max-width: 730px; margin-bottom: 0; }
.secondary-button { flex: 0 0 auto; }

footer { padding: 0 0 35px; color: #52627b; font-size: 11px; text-align: center; }

.guide-main { padding: 45px 0 90px; }
.guide-hero { max-width: 820px; margin-bottom: 32px; }
.guide-hero h1 {
  margin: 13px 0;
  font-size: clamp(38px, 7vw, 66px);
  line-height: 1;
  letter-spacing: -.05em;
}
.guide-hero p { max-width: 720px; color: var(--muted); font-size: 17px; line-height: 1.6; }
.guide-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 28px 0 24px;
}
.guide-summary a {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(9, 23, 48, .72);
}
.guide-summary strong, .guide-summary span { display: block; }
.guide-summary span { margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.guide-list { display: grid; gap: 22px; }
.guide-card { padding: 30px; }
.guide-card.recommended { border-color: rgba(73, 226, 168, .3); }
.guide-card h2 { margin: 10px 0 8px; font-size: 28px; letter-spacing: -.03em; }
.guide-card > p { color: var(--muted); line-height: 1.6; }
.guide-label {
  display: inline-flex;
  padding: 7px 10px;
  border: 1px solid rgba(73, 226, 168, .25);
  border-radius: 999px;
  color: #9eefd0;
  background: rgba(48, 178, 131, .1);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
}
.guide-steps { display: grid; gap: 12px; margin: 24px 0; padding: 0; list-style: none; counter-reset: guide-step; }
.guide-steps li {
  position: relative;
  min-height: 52px;
  padding: 14px 15px 14px 56px;
  border: 1px solid rgba(129, 169, 232, .12);
  border-radius: 15px;
  background: rgba(3, 12, 29, .48);
  color: #c4cee0;
  line-height: 1.5;
  counter-increment: guide-step;
}
.guide-steps li::before {
  content: counter(guide-step);
  position: absolute;
  top: 13px;
  left: 15px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: #fff;
  background: #2469e8;
  font-size: 11px;
  font-weight: 900;
}
.guide-warning {
  margin: 20px 0;
  padding: 16px 17px;
  border: 1px solid rgba(255, 181, 95, .23);
  border-radius: 16px;
  color: #d7c5af;
  background: rgba(132, 81, 22, .12);
  font-size: 13px;
  line-height: 1.55;
}
.guide-warning strong { color: #ffd29a; }
.guide-checklist { margin: 17px 0 22px; padding-left: 21px; color: #bcc7da; line-height: 1.6; }
.guide-checklist li + li { margin-top: 7px; }
.guide-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.guide-actions .action-link { min-height: 47px; }
.guide-back { color: #9eacc3; }


.payment-button {
  color: inherit;
  cursor: pointer;
  transition:
    transform .18s ease,
    border-color .18s ease,
    background .18s ease,
    opacity .18s ease;
}

.payment-button:not(:disabled):hover {
  transform: translateY(-1px);
  border-color: rgba(92, 153, 255, .5);
  background: rgba(22, 48, 91, .82);
}

.payment-button:disabled {
  cursor: not-allowed;
}

.account-card h2 { margin: 10px 0 7px; }
.account-card > p { color: var(--muted); line-height: 1.5; }
.identity-safe-badge {
  color: #9eefd0;
  font-size: 10px;
  font-weight: 800;
}
.identity-list {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}
.identity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 15px;
  border: 1px solid rgba(129, 169, 232, .14);
  border-radius: 15px;
  background: rgba(3, 12, 29, .48);
}
.identity-row > div {
  min-width: 0;
}
.identity-row strong,
.identity-row span { display: block; }
.identity-row span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.identity-row .text-button {
  flex: 0 0 auto;
}
.identity-row .text-button.identity-linked,
.identity-row .text-button.identity-linked:disabled {
  color: #9eefd0;
  opacity: 1;
  cursor: default;
}
.identity-form {
  margin-top: 14px;
}
.identity-form label {
  display: block;
  margin-bottom: 7px;
  color: #c8d4e8;
  font-size: 12px;
  font-weight: 700;
}
.identity-form-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
}
.identity-form-row input {
  min-width: 0;
  padding: 12px 13px;
  border: 1px solid rgba(129, 169, 232, .2);
  border-radius: 12px;
  color: #f4f8ff;
  background: rgba(3, 12, 29, .72);
}
.identity-form-row .primary-button {
  min-height: 44px;
  padding: 0 15px;
}

.payment-legal {
  margin: 10px 0 0;
  color: #657893;
  font-size: 10px;
  line-height: 1.55;
}

.payment-legal a,
.site-footer a {
  color: #8da9d0;
  text-decoration: none;
}

.payment-legal a:hover,
.site-footer a:hover {
  color: #b8d2f5;
  text-decoration: underline;
}

.site-footer {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
}

.footer-separator {
  color: #35455d;
}

@media (max-width: 900px) {
  .login-layout, .dashboard-grid { grid-template-columns: 1fr; }
  .login-layout { gap: 45px; padding-top: 40px; }
  .hero-copy { text-align: center; }
  .hero-copy > p { margin-left: auto; margin-right: auto; }
  .trust-row { justify-content: center; }
  .install-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .shell { width: min(100% - 24px, 1160px); }
  .site-header { min-height: 76px; }
  .brand-mark { width: 40px; height: 40px; }
  .login-layout { padding: 35px 0 75px; }
  .hero-copy h1 {
    font-size: clamp(38px, 12vw, 46px);
  }
  .hero-copy > p { font-size: 15px; }
  .login-card, .subscription-card, .nodes-card, .devices-card, .help-card { padding: 21px; border-radius: 22px; }
  .dashboard { padding-top: 20px; }
  .dashboard-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 18px;
  }
  .dashboard-heading h1 {
    margin: 6px 0;
    font-size: clamp(30px, 9vw, 34px);
    line-height: 1;
  }
  .dashboard-heading p { font-size: 13px; line-height: 1.45; }
  .tariff-row { grid-template-columns: 1fr; }
  .identity-form-row { grid-template-columns: 1fr; }
  .identity-row { align-items: flex-start; }
  .device-tabs { grid-template-columns: 1fr 1fr; }
  .install-step { grid-template-columns: 1fr; min-height: 0; }
  .install-step p { min-height: 0; }
  .help-card { align-items: flex-start; flex-direction: column; }
  .secondary-button { width: 100%; }
  .guide-main { padding-top: 24px; }
  .guide-hero h1 { font-size: 38px; }
  .guide-hero p { font-size: 15px; }
  .guide-summary { grid-template-columns: 1fr; }
  .guide-card { padding: 21px; border-radius: 22px; }
  .guide-card h2 { font-size: 24px; }
  .guide-actions .action-link { width: 100%; }
}
