/* Codoken — design tokens */
:root {
  --bg:        #0d0f12;
  --surface:   #141720;
  --border:    #1e2330;
  --accent:    #4f8ef7;
  --accent2:   #7c5cfc;
  --green:     #3ecf8e;
  --red:       #f06060;
  --yellow:    #f5c542;
  --text:      #e2e8f0;
  --muted:     #8896a8;
  --mono:      "JetBrains Mono", "Fira Code", "Cascadia Code", monospace;
  --sans:      "Inter", system-ui, -apple-system, sans-serif;
  --radius:    6px;
  --max:       1100px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ─────────────────────────────────────────────────────────────── */
.container { max-width: var(--max); margin: 0 auto; padding: 0 24px; }

/* ── Nav ────────────────────────────────────────────────────────────────── */
nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(13,15,18,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  max-width: var(--max); margin: 0 auto; padding: 0 24px; height: 56px;
}
.nav-logo {
  font-family: var(--mono); font-size: 1.1rem; font-weight: 700;
  color: var(--text); letter-spacing: -.5px;
}
.nav-logo span { color: var(--accent); }
.nav-links { display: flex; gap: 28px; align-items: center; }
.nav-links a { color: var(--muted); font-size: .9rem; }
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-cta {
  background: var(--accent); color: #fff !important;
  padding: 6px 16px; border-radius: var(--radius); font-size: .85rem;
  font-weight: 600;
}
.nav-cta:hover { background: #3a7ae0; text-decoration: none !important; }

/* ── Hero ───────────────────────────────────────────────────────────────── */
.hero {
  padding: 96px 24px 80px;
  text-align: center;
  background: radial-gradient(ellipse 80% 50% at 50% -10%, rgba(79,142,247,.12) 0%, transparent 70%);
}
.hero-badge {
  display: inline-block;
  font-family: var(--mono); font-size: .75rem;
  color: var(--accent); border: 1px solid rgba(79,142,247,.35);
  padding: 3px 12px; border-radius: 20px; margin-bottom: 24px;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 800; letter-spacing: -1.5px; line-height: 1.15;
  max-width: 760px; margin: 0 auto 20px;
}
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p {
  font-size: 1.15rem; color: var(--muted);
  max-width: 580px; margin: 0 auto 40px;
}
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 22px; border-radius: var(--radius);
  font-size: .9rem; font-weight: 600; cursor: pointer;
  transition: opacity .15s, transform .1s;
  border: none;
}
.btn:hover { opacity: .88; transform: translateY(-1px); text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary {
  background: transparent; color: var(--text);
  border: 1px solid var(--border);
}

/* ── Stats bar ──────────────────────────────────────────────────────────── */
.stats-bar {
  display: flex; justify-content: center; gap: 48px; flex-wrap: wrap;
  padding: 32px 24px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.stat-item { text-align: center; }
.stat-num {
  font-family: var(--mono); font-size: 1.6rem; font-weight: 700;
  color: var(--text);
}
.stat-label { font-size: .78rem; color: var(--muted); margin-top: 2px; }

/* ── Section ────────────────────────────────────────────────────────────── */
section { padding: 80px 24px; }
section + section { border-top: 1px solid var(--border); }
.section-label {
  font-family: var(--mono); font-size: .72rem; font-weight: 600;
  color: var(--accent); letter-spacing: 2px; text-transform: uppercase;
  margin-bottom: 12px;
}
.section-title {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 800; letter-spacing: -.8px; margin-bottom: 16px;
}
.section-sub {
  font-size: 1rem; color: var(--muted);
  max-width: 560px; margin-bottom: 48px;
}

/* ── How it works ───────────────────────────────────────────────────────── */
.flow {
  display: flex; gap: 0; align-items: stretch;
  flex-wrap: wrap; justify-content: center;
  max-width: var(--max); margin: 0 auto;
}
.flow-step {
  flex: 1 1 220px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px 24px;
  position: relative;
}
.flow-step + .flow-step { margin-left: -1px; }
.flow-step:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.flow-step:last-child  { border-radius: 0 var(--radius) var(--radius) 0; }
.flow-icon {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; margin-bottom: 16px;
}
.flow-step h3 { font-size: .95rem; font-weight: 700; margin-bottom: 6px; }
.flow-step p  { font-size: .83rem; color: var(--muted); line-height: 1.5; }
.flow-arrow {
  align-self: center; color: var(--muted); font-size: 1.2rem;
  padding: 0 4px; flex: 0;
}

/* ── Atom pattern ───────────────────────────────────────────────────────── */
.pattern-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px;
  max-width: var(--max); margin: 0 auto;
}
@media (max-width: 700px) { .pattern-grid { grid-template-columns: 1fr; } }
.pattern-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px 24px;
}
.pattern-card h3 {
  font-size: .95rem; font-weight: 700;
  margin-bottom: 10px; display: flex; gap: 10px; align-items: center;
}
.pattern-card p { font-size: .83rem; color: var(--muted); line-height: 1.55; }
.tag {
  font-family: var(--mono); font-size: .65rem; font-weight: 600;
  padding: 2px 8px; border-radius: 4px; letter-spacing: .5px;
}
.tag-blue   { background: rgba(79,142,247,.15); color: var(--accent); }
.tag-purple { background: rgba(124,92,252,.15); color: var(--accent2); }
.tag-green  { background: rgba(62,207,142,.15); color: var(--green); }

/* ── Roles / pricing ────────────────────────────────────────────────────── */
.roles-grid {
  display: grid; grid-template-columns: repeat(3,1fr); gap: 20px;
  max-width: var(--max); margin: 0 auto;
}
@media (max-width: 700px) { .roles-grid { grid-template-columns: 1fr; } }
.role-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px 24px;
}
.role-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.role-card p  { font-size: .83rem; color: var(--muted); margin-bottom: 16px; line-height: 1.5; }
.role-earn {
  font-family: var(--mono); font-size: .8rem; color: var(--green);
  background: rgba(62,207,142,.08); border: 1px solid rgba(62,207,142,.2);
  border-radius: 4px; padding: 4px 10px; display: inline-block;
}
.role-spend {
  font-family: var(--mono); font-size: .8rem; color: var(--yellow);
  background: rgba(245,197,66,.08); border: 1px solid rgba(245,197,66,.2);
  border-radius: 4px; padding: 4px 10px; display: inline-block;
}

