/* ===== STAKR — design tokens ===== */
:root {
  --bg:            #050f0b;
  --bg-alt:        #081a13;
  --panel:         rgba(19, 48, 38, 0.46);
  --panel-solid:   #0c211a;
  --panel-border:  rgba(87, 199, 148, 0.22);
  --emerald:       #16c784;
  --emerald-dim:   #0b4a34;
  --emerald-glow:  rgba(22, 199, 132, 0.35);
  --gold:          #d4af6a;
  --gold-dim:      #7a6438;
  --text:          #eaf3ee;
  --text-dim:      #8fa79b;
  --text-faint:    #566d63;
  --danger:        #e5595f;

  --font-display:  "Space Grotesk", sans-serif;
  --font-body:      "Inter", sans-serif;
  --font-mono:      "IBM Plex Mono", monospace;

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 8px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
}

body {
  background-image:
    radial-gradient(circle at 14% 20%, rgba(22, 199, 132, 0.10), transparent 40%),
    radial-gradient(circle at 85% 75%, rgba(212, 175, 106, 0.07), transparent 45%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-alt) 100%);
  min-height: 100vh;
}

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

button {
  font-family: inherit;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--emerald);
  outline-offset: 2px;
}

/* ===== Top bar ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px clamp(20px, 5vw, 56px) 0;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.02em;
}

.wordmark .dot { color: var(--gold); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  color: var(--text-dim);
  border: 1px solid var(--panel-border);
  padding: 6px 14px;
  border-radius: 999px;
  background: transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.nav-pill b { color: var(--emerald); font-weight: 600; }

.nav-pill:hover {
  border-color: var(--emerald);
  color: var(--text);
  text-decoration: none;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  border: 1px solid var(--panel-border);
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--panel);
  backdrop-filter: blur(8px);
}

.status-pill .pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 0 0 var(--emerald-glow);
  animation: pulse 2.4s infinite;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 var(--emerald-glow); }
  70%  { box-shadow: 0 0 0 7px rgba(22, 199, 132, 0); }
  100% { box-shadow: 0 0 0 0 rgba(22, 199, 132, 0); }
}

/* ===== Layout ===== */
.layout {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(24px, 4vw, 64px);
  align-items: center;
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(28px, 6vh, 64px) clamp(20px, 5vw, 56px) 48px;
  min-height: calc(100vh - 76px);
}

@media (max-width: 920px) {
  .layout {
    grid-template-columns: 1fr;
    padding-top: 24px;
  }
}

/* ===== Hero (left) ===== */
.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 18px;
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(32px, 4.6vw, 54px);
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0 0 20px;
}

.hero h1 em {
  font-style: normal;
  color: var(--emerald);
}

.hero p.lede {
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-dim);
  max-width: 46ch;
  margin: 0 0 36px;
}

.vault-wrap {
  display: flex;
  align-items: center;
  gap: 32px;
  margin-bottom: 40px;
}

.vault-svg { width: 132px; height: 132px; flex-shrink: 0; }

.ring-outer   { transform-origin: 100px 100px; animation: spin-slow 40s linear infinite; }
.ring-mid     { transform-origin: 100px 100px; transition: transform 0.6s cubic-bezier(.2,.8,.2,1); }
.ring-inner   { transform-origin: 100px 100px; transition: transform 0.6s cubic-bezier(.2,.8,.2,1); }
.vault-glow   { transition: opacity 0.6s ease; opacity: 0; }
.vault-check  { opacity: 0; transition: opacity 0.4s ease 0.2s; }

@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

[data-vault-stage="sent"]      .ring-mid   { transform: rotate(70deg); }
[data-vault-stage="verifying"] .ring-mid   { animation: spin-fast 0.6s linear infinite; }
[data-vault-stage="verifying"] .ring-inner { animation: spin-fast-rev 0.4s linear infinite; }
[data-vault-stage="unlocked"]  .ring-mid   { transform: rotate(180deg); }
[data-vault-stage="unlocked"]  .ring-inner { transform: rotate(-140deg); }
[data-vault-stage="unlocked"]  .vault-glow { opacity: 1; }
[data-vault-stage="unlocked"]  .vault-check{ opacity: 1; }
[data-vault-stage="unlocked"]  .vault-bolt { opacity: 0; }

@keyframes spin-fast     { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes spin-fast-rev { from { transform: rotate(0deg); } to { transform: rotate(-360deg); } }

.vault-caption {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-faint);
  line-height: 1.6;
}

.vault-caption strong { color: var(--text-dim); }

.flow-steps {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0;
  margin: 0;
  list-style: none;
  max-width: 40ch;
}

.flow-steps li {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 14.5px;
  color: var(--text-dim);
}

