/* ==========================================================
   登录页 · 科幻版
   （加载在 style.css 之后，覆盖旧的登录样式）
   ========================================================== */

.login-body {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  overflow: hidden;
  background-color: #05070f;
  /* 背景图：火箭 / 发动机 / 高铁 主视觉（WebP 优先，JPEG 兜底） */
  background-image: url("img/login-bg-hd.jpg");
  background-image: image-set(
    url("img/login-bg-hd.webp") type("image/webp"),
    url("img/login-bg-hd.jpg") type("image/jpeg")
  );
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  /* 注意：这里不要用 background-attachment: fixed。
     Windows 开 125%/150% 缩放时，fixed 背景会按 CSS 像素栅格化，画面会发虚。 */
  color: #e6f0ff;
}

/* 右侧渐变压暗，保证登录卡片上的字看得清 */
.login-fx {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(
      90deg,
      rgba(3, 6, 14, 0.04) 0%,
      rgba(3, 6, 14, 0.10) 40%,
      rgba(3, 6, 14, 0.42) 68%,
      rgba(2, 5, 12, 0.66) 100%
    ),
    radial-gradient(circle at 50% 48%, transparent 60%, rgba(2, 5, 12, 0.3) 100%);
}

/* ---------- 登录卡片靠右（往左收一点） ---------- */

.login-shell {
  position: relative;
  z-index: 2;
  width: 100%;
  display: flex;
  justify-content: flex-end;
  padding: 0 clamp(28px, 12vw, 200px) 0 clamp(16px, 4vw, 60px);
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 430px;
  padding: 38px 38px 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: linear-gradient(160deg, rgba(16, 27, 52, 0.78), rgba(8, 14, 30, 0.86));
  border: 1px solid rgba(110, 170, 255, 0.22);
  border-radius: 22px;
  box-shadow:
    0 0 0 1px rgba(80, 140, 255, 0.08) inset,
    0 30px 80px -30px rgba(0, 0, 0, 0.9),
    0 0 60px -20px rgba(60, 130, 255, 0.45);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

/* 卡片四角的高亮装饰 */
.login-card::before,
.login-card::after {
  content: "";
  position: absolute;
  width: 26px;
  height: 26px;
  border: 2px solid rgba(90, 200, 255, 0.55);
  pointer-events: none;
}

.login-card::before {
  top: -1px;
  left: -1px;
  border-right: 0;
  border-bottom: 0;
  border-radius: 22px 0 0 0;
}

.login-card::after {
  right: -1px;
  bottom: -1px;
  border-left: 0;
  border-top: 0;
  border-radius: 0 0 22px 0;
}

/* ---------- 头像 ---------- */

.avatar-3d {
  position: relative;
  width: 146px;
  height: 146px;
  margin: 2px auto 18px;
  perspective: 700px;
}

/* 旋转的能量环 */
.avatar-3d::before {
  content: "";
  position: absolute;
  inset: -9px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    rgba(76, 201, 240, 0),
    rgba(76, 201, 240, 0.9),
    rgba(139, 92, 246, 0.9),
    rgba(76, 201, 240, 0)
  );
  filter: blur(7px);
  opacity: 0.85;
  animation: ringSpin 6s linear infinite;
}

.avatar-tilt {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.18s ease-out;
  will-change: transform;
}

.avatar-inner {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 2px solid rgba(120, 200, 255, 0.55);
  border-radius: 50%;
  background: #0b1428;
  box-shadow:
    0 0 24px rgba(76, 201, 240, 0.45),
    0 18px 40px -18px rgba(0, 0, 0, 0.9);
  animation: floaty 6.5s ease-in-out infinite;
}

.avatar-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* 新构图已经框好「脸 + 手 + 咖啡杯」，不再需要放大 */
  transform: none;
  transform-origin: 50% 50%;
}

.avatar-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    118deg,
    rgba(255, 255, 255, 0.35) 0%,
    rgba(255, 255, 255, 0.06) 24%,
    rgba(255, 255, 255, 0) 44%
  );
  pointer-events: none;
  animation: shineSweep 6s ease-in-out infinite;
}

/* ---------- 标题 ---------- */

