:root {
  color-scheme: dark;
  --auth-bg: #04060d;
  --auth-bg-soft: #060915;
  --auth-surface-strong: rgba(3, 5, 11, 0.96);
  --auth-border: rgba(255, 255, 255, 0.1);
  --auth-border-strong: rgba(255, 255, 255, 0.18);
  --auth-text: #f7f9ff;
  --auth-text-soft: rgba(234, 238, 248, 0.72);
  --auth-text-faint: rgba(215, 221, 234, 0.48);
  --auth-success: #78f0b4;
  --auth-danger: #ff9aa3;
  --auth-shadow: 0 34px 90px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: Inter, system-ui, sans-serif;
  color: var(--auth-text);
  background:
    radial-gradient(circle at 18% 0%, rgba(181, 145, 255, 0.18), transparent 34%),
    radial-gradient(circle at 84% 100%, rgba(109, 220, 255, 0.14), transparent 32%),
    linear-gradient(180deg, var(--auth-bg) 0%, var(--auth-bg-soft) 100%);
}

body.auth-embedded {
  background: transparent;
  overflow: hidden;
}

a {
  color: inherit;
}

.auth-page {
  position: relative;
  min-height: 100vh;
  padding: 32px 20px;
  overflow: hidden;
}

.auth-page--embedded {
  min-height: auto;
  padding: 0;
}

.auth-orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(90px);
  pointer-events: none;
  opacity: 0.72;
}

.auth-orb--top {
  top: -150px;
  left: -70px;
  width: 420px;
  height: 420px;
  background: rgba(186, 157, 255, 0.28);
}

.auth-orb--bottom {
  right: -90px;
  bottom: -130px;
  width: 360px;
  height: 360px;
  background: rgba(109, 220, 255, 0.22);
}

.auth-page--embedded .auth-orb {
  display: none;
}

.auth-stage {
  position: relative;
  z-index: 1;
  width: min(100%, 484px);
  min-height: calc(100vh - 64px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.auth-page--embedded .auth-stage {
  width: 100%;
  min-height: auto;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font: 800 1.18rem/1 "Space Grotesk", sans-serif;
  letter-spacing: -0.05em;
}

.auth-brand--card {
  width: 100%;
  margin: 0 0 20px;
}

.auth-brand span {
  color: #cdb8ff;
}

.auth-shell,
.auth-redirect-state {
  width: 100%;
}

.auth-redirect-state {
  display: none;
}

.auth-status-card,
.auth-card {
  position: relative;
  overflow: hidden;
  border-radius: 30px;
  border: 1px solid var(--auth-border);
  background: linear-gradient(180deg, rgba(10, 13, 22, 0.8), rgba(3, 5, 11, 0.96));
  box-shadow: var(--auth-shadow);
  backdrop-filter: blur(26px);
}

.auth-status-card {
  padding: 26px 24px;
}

.auth-page--pending .auth-redirect-state,
.auth-page--redirecting .auth-redirect-state {
  display: block;
}

.auth-page--pending .auth-shell,
.auth-page--redirecting .auth-shell {
  display: none;
}

.auth-kicker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(247, 249, 255, 0.84);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-status-card h2,
.auth-card h1 {
  margin: 16px 0 10px;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.05em;
  line-height: 0.95;
}

.auth-status-card h2 {
  font-size: clamp(1.8rem, 4vw, 2.45rem);
}

.auth-card h1 {
  font-size: clamp(2rem, 6vw, 2.75rem);
  margin-top: 0;
}

.auth-status-card p,
.auth-copy,
.auth-notice,
.auth-session-state,
.auth-legal {
  color: var(--auth-text-soft);
  line-height: 1.65;
}

.auth-card {
  padding: 1px;
}

.auth-card-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top center, rgba(255, 255, 255, 0.11), transparent 34%),
    radial-gradient(circle at bottom right, rgba(109, 220, 255, 0.1), transparent 34%);
  pointer-events: none;
}

.auth-card-inner {
  position: relative;
  z-index: 1;
  padding: 28px;
  border-radius: 29px;
  background:
    linear-gradient(180deg, rgba(10, 13, 22, 0.72), rgba(3, 5, 11, 0.94)),
    linear-gradient(135deg, rgba(255, 255, 255, 0.04), transparent 42%);
}

.auth-page--embedded .auth-card-inner {
  padding: 24px 22px 20px;
}

.auth-card-inner::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 24%),
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.05), transparent 24%);
}

.auth-copy {
  margin: 0 0 18px;
  max-width: 28ch;
}

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

.auth-form--primary {
  margin-bottom: 18px;
}

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

.auth-field span {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--auth-text-faint);
}

.auth-field input {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--auth-text);
  font: inherit;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.auth-field input::placeholder {
  color: rgba(255, 255, 255, 0.34);
}

.auth-field input:focus {
  outline: none;
  border-color: var(--auth-border-strong);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.06);
}

.auth-primary-button,
.auth-secondary-button,
.auth-provider-button {
  font: 700 0.94rem/1 Inter, sans-serif;
}

