:root {
  --bg-1: #edf2ff;
  --bg-2: #f6fbff;
  --bg-3: #eef4ff;
  --card: rgba(255, 255, 255, 0.92);
  --text: #0f172a;
  --muted: #64748b;
  --border: #dbe4f0;
  --primary: #0a84ff;
  --primary-hover: #006ad7;
  --danger: #d70015;
  --surface-soft: #f8fbff;
  --surface-hover: #eef4ff;
  --surface-raised: #ffffff;
  --input-bg: rgba(255, 255, 255, 0.92);
  --focus-ring: rgba(10, 132, 255, 0.13);
  --link: #1e4f95;
  --turnstile-bg: #f8fbff;
  --turnstile-border: #c9d8ea;
  --radius-xl: 22px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --shadow-card: 0 24px 56px rgba(15, 23, 42, 0.14), 0 8px 20px rgba(15, 23, 42, 0.08);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

:root[data-color-scheme="dark"] {
  --bg-1: #06101d;
  --bg-2: #0a1527;
  --bg-3: #0f1b31;
  --card: rgba(10, 18, 34, 0.84);
  --text: #e2e8f0;
  --muted: #8ea2c0;
  --border: #24344d;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --danger: #fb7185;
  --surface-soft: rgba(12, 22, 38, 0.9);
  --surface-hover: rgba(34, 50, 74, 0.88);
  --surface-raised: rgba(18, 30, 49, 0.96);
  --input-bg: rgba(10, 18, 32, 0.96);
  --focus-ring: rgba(59, 130, 246, 0.24);
  --link: #8db7ff;
  --turnstile-bg: rgba(12, 22, 38, 0.92);
  --turnstile-border: #314663;
  --shadow-card: 0 28px 72px rgba(0, 0, 0, 0.48), 0 10px 28px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(860px 420px at -10% -10%, #d9e8ff 0%, rgba(217, 232, 255, 0) 60%),
    radial-gradient(760px 360px at 110% -20%, #dcf4ee 0%, rgba(220, 244, 238, 0) 58%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 58%, var(--bg-3) 100%);
}

:root[data-color-scheme="dark"] body {
  background:
    radial-gradient(760px 420px at -10% -12%, rgba(48, 94, 182, 0.34) 0%, rgba(48, 94, 182, 0) 60%),
    radial-gradient(720px 360px at 110% -18%, rgba(28, 182, 154, 0.22) 0%, rgba(28, 182, 154, 0) 58%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 58%, var(--bg-3) 100%);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}

.login-card {
  width: 100%;
  max-width: 480px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: var(--card);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-card);
  padding: 20px;
  overflow: hidden;
  contain: layout paint style;
  transform: translateZ(0);
}

.hero-split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.hero-copy {
  min-width: 0;
}

.hero h1 {
  margin: 0;
  font-size: 27px;
  letter-spacing: -0.02em;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.hero .muted {
  margin: 8px 0 0;
}

.theme-panel {
  min-width: 156px;
}

.login-type-switch {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  gap: 4px;
}

.type-btn {
  margin-top: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: none;
}

.type-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.type-btn.active {
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);
}

.type-btn:active {
  transform: none;
}

.login-type-hint {
  margin-top: 8px;
  line-height: 1.4;
}

.mode-switch {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  gap: 4px;
}

.mode-btn {
  appearance: none;
  margin-top: 0;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.mode-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.mode-btn.active {
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);
}

.factor-switch {
  margin-top: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  gap: 4px;
}

.factor-btn {
  margin-top: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
}

.factor-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.factor-btn.active {
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.09);
}

.factor-btn:active {
  transform: none;
}

.factor-input-hidden {
  display: none;
}

.factor-hint {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  margin-top: 2px;
}

.pane-window {
  margin-top: 14px;
  overflow: hidden;
  position: relative;
  contain: content;
}

.pane-track {
  width: 200%;
  display: flex;
  transform: translate3d(0, 0, 0);
  transition: transform 260ms cubic-bezier(0.22, 0.61, 0.36, 1);
  will-change: transform;
  backface-visibility: hidden;
}

.login-card.is-reset .pane-track {
  transform: translate3d(-50%, 0, 0);
}

.pane {
  width: 50%;
  flex: 0 0 50%;
  padding: 2px 1px 2px;
  contain: layout paint;
}

.form-grid {
  display: grid;
  gap: 8px;
}

.login-form {
  margin-top: 14px;
}

label {
  color: var(--muted);
  font-size: 12px;
}

input,
select {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 10px 11px;
  font-size: 14px;
  line-height: 1.3;
  font-family: inherit;
  background: var(--input-bg);
  color: var(--text);
}

input::placeholder,
select::placeholder {
  color: var(--muted);
  opacity: 0.88;
}

input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
  outline: none;
}

button {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  padding: 10px 11px;
  font-size: 14px;
  line-height: 1.3;
  font-family: inherit;
  margin-top: 4px;
  border-color: transparent;
  background: linear-gradient(180deg, #1f8bff, var(--primary));
  color: #fff;
  font-weight: 640;
  cursor: pointer;
  transition: transform 0.16s ease, background-color 0.16s ease, opacity 0.16s ease;
}

button:hover {
  background: var(--primary-hover);
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.link-btn {
  margin-top: 8px;
  border: 0;
  background: transparent;
  color: var(--link);
  padding: 6px 2px 2px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
}

.link-btn:hover {
  color: var(--link);
  text-decoration: underline;
  background: transparent;
}

.status {
  min-height: 20px;
  margin-top: 6px;
}

.status.error {
  color: var(--danger);
}

.login-help {
  margin-top: 10px;
  line-height: 1.45;
}

.turnstile-wrap {
  margin-top: 4px;
  padding: 8px;
  border: 1px dashed var(--turnstile-border);
  border-radius: 12px;
  background: var(--turnstile-bg);
}

.turnstile-wrap[hidden] {
  display: none;
}

@media (max-width: 560px) {
  .login-card {
    padding: 16px;
    border-radius: 16px;
  }

  .hero-split {
    flex-direction: column;
  }

  .theme-panel {
    width: 100%;
    min-width: 0;
  }

  .hero h1 {
    font-size: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mode-btn,
  .pane-track,
  button {
    transition: none;
  }
}
