:root {
  --bg: #0e1a3e;
  --card: rgba(46, 62, 110, 0.55);
  --card-deep: rgba(14, 26, 62, 0.84);
  --text: #f4edff;
  --muted: #c3b5dd;
  --faint: #9384b3;
  --line: rgba(208, 168, 224, 0.22);
  --line-soft: rgba(208, 168, 224, 0.14);
  --accent: #9e7bbe;
  --accent-deep: #5e4e8e;
  --accent-glow: rgba(158, 123, 190, 0.38);
  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--sans);
  background:
    radial-gradient(ellipse 78% 58% at 50% -15%, #5e4e8e 0%, rgba(94, 78, 142, 0.58) 34%, transparent 70%),
    radial-gradient(ellipse 58% 50% at 106% 88%, #2e3e6e 0%, transparent 62%),
    radial-gradient(ellipse 52% 46% at -10% 100%, #1b2550 0%, transparent 58%),
    linear-gradient(180deg, #17244f 0%, #0e1a3e 52%, #080f27 100%);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input { font: inherit; }

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

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.grid {
  position: absolute;
  inset: -10%;
  background-image:
    linear-gradient(rgba(208, 168, 224, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(208, 168, 224, 0.06) 1px, transparent 1px);
  background-size: 92px 92px;
  transform: perspective(700px) rotateX(0.001deg);
  -webkit-mask-image: radial-gradient(ellipse 75% 65% at 50% 45%, #000 20%, transparent 78%);
  mask-image: radial-gradient(ellipse 75% 65% at 50% 45%, #000 20%, transparent 78%);
  opacity: 0.75;
}

.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(96px);
  opacity: 0.58;
  will-change: transform;
}

.glow-a {
  width: 680px;
  height: 520px;
  left: 50%;
  top: -190px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(158, 123, 190, 0.48), transparent 68%);
  animation: liquid-a 19s ease-in-out infinite alternate;
}

.glow-b {
  width: 560px;
  height: 560px;
  right: -230px;
  bottom: 2%;
  background: radial-gradient(circle, rgba(94, 78, 142, 0.46), transparent 68%);
  animation: liquid-b 24s ease-in-out infinite alternate;
}

.glow-c {
  width: 500px;
  height: 500px;
  left: -250px;
  top: 38%;
  background: radial-gradient(circle, rgba(93, 120, 190, 0.3), transparent 68%);
  animation: liquid-c 21s ease-in-out infinite alternate;
}

@keyframes liquid-a {
  from { transform: translate(-50%, 0) scale(1); opacity: 0.5; }
  to { transform: translate(-48%, 24px) scale(1.07); opacity: 0.68; }
}

@keyframes liquid-b {
  from { transform: translate(0, 0) scale(1); opacity: 0.48; }
  to { transform: translate(-26px, -22px) scale(1.08); opacity: 0.62; }
}

@keyframes liquid-c {
  from { transform: translate(0, 0) scale(1); opacity: 0.4; }
  to { transform: translate(22px, 18px) scale(1.1); opacity: 0.58; }
}

.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 15%, rgba(255, 255, 255, 0.038) 38%, transparent 56%);
  mix-blend-mode: screen;
  pointer-events: none;
}

.topbar {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 30px 34px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  border-radius: 16px;
}

.brand:focus-visible {
  outline: 2px solid rgba(208, 168, 224, 0.75);
  outline-offset: 6px;
}

.brand-mark {
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 17px;
  font-family: var(--serif);
  font-size: 29px;
  font-style: italic;
  color: #f1e6ff;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.04) 55%, rgba(255, 255, 255, 0.1)),
    linear-gradient(145deg, rgba(158, 123, 190, 0.48), rgba(46, 36, 80, 0.68));
  border: 1px solid rgba(255, 255, 255, 0.32);
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.3),
    inset 0 1px 1px rgba(255, 255, 255, 0.42);
  backdrop-filter: blur(18px) saturate(145%);
  -webkit-backdrop-filter: blur(18px) saturate(145%);
  text-shadow: 0 1px 12px rgba(208, 168, 224, 0.38);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.brand-text strong {
  font-family: var(--serif);
  font-size: 24px;
  font-style: italic;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
}

.brand-text small {
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--faint);
}

.env-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.025));
  color: #d6c8ed;
  font-size: 12.5px;
  letter-spacing: 0.08em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(18px) saturate(145%);
  -webkit-backdrop-filter: blur(18px) saturate(145%);
}

.env-pill i,
.card-pill i,
.note-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #d0a8e0;
  box-shadow: 0 0 0 4px rgba(208, 168, 224, 0.12), 0 0 14px rgba(208, 168, 224, 0.58);
}

.stage {
  position: relative;
  z-index: 1;
  min-height: calc(100vh - 92px);
  display: grid;
  place-items: center;
  padding: 58px 20px 52px;
}

