:root {
  --bg: #060410;
  --bg-alt: #0b0818;
  --surface: #120d24;
  --surface-hover: #181030;
  --border: #2a1f4d;

  --violet: #8b5cf6;
  --violet-deep: #6d28d9;
  --magenta: #c026d3;
  --gradient: linear-gradient(135deg, var(--violet) 0%, var(--magenta) 100%);

  --text: #ece7fa;
  --text-dim: #9c92c0;
  --text-faint: #675e8c;

  --ok: #34d399;
  --error: #f87171;

  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --sans: 'Inter', system-ui, sans-serif;

  --radius: 12px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.5;
  position: relative;
  min-height: 100vh;
}

#matrix-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.16;
  pointer-events: none;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

::selection { background: rgba(139,92,246,0.35); color: #fff; }

@media (prefers-reduced-motion: reduce) {
  #matrix-canvas { display: none; }
}

header, main, footer { position: relative; z-index: 2; }

a { color: inherit; text-decoration: none; }

/* ---------- topbar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px clamp(20px, 5vw, 64px);
  border-bottom: 1px solid var(--border);
  background: rgba(6, 4, 16, 0.7);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; transition: box-shadow .2s; }
.brand:hover .brand-mark { box-shadow: 0 0 0 2px rgba(139,92,246,0.5), 0 0 18px rgba(139,92,246,0.5); }
.brand-text { font-family: var(--mono); font-weight: 700; letter-spacing: 0.02em; font-size: 1.05rem; }
.brand-text .dash { color: var(--text-dim); }
.brand-text .lab {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.topnav { display: flex; align-items: center; gap: 22px; font-size: 0.92rem; }
.topnav a { color: var(--text-dim); transition: color .15s; }
.topnav a:hover { color: var(--text); }
.nav-cta {
  background: var(--gradient);
  color: #fff !important;
  padding: 9px 18px;
  border-radius: 999px;
  font-weight: 600;
}
.nav-ghost {
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 999px;
}

/* ---------- flash ---------- */

.flash-stack { max-width: 880px; margin: 18px auto 0; padding: 0 20px; display: grid; gap: 8px; }
.flash { padding: 12px 16px; border-radius: 8px; font-size: 0.9rem; font-family: var(--mono); }
.flash-error { background: rgba(248,113,113,0.1); border: 1px solid rgba(248,113,113,0.35); color: var(--error); }
.flash-message, .flash-success { background: rgba(52,211,153,0.1); border: 1px solid rgba(52,211,153,0.35); color: var(--ok); }

/* ---------- hero ---------- */

.hero {
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(50px, 8vw, 90px) 24px 30px;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 40px;
  align-items: center;
}

.hero-text { text-align: left; }

.hero-eyebrow {
  font-family: var(--mono);
  color: var(--violet);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  margin-bottom: 18px;
}

.hero-title {
  font-family: var(--mono);
  font-size: clamp(2.1rem, 4.5vw, 3.3rem);
  font-weight: 800;
  line-height: 1.1;
  margin: 0 0 20px;
  background: linear-gradient(120deg, #fff 30%, var(--violet) 70%, var(--magenta) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  color: var(--text-dim);
  font-size: 1.02rem;
  max-width: 520px;
  margin: 0 0 30px;
}

.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 40px; }

.hero-mark {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
}

.hero-mark-glow {
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139,92,246,0.55) 0%, rgba(192,38,211,0.25) 45%, transparent 72%);
  filter: blur(18px);
  animation: pulse-glow 4.5s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.08); opacity: 1; }
}

.hero-mark-img {
  position: relative;
  width: 78%;
  border-radius: 24px;
  object-fit: cover;
  box-shadow: 0 30px 70px -20px rgba(139,92,246,0.55), 0 0 0 1px rgba(139,92,246,0.25);
  animation: float-logo 6s ease-in-out infinite;
}

@keyframes float-logo {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@media (prefers-reduced-motion: reduce) {
  .hero-mark-glow, .hero-mark-img { animation: none; }
}

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; text-align: center; }
  .hero-text { text-align: center; }
  .hero-sub { margin-left: auto; margin-right: auto; }
  .hero-actions { justify-content: center; }
  .hero-terminal { margin: 0 auto; }
  .hero-mark { max-width: 260px; margin: 0 auto; order: -1; }
}

.note {
  max-width: 720px;
  margin: 10px auto 60px;
  padding: 0 24px;
  text-align: center;
}
.note p {
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--text-dim);
  line-height: 1.7;
}
.note-quote { color: var(--violet); font-size: 1.4rem; margin-right: 2px; }
.note a { color: var(--violet); font-weight: 600; }
.note a:hover { text-decoration: underline; }

