:root {
  --sider: #304156;
  --sider-deep: #243447;
  --primary: #409eff;
  --text: #303133;
  --muted: #909399;
  --border: #e4e7ed;
  --danger: #f56c6c;
  --sheet: #fff;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body {
  height: 100%;
  margin: 0;
  -webkit-tap-highlight-color: transparent;
}
body {
  font-family: "PingFang SC", "Helvetica Neue", Helvetica, "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--sider);
  min-height: 100%;
  min-height: 100dvh;
}

.login-page {
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

/* 上半品牌区：手机首屏视觉重心 */
.login-hero {
  flex: 0 0 auto;
  padding: 48px 24px 36px;
  text-align: center;
  color: #fff;
  background:
    radial-gradient(ellipse 120% 80% at 50% 0%, #3d536c 0%, transparent 70%),
    linear-gradient(180deg, #304156 0%, var(--sider-deep) 100%);
  animation: fade-in 0.4s ease both;
}
.brand-icon {
  display: inline-block;
  font-size: 42px;
  line-height: 1;
  margin-bottom: 14px;
  animation: bob 2.6s ease-in-out infinite;
}
.login-hero h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 650;
  letter-spacing: 0.08em;
}
.login-hero p {
  margin: 10px 0 0;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.72);
}

/* 下半表单：贴底全宽白底，手机原生感 */
.login-sheet {
  flex: 1 1 auto;
  background: var(--sheet);
  border-radius: 20px 20px 0 0;
  padding: 28px 20px 24px;
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.12);
  animation: sheet-up 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes sheet-up {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
  font-size: 13px;
  color: var(--muted);
}
.field input {
  width: 100%;
  height: 50px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0 14px;
  font-size: 16px; /* 避免 iOS 自动放大 */
  color: var(--text);
  background: #f7f8fa;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.field input:focus {
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.18);
}

.pwd-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.pwd-wrap input {
  padding-right: 64px;
}
.pwd-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  height: 38px;
  min-width: 52px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.pwd-toggle:active { opacity: 0.65; }

.msg {
  margin: -6px 0 14px;
  font-size: 13px;
  color: var(--danger);
  line-height: 1.4;
}
.msg[hidden] { display: none !important; }

.btn-login {
  width: 100%;
  height: 50px;
  margin-top: 4px;
  border: 0;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.2em;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.12s;
  -webkit-appearance: none;
}
.btn-login:active { transform: scale(0.985); opacity: 0.92; }
.btn-login:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}
.btn-login.busy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: 0.06em;
}
.btn-spin {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 平板/桌面：仍以手机版式居中，不改成左右分栏 */
@media (min-width: 480px) {
  .login-page {
    max-width: 420px;
    margin: 0 auto;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.06);
  }
  .login-hero { padding: 56px 28px 40px; }
  .login-sheet { padding: 32px 28px 28px; }
}

@media (min-width: 900px) {
  body {
    display: flex;
    align-items: stretch;
    justify-content: center;
    background:
      radial-gradient(900px 500px at 20% 0%, #3a5169 0%, transparent 55%),
      linear-gradient(160deg, #1a2430 0%, #243447 100%);
  }
  .login-page {
    margin: 0;
    min-height: 100dvh;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  }
}
