:root {
  --black: #000000;
  --void: #0a0a0a;
  --zinc-950: #0c0c0d;
  --zinc-900: #141415;
  --zinc-800: #1f1f21;
  --zinc-700: #38383c;
  --zinc-600: #5a5a60;
  --zinc-500: #86868c;
  --zinc-400: #adadb3;
  --zinc-300: #cfcfd3;
  --zinc-200: #e6e6e8;
  --white: #ffffff;
  --line: rgba(255,255,255,0.10);
  --line-strong: rgba(255,255,255,0.18);
}

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

html { overflow-x: hidden; width: 100%; }

body {
  background:
    linear-gradient(rgba(0,0,0,0.75), rgba(0,0,0,0.75)),
    url('/logo/background.webp');
  background-size: cover;
  background-position: center;
  background-attachment: scroll;
  color: var(--zinc-300);
  font-family: 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
  min-height: 100vh;
}

h1, h2 { font-family: 'Space Grotesk', sans-serif; letter-spacing: -0.02em; }

.mono { font-family: 'JetBrains Mono', monospace; letter-spacing: 0.02em; }

a { color: inherit; text-decoration: none; }

::selection { background: var(--white); color: var(--black); }

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, black 10%, transparent 70%);
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
}

.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 8px;
}

.auth-card {
  width: 100%;
  max-width: 640px;
  padding: 40px 8px;
}

.auth-head {
  text-align: center;
  margin-bottom: 32px;
}

.auth-head h1 {
  font-size: 24px;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 8px;
}

.auth-head p {
  font-size: 14px;
  color: var(--zinc-500);
  line-height: 1.6;
}

.auth-head p a {
  color: var(--zinc-300);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-head p a:hover { color: var(--white); }

.field-group { margin-bottom: 20px; }

.cf-turnstile { min-height: 65px; }

label {
  display: block;
  font-size: 12.5px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--zinc-400);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

input, select {
  width: 100%;
  background: var(--zinc-900);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--zinc-200);
  font-family: 'Inter', sans-serif;
  font-size: 14.5px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--zinc-400);
  background: var(--zinc-800);
}

input::placeholder { color: var(--zinc-600); }

.pw-wrap { position: relative; }

.pw-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--zinc-500);
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  padding: 4px 6px;
}

.pw-toggle:hover { color: var(--zinc-200); }

.pw-hint {
  font-size: 12px;
  color: var(--zinc-600);
  margin-top: 8px;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2386868c' stroke-width='1.5' fill='none' fill-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}

.country-select {
  position: relative;
}

.country-input {
  width: 100%;
  background: var(--zinc-900);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--zinc-200);
  font-family: 'Inter', sans-serif;
  font-size: 14.5px;
  cursor: pointer;
}

.country-input:focus {
  outline: none;
  border-color: var(--zinc-400);
  background: var(--zinc-800);
}

.country-input:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 2px;
  border-radius: 4px;
}

.country-input::placeholder { color: var(--zinc-600); }

.country-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  background: var(--zinc-900);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  z-index: 20;
  display: none;
  box-shadow: 0 12px 32px rgba(0,0,0,0.5);
}

.country-dropdown.open { display: block; }

.country-option {
  padding: 10px 14px;
  font-size: 14px;
  color: var(--zinc-300);
  cursor: pointer;
}

.country-option:hover, .country-option.active {
  background: rgba(255,255,255,0.05);
  color: var(--zinc-200);
}

.country-option.no-results {
  color: var(--zinc-600);
  cursor: default;
}

.country-option.no-results:hover {
  background: transparent;
  color: var(--zinc-600);
}

.country-input.invalid { border-color: var(--zinc-400); }

.btn-solid {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 20px;
  font-size: 14.5px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  background: var(--white);
  color: var(--black);
  border: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  margin-top: 6px;
}

.btn-solid:hover { background: var(--zinc-200); transform: translateY(-1px); }

.btn-solid:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.terms-note {
  font-size: 12px;
  color: var(--zinc-600);
  line-height: 1.6;
  margin-top: 18px;
  text-align: center;
}

.terms-note a { color: var(--zinc-400); text-decoration: underline; text-underline-offset: 2px; }

.terms-note a:hover { color: var(--zinc-200); }

.divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 28px 0;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

.divider span {
  font-size: 11.5px;
  color: var(--zinc-600);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.05em;
}

.oauth-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--zinc-300);
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 10px;
}

.oauth-btn:hover { border-color: var(--zinc-500); background: rgba(255,255,255,0.03); color: var(--white); }

