:root {
  color-scheme: dark;
  --bg: #07090d;
  --panel: rgba(15, 18, 24, 0.92);
  --panel-soft: rgba(255, 255, 255, 0.035);
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f5f7fb;
  --muted: #8d95a5;
  --muted-strong: #b7beca;
  --accent: #e7ebf2;
  --accent-ink: #090b0f;
  --danger: #ff7d7d;
  --success: #9ad9b2;
  --focus: rgba(255, 255, 255, 0.28);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 12% 0%, rgba(255, 255, 255, 0.055), transparent 28%),
    radial-gradient(circle at 92% 82%, rgba(255, 255, 255, 0.04), transparent 30%),
    var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

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

a {
  color: var(--text);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-root {
  min-height: 100dvh;
}

.auth-page {
  position: relative;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding:
    max(32px, env(safe-area-inset-top))
    max(20px, env(safe-area-inset-right))
    max(32px, env(safe-area-inset-bottom))
    max(20px, env(safe-area-inset-left));
}

.auth-orb {
  position: fixed;
  width: 360px;
  aspect-ratio: 1;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(2px);
  opacity: 0.35;
}

.auth-orb-one {
  top: -220px;
  left: -150px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    inset 0 0 80px rgba(255, 255, 255, 0.03),
    0 0 100px rgba(255, 255, 255, 0.025);
}

.auth-orb-two {
  right: -220px;
  bottom: -210px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    inset 0 0 90px rgba(255, 255, 255, 0.025),
    0 0 90px rgba(255, 255, 255, 0.02);
}

.auth-card-wrap {
  position: relative;
  z-index: 1;
  width: min(100%, 430px);
}

.brand {
  width: fit-content;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 auto 22px;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  padding: 8px;
  border-radius: 11px;
  background: #f3f5f8;
  box-shadow: 0 8px 24px rgba(255, 255, 255, 0.08);
}

.brand-mark-bar {
  width: 5px;
  border-radius: 2px 2px 1px 1px;
  background: #0a0c10;
}

.brand-mark-bar:nth-child(1) {
  height: 9px;
}

.brand-mark-bar:nth-child(2) {
  height: 16px;
}

.brand-mark-bar:nth-child(3) {
  height: 12px;
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-copy strong {
  font-size: 16px;
  letter-spacing: -0.02em;
}

.brand-copy small {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.035em;
}

.auth-card {
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(19, 22, 29, 0.96), rgba(12, 15, 20, 0.97));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.auth-card-header {
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 9px;
  color: #7f8795 !important;
  font-size: 10px !important;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.auth-card-header h1 {
  margin: 0;
  font-size: clamp(27px, 5vw, 32px);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.auth-card-header p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.auth-status {
  margin: -4px 0 20px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel-soft);
  color: var(--muted-strong);
  font-size: 12px;
  line-height: 1.45;
}

.auth-status[data-type="success"] {
  border-color: rgba(154, 217, 178, 0.22);
  color: var(--success);
}

.auth-status[data-type="error"] {
  border-color: rgba(255, 125, 125, 0.25);
  color: var(--danger);
}

.auth-form {
  display: grid;
  gap: 17px;
}

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

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.field label,
.field-row a {
  font-size: 12px;
}

.field label {
  color: var(--muted-strong);
  font-weight: 600;
}

.field-row a {
  color: var(--muted);
}

input[type="text"],
input[type="email"],
input[type="password"] {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  padding: 0 14px;
  transition:
    border-color 150ms ease,
    background 150ms ease,
    box-shadow 150ms ease;
}

input::placeholder {
  color: #626b7a;
}

input:hover {
  border-color: var(--line-strong);
}

input:focus {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 3px var(--focus);
}

input[aria-invalid="true"] {
  border-color: rgba(255, 125, 125, 0.5);
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 62px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 7px 8px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
}

.password-toggle:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.field-hint,
.field-error {
  min-height: 0;
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
}

.field-hint {
  color: #6f7785;
}

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

.field-error:empty {
  display: none;
}

.primary-button,
.oauth-button {
  min-height: 48px;
  width: 100%;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  transition:
    transform 120ms ease,
    background 150ms ease,
    border-color 150ms ease;
}

.primary-button {
  margin-top: 2px;
  border: 1px solid #f2f4f7;
  background: var(--accent);
  color: var(--accent-ink);
}

.primary-button:hover {
  background: #ffffff;
}

.primary-button:active,
.oauth-button:active {
  transform: translateY(1px);
}

.oauth-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.028);
  color: var(--text);
}

.oauth-button:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.05);
}

.google-mark {
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: #111;
  font-size: 12px;
  font-weight: 800;
}

.auth-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 11px;
  color: #5d6571;
}

.auth-divider span {
  height: 1px;
  background: var(--line);
}

.auth-divider em {
  font-style: normal;
  font-size: 11px;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  line-height: 1.45;
}