.login-card {
  position: relative;
  width: min(480px, 100%);
  padding: 36px 38px 24px;
  border-radius: 34px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  background:
    radial-gradient(ellipse 125% 65% at 12% 0%, rgba(255, 255, 255, 0.2), transparent 58%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.13) 0%, rgba(255, 255, 255, 0.06) 30%, rgba(74, 59, 120, 0.24) 58%, rgba(14, 26, 62, 0.42) 100%);
  box-shadow:
    0 44px 100px rgba(0, 0, 0, 0.52),
    0 8px 28px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -1px 0 rgba(255, 255, 255, 0.08),
    inset 0 0 70px rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(46px) saturate(185%);
  -webkit-backdrop-filter: blur(46px) saturate(185%);
  animation: card-in 680ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.1) 24%, rgba(255, 255, 255, 0.025) 55%, rgba(208, 168, 224, 0.3) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 34px;
}

.card-logo {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  border-radius: 23px;
  font-family: var(--serif);
  font-size: 34px;
  font-style: italic;
  color: #f5ebff;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.05) 52%, rgba(255, 255, 255, 0.12)),
    radial-gradient(circle at 28% 18%, rgba(208, 168, 224, 0.52), transparent 58%),
    linear-gradient(145deg, rgba(126, 102, 168, 0.62), rgba(38, 32, 72, 0.72));
  border: 1px solid rgba(255, 255, 255, 0.36);
  box-shadow:
    0 14px 30px rgba(0, 0, 0, 0.28),
    inset 0 1px 1px rgba(255, 255, 255, 0.5),
    inset 0 -10px 22px rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  text-shadow: 0 2px 14px rgba(208, 168, 224, 0.38);
}

.card-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.19);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.04));
  color: #e0d2f4;
  font-size: 12.5px;
  letter-spacing: 0.05em;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
}

h1 {
  margin: 0;
  font-family: var(--sans);
  font-size: clamp(38px, 6vw, 44px);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.12;
  color: #f6efff;
  text-shadow: 0 2px 26px rgba(208, 168, 224, 0.16);
}

.subtitle {
  margin: 12px 0 0;
  color: #c5b6dd;
  font-size: 15.5px;
  letter-spacing: 0.02em;
}

#login-form {
  margin-top: 28px;
}

.field {
  position: relative;
  display: block;
  margin-bottom: 14px;
}

.field input {
  width: 100%;
  height: 58px;
  padding: 0 52px;
  color: var(--text);
  font-size: 15.5px;
  letter-spacing: 0.01em;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.035));
  outline: none;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    0 1px 2px rgba(0, 0, 0, 0.14);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}

.field input::placeholder {
  color: #b5a6ce;
  opacity: 0.92;
}

.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px #1a2852 inset;
  transition: background-color 9999s ease-out 0s;
}

.field:focus-within input {
  border-color: rgba(208, 168, 224, 0.7);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.06));
  box-shadow:
    0 0 0 4px rgba(158, 123, 190, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.field-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  width: 22px;
  height: 22px;
  transform: translateY(-50%);
  color: #bbaad4;
  pointer-events: none;
  opacity: 0.86;
}

.field-icon svg,
.eye svg {
  display: block;
  width: 100%;
  height: 100%;
}

.eye {
  position: absolute;
  right: 10px;
  top: 50%;
  width: 38px;
  height: 38px;
  padding: 8px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #b4a2cf;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, transform 120ms ease;
}

.eye .eye-closed {
  display: none;
}

.eye.is-visible {
  color: #ecdfff;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.eye.is-visible .eye-open {
  display: none;
}

.eye.is-visible .eye-closed {
  display: block;
}

.eye:active {
  transform: translateY(-50%) scale(0.9);
}

.eye:hover,
.eye:focus-visible {
  color: #eee2ff;
  background: rgba(208, 168, 224, 0.12);
}

.eye:focus-visible {
  outline: 2px solid rgba(208, 168, 224, 0.65);
  outline-offset: 1px;
}

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 2px 22px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #cfc0e6;
  font-size: 13.5px;
  cursor: pointer;
  user-select: none;
}

