:root {
  --background-deep: #020203;
  --background-base: #050506;
  --background-elevated: #0a0a0c;
  --foreground: #edecef;
  --muted-foreground: rgba(255, 255, 255, 0.6);
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.14);
  --accent: #6867f7;
  --accent-bright: #7b7af9;
  --accent-glow: rgba(104, 103, 247, 0.3);
  --danger: #f87171;
  --shadow-md: 0 10px 24px rgba(0, 0, 0, 0.34);
  --shadow-xl: 0 24px 56px rgba(0, 0, 0, 0.5);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --container: min(1120px, calc(100% - 48px));
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
  color: var(--foreground);
  background: radial-gradient(1100px 620px at 24% 10%, rgba(104, 103, 247, 0.18), transparent 62%),
    radial-gradient(920px 560px at 92% 28%, rgba(121, 119, 245, 0.12), transparent 66%),
    linear-gradient(180deg, #0a0b16 0%, #06070e 44%, #020203 100%);
  overflow-x: hidden;
}

.container {
  width: var(--container);
  margin: 0 auto;
}

/* Background layers */
.noise {
  position: fixed;
  inset: -60px;
  opacity: 0.025;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

.grid-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.028;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 64px 64px;
}

.hero-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.hero-bg__scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
      to bottom,
      rgba(2, 2, 3, 0.28) 0%,
      rgba(2, 2, 3, 0.56) 62%,
      rgba(2, 2, 3, 0.8) 100%
    ),
    radial-gradient(920px 500px at 20% 10%, rgba(104, 103, 247, 0.2), transparent 68%);
  opacity: 1;
}

/* Layout */
.auth-main.hero--marketing {
  min-height: 100vh;
  padding: max(20px, env(safe-area-inset-top, 0px)) 0 max(28px, env(safe-area-inset-bottom, 0px));
  position: relative;
  isolation: isolate;
}

.auth-layout {
  min-height: calc(100vh - 96px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 20px;
}

.auth-back-home {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s ease;
  margin-top: 10px;
}

.auth-back-home:hover,
.auth-back-home:focus-visible {
  color: #ffffff;
}

.auth-back-home:focus-visible {
  outline: none;
  border-radius: 10px;
  box-shadow: 0 0 0 2px rgba(2, 2, 3, 0.72), 0 0 0 4px rgba(104, 103, 247, 0.45);
}

.auth-back-home i {
  font-size: 0.85em;
  color: inherit;
  opacity: 1;
}

/* Card */
.auth-card-shell {
  position: relative;
  width: min(100%, 430px);
}

.auth-card-glow {
  position: absolute;
  inset: -22% -14%;
  border-radius: 999px;
  filter: blur(90px);
  background: radial-gradient(circle at center, var(--accent-glow), transparent 70%);
  pointer-events: none;
}

.auth-card {
  position: relative;
  z-index: 1;
  padding: 40px 32px;
  box-shadow: var(--shadow-xl);
  border-radius: 18px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  backdrop-filter: blur(12px);
}

.auth-card__beam {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background: radial-gradient(900px 160px at 50% -70px, rgba(104, 103, 247, 0.2), transparent 62%);
  pointer-events: none;
}

.auth-card__head {
  text-align: center;
  margin-bottom: 16px;
  position: relative;
}

.auth-card__head .logo-mark {
  margin: 0 auto 10px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(104, 103, 247, 0.12);
  border: 1px solid rgba(104, 103, 247, 0.35);
}

.auth-card__head i {
  font-size: 1.5rem;
  color: #c9c7ff;
}

.auth-card__head h2 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
}

.auth-card__head p {
  margin: 6px 0 0;
  color: var(--muted-foreground);
  font-size: 0.94rem;
}

/* Buttons */
.btn {
  appearance: none;
  border: 0;
  border-radius: 12px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 12px 14px;
  min-height: 44px;
  transition: transform 160ms var(--ease-out), box-shadow 160ms var(--ease-out), background-color 160ms, color 160ms;
  user-select: none;
}

.btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  box-shadow: 0 10px 20px rgba(104, 103, 247, 0.28);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(104, 103, 247, 0.34);
}

.btn-primary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(2, 2, 3, 0.75), 0 0 0 6px rgba(104, 103, 247, 0.36);
}