.auth-primary-button,
.auth-secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 18px;
  border-radius: 16px;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.auth-primary-button {
  border: none;
  color: #05070d;
  background: linear-gradient(180deg, #ffffff 0%, #eef3ff 100%);
  box-shadow: 0 18px 34px rgba(255, 255, 255, 0.12);
}

.auth-primary-button:hover,
.auth-secondary-button:hover,
.auth-provider-button:hover {
  transform: translateY(-1px);
}

.auth-primary-button:disabled,
.auth-secondary-button:disabled,
.auth-provider-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
}

.auth-secondary-button {
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--auth-text);
  background: rgba(255, 255, 255, 0.04);
}

.auth-secondary-button--full {
  width: 100%;
}

.auth-divider {
  position: relative;
  margin: 16px 0 14px;
  text-align: center;
  color: var(--auth-text-faint);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.auth-divider::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-divider span {
  position: relative;
  padding: 0 10px;
  background: var(--auth-surface-strong);
}

.auth-provider-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.auth-provider-button {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 50px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--auth-text);
  text-align: left;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.auth-provider-button span:last-child {
  font-weight: 700;
}

.auth-provider-button:hover {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
}

.auth-provider-mark {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.auth-provider-mark img {
  display: block;
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.auth-provider-mark--google {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(255, 255, 255, 0.2);
}

.auth-provider-mark--google img {
  width: 18px;
  height: 18px;
}

.auth-provider-mark--github {
  background: rgba(255, 255, 255, 0.08);
}

.auth-provider-mark--github img {
  width: 19px;
  height: 19px;
}

.auth-notice,
.auth-session-state {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
}

.auth-session-state strong {
  display: block;
  margin-bottom: 6px;
  color: var(--auth-text);
}

.auth-notice.is-error {
  color: #ffd8dd;
  border-color: rgba(255, 154, 163, 0.28);
  background: rgba(255, 154, 163, 0.08);
}

.auth-side-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.auth-legal {
  margin: 14px 0 0;
  font-size: 0.75rem;
}

.auth-legal a {
  color: #ffffff;
  text-decoration: none;
}

.auth-page--embedded .auth-legal {
  display: none;
}

.auth-spinner {
  width: 38px;
  height: 38px;
  margin-top: 18px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: rgba(255, 255, 255, 0.86);
  animation: auth-spin 1s linear infinite;
}

.auth-card-beams {
  position: absolute;
  inset: -1px;
  border-radius: 30px;
  overflow: hidden;
  pointer-events: none;
}

.auth-card-beam {
  position: absolute;
  opacity: 0;
  filter: blur(1px);
}

.auth-card-beam--top,
.auth-card-beam--bottom {
  width: 44%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.94), transparent);
}

.auth-card-beam--left,
.auth-card-beam--right {
  width: 2px;
  height: 44%;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.94), transparent);
}

.auth-card-beam--top {
  top: 0;
  left: -48%;
  animation: auth-beam-top 4.8s ease-in-out infinite;
}

.auth-card-beam--right {
  top: -48%;
  right: 0;
  animation: auth-beam-right 4.8s ease-in-out infinite 1.1s;
}

.auth-card-beam--bottom {
  right: -48%;
  bottom: 0;
  animation: auth-beam-bottom 4.8s ease-in-out infinite 2.2s;
}

.auth-card-beam--left {
  bottom: -48%;
  left: 0;
  animation: auth-beam-left 4.8s ease-in-out infinite 3.3s;
}

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

@keyframes auth-beam-top {
  0%, 10% {
    left: -48%;
    opacity: 0;
  }
  24%, 54% {
    opacity: 0.9;
  }
  100% {
    left: 108%;
    opacity: 0;
  }
}

@keyframes auth-beam-right {
  0%, 10% {
    top: -48%;
    opacity: 0;
  }
  24%, 54% {
    opacity: 0.9;
  }
  100% {
    top: 108%;
    opacity: 0;
  }
}

@keyframes auth-beam-bottom {
  0%, 10% {
    right: -48%;
    opacity: 0;
  }
  24%, 54% {
    opacity: 0.9;
  }
  100% {
    right: 108%;
    opacity: 0;
  }
}

@keyframes auth-beam-left {
  0%, 10% {
    bottom: -48%;
    opacity: 0;
  }
  24%, 54% {
    opacity: 0.9;
  }
  100% {
    bottom: 108%;
    opacity: 0;
  }
}

@media (max-width: 640px) {
  .auth-page {
    padding: 18px 12px;
  }

  .auth-page--embedded {
    padding: 14px;
  }

  .auth-stage {
    min-height: calc(100vh - 36px);
  }

  .auth-brand {
    font-size: 1.04rem;
  }

  .auth-status-card,
  .auth-card-inner {
    padding: 22px 20px;
  }

  .auth-page--embedded .auth-card-inner {
    padding: 20px 18px 18px;
  }

  .auth-copy {
    margin-bottom: 16px;
  }

  .auth-provider-grid,
  .auth-side-actions {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .auth-primary-button,
  .auth-secondary-button,
  .auth-provider-button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-spinner,
  .auth-card-beam {
    animation: none;
  }
}
