:root {
  --felt-900: #071e13;
  --felt-800: #0a3320;
  --felt-700: #0d5635;
  --felt-600: #12a05a;
  --felts-400: #26c977;
  --gold: #d9b451;
  --gold-soft: #f0d488;
  --ink-050: #f5f7f5;
  --ink-200: #c6cdc8;
  --ink-400: #8c978f;
  --ink-600: #5b655e;
  --card: rgba(14, 22, 18, 0.82);
  --card-border: rgba(217, 180, 81, 0.18);
  --field-bg: rgba(255, 255, 255, 0.03);
  --field-border: rgba(255, 255, 255, 0.12);
  --danger: #ff6b6b;
  --success: #3ddc84;
  --radius-lg: 22px;
  --radius-md: 13px;
  --radius-sm: 9px;
  --shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.85);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink-050);
  background: #05080a;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: clamp(14px, 3vw, 42px);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Ambient scene ---------- */
.scene { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.felt-glow {
  position: absolute;
  inset: -20% -10% auto -10%;
  height: 80%;
  background:
    radial-gradient(60% 70% at 22% 18%, rgba(18, 160, 90, 0.42), transparent 62%),
    radial-gradient(50% 60% at 88% 8%, rgba(217, 180, 81, 0.16), transparent 60%),
    radial-gradient(90% 90% at 50% 120%, rgba(12, 86, 53, 0.35), transparent 70%);
  filter: blur(6px);
}
.table-lines {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(80% 70% at 50% 40%, #000 30%, transparent 85%);
  -webkit-mask-image: radial-gradient(80% 70% at 50% 40%, #000 30%, transparent 85%);
}

/* ---------- Shell ---------- */
.shell {
  position: relative;
  z-index: 1;
  width: min(1040px, 100%);
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  overflow: hidden;
}

/* ---------- Showcase ---------- */
.showcase {
  position: relative;
  padding: clamp(26px, 4vw, 44px);
  display: flex;
  flex-direction: column;
  gap: 24px;
  background:
    radial-gradient(120% 90% at 8% 0%, rgba(18, 160, 90, 0.30), transparent 55%),
    linear-gradient(160deg, rgba(10, 51, 32, 0.65), rgba(5, 12, 8, 0.35));
  border-right: 1px solid var(--card-border);
}
.showcase::after {
  content: "";
  position: absolute;
  right: -60px;
  bottom: -60px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fffef7, #d9d4c4 55%, #9a9586);
  box-shadow: inset -18px -18px 40px rgba(0,0,0,.35), 0 20px 60px rgba(0,0,0,.5);
  opacity: .14;
  pointer-events: none;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; place-items: center; filter: drop-shadow(0 6px 16px rgba(18,160,90,.5)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text strong { font-family: var(--serif); font-size: 1.32rem; letter-spacing: .3px; }
.brand-text span { font-size: .72rem; letter-spacing: .32em; text-transform: uppercase; color: var(--gold-soft); }

.showcase-copy { margin-top: auto; }
.eyebrow {
  margin: 0 0 10px;
  font-size: .76rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--felt-600);
  font-weight: 700;
}
.showcase h1 {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.9rem, 3.4vw, 2.7rem);
  line-height: 1.08;
  letter-spacing: -.01em;
}
.lede { margin: 0; color: var(--ink-200); font-size: .95rem; line-height: 1.6; max-width: 42ch; }

.stats {
  list-style: none;
  margin: 28px 0 0;
  padding: 0;
  display: flex;
  gap: 26px;
  flex-wrap: wrap;
}
.stats li { display: flex; flex-direction: column; }
.stats strong { font-family: var(--serif); font-size: 1.5rem; color: var(--gold-soft); }
.stats span { font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-400); }

.showcase-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: .8rem;
  color: var(--ink-400);
}
.live-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(61, 220, 132, .6);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(61, 220, 132, .55); }
  70% { box-shadow: 0 0 0 9px rgba(61, 220, 132, 0); }
  100% { box-shadow: 0 0 0 0 rgba(61, 220, 132, 0); }
}

/* ---------- Auth ---------- */
.auth { padding: clamp(26px, 4vw, 44px); display: flex; flex-direction: column; }
.auth-inner { width: 100%; max-width: 400px; margin: auto; }
.auth-head h2 { margin: 0 0 6px; font-size: 1.42rem; letter-spacing: -.01em; }
.auth-head p { margin: 0 0 22px; color: var(--ink-400); font-size: .88rem; }

