:root {
  --bg:        #0D0B1A;
  --bg-2:      #13111F;
  --primary:   #7C3AED;
  --primary-d: #6D28D9;
  --accent:    #10B981;
  --accent-2:  #A78BFA;
  --bg-3:      #1E1A35;
  --text:      #F5F3FF;
  --text-2:    #C4B5FD;
  --border:    #2D2640;
  --border-2:  #3A3357;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-head: 'Plus Jakarta Sans', 'Inter', sans-serif;
  --maxw: 1200px;
  --r: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

::selection { background: rgba(124,58,237,.35); color: #fff; }
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; }
a { color: inherit; text-decoration: none; }
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 32px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-family: var(--font-body); font-weight: 600; font-size: 15px;
  padding: 13px 22px; border-radius: 11px; cursor: pointer; border: 1px solid transparent;
  transition: transform .18s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease;
  white-space: nowrap; width: 100%;
}
.btn-primary {
  background: var(--primary); color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,.12) inset, 0 8px 24px -10px rgba(124,58,237,.8);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-d); transform: translateY(-1px); box-shadow: 0 1px 0 rgba(255,255,255,.14) inset, 0 14px 30px -10px rgba(124,58,237,.9); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.btn-ghost {
  background: rgba(245,243,255,.03); color: var(--text); border-color: var(--border-2);
  backdrop-filter: blur(8px);
}
.btn-ghost:hover { background: rgba(245,243,255,.07); border-color: #2f3d5c; transform: translateY(-1px); }
.btn-lg { padding: 15px 28px; font-size: 16px; border-radius: 13px; }
.btn svg { width: 16px; height: 16px; }

/* ===== Nav ===== */
header.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  transition: background .3s ease, border-color .3s ease, backdrop-filter .3s ease;
  border-bottom: 1px solid transparent;
}
header.nav.scrolled {
  background: rgba(10,15,30,.72);
  backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 70px; }
.logo { display: flex; align-items: center; gap: 11px; }
.logo-mark { width: 32px; height: 35px; flex: none; display: block; filter: drop-shadow(0 4px 12px rgba(124,58,237,.45)); }
.logo-mark path, .logo-mark line { stroke: var(--accent-2); }
.wordmark { font-family: 'Quicksand', var(--font-head); font-size: 23px; letter-spacing: -0.5px; color: var(--accent-2); line-height: 1; }
.wordmark .w1 { font-weight: 500; } .wordmark .w2 { font-weight: 700; }
.back-link { font-size: 14px; color: var(--text-2); transition: color .2s; display: flex; align-items: center; gap: 6px; }
.back-link:hover { color: var(--text); }
.back-link svg { width: 15px; height: 15px; }

/* ===== Background ===== */
#bg-canvas {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: 1; pointer-events: none; display: block;
}
.bg-grid {
  position: fixed; inset: 0; z-index: 1; opacity: .28; pointer-events: none;
  background-image: linear-gradient(rgba(30,41,59,.5) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(30,41,59,.5) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(80% 80% at 50% 30%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(80% 80% at 50% 30%, #000 30%, transparent 75%);
}
.bg-glow {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(100% 70% at 50% 0%, rgba(124,58,237,.13), transparent 60%);
}

/* ===== Login layout ===== */
.login-wrap {
  position: relative; z-index: 2;
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 100px 20px 60px;
}
.login-card {
  width: 100%; max-width: 440px;
  background: linear-gradient(160deg, rgba(30,26,53,.88), rgba(19,17,31,.92));
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 44px 40px;
  backdrop-filter: blur(24px);
  box-shadow: 0 40px 80px -40px rgba(0,0,0,.7), 0 1px 0 rgba(255,255,255,.06) inset;
  position: relative; overflow: hidden;
}
.login-card::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(124,58,237,.6), transparent);
}

.login-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 32px; justify-content: center; }

.login-title { font-size: 24px; font-weight: 700; text-align: center; margin-bottom: 6px; }
.login-sub { font-size: 15px; color: var(--text-2); text-align: center; margin-bottom: 30px; }

/* ===== Form fields ===== */
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 8px; letter-spacing: .02em; }
.input-wrap { position: relative; }
.field input {
  width: 100%;
  background: rgba(10,15,30,.7); border: 1px solid var(--border-2); border-radius: 12px;
  padding: 0 18px; color: var(--text); font-family: var(--font-body); font-size: 15px; height: 50px;
  transition: border-color .2s, box-shadow .2s;
}
.field input::placeholder { color: #7C6FA0; }
.field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(124,58,237,.18); }
.field input.error { border-color: #ef4444; box-shadow: 0 0 0 4px rgba(239,68,68,.15); }
.field input[type="password"] { padding-right: 48px; }

.toggle-pw {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: var(--text-2); padding: 4px;
  display: flex; align-items: center; transition: color .2s;
}
.toggle-pw:hover { color: var(--text); }
.toggle-pw svg { width: 18px; height: 18px; }

/* ===== Error banner ===== */
.login-error {
  display: none; align-items: center; gap: 10px;
  background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.25);
  border-radius: 10px; padding: 12px 16px; font-size: 14px; color: #f87171;
  margin-bottom: 20px; line-height: 1.45;
}
.login-error.show { display: flex; }
.login-error svg { width: 16px; height: 16px; flex: none; }

