:root {
  --auth-accent: #0066FF;
  --auth-accent-hover: #0052CC;
  --auth-accent-glow: rgba(0, 102, 255, 0.35);
  --auth-brand-bg: #0a0f0f;
  --auth-form-bg: #111618;
  --auth-input-bg: #1a2020;
  --auth-input-border: #2a3535;
  --auth-text: #f1f5f9;
  --auth-text-muted: #94a3b8;
  --auth-text-dim: #64748b;
  --auth-error-bg: rgba(239, 68, 68, 0.12);
  --auth-error-text: #fca5a5;
  --auth-success-bg: rgba(0, 102, 255, 0.1);
  --auth-success-text: #93c5fd;
  --font-heading: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-label: 'JetBrains Mono', monospace;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: hidden;
}

body.auth-page {
  font-family: var(--font-body);
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  max-width: 100vw;
  color: var(--auth-text);
  background: var(--auth-form-bg);
  overflow-x: hidden;
  touch-action: manipulation;
}

body.auth-page input,
body.auth-page textarea,
body.auth-page select {
  font-size: 16px !important;
}

.auth-shell {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  max-width: 100vw;
}

/* ── Brand panel (45%) ── */
.auth-brand-panel {
  flex: 0 0 45%;
  background: var(--auth-brand-bg);
  display: flex;
  flex-direction: column;
  padding: 40px 48px;
  position: relative;
}

.auth-brand-logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.auth-brand-logo img {
  height: 36px;
  width: auto;
  display: block;
}

.auth-brand-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 0;
  max-width: 420px;
}

.auth-brand-headline {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 3.2vw, 2.75rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: #fff;
  margin-bottom: 40px;
}

.auth-stats {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.auth-stat-value {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--auth-accent);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.auth-stat-label {
  font-size: 0.92rem;
  color: var(--auth-text-muted);
  line-height: 1.45;
}

/* ── Form panel (55%) ── */
.auth-form-panel {
  flex: 0 0 55%;
  background: var(--auth-form-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
}

.auth-page-wrapper {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.auth-form-inner {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.auth-form-mobile-logo {
  display: none;
  margin-bottom: 32px;
}

.auth-form-mobile-logo img {
  height: 32px;
  width: auto;
}

.auth-form-title {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  margin-bottom: 8px;
}

.auth-form-subtitle {
  font-size: 0.92rem;
  color: var(--auth-text-muted);
  line-height: 1.5;
  margin-bottom: 32px;
}

.auth-form-title {
  margin-bottom: 32px;
}

.auth-form-title + .auth-form-subtitle {
  margin-top: -24px;
}

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

.form-group label {
  display: block;
  font-family: var(--font-label);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--auth-text-dim);
  margin-bottom: 8px;
}

.auth-field {
  position: relative;
}

.auth-field input {
  width: 100%;
  max-width: 100%;
  padding: 14px 44px 14px 16px;
  border-radius: 8px;
  border: 1px solid var(--auth-input-border);
  background: var(--auth-input-bg);
  color: var(--auth-text);
  font-family: var(--font-body);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-field input::placeholder {
  color: #4a5568;
}

.auth-field input:focus {
  border-color: var(--auth-accent);
  box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.15);
}

.toggle-eye {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--auth-text-dim);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: color 0.2s ease;
}

.toggle-eye:hover {
  color: var(--auth-text-muted);
}

.toggle-eye svg {
  width: 18px;
  height: 18px;
}

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
}

.remember {
  display: flex;
  align-items: center;
  gap: 8px;
}

.remember input {
  width: 16px;
  height: 16px;
  accent-color: var(--auth-accent);
  cursor: pointer;
}

.remember label {
  margin: 0;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--auth-text-muted);
  cursor: pointer;
}
.forgot-link {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--auth-text-dim);
  text-decoration: none;
  transition: color 0.2s ease;
}

.forgot-link:hover {
  color: var(--auth-text-muted);
}

