/* ─── 贪婪运营后台 · 登录页（移动端 App 风格） ─────────────── */
:root {
  --bg:      #f1f2f5;
  --surface: #ffffff;
  --fg:      #101828;
  --fg-2:    #475467;
  --muted:   #98a2b3;
  --border:  #eef0f3;
  --accent:  #2563eb;
  --accent-deep: #1d4ed8;
  --accent-soft: #eaf1ff;

  --err:        #dc2626;
  --err-soft:   #fef2f2;
  --err-border: #fecaca;

  --font-body: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'PingFang SC',
               'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'PingFang SC',
                  'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ─── 背景图（登录页·樱花） ───────────────────────────── */
/* 手机竖屏：取中下部，人物额头+眼睛露在卡片上方，头顶不被切 */
body.login-body {
  background: #d4a2bd url("../img/login-bg.jpg") center bottom / auto 117% no-repeat;
}

/* 宽屏：铺满，人物头部完整可见、樱花占满两侧 */
@media (min-width: 900px) {
  body.login-body {
    background-size: cover;
    background-position: center 24%;
  }
}

/* 手机横屏：竖幅图按高度放大不够宽，改铺满 */
@media (max-width: 899px) and (orientation: landscape) {
  body.login-body {
    background-size: cover;
    background-position: center 30%;
  }
}

/* 窄屏：卡片垂直+水平居中（正中间）；内容超高时 margin:auto 保证顶部也滚得到 */
@media (max-width: 899px) {
  body.login-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 22px 16px max(22px, env(safe-area-inset-bottom));
  }
  .login-wrap { margin: auto; }
}

.login-wrap {
  width: min(400px, 100%);
}

/* 白色卡片，与后台内容卡同款 */
.login-card {
  background: var(--surface);
  border: 0;
  border-radius: 22px;
  padding: 32px 24px 26px;
  box-shadow: 0 2px 6px rgba(16, 24, 40, .08), 0 26px 56px -26px rgba(16, 24, 40, .5);
}

/* ─── 品牌区（头像 + 名称，来自 txt 文件） ─────────────── */
.brand { text-align: center; }

.avatar {
  width: 76px;
  height: 76px;
  border-radius: 50%;            /* 一比一圆形头像 */
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center;
  margin-inline: auto;
  border: 0;
  box-shadow: 0 12px 26px -14px rgba(16, 24, 40, .45);
}

.avatar-fallback {
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, #3b82f6, #1d4ed8);
  color: #fff;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  box-shadow: 0 12px 26px -14px rgba(37, 99, 235, .8);
}

.title {
  margin: 16px 0 24px;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -.2px;
  color: var(--fg);
}

/* ─── 弹窗（Toast） ────────────────────────────────────── */
.toast-region {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  left: 50%;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(420px, calc(100vw - 48px));
  padding: 12px 18px;
  font-size: 13.5px;
  color: var(--fg);
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  backdrop-filter: blur(14px) saturate(180%);
  border-radius: 14px;
  box-shadow: 0 10px 32px rgba(16, 24, 40, .16), 0 2px 6px rgba(16, 24, 40, .06);
  animation: toast-in 320ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
  pointer-events: auto;
}

.toast::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
}

.toast--error::before { background: #ef4444; }

.toast.is-leaving { animation: toast-out 280ms cubic-bezier(0.4, 0, 0.2, 1) both; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-16px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(-10px) scale(0.97); }
}

/* 登录失败：卡片震动 */
.login-card.is-shaking {
  animation: card-shake 480ms cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
@keyframes card-shake {
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

/* ─── 表单 ─────────────────────────────────────────────── */
.login-form { display: flex; flex-direction: column; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

/* 输入框：浅灰底 + 椭圆（胶囊）形，字号 16px 防 iOS 自动放大 */
.input {
  width: 100%;
  padding: 13px 22px;
  min-height: 50px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 16px;
  outline: none;
  transition: border-color .14s ease, background .14s ease, box-shadow .14s ease;
}

.input::placeholder { color: var(--muted); }

.input:focus {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.input, .btn-submit { touch-action: manipulation; }

.btn-submit {
  margin-top: 8px;
  padding: 0 22px;
  min-height: 52px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(150deg, #3b82f6, var(--accent-deep));
  color: #ffffff;
  font: inherit;
  font-family: var(--font-display);
  font-size: 15.5px;
  font-weight: 650;
  letter-spacing: .02em;
  cursor: pointer;
  box-shadow: 0 12px 26px -14px rgba(37, 99, 235, .9);
  transition: transform .1s ease, filter .14s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn-submit:hover { filter: brightness(1.06); }
.btn-submit:active { transform: scale(.985); }
.btn-submit:disabled { opacity: .6; cursor: not-allowed; }

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

/* 矮屏（小屏手机 / 横屏）：卡片收紧，别挤成一团 */
@media (max-height: 720px) {
  .login-card { padding: 22px 20px 20px; border-radius: 20px; }
  .avatar { width: 62px; height: 62px; border-radius: 50%; }
  .title { margin: 12px 0 18px; font-size: 19px; }
  .input { min-height: 46px; padding: 11px 20px; }
  .btn-submit { min-height: 48px; }
}
