:root {
  --background: #0D0E12;
  --foreground: #FAF8FE;
  --card: #1E1F25;
  --primary: #BA9EFF;
  --primary-hover: #A27CFF;
  --primary-foreground: #14111F;
  --muted: #18191E;
  --muted-foreground: #ABAAB0;
  --accent: #BA9EFF20;
  --input: #121318;
  --ring: #BA9EFF;
  --radius: 10px;
  --elevated: #24252B;
  --elevated-hover: #2B2C33;
  --tertiary: #94949C;
  --line: #47484C;
  --hairline: rgba(255, 255, 255, 0.06);
  --success-text: #6EE7B7;
  --warning-text: #FCD34D;
  --error-text: #F87171;
  --ease-enter: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-move: cubic-bezier(0.76, 0, 0.24, 1);
  --dur-feedback: 120ms;
  --dur-move: 200ms;
  --dur-lead: 360ms;
  --distance: 12px;
  --font-sans: "Inter", system-ui, sans-serif;
  --font-display: "Manrope", "Inter", system-ui, sans-serif;
  --gutter: 32px;
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, p, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
button, input { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
h1:focus { outline: none; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.i.solid { fill: currentColor; stroke: none; }
.i-xs { width: 13px; height: 13px; }
.i-sm { width: 14px; height: 14px; }
.i-lg { width: 20px; height: 20px; }

.backdrop { position: fixed; inset: 0; pointer-events: none; overflow: hidden; background: radial-gradient(ellipse 120% 80% at 50% 40%, #1A1B22 0%, #0C0E12 100%); }
.backdrop::after { content: ""; position: absolute; inset: 0 0 auto; height: 1px; background: linear-gradient(90deg, transparent 0%, #BA9EFF30 50%, transparent 100%); }
.backdrop-glow { position: absolute; left: 50%; top: 33%; width: 900px; height: 600px; transform: translate(-55%, -50%); border-radius: 50%; background: rgba(186, 158, 255, 0.07); filter: blur(160px); }

.topbar, .stage, .footer { position: relative; z-index: 1; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 80px; padding: 0 var(--gutter); }
.brand { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; }
.brand img { width: 24px; height: 24px; }
.brand-name { font-weight: 700; color: var(--foreground); }
.brand-sub { color: var(--tertiary); }
.step { font-size: 13px; color: var(--tertiary); }

.stage { flex: 1; display: flex; align-items: center; justify-content: center; padding: 16px; }
.stage > section { width: 100%; display: flex; justify-content: center; }
.noscript { color: var(--muted-foreground); }

.footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 40px; padding: 8px var(--gutter); font-size: 12px; color: #FAF8FE80; }
.footer-link { text-decoration: none; transition: color var(--dur-feedback); }
.footer-link:hover { color: var(--foreground); }

.card { width: 100%; border: 1px solid var(--hairline); border-radius: 16px; background: var(--card); box-shadow: 0 40px 100px -30px #000; padding: 40px; }
.card-narrow { max-width: 440px; }
.card-wide { max-width: 460px; }
.card-join { max-width: 940px; display: grid; grid-template-columns: 1fr 440px; padding: 0; overflow: hidden; }

.join-intro { position: relative; display: flex; flex-direction: column; padding: 40px; background: var(--muted); border-right: 1px solid var(--hairline); }
.join-intro-glow { position: absolute; left: -80px; top: -96px; width: 288px; height: 288px; border-radius: 50%; pointer-events: none; background: radial-gradient(circle, #BA9EFF2E 0%, transparent 70%); }
.join-intro > *:not(.join-intro-glow) { position: relative; }
.eyebrow { font-size: 14px; color: var(--muted-foreground); }
.join-title { margin-top: 8px; font-family: var(--font-display); font-size: 34px; font-weight: 800; line-height: 1.1; color: var(--foreground); }
.next { margin-top: 36px; }
.next-heading { font-size: 13px; font-weight: 500; color: var(--foreground); }
.next-list { margin-top: 12px; }
.next-item { position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 8px 0; }
.next-item:not(:last-child)::after { content: ""; position: absolute; left: 13px; top: 36px; bottom: -8px; width: 1px; background: rgba(255, 255, 255, 0.08); }
.next-icon { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; flex: none; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.1); color: var(--tertiary); }
.next-icon .i { width: 14px; height: 14px; }
.is-current .next-icon { border-color: transparent; background: var(--primary); color: var(--primary-foreground); }
.next-text { min-width: 0; padding-top: 4px; }
.next-label { display: block; font-size: 13.5px; color: var(--muted-foreground); }
.is-current .next-label { color: var(--foreground); }
.next-sub { display: block; margin-top: 2px; font-size: 12px; color: var(--tertiary); }
.join-form { padding: 40px; }

.title-md { font-family: var(--font-display); font-size: 24px; font-weight: 700; line-height: 1.25; color: var(--foreground); }
.join-form .title-md { font-size: 22px; }
.title-gap { margin-top: 20px; }
.title-xl { font-family: var(--font-display); font-size: 34px; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; text-align: center; color: var(--foreground); }
.body { margin-top: 8px; font-size: 14px; line-height: 1.6; color: var(--muted-foreground); }
.strong { color: var(--foreground); font-weight: 500; overflow-wrap: anywhere; }
.footnote { margin-top: 20px; text-align: center; font-size: 12.5px; color: var(--tertiary); }

.chip { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; }
.chip-accent { background: var(--accent); color: var(--primary); }
.chip-warn { background: #F59E0B1F; box-shadow: inset 0 0 0 1px #F59E0B47; color: var(--warning-text); }

.fields { display: grid; gap: 16px; margin-top: 24px; }
.fields-gap { margin-top: 28px; }
.label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; color: var(--muted-foreground); }
.control { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 6px 0 14px; border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--input); transition: border-color var(--dur-feedback), box-shadow var(--dur-feedback); }
.control:focus-within { border-color: var(--ring); box-shadow: 0 0 0 1px var(--ring); }
.control:has([aria-invalid="true"]) { border-color: #EF44444D; }
.control:has([aria-invalid="true"]):focus-within { border-color: var(--error-text); box-shadow: 0 0 0 1px var(--error-text); }
.control input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: transparent; font-size: 14px; color: var(--foreground); outline: none; }
.control input::-ms-reveal { display: none; }
.eye { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex: none; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--tertiary); cursor: pointer; transition: background var(--dur-feedback), color var(--dur-feedback); }
.eye:hover { background: rgba(255, 255, 255, 0.06); color: var(--foreground); }
.eye .i-hide, .eye[aria-pressed="true"] .i-show { display: none; }
.eye[aria-pressed="true"] .i-hide { display: block; }

.rules { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; margin-top: 10px; }
.rules li { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--tertiary); transition: color var(--dur-move); }
.rules li.met { color: var(--success-text); }
.rules .rule-on { stroke-width: 2.6; }
.rules .rule-on, .rules li.met .rule-off { display: none; }
.rules li.met .rule-on { display: block; }
.field-error, .form-error { margin-top: 6px; font-size: 12.5px; color: var(--error-text); }
.form-error { margin-top: 16px; font-size: 13px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: var(--radius); font-weight: 600; text-decoration: none; cursor: pointer; transition: background var(--dur-feedback), transform var(--dur-feedback), opacity var(--dur-feedback); }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { cursor: not-allowed; opacity: 0.6; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 14px; }
.btn-sm { height: 32px; padding: 0 12px; border-radius: 8px; font-size: 12.5px; font-weight: 500; }
.btn-block { width: 100%; margin-top: 24px; }
.btn-primary { background: var(--primary); color: var(--primary-foreground); box-shadow: 0 8px 28px -10px #BA9EFF99; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-secondary { border: 1px solid var(--line); background: var(--elevated); color: var(--foreground); }
.btn-secondary:hover { background: var(--elevated-hover); }
.btn[aria-busy="true"]::before { content: ""; width: 15px; height: 15px; flex: none; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 700ms linear infinite; }
.btn[aria-busy="true"] > .i { display: none; }
.btn-open { height: 44px; min-width: 176px; margin-top: 32px; padding: 0 24px; border-radius: 8px; font-size: 14px; box-shadow: 0 8px 24px #BA9EFF33; }
.btn-open[aria-busy="true"] { opacity: 0.7; cursor: progress; }
.btn-open[aria-busy="true"]::before { content: none; }
.btn-open[aria-busy="true"] > .i { display: block; }

.request-form { margin-top: 24px; }
.request-form .btn-block { margin-top: 20px; }

.divider { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--hairline); }
.divider-heading { font-size: 13px; font-weight: 500; color: var(--foreground); }
.divider-body { margin-top: 4px; font-size: 12.5px; line-height: 1.6; color: var(--muted-foreground); }

.done { display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 480px; padding-bottom: 24px; }
.planet { position: relative; display: grid; place-items: center; width: min(360px, 100%); aspect-ratio: 1; margin-top: -16px; }
.planet-glow { position: absolute; inset: 18%; border-radius: 50%; pointer-events: none; filter: blur(64px); background: radial-gradient(circle, rgba(186, 158, 255, 0.22) 0%, rgba(105, 156, 255, 0.08) 55%, transparent 75%); }
.planet canvas { position: relative; width: 100%; height: auto; aspect-ratio: 1; cursor: grab; touch-action: pan-y; }
.planet canvas:active { cursor: grabbing; }
.status { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 22px; margin-top: 10px; text-align: center; font-size: 14.5px; color: var(--muted-foreground); }
.status[data-tone="warn"] { color: var(--warning-text); }
.status[data-tone="busy"]::before { content: ""; width: 15px; height: 15px; flex: none; border-radius: 50%; border: 2px solid var(--elevated); border-top-color: var(--primary); animation: spin 700ms linear infinite; }

.downloads { display: flex; flex-direction: column; align-items: center; width: 100%; margin-top: 16px; }
.disclosure { display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px; border: 0; border-radius: 6px; background: transparent; font-size: 13px; color: var(--tertiary); cursor: pointer; transition: color var(--dur-feedback); }
.disclosure:hover { color: var(--foreground); }
.chevron { transition: transform var(--dur-move); }
.disclosure[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.downloads-list { width: 100%; max-width: 420px; margin-top: 8px; padding: 0 16px; border: 1px solid var(--hairline); border-radius: 12px; background: var(--input); font-size: 13px; }
.download-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; min-height: 48px; padding: 8px 0; }
.download-row + .download-row { border-top: 1px solid var(--hairline); }
.os-icon { color: var(--muted-foreground); }
.os { flex: 1; color: var(--foreground); }
.help-link { font-size: 12.5px; color: var(--primary); text-underline-offset: 3px; }
.help-link:hover { color: var(--foreground); }
.missed .download-row:first-child .btn-secondary { border-color: transparent; background: var(--primary); color: var(--primary-foreground); font-weight: 600; }
.missed .download-row:first-child .btn-secondary:hover { background: var(--primary-hover); }

.enter-card { animation: card-in var(--dur-lead) var(--ease-enter) both; }
.enter-lead { animation: lead-in var(--dur-lead) var(--ease-enter) 140ms both; }
.enter-reveal { animation: reveal var(--dur-move) var(--ease-enter) 120ms both; }
.enter-planet { animation: planet-in 700ms cubic-bezier(0.34, 1.56, 0.64, 1) 150ms both; }
@keyframes card-in { from { opacity: 0; transform: translateY(var(--distance)) scale(0.985); } }
@keyframes lead-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes reveal { from { opacity: 0; transform: translateY(-4px); } }
@keyframes planet-in { from { opacity: 0; transform: translateY(40px) scale(0.7); } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 860px) {
  .card-join { grid-template-columns: 1fr; max-width: 460px; }
  .join-intro { border-right: 0; border-bottom: 1px solid var(--hairline); }
}

@media (max-width: 640px) {
  :root { --gutter: 16px; }
  .topbar { height: 64px; }
  .stage { align-items: flex-start; padding: 8px 16px 24px; }
  .card, .join-intro, .join-form { padding: 24px; }
  .card-join { padding: 0; }
  .join-title, .title-xl { font-size: 28px; }
  .title-md { font-size: 22px; }
  .next { margin-top: 24px; }
  .control input { font-size: 16px; }
  .rules { grid-template-columns: 1fr; }
  .done { padding-bottom: 8px; }
  .planet { width: min(300px, 100%); margin-top: 0; }
}

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