:root {
  --bg: #05070d;
  --bg-strong: #0b1223;
  --surface: rgba(9, 13, 24, 0.72);
  --surface-2: rgba(14, 19, 34, 0.92);
  --text: #f3f6ff;
  --muted: #a8b3cc;
  --line: rgba(255, 255, 255, 0.18);
  --line-strong: rgba(147, 197, 253, 0.5);
  --primary: #6366f1;
  --primary-hover: #5558df;
  --primary-contrast: #ffffff;
  --secondary-bg: rgba(99, 102, 241, 0.15);
  --secondary-hover: rgba(99, 102, 241, 0.24);
  --ok-bg: rgba(16, 185, 129, 0.2);
  --ok-text: #b9ffe4;
  --error-bg: rgba(239, 68, 68, 0.2);
  --error-text: #ffd2d2;
  --shadow: 0 20px 50px rgba(2, 6, 23, 0.45);
}

body[data-theme="light"] {
  --bg: #f2f5ff;
  --bg-strong: #e7ecfb;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-2: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --line: rgba(15, 23, 42, 0.15);
  --line-strong: rgba(99, 102, 241, 0.55);
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-contrast: #ffffff;
  --secondary-bg: rgba(79, 70, 229, 0.08);
  --secondary-hover: rgba(79, 70, 229, 0.16);
  --ok-bg: #e9fbf3;
  --ok-text: #14532d;
  --error-bg: #ffeded;
  --error-text: #7f1d1d;
  --shadow: 0 18px 42px rgba(15, 23, 42, 0.16);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Sora", "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  position: relative;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  background:
    radial-gradient(circle at 20% 12%, rgba(99, 102, 241, 0.35), transparent 34%),
    radial-gradient(circle at 78% 80%, rgba(56, 189, 248, 0.14), transparent 36%),
    linear-gradient(155deg, var(--bg), var(--bg-strong));
}

body::after {
  opacity: 0.11;
  background-image:
    linear-gradient(to right, rgba(129, 140, 248, 0.5) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(129, 140, 248, 0.5) 1px, transparent 1px);
  background-size: 42px 42px;
}

.theme-toggle {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 20;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.theme-toggle:hover {
  border-color: var(--line-strong);
}

.shell {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.brand,
.card {
  padding: clamp(26px, 5vw, 64px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand {
  border-right: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 14px;
  font-size: 12px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--muted);
}

.brand h1 {
  margin: 0;
  font-size: clamp(42px, 6vw, 74px);
  line-height: 0.95;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 16px 0 0;
  max-width: 560px;
  font-size: clamp(16px, 2vw, 22px);
  line-height: 1.42;
  color: var(--muted);
}

.card {
  background: var(--surface-2);
}

.card h2 {
  margin: 0 0 8px;
  font-size: clamp(28px, 3vw, 44px);
  line-height: 1.1;
}

form {
  display: grid;
  gap: 12px;
}

.hidden {
  display: none;
}

label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

input {
  width: 100%;
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  padding: 0 14px;
  font-size: 14px;
  outline: none;
}

input:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.input-wrap {
  position: relative;
}

#password {
  padding-right: 48px;
}

#confirm-password {
  padding-right: 78px;
}

.eye-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  height: 30px;
  min-width: 30px;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  line-height: 1;
  font-size: 16px;
  cursor: pointer;
}

.eye-btn:hover {
  color: var(--text);
}

.match-indicator {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  text-align: center;
  font-weight: 700;
}

.match-indicator.with-eye {
  right: 42px;
}

.match-indicator.ok {
  color: #22c55e;
}

.match-indicator.error {
  color: #ef4444;
}

.match-indicator.neutral {
  color: var(--muted);
}

.strength-track {
  width: 100%;
  height: 9px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.25);
  overflow: hidden;
}

.strength-fill {
  width: 0%;
  height: 100%;
  transition: width 150ms ease;
}

.strength-text {
  margin: 6px 0 2px;
  font-size: 12px;
  color: var(--muted);
}

button {
  height: 48px;
  margin-top: 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--primary);
  color: var(--primary-contrast);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

button:hover {
  background: var(--primary-hover);
}

button.secondary {
  width: 100%;
  background: var(--secondary-bg);
  color: var(--text);
  border-color: var(--line);
}

button.secondary:hover {
  background: var(--secondary-hover);
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.link-btn {
  width: 100%;
  margin-top: 8px;
  height: 34px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  text-decoration: underline;
  font-weight: 700;
}

.link-btn:hover {
  color: var(--text);
  background: transparent;
}

.forgot-section {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}

.forgot-section button {
  width: 100%;
}

#result {
  margin: 12px 0 0;
  min-height: 46px;
  border-radius: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.4;
  padding: 12px;
}

#result:empty {
  min-height: 0;
  padding: 0;
}

#result.ok {
  background: var(--ok-bg);
  color: var(--ok-text);
}

#result.error {
  background: var(--error-bg);
  color: var(--error-text);
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .brand {
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding-bottom: 26px;
  }

  .card {
    padding-top: 26px;
  }
}

@media (max-width: 560px) {
  .theme-toggle {
    right: 10px;
    top: 10px;
  }

  .brand,
  .card {
    padding: 18px 16px 22px;
  }

  .brand h1 {
    font-size: 40px;
  }

  .card h2 {
    font-size: 30px;
  }
}

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