.auth-card .btn {
  font-size: 1rem;
  margin-top: 8px;
  min-height: 45px;
}

/* Forms */
.auth-form {
  display: none;
  gap: 10px;
}

.auth-form.is-active {
  display: grid;
}

.auth-field {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.auth-field > span {
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.auth-input-wrap {
  min-height: 45px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(104, 103, 247, 0.12);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  transition: box-shadow 160ms var(--ease-out), border-color 160ms var(--ease-out), background-color 160ms var(--ease-out);
}

.auth-input-wrap i {
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.5);
}

.auth-input-wrap:focus-within {
  background: rgba(104, 103, 247, 0.18);
  border-color: rgba(123, 122, 249, 0.62);
  box-shadow: 0 0 0 1px rgba(123, 122, 249, 0.42), 0 0 0 4px rgba(104, 103, 247, 0.2);
}

.auth-input-wrap.is-error {
  border-color: rgba(248, 113, 113, 0.72);
  background: rgba(248, 113, 113, 0.1);
}

.auth-input-wrap input {
  flex: 1 1 0%;
  min-width: 0;
  width: auto;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--foreground);
  font: inherit;
  font-size: 0.875rem;
}

.auth-input-wrap input::placeholder {
  color: rgba(255, 255, 255, 0.42);
}

.auth-pass-toggle,
.auth-code-btn,
.auth-link-btn {
  border: 0;
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  font-family: inherit;
}

.auth-pass-toggle {
  padding: 8px;
  border-radius: 10px;
}

.auth-pass-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(2, 2, 3, 0.82), 0 0 0 4px rgba(104, 103, 247, 0.26);
}

.auth-code-btn {
  flex-shrink: 0;
  align-self: center;
  white-space: nowrap;
  line-height: 1.2;
  min-height: 32px;
  border-radius: 10px;
  color: var(--accent);
  padding: 0 8px;
  font-size: 14px;
  font-weight: 700;
}

.auth-code-btn:hover:not(:disabled) {
  color: #9b99ff;
}

.auth-code-btn:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.auth-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.auth-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.auth-link {
  color: var(--accent);
  font-size: 0.875rem;
}

.auth-register-entry {
  margin: 20px 0 0;
  text-align: center;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

/* OAuth */
.auth-oauth {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.auth-oauth__label {
  margin: 0 0 12px;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  letter-spacing: 0.06em;
}

.auth-oauth__row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(10px, 3vw, 16px);
  flex-wrap: wrap;
}

.auth-oauth__btn {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: var(--shadow-md);
  transition: transform 160ms var(--ease-out), box-shadow 160ms var(--ease-out), background-color 160ms;
}

.auth-oauth__btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.auth-oauth__btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(2, 2, 3, 0.82), 0 0 0 5px rgba(104, 103, 247, 0.35);
}

.auth-oauth__btn i {
  font-size: 1.2rem;
  line-height: 1;
}

.auth-oauth__icon-svg {
  width: 1.2rem;
  height: 1.2rem;
  display: block;
}

/* Toast */
.auth-toast {
  position: fixed;
  left: 50%;
  top: 20px;
  transform: translate(-50%, -12px);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: calc(100vw - 32px);
  border-radius: 14px;
  border: 1px solid var(--border-hover);
  background: rgba(5, 5, 6, 0.9);
  padding: 13px 14px 13px 16px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--foreground);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.42);
  opacity: 0;
  transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out);
  z-index: 120;
}

.auth-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.auth-toast__icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: currentColor;
}

.auth-toast.is-error {
  border-color: rgba(248, 113, 113, 0.52);
  background: rgba(248, 113, 113, 0.14);
  color: #fda4a4;
}

.auth-toast.is-success {
  border-color: rgba(110, 231, 183, 0.5);
  background: rgba(110, 231, 183, 0.14);
  color: #86efac;
}

.auth-toast__icon i {
  font-size: 20px;
}

.auth-toast__text {
  min-width: 0;
}

@media (max-width: 640px) {
  .auth-card {
    padding: 34px 22px;
  }

  .auth-toast {
    top: 14px;
    max-width: calc(100vw - 24px);
    padding: 12px 12px 12px 14px;
    font-size: 14px;
  }
}

/* Reveal */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

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

  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
}