.login-title {
  max-width: 100%;
  margin: 0;
  font-size: clamp(26px, 1.9vw + 12px, 38px);
  font-weight: 900;
  letter-spacing: 3px;
  line-height: 1.3;
  background: linear-gradient(180deg, #ffffff 0%, #cbe6ff 38%, #4cc9f0 72%, #2f6bff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter:
    drop-shadow(0 0 14px rgba(76, 201, 240, 0.55))
    drop-shadow(0 0 34px rgba(47, 107, 255, 0.35));
  animation: titlePulse 4.5s ease-in-out infinite;
}

/* 标题下方的一条科技感横线 */
.sci-rule {
  position: relative;
  width: 76%;
  height: 1px;
  margin: 14px auto 10px;
  background: linear-gradient(90deg, transparent, rgba(76, 201, 240, 0.85), transparent);
}

.sci-rule::after {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 34%;
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, transparent, #7ce7ff, transparent);
  animation: ruleSweep 3.6s ease-in-out infinite;
}

.login-subtitle {
  margin: 0 0 24px;
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 10.5px;
  letter-spacing: 4px;
  color: rgba(140, 190, 255, 0.62);
}

/* ---------- 表单 ---------- */

.login-form {
  width: 100%;
  text-align: left;
}

.login-card .field {
  display: block;
  margin-bottom: 14px;
}

.login-card .field-label {
  display: block;
  margin-bottom: 7px;
  font-size: 12.5px;
  letter-spacing: 1.5px;
  color: rgba(160, 195, 240, 0.8);
}

.login-card .field-input {
  width: 100%;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 15px;
  color: #eaf3ff;
  background: rgba(8, 18, 38, 0.75);
  border: 1px solid rgba(90, 150, 235, 0.25);
  border-radius: 11px;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.login-card .field-input::placeholder {
  color: rgba(150, 180, 220, 0.38);
}

.login-card .field-input:focus {
  outline: none;
  background: rgba(10, 22, 46, 0.9);
  border-color: rgba(76, 201, 240, 0.85);
  box-shadow: 0 0 0 3px rgba(76, 201, 240, 0.16), 0 0 22px -6px rgba(76, 201, 240, 0.7);
}

.login-card .toggle-password {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  padding: 6px 10px;
  font-family: inherit;
  font-size: 12px;
  color: rgba(150, 195, 240, 0.75);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.18s, background 0.18s;
}

.login-card .toggle-password:hover {
  color: #7ce7ff;
  background: rgba(76, 201, 240, 0.12);
}

.login-card .input-wrap {
  position: relative;
  display: block;
}

.login-card .field-input.has-toggle {
  padding-right: 64px;
}

/* 错误提示 */
.login-card .login-error {
  margin: 0 0 13px;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.5;
  color: #ffb4b4;
  background: rgba(120, 20, 30, 0.4);
  border: 1px solid rgba(255, 110, 110, 0.35);
  border-radius: 10px;
}

/* 登录按钮 */
.login-card .login-button {
  width: 100%;
  margin-top: 6px;
  padding: 13px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 4px;
  color: #04101f;
  background: linear-gradient(120deg, #6ee7ff, #4cc9f0 45%, #4f7cff);
  border: 0;
  border-radius: 11px;
  cursor: pointer;
  box-shadow:
    0 0 24px -6px rgba(76, 201, 240, 0.9),
    0 16px 32px -18px rgba(47, 107, 255, 0.9);
  transition: transform 0.12s, box-shadow 0.2s, filter 0.2s;
}

.login-card .login-button:hover {
  filter: brightness(1.08);
  box-shadow:
    0 0 34px -4px rgba(76, 201, 240, 1),
    0 18px 36px -16px rgba(47, 107, 255, 1);
}

.login-card .login-button:active {
  transform: translateY(1px);
}

.login-card .login-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.login-hint {
  margin: 18px 0 0;
  font-size: 12px;
  letter-spacing: 1px;
  color: rgba(150, 185, 230, 0.55);
}

/* ---------- 动画 ---------- */

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

@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes shineSweep {
  0%, 100% { transform: translateX(-40%); }
  50% { transform: translateX(40%); }
}

@keyframes titlePulse {
  0%, 100% {
    filter:
      drop-shadow(0 0 14px rgba(76, 201, 240, 0.5))
      drop-shadow(0 0 34px rgba(47, 107, 255, 0.3));
  }
  50% {
    filter:
      drop-shadow(0 0 22px rgba(76, 201, 240, 0.85))
      drop-shadow(0 0 52px rgba(47, 107, 255, 0.55));
  }
}

@keyframes ruleSweep {
  0% { transform: translateX(-30%); opacity: 0; }
  30% { opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translateX(240%); opacity: 0; }
}

@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

.login-card.is-shaking {
  animation: shake 0.4s ease-in-out;
}

/* ---------- 窄屏：卡片回到中间，背景整体压暗 ---------- */

@media (max-width: 900px) {
  .login-body {
    background-position: 58% center;
  }

  .login-shell {
    justify-content: center;
    padding: 0;
  }

  .login-fx {
    background: linear-gradient(
      180deg,
      rgba(2, 5, 12, 0.55) 0%,
      rgba(2, 5, 12, 0.66) 55%,
      rgba(2, 5, 12, 0.82) 100%
    );
  }
}

/* ---------- 窄屏 ---------- */

@media (max-width: 560px) {
  .login-body {
    padding: 16px 14px;
  }

  .login-card {
    padding: 28px 22px 24px;
    border-radius: 18px;
  }

  .avatar-3d {
    width: 104px;
    height: 104px;
    margin-bottom: 14px;
  }

  .login-title {
    letter-spacing: 1.5px;
  }

  .login-subtitle {
    letter-spacing: 2.5px;
    font-size: 9.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .avatar-3d::before,
  .avatar-inner,
  .avatar-shine,
  .login-title,
  .sci-rule::after {
    animation: none !important;
  }
}