.roles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 4px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--field-border);
  border-radius: var(--radius-sm);
  margin-bottom: 22px;
}
.role {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-400);
  font: inherit;
  font-size: .82rem;
  font-weight: 600;
  padding: 8px 4px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .18s, color .18s;
}
.role:hover { color: var(--ink-050); }
.role[aria-selected="true"] {
  background: linear-gradient(180deg, var(--felt-600), var(--felt-700));
  color: #fff;
  box-shadow: 0 6px 16px -8px rgba(18, 160, 90, .9);
}

/* Form fields */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: 7px; color: var(--ink-200); }

.control {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--field-bg);
  border: 1px solid var(--field-border);
  border-radius: var(--radius-sm);
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.control:focus-within {
  border-color: var(--felt-600);
  box-shadow: 0 0 0 3px rgba(18, 160, 90, .22);
  background: rgba(255, 255, 255, 0.05);
}
.control .icon { width: 18px; height: 18px; margin-left: 12px; color: var(--ink-400); flex: none; }
.control input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--ink-050);
  font: inherit;
  font-size: .95rem;
  padding: 12px 12px;
}
.control input::placeholder { color: var(--ink-600); }

.field.invalid .control { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(255, 107, 107, .16); }
.field.valid .control { border-color: rgba(61, 220, 132, .7); }

.reveal {
  appearance: none; border: 0; background: transparent;
  color: var(--ink-400); cursor: pointer;
  padding: 8px 12px; display: grid; place-items: center;
  border-radius: 6px;
}
.reveal:hover { color: var(--ink-050); }
.reveal svg { width: 19px; height: 19px; }
.reveal .eye-closed { display: none; }
.reveal[aria-pressed="true"] .eye-open { display: none; }
.reveal[aria-pressed="true"] .eye-closed { display: block; }

.hint { margin: 7px 2px 0; font-size: .76rem; color: var(--ink-600); }
.error { margin: 7px 2px 0; font-size: .78rem; color: var(--danger); }
.caps { margin: 7px 2px 0; font-size: .76rem; color: var(--gold-soft); }

/* strength meter */
.meter { height: 4px; border-radius: 4px; background: rgba(255,255,255,.08); margin-top: 8px; overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: var(--danger); transition: width .3s, background .3s; }

.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 20px; }
.check { display: flex; align-items: center; gap: 9px; font-size: .82rem; color: var(--ink-200); cursor: pointer; user-select: none; }
.check input { accent-color: var(--felt-600); width: 16px; height: 16px; }
.link { color: var(--gold-soft); text-decoration: none; font-size: .82rem; }
.link:hover { text-decoration: underline; }

/* Buttons */
.btn {
  appearance: none; border: 0; font: inherit; cursor: pointer;
  border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .12s, box-shadow .2s, background .2s, opacity .2s;
}
.btn:active { transform: translateY(1px); }
.btn.primary {
  width: 100%;
  padding: 13px 16px;
  font-weight: 700;
  letter-spacing: .01em;
  color: #062012;
  background: linear-gradient(180deg, var(--felts-400), var(--felt-600));
  box-shadow: 0 14px 30px -12px rgba(18, 160, 90, .95);
}
.btn.primary:hover { box-shadow: 0 18px 36px -12px rgba(18, 160, 90, 1); }
.btn.primary:disabled { opacity: .7; cursor: progress; }
.btn.ghost {
  padding: 11px 16px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--field-border);
  color: var(--ink-050);
  font-weight: 600;
}
.btn.ghost:hover { background: rgba(255,255,255,.09); }

.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(6, 32, 18, .35);
  border-top-color: #062012;
  display: none;
}
.btn.primary.loading .spinner { display: block; animation: spin .7s linear infinite; }
.btn.primary.loading .btn-label { opacity: .85; }
@keyframes spin { to { transform: rotate(360deg); } }

.form-note { min-height: 1.1em; margin: 12px 0 0; font-size: .82rem; text-align: center; color: var(--ink-200); }

/* Divider + OAuth */
.divider {
  display: flex; align-items: center; gap: 12px;
  margin: 22px 0 16px;
  color: var(--ink-600); font-size: .74rem;
  text-transform: uppercase; letter-spacing: .12em;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--field-border); }
