:root {
  --bg: #070b14;
  --bg-card: #0e1626;
  --bg-elev: #141c2c;
  --ink: #f3f6fa;
  --muted: #c9d0da;
  --accent: #c0c7d1;
  --accent-2: #e6eaf0;
  --line: rgba(192, 199, 209, 0.18);
  --danger: #e07a7a;
  --ok: #b8d4c4;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --font: "IBM Plex Sans Arabic", "IBM Plex Sans", "Segoe UI", Tahoma, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { color-scheme: dark; }

body {
  min-height: 100dvh;
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(184, 196, 214, 0.12), transparent 55%),
    radial-gradient(800px 500px at 0% 100%, rgba(122, 20, 36, 0.18), transparent 50%),
    var(--bg);
  color: var(--ink);
  line-height: 1.6;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(192, 199, 209, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(192, 199, 209, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 20%, #000, transparent 75%);
}

.wrap {
  width: min(430px, 100%);
  margin: 0 auto;
  padding: 18px 18px 48px;
  position: relative;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.lang-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(14, 22, 38, 0.8);
}
.lang-toggle button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  cursor: pointer;
}
.lang-toggle button[aria-pressed="true"] {
  background: var(--accent);
  color: #0a101a;
}

.demo-badge {
  font-size: 11px;
  letter-spacing: 0.12em;
  font-weight: 700;
  text-transform: uppercase;
  color: #0a101a;
  background: linear-gradient(90deg, #d8b4b9, #c0c7d1);
  border-radius: 999px;
  padding: 5px 10px;
}

.hero {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 148px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  background: #0a0a0b center / cover no-repeat;
}
.hero.silver { background-image: linear-gradient(90deg, rgba(7,11,20,.55), rgba(7,11,20,.15)), url("/hero-silver.png"); }
.hero-inner {
  position: relative;
  padding: 22px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 148px;
  justify-content: flex-end;
}
.logo {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,.2);
  background: #0a0a0b;
}
.brand {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.card {
  background: linear-gradient(180deg, rgba(20,28,44,.96), rgba(14,22,38,.96));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 18px 18px;
  box-shadow: var(--shadow);
}

.welcome {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 18px;
  border-radius: 14px;
  background: rgba(192, 199, 209, 0.08);
  border: 1px solid var(--line);
}
.welcome strong { font-size: 1.25rem; }
.welcome span { color: var(--muted); font-size: 0.85rem; }

label, .lbl {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 6px;
}
.field { margin-bottom: 14px; }
input[type="text"], input[type="tel"] {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  border-radius: 12px;
  padding: 13px 14px;
  outline: none;
}
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(192, 199, 209, 0.15);
}
.phone {
  display: flex;
  direction: ltr;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-elev);
}
.phone:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(192, 199, 209, 0.15);
}
.prefix {
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: var(--muted);
  font-weight: 600;
  border-inline-end: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  letter-spacing: 0.02em;
}
.phone input {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  letter-spacing: 0.08em;
}
.hint { margin: 6px 0 0; font-size: 0.75rem; color: var(--muted); }

.agree {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 8px 0 18px;
  font-size: 0.9rem;
}
.agree input { margin-top: 4px; accent-color: var(--accent); width: 18px; height: 18px; flex: none; }
.agree a { color: var(--accent-2); text-underline-offset: 3px; }

button.primary, a.btn {
  display: block;
  width: 100%;
  text-align: center;
  text-decoration: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  color: #0a101a;
  background: linear-gradient(180deg, #e6eaf0, #c0c7d1);
  border-radius: 14px;
  padding: 14px 16px;
}
button.primary:disabled { opacity: 0.55; cursor: not-allowed; }
button.primary:not(:disabled):active { transform: translateY(1px); }

.err {
  display: none;
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(224, 122, 122, 0.12);
  color: #f0c7c7;
  border: 1px solid rgba(224, 122, 122, 0.3);
  font-size: 0.9rem;
}
.err.show { display: block; }

.note {
  margin: 16px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  padding: 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px dashed var(--line);
}
.foot {
  margin-top: 22px;
  text-align: center;
  color: var(--muted);
  font-size: 0.75rem;
}
.foot a { color: var(--accent-2); }

/* Success */
.success { display: none; text-align: center; }
.success.show { display: block; }
.form.hide { display: none; }
.success h2 { margin: 8px 0 6px; font-size: 1.3rem; }
.points {
  margin: 14px 0 18px;
  padding: 16px;
  border-radius: 14px;
  background: rgba(192, 199, 209, 0.08);
  border: 1px solid var(--line);
}
.points b { display: block; font-size: 1.8rem; letter-spacing: -0.03em; }
.wallet-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  background: #000;
  color: #fff;
  border: 1px solid #3c4043;
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 600;
  text-decoration: none;
  margin: 8px 0 4px;
}
.wallet-btn svg { width: 22px; height: 22px; }
.member-id { margin: 10px 0 0; font-size: 0.8rem; color: var(--muted); letter-spacing: 0.04em; direction: ltr; unicode-bidi: isolate; }

/* Terms */
.terms-body { padding-bottom: 40px; }
.terms-body h1 { font-size: 1.4rem; margin: 8px 0 6px; }
.draft {
  display: inline-block;
  margin: 0 0 16px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(224, 180, 67, 0.15);
  color: #f5c542;
  border: 1px solid rgba(224, 180, 67, 0.35);
}
.terms-body h2 { font-size: 1.05rem; margin: 22px 0 8px; }
.terms-body p, .terms-body li { color: var(--ink); font-size: 0.95rem; }
.terms-body ul { padding-inline-start: 1.2em; }
.terms-body .legal { color: var(--muted); font-size: 0.85rem; }
.back { display: inline-block; margin-bottom: 10px; color: var(--accent-2); font-size: 0.9rem; }
.lang-block[hidden] { display: none !important; }

@media (min-width: 480px) {
  .wrap { padding-top: 28px; }
}