.btn {
  display: inline-block;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 13px 26px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn-primary { background: var(--gradient); color: #fff; box-shadow: 0 8px 24px -8px rgba(139,92,246,0.6); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 28px -8px rgba(139,92,246,0.75); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-hover); }
.btn-block { width: 100%; text-align: center; }
.btn-small { padding: 8px 14px; font-size: 0.82rem; }

.hero-terminal {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 480px;
  box-shadow: 0 30px 60px -30px rgba(139,92,246,0.35);
}
.terminal-bar { display: flex; gap: 6px; padding: 12px 14px; background: var(--bg-alt); border-bottom: 1px solid var(--border); }
.terminal-bar span { width: 10px; height: 10px; border-radius: 50%; background: var(--border); }
.terminal-bar span:nth-child(1) { background: #f87171; }
.terminal-bar span:nth-child(2) { background: #fbbf24; }
.terminal-bar span:nth-child(3) { background: #34d399; }
.terminal-body { padding: 18px 20px; font-family: var(--mono); font-size: 0.85rem; }
.terminal-body p { margin: 6px 0; }
.prompt { color: var(--violet); }
.dim { color: var(--text-faint); }
.blink { animation: blink 1.1s steps(1) infinite; color: var(--violet); }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- features ---------- */

.features {
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 26px;
}
.feature { padding: 26px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.feature-num { font-family: var(--mono); color: var(--violet); font-size: 0.8rem; }
.feature h3 { margin: 10px 0 8px; font-size: 1.05rem; }
.feature p { color: var(--text-dim); font-size: 0.92rem; margin: 0; }

/* ---------- pricing ---------- */

.pricing { max-width: 1000px; margin: 40px auto 100px; padding: 0 24px; text-align: center; }
.pricing h2 { font-family: var(--mono); font-size: 1.8rem; margin-bottom: 6px; }
.section-sub { color: var(--text-dim); margin: 0 0 34px; font-size: 0.92rem; }

.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 22px; text-align: left; }

.plan-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  display: flex;
  flex-direction: column;
}
.plan-featured { border-color: var(--violet); box-shadow: 0 0 0 1px var(--violet), 0 20px 50px -25px rgba(139,92,246,0.6); }
.plan-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.plan-devices { font-family: var(--mono); font-weight: 700; font-size: 1.1rem; }
.plan-badge { font-size: 0.72rem; background: var(--gradient); color: #fff; padding: 4px 10px; border-radius: 999px; }
.plan-rows { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 8px; }
.plan-rows li { display: flex; justify-content: space-between; font-size: 0.9rem; color: var(--text-dim); border-bottom: 1px dashed var(--border); padding-bottom: 6px; }
.plan-price { color: var(--text); font-family: var(--mono); font-weight: 600; }

/* ---------- auth ---------- */

.auth-section { max-width: 440px; margin: 60px auto 100px; padding: 0 20px; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 34px; }
.auth-eyebrow { font-family: var(--mono); color: var(--violet); font-size: 0.8rem; margin-bottom: 6px; }
.auth-card h1 { font-family: var(--mono); font-size: 1.5rem; margin: 0 0 24px; }

.auth-form { display: grid; gap: 16px; }
.auth-form label, .buy-form label { display: grid; gap: 6px; font-size: 0.85rem; color: var(--text-dim); }
.auth-form input, .buy-form input, .buy-form select {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.95rem;
}
.auth-form input:focus, .buy-form input:focus, .buy-form select:focus {
  outline: none;
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.2);
}

.auth-divider { display: flex; align-items: center; gap: 12px; margin: 24px 0; color: var(--text-faint); font-size: 0.8rem; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.tg-login-wrap { display: flex; justify-content: center; }
.auth-switch { margin: 22px 0 0; font-size: 0.88rem; color: var(--text-dim); text-align: center; }
.auth-switch a { color: var(--violet); font-weight: 600; }
.optional { color: var(--text-faint); font-weight: 400; }

/* ---------- dashboard ---------- */

.dash { max-width: 900px; margin: 0 auto; padding: 50px 20px 100px; }
.dash-eyebrow { font-family: var(--mono); color: var(--violet); font-size: 0.8rem; margin-bottom: 6px; }
.dash h1 { font-family: var(--mono); margin: 0 0 30px; }

.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-bottom: 20px; }
.dash-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.dash-card h3 { margin: 0 0 16px; font-size: 1rem; font-family: var(--mono); }

.status-ok { color: var(--ok); font-family: var(--mono); font-weight: 600; margin-bottom: 12px; }
.status-off { color: var(--text-faint); font-family: var(--mono); font-weight: 600; margin-bottom: 12px; }

.kv { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 8px; }
.kv li { display: flex; justify-content: space-between; font-size: 0.9rem; }
.kv li span:first-child { color: var(--text-dim); }

.key-label { display: block; font-size: 0.78rem; color: var(--text-faint); margin-bottom: 6px; }
.key-box { display: flex; align-items: center; gap: 10px; background: var(--bg-alt); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.key-box code { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.8rem; color: var(--violet); }

.buy-card { margin-top: 4px; }
.buy-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; align-items: end; }
.buy-form button { grid-column: 1 / -1; margin-top: 4px; }
.small { font-size: 0.8rem; margin-top: 14px; }

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 34px clamp(20px, 5vw, 64px);
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text-faint);
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  align-items: center;
  justify-content: space-between;
}
.footer-links a { color: var(--text-dim); }
.footer-links a:hover { color: var(--violet); }
.fine-print { width: 100%; margin: 0; font-size: 0.75rem; opacity: 0.6; }

@media (max-width: 640px) {
  .topnav { gap: 12px; font-size: 0.82rem; }
  .nav-cta, .nav-ghost { padding: 7px 12px; }
}
