:root {
  --bg: #061018;
  --card: #0c1a28;
  --line: rgba(120, 190, 210, 0.14);
  --text: #eef7ff;
  --muted: #8aa4b8;
  --accent: #3ee0c4;
  --accent-2: #6aa7ff;
  --danger: #ff7b8a;
  --ok: #7dffb3;
  --ink: #04231d;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Vazirmatn", Tahoma, sans-serif;
  color: var(--text);
  background:
    radial-gradient(700px 280px at 100% -10%, rgba(62, 224, 196, 0.14), transparent 50%),
    radial-gradient(900px 400px at -10% 80%, rgba(106, 167, 255, 0.12), transparent 45%),
    repeating-linear-gradient(-18deg, transparent 0 22px, rgba(255,255,255,0.015) 22px 23px),
    var(--bg);
}

.app { max-width: 1180px; margin: 0 auto; padding: 18px 18px 56px; }
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 44px; height: 44px; border-radius: 14px;
  background:
    linear-gradient(135deg, var(--accent) 0 42%, transparent 42% 58%, var(--accent-2) 58%);
  box-shadow: 0 0 0 1px rgba(62, 224, 196, 0.25);
}
.brand h1 { margin: 0; font-size: 22px; letter-spacing: -0.03em; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }

.card {
  background: rgba(12, 26, 40, 0.92);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 20px;
  backdrop-filter: blur(18px);
}
.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(3, 1fr); }
.two { grid-template-columns: 1fr 1fr; }
.stat h3, .card h2, .card h3 { margin: 0 0 8px; }
.muted { color: var(--muted); }
.stat strong { font-size: 28px; }
.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

label { display: block; margin: 12px 0 6px; color: var(--muted); font-size: 13px; }
input, select, textarea, button, .btn { font: inherit; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #07131f;
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
}
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  background: var(--accent);
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
}
button.secondary, .btn.secondary { background: #143049; color: var(--text); font-weight: 700; }
button.ghost, .btn.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  font-weight: 600;
}
button.ghost:hover { color: var(--danger); }
button.danger { background: #4d1c28; color: #ffd6db; }
.btn.apk-download {
  flex-direction: column;
  gap: 2px;
  min-width: 180px;
  padding: 14px 18px;
  line-height: 1.2;
}
.btn.apk-download small {
  font-size: 11px;
  font-weight: 700;
  opacity: 0.8;
}
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.hidden,
[hidden] { display: none !important; }
#adminView[hidden],
#userView[hidden],
#loginView.hidden { display: none !important; }
.ok { color: var(--ok); margin: 8px 0 0; }
.bad { color: var(--danger); margin: 8px 0 0; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: right; padding: 10px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); }
#adminView .card { overflow-x: auto; }
#adminView table { min-width: 720px; }

.gate {
  display: grid;
  grid-template-columns: minmax(280px, 0.82fr) minmax(0, 1.18fr);
  gap: 28px;
  align-items: start;
  margin-bottom: 22px;
}
.gate-copy h2 {
  margin: 0 0 18px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.25;
  max-width: 16ch;
}
.steps {
  list-style: none;
  margin: 0 0 22px;
  padding: 0;
  display: grid;
  gap: 10px;
}
.steps li {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  align-items: center;
  color: var(--muted);
}
.steps b {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: #0b2233;
  border: 1px solid var(--line);
  color: var(--accent);
}
.steps.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 14px;
}
.steps.compact li { font-size: 13px; }

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: #07131f;
  padding: 5px;
  border-radius: 14px;
  margin-bottom: 8px;
}
.auth-tabs button {
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}
.auth-tabs button.active { background: var(--accent); color: var(--ink); }
.gate-auth button[type="submit"] { width: 100%; margin-top: 16px; }

.plan-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.plan-chip {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(12, 26, 40, 0.7);
}
.plan-chip h3 { margin: 0; font-size: 15px; }
.plan-chip.featured {
  border-color: rgba(62, 224, 196, 0.45);
  box-shadow: 0 0 0 1px rgba(62, 224, 196, 0.18);
}
.plan-chip small { color: var(--accent); font-size: 11px; font-weight: 700; }
.gate-copy .btn { margin: 0 8px 8px 0; }
.plan-chip .plan-price { margin: 6px 0 0; font-size: 22px; font-weight: 800; color: var(--accent); }
.plan-chip p { margin: 4px 0 0; font-size: 12px; }

.shell {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.rail {
  display: grid;
  gap: 12px;
  position: sticky;
  top: 16px;
}
.signal {
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 22px 18px;
  background: linear-gradient(180deg, #102636, #0b1c28);
  text-align: center;
}
.ring {
  width: 84px; height: 84px; margin: 0 auto 12px;
  border-radius: 50%;
  background:
    conic-gradient(from 200deg, var(--accent), var(--accent-2), #1a3a4d 70%);
  mask: radial-gradient(farthest-side, transparent calc(100% - 9px), #000 calc(100% - 8px));
}
.signal strong { display: block; font-size: 22px; margin: 4px 0; }
.remain { margin: 0; color: var(--ok); font-weight: 700; }
.rail-block {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: rgba(12, 26, 40, 0.72);
}
.rail-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.rail-head h3 { margin: 0; font-size: 14px; }
.rail-head span { color: var(--accent); font-size: 12px; font-weight: 700; }

.device-list { display: grid; gap: 8px; }
.device-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #07131f;
}
.device-row button { padding: 6px 10px; font-size: 12px; }

.cta-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.cta-bar .btn, .cta-bar button { min-height: 44px; }

.proto-board { padding: 14px; }
.seg {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 14px;
}
.seg button {
  background: #07131f;
  color: var(--muted);
  font-weight: 700;
  min-width: 0;
  padding: 10px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.seg button.active { background: var(--accent); color: var(--ink); }

.proto-view {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}
.qr {
  width: 150px; height: 150px;
  border-radius: 16px;
  background: #fff;
  padding: 8px;
}
.proto-view h3 { margin: 0 0 4px; }
.link-clip {
  display: block;
  background: #07131f;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  direction: ltr;
  text-align: left;
  margin: 10px 0;
}
.wallet-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.wallet-row article { padding: 12px; }
.wallet-row .qr { width: 100px; height: 100px; margin: 8px auto; display: block; }

pre {
  white-space: pre-wrap;
  word-break: break-all;
  background: #07131f;
  border-radius: 12px;
  padding: 10px;
  font-size: 12px;
}

@media (max-width: 1100px) {
  .proto-view { grid-template-columns: 1fr; }
  .proto-view .qr { margin: 0 auto; }
}
@media (max-width: 960px) {
  .gate, .shell, .plan-strip, .stats, .two, .steps.compact, .wallet-row {
    grid-template-columns: 1fr;
  }
  .rail { position: static; }
  .gate-copy h2 { max-width: none; }
  .top { flex-direction: column; align-items: stretch; }
  .header-actions { justify-content: flex-end; }
}

@media (min-width: 1280px) and (pointer: coarse) {
  button, .btn, input, select { min-height: 52px; font-size: 18px; }
}