.oauth { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.oauth-btn {
  padding: 11px 8px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--field-border);
  color: var(--ink-050);
  font-size: .82rem;
  font-weight: 600;
}
.oauth-btn:hover { background: rgba(255,255,255,.08); border-color: rgba(217,180,81,.35); }

.signup { margin: 22px 0 0; text-align: center; font-size: .84rem; color: var(--ink-400); }
.legal { margin: 22px 0 0; font-size: .72rem; color: var(--ink-600); text-align: center; line-height: 1.5; }

/* Sub panels */
.subpanel { animation: fade .22s ease; }
.subpanel h3 { margin: 0 0 6px; font-size: 1.12rem; }
.subpanel .sub { margin: 0 0 18px; font-size: .84rem; color: var(--ink-400); }
.subpanel .sub.center { text-align: center; margin-top: 16px; }
.subpanel-actions { display: flex; gap: 10px; margin-top: 8px; }
.subpanel-actions .btn { flex: 1; }

.otp { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.otp input {
  width: 100%;
  aspect-ratio: 1 / 1.15;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink-050);
  background: var(--field-bg);
  border: 1px solid var(--field-border);
  border-radius: var(--radius-sm);
  outline: 0;
  transition: border-color .16s, box-shadow .16s;
}
.otp input:focus { border-color: var(--felt-600); box-shadow: 0 0 0 3px rgba(18,160,90,.22); }

@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(20px);
  z-index: 20;
  padding: 12px 20px;
  border-radius: 999px;
  background: rgba(8, 20, 14, 0.95);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  font-size: .86rem;
  opacity: 0;
  transition: opacity .25s, transform .25s;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { border-color: rgba(61, 220, 132, .5); }
.toast.err { border-color: rgba(255, 107, 107, .5); }

/* shake */
.shake { animation: shake .38s cubic-bezier(.36,.07,.19,.97); }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-7px); }
  40%, 60% { transform: translateX(7px); }
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 30;
  background: var(--felt-600);
  color: #062012;
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  font-size: .84rem;
  font-weight: 700;
}
.skip-link:focus { left: 0; }

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

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .showcase {
    border-right: 0;
    border-bottom: 1px solid var(--card-border);
    gap: 18px;
  }
  .showcase::after { display: none; }
  .stats { margin-top: 18px; gap: 20px; }
  .showcase h1 { font-size: clamp(1.7rem, 6vw, 2.2rem); }
  .lede { font-size: .9rem; }
}
@media (max-width: 420px) {
  body { padding: 0; }
  .shell { border-radius: 0; border-left: 0; border-right: 0; min-height: 100dvh; }
  .stats li:nth-child(3) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* Light fallback */
html[data-theme="light"] {
  --card: rgba(255, 255, 255, 0.88);
  --card-border: rgba(10, 51, 32, 0.15);
  --field-bg: rgba(10, 51, 32, 0.03);
  --field-border: rgba(10, 51, 32, 0.16);
  --ink-050: #0a1a12;
  --ink-200: #2d3b33;
  --ink-400: #5b655e;
  --ink-600: #7c857e;
}
html[data-theme="light"] body { background: #eef3ee; color: var(--ink-050); }
html[data-theme="light"] .table-lines { display: none; }

/* ---------- registration / shared additions ---------- */
.req-list { list-style: none; margin: 10px 2px 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; }
.req-list li { font-size: .74rem; color: var(--ink-600); position: relative; padding-left: 17px; }
.req-list li::before { content: "○"; position: absolute; left: 0; }
.req-list li.ok { color: var(--success); }
.req-list li.ok::before { content: "✓"; }
.req-list li.no { color: var(--ink-400); }

.role-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.role-opt { appearance: none; border: 1px solid var(--field-border); background: var(--field-bg); color: var(--ink-200); font: inherit; font-weight: 600; font-size: .84rem; padding: 9px 6px; border-radius: 9px; cursor: pointer; transition: background .16s, color .16s; }
.role-opt:hover { background: rgba(255, 255, 255, .07); color: var(--ink-050); }
.role-opt.selected { color: #062012; background: linear-gradient(180deg, var(--felts-400), var(--felt-600)); border-color: transparent; }

.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.check.agree { margin: 2px 0 0; align-items: flex-start; }
.check.agree input { margin-top: 2px; }
.check.agree span { font-size: .82rem; }