.back-home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--zinc-600);
  margin-top: 32px;
}

.back-home:hover { color: var(--zinc-300); }

.field-error {
  font-size: 12.5px;
  color: var(--zinc-300);
  margin-top: 6px;
  display: none;
}

.field-error.show { display: block; }

input.invalid { border-color: var(--zinc-400); }

.signup-success-view {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 4px;
}

.signup-success-view.show { display: flex; }

.signup-success-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--white);
  color: var(--black);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}

.signup-success-view h2 {
  font-size: 19px;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 8px;
}

.signup-success-view .signup-success-text {
  font-size: 13.5px;
  color: var(--zinc-400);
  line-height: 1.6;
  margin-bottom: 26px;
  max-width: 320px;
}

.signup-success-view .btn-solid {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 280px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--white);
  color: var(--black);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 12px 20px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 200;
  white-space: nowrap;
  max-width: 90vw;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.username-wrap { position: relative; }

.username-wrap input { padding-right: 40px; }

.username-status {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
}

.username-status .us-spinner,
.username-status .us-check,
.username-status .us-x { display: none; }

.username-status.checking {
  display: flex;
  color: var(--zinc-500);
}

.username-status.checking .us-spinner {
  display: block;
  animation: us-spin 0.7s linear infinite;
}

@keyframes us-spin { to { transform: rotate(360deg); } }

.username-status.available {
  display: flex;
  background: var(--white);
  color: var(--black);
}

.username-status.available .us-check { display: block; }

.username-status.taken {
  display: flex;
  background: var(--zinc-700);
  color: var(--white);
}

.username-status.taken .us-x { display: block; }

#username-hint { font-size: 12px; margin-top: 6px; }

#username-hint.hint-available { color: var(--zinc-300); }

#username-hint.hint-taken { color: var(--zinc-500); }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 2px;
  border-radius: 4px;
}

.check-email-view {
  display: none;
  text-align: center;
}

.check-email-view.show { display: block; }

.check-email-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 18px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--zinc-900);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--zinc-300);
}

.check-email-view h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 12px;
}

.check-email-text {
  font-size: 14px;
  color: var(--zinc-500);
  line-height: 1.6;
  margin-bottom: 24px;
}

.check-email-text strong {
  color: var(--zinc-200);
  font-weight: 500;
}

.btn-outline {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--zinc-200);
  font-family: 'Inter', sans-serif;
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.btn-outline:hover { border-color: var(--zinc-500); background: rgba(255,255,255,0.03); }

.btn-outline:disabled { opacity: 0.5; cursor: default; }

.check-email-note {
  font-size: 12.5px;
  color: var(--zinc-600);
  margin-top: 16px;
}

.back-to-signin {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 24px;
  padding: 8px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 13px;
  color: var(--zinc-400);
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.back-to-signin:hover {
  color: var(--white);
  border-color: var(--zinc-500);
  background: rgba(255,255,255,0.03);
}

.field-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.field-label-row label { margin-bottom: 0; }

.forgot-link {
  font-size: 12.5px;
  color: var(--zinc-500);
}

.forgot-link:hover { color: var(--zinc-200); }

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

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

.modal-box {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--zinc-950);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 32px 24px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}

.modal-box h2 {
  font-size: 19px;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 10px;
}

.modal-subtext {
  font-size: 13.5px;
  color: var(--zinc-500);
  line-height: 1.6;
  margin-bottom: 22px;
}

.modal-subtext strong { color: var(--zinc-200); font-weight: 500; }

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--zinc-500);
  cursor: pointer;
  padding: 4px;
  line-height: 0;
}

.modal-close:hover { color: var(--white); }

.resend-row {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 16px;
  font-size: 13px;
  color: var(--zinc-500);
}

.resend-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--zinc-200);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.resend-btn:hover { color: var(--white); }

.resend-btn:disabled { color: var(--zinc-500); cursor: not-allowed; text-decoration: none; }

.resend-status { font-size: 12.5px; text-align: center; margin-top: 10px; min-height: 16px; color: var(--zinc-500); }

.resend-status.error { color: #f87171; }

.reset-sent-view { display: none; text-align: center; }

.reset-sent-view.show { display: block; }

.step-view { display: none; }

.step-view.active { display: block; }

@media (max-width: 480px) {
  .page { justify-content: flex-start; padding: 20px 8px 40px; }
  .auth-card { padding: 32px 8px; }
  .page.page-centered { justify-content: center; }
}
