:root {
  color-scheme: dark;
  --bg: #050914;
  --panel: rgba(13, 22, 37, 0.94);
  --panel-strong: rgba(16, 22, 36, 0.98);
  --text: #f8fbff;
  --text-muted: #aab4c8;
  --accent: #8b5cf6;
  --accent-strong: #c4b5fd;
  --accent-cyan: #a78bfa;
  --success: #38f08b;
  --error: #ff3d6e;
  --border: rgba(226, 232, 255, 0.16);
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "IBM Plex Mono", "JetBrains Mono", "SFMono-Regular", ui-monospace, Consolas, "Liberation Mono", Menlo, monospace;
  letter-spacing: 0.01em;
  background:
    radial-gradient(circle at 12% 12%, rgba(139, 92, 246, 0.2), transparent 20%),
    radial-gradient(circle at 88% 14%, rgba(255, 61, 110, 0.08), transparent 18%),
    radial-gradient(circle at 70% 82%, rgba(139, 92, 246, 0.12), transparent 22%),
    linear-gradient(180deg, #070d19 0%, #050914 45%, #03060d 100%);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    radial-gradient(circle at 20% 10%, rgba(139, 92, 246, 0.14), transparent 10%),
    radial-gradient(circle at 84% 14%, rgba(255, 61, 110, 0.06), transparent 10%);
  background-size: 56px 56px, 56px 56px, auto, auto;
  opacity: 0.78;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 0%, rgba(139, 92, 246, 0.14), transparent 28%),
    radial-gradient(circle at 50% 100%, rgba(255, 61, 110, 0.05), transparent 24%);
  mix-blend-mode: screen;
  opacity: 0.7;
}

.auth-container {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

.auth-container.auth-signup {
  grid-template-columns: 1fr 1.08fr;
}

.auth-panel,
.auth-promo,
.welcome-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(21, 22, 33, 0.96), rgba(13, 14, 22, 0.96));
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.auth-panel::before,
.auth-promo::before,
.welcome-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04), transparent 35%);
  pointer-events: none;
}

.auth-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px 48px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-container.auth-signup .auth-panel {
  align-items: stretch;
}

.signup-panel {
  padding: 40px 48px;
}

.auth-promo {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px 48px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-header {
  width: 100%;
  max-width: 420px;
  margin-bottom: 28px;
  text-align: center;
}

.auth-header h1,
.promo-header h2,
.promo-content h2,
.welcome-card h1 {
  margin: 0;
  font-family: "IBM Plex Mono", "JetBrains Mono", "SFMono-Regular", ui-monospace, Consolas, "Liberation Mono", Menlo, monospace;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.auth-header h1 {
  font-size: clamp(1.55rem, 1.6vw, 2rem);
  margin-bottom: 10px;
}

.auth-header p,
.promo-content p,
.welcome-card p,
.auth-footer p,
.auth-form span,
.promo-list li {
  color: var(--text-muted);
}

.snowflake-logo,
.welcome-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.26), rgba(255, 61, 110, 0.08));
  border: 1px solid rgba(139, 92, 246, 0.2);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 16px 32px rgba(0, 0, 0, 0.3);
}

.auth-form {
  display: grid;
  gap: 14px;
  width: 100%;
  max-width: 420px;
  margin-bottom: 20px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

.auth-form span {
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

input[type="text"],
input[type="email"],
input[type="password"],
select {
  min-height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

input::placeholder,
textarea::placeholder {
  color: rgba(141, 146, 173, 0.72);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(196, 140, 255, 0.8);
  box-shadow: 0 0 0 4px rgba(141, 82, 255, 0.14);
  transform: translateY(-1px);
}

.checkbox-label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--text-muted);
  font-size: 0.84rem;
  cursor: pointer;
  line-height: 1.55;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: var(--accent);
}

.forgot-link,
.auth-footer a {
  color: var(--accent-strong);
}

.forgot-link:hover,
.auth-footer a:hover {
  color: #ece6ff;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 14px;
  min-height: 46px;
  padding: 0 18px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button-primary {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--accent), #5a1ff0);
  color: #f8f5ff;
  box-shadow:
    0 0 0 1px rgba(196, 140, 255, 0.18) inset,
    0 16px 34px rgba(141, 82, 255, 0.28);
}

.button-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, 0.16) 48%, transparent 100%);
  transform: translateX(-120%);
  transition: transform 0.6s ease;
}

.button-primary:hover::after {
  transform: translateX(120%);
}

.button-full {
  width: 100%;
}

.auth-footer {
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.auth-footer p {
  margin: 0;
  font-size: 0.9rem;
}

.auth-promo {
  gap: 18px;
}

.signup-promo {
  display: grid;
  align-content: center;
}

.promo-header {
  margin-bottom: 8px;
}

.promo-header h2 {
  font-size: clamp(1.4rem, 1.7vw, 2rem);
}

.promo-content {
  display: grid;
  gap: 16px;
}

.promo-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.promo-list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.9rem;
  line-height: 1.55;
}

.check-icon {
  flex-shrink: 0;
  color: var(--success);
  font-weight: 800;
}

.feature-card {
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.feature-card:hover {
  transform: translateY(-2px);
  border-color: rgba(141, 82, 255, 0.28);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.28);
}

.feature-icon {
  width: 36px;
  height: 36px;
  margin-bottom: 10px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(141, 82, 255, 0.16);
  color: var(--accent-strong);
  font-size: 1.1rem;
}

.feature-card h3 {
  margin: 0 0 4px;
  color: var(--text);
  font-size: 0.96rem;
}

.feature-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.86rem;
}

.response-message {
  display: none;
  width: 100%;
  max-width: 420px;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.85rem;
}

.response-message.show {
  display: block;
}

.response-message.success {
  border-color: rgba(75, 227, 141, 0.24);
  background: rgba(75, 227, 141, 0.1);
  color: #9ff0bf;
}

.response-message.error {
  border-color: rgba(255, 107, 133, 0.24);
  background: rgba(255, 107, 133, 0.08);
  color: #ffb1c0;
}

.welcome-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
}

.welcome-container {
  width: 100%;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.welcome-card {
  width: min(100%, 440px);
  padding: 42px 40px;
  text-align: center;
  border-radius: 28px;
}

.welcome-card h1 {
  margin-bottom: 12px;
  font-size: clamp(1.8rem, 2.2vw, 2.4rem);
}

.welcome-card p {
  margin: 0 0 24px;
  font-size: 0.98rem;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  margin: 0 auto 24px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

.signup-page .auth-panel,
.login-page .auth-panel,
.welcome-page .welcome-card,
.auth-promo {
  animation: cardRise 0.45s ease both;
}

.auth-container,
.welcome-container {
  animation: fadeRise 0.45s ease both;
}

@keyframes fadeRise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cardRise {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

@media (max-width: 900px) {
  .auth-container,
  .auth-container.auth-signup {
    grid-template-columns: 1fr;
  }

  .auth-panel {
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .auth-promo {
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }
}

@media (max-width: 640px) {
  .auth-panel,
  .signup-panel,
  .auth-promo {
    padding: 28px 18px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .auth-header,
  .auth-form,
  .auth-footer,
  .response-message {
    max-width: none;
  }

  .welcome-card {
    padding: 34px 24px;
  }
}

@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;
  }
}
