:root {
  --background: #fbfaff;
  --foreground: #10071a;
  --card: rgba(255, 255, 255, 0.95);
  --muted-foreground: #6e6485;
  --border: #dedbe6;
  --input: #d9d5e2;
  --primary: #8751ff;
  --primary-soft: rgba(135, 81, 255, 0.1);
  --error: #dc2626;
}

.dark {
  --background: #0d0915;
  --foreground: #f5f0ff;
  --card: rgba(20, 16, 29, 0.95);
  --muted-foreground: #a99dbe;
  --border: #2a2536;
  --input: #302a3d;
  --primary: #8751ff;
  --primary-soft: rgba(135, 81, 255, 0.12);
  --error: #fb7185;
}

* {
  box-sizing: border-box;
}

html {
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

body {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background: var(--background);
  color: var(--foreground);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 15% 15%, rgba(135, 81, 255, 0.13), transparent 35%),
    radial-gradient(circle at 85% 80%, rgba(135, 81, 255, 0.07), transparent 32%);
  pointer-events: none;
}

.header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand img {
  width: 40px;
  height: 40px;
  filter: drop-shadow(0 8px 16px rgba(135, 81, 255, 0.2));
}

.brand-copy {
  display: grid;
  line-height: 1.08;
}

.brand-copy strong {
  font-size: 15px;
  font-weight: 700;
}

.brand-copy span {
  margin-top: 3px;
  color: var(--muted-foreground);
  font-size: 12px;
  letter-spacing: 0.03em;
}

.theme-toggle,
.password-toggle {
  display: grid;
  padding: 0;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--foreground);
  cursor: pointer;
}

.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

.theme-toggle:hover {
  background: var(--primary-soft);
}

.theme-toggle svg,
.password-toggle svg,
.submit-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.dark .moon-icon,
html:not(.dark) .sun-icon {
  display: none;
}

main {
  display: grid;
  min-height: 100dvh;
  padding: 92px 16px 84px;
  place-items: center;
}

.login-card {
  width: min(100%, 448px);
  padding: 24px;
  border: 1px solid rgba(42, 37, 54, 0.72);
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(24px);
  animation: fade-in 350ms ease-out;
}

.lock-box {
  display: grid;
  width: 44px;
  height: 44px;
  margin-bottom: 18px;
  place-items: center;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
}

.lock-box svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 26px;
}

h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.help {
  display: grid;
  width: 17px;
  height: 17px;
  place-items: center;
  border: 1px solid var(--muted-foreground);
  border-radius: 50%;
  color: var(--muted-foreground);
  font-size: 11px;
  font-weight: 600;
}

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

label {
  margin-top: 3px;
  color: var(--foreground);
  font-weight: 450;
}

input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--input);
  border-radius: 10px;
  outline: none;
  background: transparent;
  color: var(--foreground);
  font: inherit;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 42px;
}

.password-toggle {
  position: absolute;
  top: 0;
  right: 0;
  width: 40px;
  height: 38px;
  color: var(--muted-foreground);
}

.form-error {
  margin: 2px 0 0;
  color: var(--error);
  font-size: 12px;
}

.submit-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 38px;
  margin-top: 14px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(90deg, #6040a5 0%, #4b327c 50%, #3d2964 100%);
  box-shadow: 0 10px 24px rgba(61, 41, 100, 0.25);
  color: #fff;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: filter 150ms ease, transform 150ms ease;
}

.submit-button:hover {
  filter: brightness(1.1);
}

.submit-button:active {
  filter: brightness(0.95);
  transform: scale(0.99);
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

footer {
  position: fixed;
  right: 20px;
  bottom: 18px;
  left: 20px;
  color: var(--muted-foreground);
  font-size: 12px;
  text-align: center;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 520px) {
  .header {
    padding: 18px 20px;
  }

  main {
    padding: 96px 16px 88px;
  }

  .login-card {
    padding: 24px;
  }

  input {
    height: 44px;
    font-size: 16px;
  }

  .password-toggle {
    height: 44px;
  }

  .submit-button {
    height: 44px;
    font-size: 15px;
  }
}

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