/* ── Pricing table ──────────────────────────────────────────────────────── */
.pricing-table {
  width: 100%; border-collapse: collapse;
  font-size: .85rem; max-width: 640px; margin: 0 auto;
}
.pricing-table th, .pricing-table td {
  padding: 10px 16px; border: 1px solid var(--border); text-align: left;
}
.pricing-table th { background: var(--surface); color: var(--muted); font-weight: 600; }
.pricing-table td:first-child { font-family: var(--mono); }
.pricing-table tr:hover td { background: rgba(255,255,255,.02); }

/* ── Install / quickstart ───────────────────────────────────────────────── */
.install-tabs { display: flex; gap: 0; margin-bottom: 0; }
.tab-btn {
  font-family: var(--mono); font-size: .78rem; font-weight: 600;
  padding: 8px 18px; background: var(--surface);
  border: 1px solid var(--border); color: var(--muted);
  cursor: pointer; transition: color .15s;
}
.tab-btn:first-child { border-radius: var(--radius) 0 0 0; }
.tab-btn:last-child  { border-radius: 0 var(--radius) 0 0; }
.tab-btn.active { color: var(--text); border-bottom-color: var(--surface); background: var(--surface); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
pre {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  padding: 20px 24px; overflow-x: auto;
  font-family: var(--mono); font-size: .8rem; line-height: 1.65;
}
.kw  { color: #c792ea; }
.str { color: var(--green); }
.cm  { color: var(--muted); font-style: italic; }
.key { color: var(--accent); }

/* ── CTA banner ─────────────────────────────────────────────────────────── */
.cta-banner {
  background: linear-gradient(135deg, rgba(79,142,247,.1) 0%, rgba(124,92,252,.1) 100%);
  border: 1px solid rgba(79,142,247,.2);
  border-radius: 12px; padding: 56px 40px; text-align: center;
  max-width: var(--max); margin: 0 auto;
}
.cta-banner h2 { font-size: clamp(1.4rem,3vw,2rem); font-weight: 800; margin-bottom: 12px; }
.cta-banner p  { color: var(--muted); margin-bottom: 32px; }

/* ── Footer ─────────────────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 32px 24px; text-align: center;
  font-size: .78rem; color: var(--muted);
}
footer a { color: var(--muted); }
footer a:hover { color: var(--text); }

/* ── Dashboard ──────────────────────────────────────────────────────────── */
.dash-header {
  padding: 40px 24px 24px;
  border-bottom: 1px solid var(--border);
}
.dash-header h1 { font-size: 1.5rem; font-weight: 800; margin-bottom: 4px; }
.dash-header p  { color: var(--muted); font-size: .88rem; }

.dash-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px; margin-bottom: 32px;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 20px;
}
.stat-card-label { font-size: .75rem; color: var(--muted); margin-bottom: 6px; }
.stat-card-value {
  font-family: var(--mono); font-size: 1.6rem; font-weight: 700;
}
.stat-card-sub { font-size: .72rem; color: var(--muted); margin-top: 4px; }

.role-section { margin-bottom: 40px; }
.role-section h2 {
  font-size: .85rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.5px; color: var(--muted); margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px;
}
.role-section h2::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

.tx-list { display: flex; flex-direction: column; gap: 6px; }
.tx-row {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 16px;
  font-size: .82rem;
}
.tx-row-meta { color: var(--muted); font-size: .75rem; margin-top: 2px; }
.tx-pos { font-family: var(--mono); color: var(--green); font-weight: 600; }
.tx-neg { font-family: var(--mono); color: var(--red); font-weight: 600; }

.referral-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px 24px;
}
.referral-box h2 { font-size: 1rem; font-weight: 700; margin-bottom: 6px; }
.referral-box p  { font-size: .83rem; color: var(--muted); margin-bottom: 18px; }
.ref-link-row {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.ref-link-input {
  flex: 1; min-width: 0;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px 12px;
  font-family: var(--mono); font-size: .8rem; color: var(--text);
}
.ref-copy-btn {
  background: var(--accent); color: #fff;
  border: none; border-radius: var(--radius);
  padding: 8px 18px; font-size: .82rem; font-weight: 600;
  cursor: pointer; transition: opacity .15s;
}
.ref-copy-btn:hover { opacity: .85; }
.ref-stats { margin-top: 16px; font-size: .82rem; color: var(--muted); }
.ref-stats strong { color: var(--text); }

/* auth screen */
.auth-screen {
  min-height: 100vh; display: flex; align-items: center;
  justify-content: center; padding: 24px;
}
.auth-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 40px 36px; width: 100%; max-width: 380px;
  text-align: center;
}
.auth-box h2 { font-size: 1.2rem; font-weight: 800; margin-bottom: 8px; }
.auth-box p  { font-size: .85rem; color: var(--muted); margin-bottom: 28px; }
.auth-input {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 14px;
  font-size: .9rem; color: var(--text); margin-bottom: 12px;
  outline: none; transition: border-color .15s;
}
.auth-input:focus { border-color: var(--accent); }
.auth-btn {
  width: 100%; background: var(--accent); color: #fff;
  border: none; border-radius: var(--radius); padding: 10px;
  font-size: .9rem; font-weight: 600; cursor: pointer;
  transition: opacity .15s;
}
.auth-btn:hover { opacity: .88; }
.auth-msg { font-size: .82rem; color: var(--muted); margin-top: 14px; min-height: 20px; }
.auth-msg.success { color: var(--green); }
.auth-msg.error   { color: var(--red); }

/* spinner */
.spinner {
  width: 18px; height: 18px; border: 2px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* loading overlay */
#dash-loading {
  display: flex; align-items: center; justify-content: center;
  padding: 80px; gap: 12px; color: var(--muted); font-size: .9rem;
}

.hidden { display: none !important; }

@media (max-width: 600px) {
  .nav-links a:not(.nav-cta) { display: none; }
  section { padding: 56px 16px; }
  .flow-arrow { display: none; }
  .flow-step + .flow-step { margin-left: 0; margin-top: -1px; }
  .flow-step { border-radius: var(--radius) !important; }
}