.check-row input {
  width: 16px;
  height: 16px;
  margin: 0;
  flex: 0 0 auto;
  accent-color: #f1f3f6;
}

.auth-footer {
  margin-top: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.auth-footer p {
  margin: 0;
}

.auth-footer a {
  color: var(--text);
  font-weight: 650;
}

.legal-copy {
  margin-top: 11px !important;
  color: #5d6572;
  font-size: 10px;
}

@media (max-width: 520px) {
  .auth-page {
    align-items: start;
    padding-top: max(26px, env(safe-area-inset-top));
  }

  .brand {
    margin-bottom: 18px;
  }

  .auth-card {
    padding: 24px 20px;
    border-radius: 18px;
  }

  .auth-card-header {
    margin-bottom: 21px;
  }

  .auth-form {
    gap: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

/* Mobile auth-flow refinements */
.google-mark {
  width: 21px;
  height: 21px;
  flex: 0 0 21px;
  display: block;
  border-radius: 50%;
  background: #fff;
}

@media (max-width: 520px) {
  .auth-page {
    overflow-x: hidden;
    overflow-y: visible;
    padding-bottom: calc(max(36px, env(safe-area-inset-bottom)) + 28px);
  }

  .auth-root[data-route="register"] .auth-page {
    min-height: auto;
    place-items: start center;
    padding-top: max(22px, env(safe-area-inset-top));
    padding-bottom: calc(max(28px, env(safe-area-inset-bottom)) + 24px);
  }

  .auth-root[data-route="register"] .brand {
    margin-bottom: 15px;
  }

  .auth-root[data-route="register"] .auth-card {
    padding: 22px 20px;
  }

  .auth-root[data-route="register"] .auth-card-header {
    margin-bottom: 18px;
  }

  .auth-root[data-route="register"] .auth-card-header p {
    margin-top: 8px;
  }

  .auth-root[data-route="register"] .auth-form {
    gap: 13px;
  }

  .auth-root[data-route="register"] .field {
    gap: 7px;
  }

  .auth-root[data-route="register"] .auth-footer {
    margin-top: 17px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
}

/* Visually hidden labels remain available to screen readers. */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.field-row-end {
  justify-content: flex-end;
}

.auth-root[data-route="login"] .field,
.auth-root[data-route="register"] .field {
  gap: 6px;
}

.password-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: -1px;
}

.password-actions a {
  color: var(--muted);
  font-size: 12px;
}

/* Final auth interaction refinements */
:root {
  --muted: #9aa4b5;
  --muted-strong: #c0c7d2;
}

input::placeholder {
  color: #778293;
}

.field-hint {
  color: #8791a2;
}

.legal-copy {
  color: #737d8c;
}

.password-toggle {
  min-width: 44px;
  min-height: 40px;
  right: 4px;
  display: grid;
  place-items: center;
  padding: 0 9px;
}

.primary-button:disabled,
.oauth-button:disabled,
.password-toggle:disabled {
  cursor: wait;
  opacity: 0.68;
}

.auth-form[aria-busy="true"] input {
  opacity: 0.82;
}

.check-row a,
.legal-copy a {
  color: var(--muted-strong);
  font-weight: 650;
}

.check-row a:hover,
.legal-copy a:hover {
  color: var(--text);
}

.legal-page {
  display: grid;
  gap: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.legal-page section {
  display: grid;
  gap: 6px;
}

.legal-page h2,
.legal-page p {
  margin: 0;
}

.legal-page h2 {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.legal-note {
  padding-top: 4px;
  color: #7d8797;
  font-size: 11px;
}

@media (max-width: 520px) {
  .auth-root[data-route="terms"] .auth-page,
  .auth-root[data-route="privacy"] .auth-page {
    min-height: auto;
    place-items: start center;
    overflow-y: visible;
    padding-bottom: calc(max(32px, env(safe-area-inset-bottom)) + 24px);
  }
}


.reset-success {
  display: grid;
  justify-items: center;
  gap: 18px;
  text-align: center;
}

.reset-success-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(154, 217, 178, 0.22);
  border-radius: 50%;
  background: rgba(154, 217, 178, 0.07);
}

.reset-success-icon svg {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: var(--success);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.reset-success p {
  margin: 0;
  color: var(--muted-strong);
  font-size: 14px;
  line-height: 1.55;
}

.reset-success-action {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.reset-success-action:hover {
  text-decoration: none;
}


.reset-mail-icon svg {
  width: 25px;
  height: 25px;
}

.reset-secondary-copy {
  color: var(--muted) !important;
  font-size: 12px !important;
}

.reset-secondary-copy a {
  color: var(--text);
  font-weight: 650;
}


.reset-email-target {
  margin: 0;
  color: var(--muted-strong) !important;
  font-size: 14px !important;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.reset-email-target strong {
  color: var(--text);
  font-weight: 700;
}


.auth-progress-ring {
  width: 42px;
  height: 42px;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: auth-spin 800ms linear infinite;
}

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