.check input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.check .box {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.07);
  position: relative;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.check input:checked + .box {
  border-color: rgba(208, 168, 224, 0.85);
  background: linear-gradient(145deg, #9e7bbe, #5e4e8e);
  box-shadow:
    0 4px 12px rgba(158, 123, 190, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.check input:checked + .box::after {
  content: "";
  position: absolute;
  left: 5.5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: solid #f8f1ff;
  border-width: 0 2px 2px 0;
  transform: rotate(42deg);
}

.check input:focus-visible + .box {
  outline: 2px solid rgba(208, 168, 224, 0.7);
  outline-offset: 2px;
}

.text-btn {
  padding: 0;
  border: 0;
  background: none;
  color: #b9a8d2;
  font-size: 13px;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: color 160ms ease;
}

.text-btn:hover,
.text-btn:focus-visible {
  color: #eadcff;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.text-btn:focus-visible {
  outline: 2px solid rgba(208, 168, 224, 0.6);
  outline-offset: 4px;
  border-radius: 4px;
}

.submit {
  position: relative;
  width: 100%;
  height: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 18px;
  color: #fbf7ff;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.09em;
  cursor: pointer;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(255, 255, 255, 0.42), transparent 46%),
    linear-gradient(180deg, #a98bcf 0%, #8064ad 42%, #5e4e8e 100%);
  box-shadow:
    0 16px 36px rgba(94, 78, 142, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    inset 0 -1px 0 rgba(37, 30, 68, 0.35);
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.submit::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 17px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 32%);
  opacity: 0.7;
  pointer-events: none;
}

.submit:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow:
    0 21px 42px rgba(94, 78, 142, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.56),
    inset 0 -1px 0 rgba(37, 30, 68, 0.35);
}

.submit:active {
  transform: translateY(0) scale(0.995);
}

.submit:focus-visible {
  outline: 2px solid #eadcff;
  outline-offset: 3px;
}

.submit-arrow {
  font-size: 21px;
  font-weight: 400;
  line-height: 1;
  transform: translateY(-1px);
}

.spinner {
  display: none;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 244, 235, 0.35);
  border-top-color: #f8f1ff;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.submit.is-loading {
  pointer-events: none;
  filter: saturate(0.85) brightness(0.95);
}

.submit.is-loading .submit-label,
.submit.is-loading .submit-arrow {
  opacity: 0.55;
}

.submit.is-loading .spinner {
  display: block;
  position: absolute;
  right: 20px;
}

.error {
  min-height: 20px;
  margin: 12px 2px 0;
  color: #ffb7c8;
  font-size: 13px;
  line-height: 1.5;
  letter-spacing: 0.01em;
}

.error:empty {
  min-height: 0;
  margin-top: 0;
}

.account-note {
  margin-top: 22px;
  padding: 16px 17px 15px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.025));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  transition: border-color 220ms ease, background 220ms ease, box-shadow 220ms ease;
}

.account-note.is-highlighted {
  border-color: rgba(208, 168, 224, 0.5);
  background: linear-gradient(145deg, rgba(158, 123, 190, 0.16), rgba(255, 255, 255, 0.04));
  box-shadow:
    0 0 0 4px rgba(158, 123, 190, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.note-title {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #ded0f2;
  font-size: 13px;
  letter-spacing: 0.06em;
}

.account-note p {
  margin: 9px 0 0;
  color: #b7a7ce;
  font-size: 12.5px;
  line-height: 1.8;
}

.card-footer {
  margin-top: 22px;
  padding-top: 15px;
  border-top: 1px solid rgba(208, 168, 224, 0.14);
  text-align: center;
  color: #8f7fae;
  font-size: 11.5px;
  letter-spacing: 0.13em;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  z-index: 10;
  transform: translate(-50%, 14px);
  max-width: calc(100vw - 40px);
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid rgba(208, 168, 224, 0.2);
  background: rgba(20, 29, 62, 0.94);
  color: #ded0f2;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

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

@keyframes card-in {
  from { opacity: 0; transform: translateY(18px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

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

@media (max-width: 560px) {
  .topbar {
    padding: 20px 20px 0;
    align-items: flex-start;
  }

  .brand { gap: 11px; }
  .brand-mark { width: 46px; height: 46px; border-radius: 14px; font-size: 25px; }
  .brand-text strong { font-size: 21px; }
  .brand-text small { font-size: 10.5px; letter-spacing: 0.11em; }

  .env-pill {
    padding: 8px 11px;
    font-size: 10.5px;
    letter-spacing: 0.05em;
  }

  .stage {
    min-height: calc(100vh - 80px);
    padding: 36px 14px 40px;
  }

  .login-card {
    padding: 28px 22px 20px;
    border-radius: 25px;
  }

  .card-head { margin-bottom: 26px; }
  .card-logo { width: 58px; height: 58px; border-radius: 19px; font-size: 29px; }
  .card-pill { padding: 8px 11px; font-size: 11px; }
  h1 { font-size: 36px; }
  .subtitle { font-size: 14px; }
  #login-form { margin-top: 24px; }
  .field input { height: 55px; border-radius: 14px; padding: 0 48px; font-size: 15px; }
  .field-icon { left: 16px; width: 20px; height: 20px; }
  .form-row { margin: 16px 1px 19px; }
  .submit { height: 55px; border-radius: 14px; font-size: 16px; }
  .account-note { margin-top: 18px; padding: 14px 15px; }
  .card-footer { margin-top: 19px; font-size: 10.5px; letter-spacing: 0.1em; }
}

@media (max-width: 370px) {
  .env-pill { display: none; }
  .login-card { padding: 24px 18px 18px; }
  h1 { font-size: 32px; }
  .form-row { align-items: flex-start; flex-direction: column; gap: 10px; }
}

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