.flow-steps .n {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--emerald);
  border: 1px solid var(--emerald-dim);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.flow-steps b { color: var(--text); font-weight: 600; }

/* ===== Auth card (right) ===== */
.auth-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(14px);
  padding: clamp(28px, 4vw, 40px);
  box-shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.7);
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(22,199,132,0.06), transparent 60%);
  pointer-events: none;
}

.auth-step { display: none; }
.auth-step.is-active { display: block; }

.auth-card h2 {
  font-family: var(--font-display);
  font-size: 22px;
  margin: 0 0 6px;
}

.auth-card .sub {
  font-size: 13.5px;
  color: var(--text-dim);
  margin: 0 0 28px;
  line-height: 1.5;
}

.auth-card .sub strong { color: var(--text); }

label.field-label {
  display: block;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-faint);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

input.email-input {
  width: 100%;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 15px;
  color: var(--text);
  font-family: var(--font-body);
}

input.email-input::placeholder { color: var(--text-faint); }

input.email-input:focus {
  border-color: var(--emerald);
}

.btn-primary {
  width: 100%;
  margin-top: 20px;
  background: var(--emerald);
  color: #05130d;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: 0.01em;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  box-shadow: 0 10px 30px -12px var(--emerald-glow);
}

.btn-primary:hover { transform: translateY(-1px); }
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-ghost {
  width: 100%;
  margin-top: 12px;
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--text-dim);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 13.5px;
  font-family: var(--font-body);
}

.btn-ghost:hover { color: var(--text); border-color: var(--emerald-dim); }

.otp-row {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}

.otp-digit {
  width: 100%;
  aspect-ratio: 1 / 1;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 22px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  color: var(--text);
}

.otp-digit:focus { border-color: var(--emerald); }
.otp-digit.filled { border-color: var(--emerald-dim); }

.otp-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--text-faint);
}

.otp-meta button {
  background: none;
  border: none;
  color: var(--emerald);
  font-size: 12.5px;
  padding: 0;
  font-family: var(--font-body);
}

.otp-meta button:disabled {
  color: var(--text-faint);
  cursor: not-allowed;
}

.form-error {
  display: none;
  font-size: 13px;
  color: var(--danger);
  background: rgba(229, 89, 95, 0.1);
  border: 1px solid rgba(229, 89, 95, 0.3);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-top: 16px;
}

.form-error.is-visible { display: block; }

.change-email {
  display: inline-block;
  margin-top: 18px;
  font-size: 13px;
  color: var(--text-dim);
}

.success-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--emerald-dim);
  border: 1px solid var(--emerald);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}

.footnote {
  text-align: center;
  font-size: 12px;
  color: var(--text-faint);
  padding: 0 20px 28px;
}

/* ===== Dashboard ===== */
.dash-shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px clamp(20px, 4vw, 48px) 64px;
}

.dash-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.dash-user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dash-user-chip .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--emerald-dim);
  border: 1px solid var(--emerald);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--emerald);
}

.dash-user-chip .name {
  font-size: 13.5px;
  color: var(--text-dim);
}

.dash-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
}

@media (max-width: 860px) {
  .dash-grid { grid-template-columns: 1fr; }
}

.dash-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(14px);
  padding: 26px 28px;
}

.dash-card h3 {
  font-family: var(--font-display);
  font-size: 15px;
  margin: 0 0 18px;
  color: var(--text-dim);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.balance-figure {
  font-family: var(--font-mono);
  font-size: clamp(30px, 4vw, 40px);
  font-weight: 500;
  color: var(--text);
  margin: 0 0 4px;
}

.balance-figure span { color: var(--emerald); }

.balance-sub {
  font-size: 12.5px;
  color: var(--text-faint);
  margin: 0 0 22px;
}

.balance-row {
  display: flex;
  gap: 24px;
  margin-bottom: 22px;
}

.balance-stat .label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin: 0 0 4px;
}

.balance-stat .value {
  font-family: var(--font-mono);
  font-size: 18px;
  color: var(--text);
}

.dash-btn-row {
  display: flex;
  gap: 12px;
}

.dash-btn-row .btn-primary,
.dash-btn-row .btn-ghost {
  margin-top: 0;
}

.field-row {
  margin-bottom: 16px;
}

select.email-input {
  width: 100%;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 14.5px;
  color: var(--text);
  font-family: var(--font-body);
}

.tx-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 320px;
  overflow-y: auto;
}

.tx-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--panel-border);
}

.tx-row:last-child { border-bottom: none; }

.tx-meta .type {
  font-size: 13.5px;
  color: var(--text);
  text-transform: capitalize;
}

.tx-meta .date {
  font-size: 11.5px;
  color: var(--text-faint);
  font-family: var(--font-mono);
}