/* ===== Forgot link ===== */
.forgot-link {
  display: block; text-align: center; margin-top: 16px;
  font-size: 13.5px; color: var(--text-2); cursor: pointer;
  transition: color .2s;
}
.forgot-link:hover { color: var(--accent-2); }

/* ===== Divider ===== */
.divider {
  display: flex; align-items: center; gap: 14px;
  margin: 28px 0; font-size: 13px; color: #6B5E82;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ===== Beta CTA block ===== */
.beta-block {
  background: linear-gradient(160deg, rgba(124,58,237,.09), rgba(16,185,129,.05));
  border: 1px solid rgba(124,58,237,.22);
  border-radius: 14px; padding: 22px; text-align: center;
}
.eyebrow-sm {
  font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent); display: inline-flex; align-items: center; gap: 7px; margin-bottom: 10px;
}
.eyebrow-sm::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px rgba(16,185,129,.7); display: inline-block; }
.beta-block h3 { font-size: 16px; margin-bottom: 8px; }
.beta-block p { font-size: 13.5px; color: var(--text-2); margin-bottom: 16px; line-height: 1.5; }
.beta-block .btn { padding: 12px 20px; font-size: 14px; border-radius: 11px; }

/* ===== Footer ===== */
.login-footer {
  position: relative; z-index: 2;
  text-align: center; padding: 20px 24px 28px; font-size: 13px; color: #7C6FA0;
}
.login-footer a { color: var(--text-2); transition: color .2s; }
.login-footer a:hover { color: var(--text); }

/* ===== Modal overlay ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.65); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity .25s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: linear-gradient(160deg, rgba(30,26,53,.97), rgba(19,17,31,.98));
  border: 1px solid var(--border-2);
  border-radius: 22px; padding: 40px; width: 100%; max-width: 480px;
  box-shadow: 0 40px 80px -20px rgba(0,0,0,.8), 0 1px 0 rgba(255,255,255,.07) inset;
  position: relative;
  transform: translateY(16px) scale(.98);
  transition: transform .28s cubic-bezier(.16,1,.3,1);
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(124,58,237,.5), transparent);
}

.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: none; border: none; cursor: pointer; color: var(--text-2); padding: 8px;
  border-radius: 8px; transition: background .2s, color .2s; display: flex;
}
.modal-close:hover { background: rgba(245,243,255,.07); color: var(--text); }
.modal-close svg { width: 18px; height: 18px; }

.modal h2 { font-size: 22px; margin-bottom: 8px; }
.modal .modal-desc { font-size: 15px; color: var(--text-2); margin-bottom: 28px; line-height: 1.5; }

.modal .field { margin-bottom: 16px; }
.modal .field input {
  width: 100%;
  background: rgba(10,15,30,.7); border: 1px solid var(--border-2); border-radius: 12px;
  padding: 0 18px; color: var(--text); font-family: var(--font-body); font-size: 15px; height: 50px;
  transition: border-color .2s, box-shadow .2s;
}
.modal .field input::placeholder { color: #7C6FA0; }
.modal .field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(124,58,237,.18); }
.modal .field input.error { border-color: #ef4444; box-shadow: 0 0 0 4px rgba(239,68,68,.15); }
.modal .field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 8px; letter-spacing: .02em; }

.modal-msg { font-size: 14px; margin-top: 14px; min-height: 20px; line-height: 1.5; }
.modal-msg.ok { color: var(--accent); }
.modal-msg.err { color: #f87171; }

/* Beta modal email form */
.beta-email-form { display: flex; flex-direction: column; gap: 12px; }
.beta-email-form .email-input {
  width: 100%;
  background: rgba(10,15,30,.7); border: 1px solid var(--border-2); border-radius: 12px;
  padding: 0 18px; color: var(--text); font-family: var(--font-body); font-size: 15px; height: 50px;
  transition: border-color .2s, box-shadow .2s;
}
.beta-email-form .email-input::placeholder { color: #7C6FA0; }
.beta-email-form .email-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(124,58,237,.18); }
.beta-email-form.invalid .email-input { border-color: #ef4444; box-shadow: 0 0 0 4px rgba(239,68,68,.15); }
.fine-text { font-size: 13px; color: #7C6FA0; text-align: center; margin-top: 14px; }

@media (max-width: 480px) {
  .login-card { padding: 32px 24px; }
  .modal { padding: 32px 24px; }
  .wrap { padding: 0 20px; }
}
