:root {
  color-scheme: light dark;
  --background: #f0f9ff;
  --background-deep: #e0f2fe;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --text: #0c4a6e;
  --text-strong: #0f172a;
  --text-muted: #475569;
  --border: #bae6fd;
  --border-strong: #7dd3fc;
  --primary: #0369a1;
  --primary-hover: #075985;
  --primary-text: #ffffff;
  --accent: #ea580c;
  --focus: #0ea5e9;
  --danger: #b91c1c;
  --success: #047857;
  --shadow: 0 24px 60px rgba(12, 74, 110, 0.14);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 28px;
  --motion-fast: 160ms;
  --motion-medium: 240ms;
  font-family:
    "Plus Jakarta Sans", Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--background);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--text-strong);
  background:
    radial-gradient(circle at 12% 10%, rgba(56, 189, 248, 0.24), transparent 34rem),
    radial-gradient(circle at 88% 80%, rgba(234, 88, 12, 0.11), transparent 30rem),
    var(--background);
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.shell {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.brand-panel,
.auth-panel {
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

.brand-panel {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding-top: max(24px, env(safe-area-inset-top));
  padding-bottom: 28px;
}

.brand-panel::after {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  right: -140px;
  bottom: -160px;
  border-radius: 999px;
  border: 56px solid rgba(14, 165, 233, 0.1);
  pointer-events: none;
}

.brand {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  min-height: 48px;
  gap: 10px;
  color: var(--text-strong);
  text-decoration: none;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: #082f49;
  background: linear-gradient(145deg, #7dd3fc, #38bdf8);
  box-shadow: 0 8px 22px rgba(14, 165, 233, 0.24);
  font-size: 18px;
  font-weight: 800;
}

.brand-copy {
  position: relative;
  z-index: 1;
  max-width: 620px;
}

.eyebrow,
.step-label {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  overflow-wrap: break-word;
}

h1 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(36px, 8vw, 68px);
  line-height: 1.02;
  letter-spacing: -0.055em;
  text-wrap: balance;
}

.brand-description {
  max-width: 600px;
  margin: 18px 0 0;
  color: var(--text-muted);
  font-size: clamp(16px, 2.2vw, 19px);
  line-height: 1.65;
}

.trust-list {
  position: relative;
  z-index: 1;
  display: none;
  margin: auto 0 0;
  padding: 0;
  list-style: none;
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
}

.trust-list li {
  display: flex;
  align-items: center;
  gap: 10px;
}

.check {
  width: 18px;
  height: 18px;
  position: relative;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #d1fae5;
  border: 1px solid #6ee7b7;
}

.check::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 3px;
  width: 5px;
  height: 8px;
  border-right: 2px solid #047857;
  border-bottom: 2px solid #047857;
  transform: rotate(45deg);
}

.auth-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 8px;
  padding-bottom: max(28px, env(safe-area-inset-bottom));
}

.language-switch {
  width: fit-content;
  display: flex;
  align-self: flex-end;
  gap: 4px;
  margin: 0 0 10px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
}

.language-switch button {
  min-width: 48px;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  color: var(--text-muted);
  background: transparent;
  font-size: 13px;
  font-weight: 750;
  transition: color var(--motion-fast) ease, background var(--motion-fast) ease;
}