.btn-submit {
  width: 100%;
  padding: 15px 20px;
  border: none;
  border-radius: 8px;
  background: var(--auth-accent);
  color: #fff;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px var(--auth-accent-glow);
  transition: background 0.2s ease, transform 0.15s ease, opacity 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-submit.is-loading {
  cursor: wait;
  opacity: 1;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 32px rgba(0, 102, 255, 0.42);
}

.btn-submit.is-loading::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 0%, rgba(255, 255, 255, 0.28) 48%, transparent 72%);
  transform: translateX(-130%);
  animation: auth-btn-sheen 1.15s ease-in-out infinite;
  pointer-events: none;
}

.btn-submit.is-loading .auth-btn-label {
  opacity: 0.95;
  position: relative;
  z-index: 1;
}

.auth-btn-orbit {
  position: relative;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  z-index: 1;
}

.auth-btn-orbit span {
  position: absolute;
  inset: 0;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-btn-spin 0.85s linear infinite;
}

.auth-btn-orbit span:last-child {
  inset: 4px;
  border-width: 2px;
  border-top-color: rgba(255, 255, 255, 0.9);
  animation-direction: reverse;
  animation-duration: 0.6s;
}

@keyframes auth-btn-sheen {
  to { transform: translateX(130%); }
}

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

.btn-submit:hover:not(:disabled) {
  background: var(--auth-accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 102, 255, 0.4);
}

.btn-submit:disabled:not(.is-loading) {
  opacity: 0.55;
  cursor: not-allowed;
}

.auth-divider {
  margin: 24px 0 20px;
  text-align: center;
  color: var(--auth-text-dim);
  font-size: 0.82rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--auth-input-border);
}

#google-login-wrap,
#google-register-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

#google-login-wrap > div,
#google-register-wrap > div {
  width: 100% !important;
  max-width: 100% !important;
}

#google-login-wrap iframe,
#google-register-wrap iframe {
  max-width: 100% !important;
}

.google-hint {
  display: none;
  text-align: center;
  color: var(--auth-text-dim);
  font-size: 0.82rem;
  font-weight: 500;
  margin-top: 12px;
}

.error-msg {
  display: none;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  text-align: center;
  color: var(--auth-error-text);
  background: var(--auth-error-bg);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.success-msg {
  display: none;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  text-align: center;
  color: var(--auth-success-text);
  background: var(--auth-success-bg);
  border: 1px solid rgba(0, 102, 255, 0.25);
}

.auth-mobile-footer {
  display: none;
  flex-shrink: 0;
  margin-top: auto;
  padding-top: 32px;
  padding-bottom: 8px;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--auth-text-dim);
}

.auth-mobile-footer a {
  color: var(--auth-text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.auth-mobile-footer a:hover {
  color: var(--auth-accent);
}

.auth-mobile-footer-sep {
  margin: 0 10px;
  opacity: 0.45;
  user-select: none;
}

.auth-link {
  margin-top: 28px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--auth-text-muted);
}

.auth-link a {
  color: var(--auth-accent);
  font-weight: 600;
  text-decoration: none;
}

.auth-link a:hover {
  text-decoration: underline;
}

.success-msg a {
  color: var(--auth-accent);
  font-weight: 600;
  text-decoration: none;
}

.success-msg a:hover {
  text-decoration: underline;
}

@media (max-width: 900px) {
  .auth-brand-panel {
    display: none;
  }

  .auth-shell {
    min-height: 100dvh;
    height: 100dvh;
    overflow: hidden;
  }

  .auth-form-panel {
    flex: 1 1 100%;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100vw;
    align-items: stretch;
    justify-content: flex-start;
    min-height: 0;
    height: 100%;
    padding: 32px 20px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .auth-page-wrapper {
    flex: 1;
    min-height: 100%;
    justify-content: space-between;
    margin: 0 auto;
    max-width: 100%;
  }

  .auth-form-mobile-logo {
    display: block;
  }

  .auth-mobile-footer {
    display: block;
  }
}

@media (max-width: 480px) {
  .auth-form-panel {
    padding: 40px 16px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  }

  .auth-form-title {
    font-size: 1.5rem;
  }

  .form-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}