.tx-amount {
  font-family: var(--font-mono);
  font-size: 14px;
}

.tx-amount.positive { color: var(--emerald); }
.tx-amount.negative { color: var(--danger); }

.empty-state {
  font-size: 13px;
  color: var(--text-faint);
  text-align: center;
  padding: 24px 0;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}

.modal-overlay.is-open { display: flex; }

.modal-box {
  background: var(--panel-solid);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 380px;
  width: 100%;
}

.modal-box h3 {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--text);
  text-transform: none;
  letter-spacing: normal;
  margin-bottom: 18px;
}

.modal-close-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.dash-loading {
  text-align: center;
  padding: 80px 0;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 13px;
}

/* ===== Burger nav + drawer ===== */
.burger-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 34px;
  height: 34px;
  background: transparent;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 0 8px;
}

.burger-btn span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text-dim);
  border-radius: 2px;
}

.nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 60;
}

.nav-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  max-width: 84vw;
  background: var(--panel-solid);
  border-right: 1px solid var(--panel-border);
  transform: translateX(-100%);
  transition: transform 0.25s cubic-bezier(.2,.8,.2,1);
  z-index: 61;
  display: flex;
  flex-direction: column;
}

.nav-drawer.is-open { transform: translateX(0); }

.nav-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--panel-border);
}

.nav-drawer-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 26px;
  line-height: 1;
}

.nav-drawer-links {
  list-style: none;
  margin: 0;
  padding: 12px 0;
  flex: 1;
}

.nav-drawer-links a {
  display: block;
  padding: 14px 24px;
  font-size: 14.5px;
  color: var(--text-dim);
  border-left: 3px solid transparent;
}

.nav-drawer-links a:hover {
  color: var(--text);
  text-decoration: none;
  background: rgba(22,199,132,0.06);
}

.nav-drawer-links a.is-active {
  color: var(--emerald);
  border-left-color: var(--emerald);
  background: rgba(22,199,132,0.08);
}

/* ===== Match cards ===== */
.match-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-bottom: 12px;
}

.match-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.match-game {
  font-family: var(--font-display);
  font-size: 15.5px;
  color: var(--text);
}

.match-id {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
}

.match-status {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  color: var(--text-dim);
  white-space: nowrap;
}

.match-status.open       { color: var(--gold); border-color: var(--gold-dim); }
.match-status.matched    { color: var(--emerald); border-color: var(--emerald-dim); }
.match-status.completed  { color: var(--text-dim); }
.match-status.disputed   { color: var(--danger); border-color: var(--danger); }

.match-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.match-stake {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--emerald);
}

.match-players {
  font-size: 12.5px;
  color: var(--text-faint);
}

.match-actions {
  display: flex;
  gap: 8px;
}

.btn-small {
  font-family: var(--font-body);
  font-size: 12.5px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-border);
  background: transparent;
  color: var(--text-dim);
}

.btn-small.primary {
  background: var(--emerald);
  color: #05130d;
  border-color: var(--emerald);
  font-weight: 600;
}

.btn-small.win  { border-color: var(--emerald-dim); color: var(--emerald); }
.btn-small.loss { border-color: var(--danger); color: var(--danger); }

/* ===== Leaderboard table ===== */
.lb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.lb-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  padding: 10px 12px;
  border-bottom: 1px solid var(--panel-border);
}

.lb-table td {
  padding: 12px;
  border-bottom: 1px solid var(--panel-border);
  color: var(--text-dim);
}

.lb-table tr:last-child td { border-bottom: none; }

.lb-rank {
  font-family: var(--font-mono);
  color: var(--text-faint);
  width: 32px;
}

.lb-name { color: var(--text); font-weight: 600; }

.lb-table td.numeric { font-family: var(--font-mono); text-align: right; }

/* ===== Join-by-ID bar ===== */
.join-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
}

.join-bar input {
  flex: 1;
}

.join-bar button { white-space: nowrap; margin-top: 0; width: auto; padding: 14px 20px; }

/* ===== Section headers within a page ===== */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.section-head h2 {
  font-family: var(--font-display);
  font-size: 20px;
  margin: 0;
}

/* ===== Profile form ===== */
.profile-form .field-row { margin-bottom: 18px; }

.profile-stats-row {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

/* ===== How it works ===== */
.how-shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.how-step {
  display: flex;
  gap: 20px;
  margin-bottom: 36px;
}

.how-step .n {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--emerald);
  border: 1px solid var(--emerald-dim);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.how-step h3 {
  font-family: var(--font-display);
  font-size: 17px;
  margin: 0 0 6px;
}

.how-step p {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.6;
  margin: 0;
}
