:root {
  --indigo: #6d6bf5;
  --indigo-dark: #5a58e0;
  --ink: #1e2233;
  --muted: #6b7280;
  --line: #e6e8f0;
  --red: #d93025;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", Roboto, sans-serif;
  background:
    radial-gradient(1000px 500px at 10% -10%, #dfe3ff 0%, transparent 60%),
    radial-gradient(800px 420px at 110% 10%, #d8f3ea 0%, transparent 55%),
    #f6f7fb;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 18px env(safe-area-inset-bottom);
}

.login-wrap { width: 100%; max-width: 400px; }

.login-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 30px 26px 24px;
  box-shadow: 0 20px 60px rgba(45, 52, 110, 0.12);
}

.logo { display: flex; justify-content: center; margin-bottom: 10px; }

.brand {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--indigo);
  margin-bottom: 18px;
}

h1 {
  margin: 0 0 6px;
  font-size: 24px;
  text-align: center;
  letter-spacing: -0.5px;
}

.sub {
  margin: 0 0 22px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 7px;
  letter-spacing: 0.5px;
}

.key-wrap { position: relative; }

#key {
  width: 100%;
  height: 50px;
  padding: 0 66px 0 15px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: #f8f9fd;
  font-size: 16px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

#key:focus {
  border-color: var(--indigo);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(109, 107, 245, 0.12);
}

.toggle {
  position: absolute;
  right: 6px;
  top: 6px;
  height: 38px;
  padding: 0 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--indigo);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.toggle:active { background: #eef0ff; }

.remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 2px 18px;
  font-size: 13px;
  color: var(--muted);
  user-select: none;
}

.remember input {
  width: 17px;
  height: 17px;
  accent-color: var(--indigo);
}

.submit {
  width: 100%;
  height: 50px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--indigo), #8b7bf7);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(109, 107, 245, 0.32);
  transition: transform 0.08s, opacity 0.15s;
}

.submit:active { transform: scale(0.985); }
.submit:disabled { opacity: 0.6; cursor: default; }

.error {
  min-height: 20px;
  margin-top: 12px;
  text-align: center;
  font-size: 13px;
  color: var(--red);
  line-height: 1.4;
}

.shake { animation: shake 0.32s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-4px); }
}

.hint {
  margin: 18px 0 0;
  text-align: center;
  font-size: 11.5px;
  color: #9aa1b2;
  line-height: 1.6;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e8eaf3;
    --muted: #9aa3b5;
    --line: #2c3145;
    color-scheme: dark;
  }
  body {
    background:
      radial-gradient(1000px 500px at 10% -10%, #232752 0%, transparent 60%),
      radial-gradient(800px 420px at 110% 10%, #123730 0%, transparent 55%),
      #12141f;
  }
  .login-card { background: #1b1e2d; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4); }
  #key { background: #12141f; border-color: var(--line); color: var(--ink); }
  #key:focus { background: #161a28; }
  .toggle:active { background: #23273a; }
}