.language-switch button[aria-pressed="true"] {
  color: var(--text-strong);
  background: var(--surface-muted);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.auth-card {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  padding: 24px 20px;
  border: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.auth-card h2 {
  margin: 0;
  color: var(--text-strong);
  font-size: clamp(27px, 7vw, 34px);
  line-height: 1.15;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.supporting {
  margin: 12px 0 24px;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.6;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 750;
}

.field input {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid #94a3b8;
  border-radius: var(--radius-sm);
  color: var(--text-strong);
  background: var(--surface);
  font-size: 17px;
  transition: border-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease;
}

.field input:hover {
  border-color: var(--primary);
}

.field input:focus-visible {
  border-color: var(--focus);
  box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.16);
}

.field input[aria-invalid="true"] {
  border-color: var(--danger);
}

.field-hint,
.field-error {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

.field-hint {
  color: var(--text-muted);
}

.field-error {
  color: var(--danger);
  font-weight: 650;
}

.challenge-wrap {
  min-height: 126px;
  margin: 20px 0;
}

#turnstile-widget {
  min-height: 65px;
  overflow: hidden;
}

.challenge-feedback {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  margin-top: 4px;
}

.challenge-status {
  flex: 1 1 auto;
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.challenge-status[data-state="error"] {
  color: var(--danger);
  font-weight: 650;
}

.challenge-status[data-state="success"] {
  color: var(--success);
  font-weight: 650;
}

.challenge-retry {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--primary);
  background: var(--surface);
  font-weight: 750;
}

.challenge-retry:hover {
  border-color: var(--primary);
  background: var(--surface-muted);
}

.primary-button,
.text-button {
  width: 100%;
  min-height: 52px;
  border-radius: var(--radius-sm);
  font-weight: 800;
  transition:
    background var(--motion-fast) ease,
    border-color var(--motion-fast) ease,
    color var(--motion-fast) ease,
    opacity var(--motion-fast) ease,
    box-shadow var(--motion-fast) ease;
}

.primary-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 18px;
  border: 1px solid var(--primary);
  color: var(--primary-text);
  background: var(--primary);
  box-shadow: 0 8px 20px rgba(3, 105, 161, 0.2);
}

.primary-button:hover:not(:disabled) {
  border-color: var(--primary-hover);
  background: var(--primary-hover);
  box-shadow: 0 10px 24px rgba(3, 105, 161, 0.25);
}

.primary-button:active:not(:disabled) {
  box-shadow: 0 3px 10px rgba(3, 105, 161, 0.18);
}

.primary-button:disabled {
  cursor: not-allowed;
  border-color: #94a3b8;
  color: #f8fafc;
  background: #94a3b8;
  box-shadow: none;
  opacity: 0.72;
}

.button-loader {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 999px;
  animation: spin 700ms linear infinite;
}

.primary-button[aria-busy="true"] .button-loader {
  display: block;
}

.text-button {
  margin-top: 8px;
  padding: 12px 16px;
  border: 1px solid transparent;
  color: var(--primary);
  background: transparent;
}

.text-button:hover {
  background: var(--surface-muted);
}

.otp-input {
  text-align: center;
  font-size: 26px !important;
  font-weight: 800;
  letter-spacing: 0.34em;
  font-variant-numeric: tabular-nums;
}

.claim-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 22px;
  padding: 12px 14px;
  border: 1px solid #fdba74;
  border-radius: var(--radius-sm);
  color: #9a3412;
  background: #fff7ed;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

.claim-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  margin-top: 5px;
  border-radius: 999px;
  background: var(--accent);
}

.success-step {
  text-align: center;
}

.success-mark {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  margin: 0 auto 20px;
  border-radius: 999px;
  border: 1px solid #6ee7b7;
  background: #d1fae5;
}

.success-mark span {
  width: 17px;
  height: 30px;
  border-right: 4px solid var(--success);
  border-bottom: 4px solid var(--success);
  transform: translateY(-3px) rotate(45deg);
}

.link-button {
  text-decoration: none;
}

.global-status {
  min-height: 24px;
  margin: 18px 0 0;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.5;
  text-align: center;
}

.global-status[data-state="error"] {
  color: var(--danger);
}

.global-status[data-state="success"] {
  color: var(--success);
}

.legal {
  margin: 14px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.55;
  text-align: center;
}

[hidden] {
  display: none !important;
}

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

@media (min-width: 760px) {
  .brand-panel,
  .auth-panel {
    padding-left: 40px;
    padding-right: 40px;
  }

  .brand-panel {
    padding-top: 40px;
    padding-bottom: 44px;
  }

  .auth-panel {
    padding-top: 28px;
    padding-bottom: 40px;
  }

  .auth-card {
    padding: 36px;
  }

  .trust-list {
    display: grid;
    gap: 12px;
  }
}

@media (min-width: 1024px) {
  .shell {
    grid-template-columns: minmax(0, 1.08fr) minmax(440px, 0.92fr);
  }

  .brand-panel {
    min-height: 100vh;
    min-height: 100dvh;
    justify-content: flex-start;
    padding: 64px clamp(56px, 7vw, 112px);
    border-right: 1px solid rgba(125, 211, 252, 0.45);
  }

  .brand-copy {
    margin: auto 0;
  }

  .auth-panel {
    padding: 48px clamp(40px, 5vw, 80px);
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #07131d;
    --background-deep: #0c2232;
    --surface: #0f2534;
    --surface-muted: #173447;
    --text: #bae6fd;
    --text-strong: #f8fafc;
    --text-muted: #cbd5e1;
    --border: #28526a;
    --border-strong: #39728f;
    --primary: #38bdf8;
    --primary-hover: #7dd3fc;
    --primary-text: #082f49;
    --focus: #7dd3fc;
    --danger: #fca5a5;
    --success: #6ee7b7;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  }

  body {
    background:
      radial-gradient(circle at 12% 10%, rgba(14, 165, 233, 0.18), transparent 34rem),
      radial-gradient(circle at 88% 80%, rgba(234, 88, 12, 0.09), transparent 30rem),
      var(--background);
  }

  .field input {
    border-color: #64748b;
  }

  .check,
  .success-mark {
    border-color: #047857;
    background: #064e3b;
  }

  .check::after,
  .success-mark span {
    border-color: #a7f3d0;
  }

  .claim-banner {
    border-color: #9a3412;
    color: #fed7aa;
    background: #431407;
  }
}

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