/* Coremail 风格登录页 — 与常见 XT 系列皮肤对齐 */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  color: #333;
  overscroll-behavior-y: none;
}

button,
input,
label {
  -webkit-tap-highlight-color: transparent;
}

.page {
  position: relative;
  display: flex;
  align-items: stretch;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: #2a4a68;
  background-image: url("https://images.unsplash.com/photo-1506905925346-21bda4d32df4?auto=format&fit=crop&w=2000&q=80");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  /* 与左侧 Coremail 顶栏首行对齐用 */
  --header-pad-top: 36px;
  --header-side-inset: 48px;
  /* 与 .login-wrap 左右 margin 一致，用于顶栏图标与「简体中文」右缘对齐 */
  --login-gutter-x: var(--header-side-inset);
  --brand-title-size: 28px;
  --brand-title-line-height: 1.2;
}

/* 左侧风景与品牌 */
.pane--visual {
  position: relative;
  flex: 1 1 58%;
  min-height: 420px;
  overflow: hidden;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-self: stretch;
}

.pane--visual > .brand-top,
.pane--visual > .brand-center,
.pane--visual > .brand-foot {
  position: relative;
  z-index: 1;
}

.brand-top {
  flex: 0 0 auto;
  padding: var(--header-pad-top) var(--header-side-inset) 0;
  font-size: var(--brand-title-size);
  font-weight: 300;
  letter-spacing: 0.02em;
  line-height: var(--brand-title-line-height);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.brand-center {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 24px;
  text-align: center;
}

.brand-center__logo {
  font-size: clamp(72px, 12vw, 120px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.04em;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

.brand-center__tagline {
  margin: 20px 0 0;
  font-size: 22px;
  font-weight: 400;
  letter-spacing: 0.35em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.brand-foot {
  flex: 0 0 auto;
  margin-top: auto;
  padding: 20px 48px 28px;
  font-size: 12px;
  opacity: 0.92;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  text-align: left;
}

/* 右侧登录区 */
.pane--login {
  position: relative;
  flex: 0 0 42%;
  max-width: 560px;
  min-width: 320px;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

@media (max-width: 900px) {
  .pane--login {
    min-width: 0;
  }
}

.pane--login__shade {
  position: absolute;
  inset: 0;
  z-index: 0;
  /* 半透明 + 背景模糊（需整页铺同一底图，见 .page） */
  background: rgba(12, 26, 44, 0.38);
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  pointer-events: none;
}

/* 与左上角「Coremail」同一水平线；右缘与 .login-wrap 内「简体中文」行右对齐（同列居中时的内容区右缘） */
.login-header-icons {
  position: absolute;
  top: var(--header-pad-top);
  right: calc((100% - min(400px, calc(100% - 2 * var(--login-gutter-x)))) / 2);
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: calc(var(--brand-title-size) * var(--brand-title-line-height));
  color: rgba(255, 255, 255, 0.92);
}

/* Language 行：仍在登录卡上方，位置与原先一致 */
.login-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 14px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.92);
}

.lang-select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: default;
  user-select: none;
}

.login-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  margin: auto var(--header-side-inset);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  padding: 48px 0;
}

.icon-btn {
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  cursor: default;
  opacity: 0.88;
  font-size: 14px;
}

.lang-select__label {
  opacity: 0.9;
}

.lang-select__value {
  font-weight: 500;
}

.lang-select__caret {
  font-size: 10px;
  opacity: 0.85;
  margin-left: 2px;
}

.login-card {
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  padding: 28px 32px 32px;
}

.login-card__title {
  margin: 0 0 24px;
  font-size: 18px;
  font-weight: 600;
  color: #222;
}

.form-error {
  margin: -8px 0 14px;
  font-size: 13px;
  color: #d4380d;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.field {
  position: relative;
  margin-bottom: 16px;
}

.field__icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  pointer-events: none;
}

.field__input {
  width: 100%;
  height: 42px;
  padding: 8px 12px 8px 40px;
  border: 1px solid #d9d9d9;
  border-radius: 2px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}

.field__input::placeholder {
  color: #bfbfbf;
}

@media (hover: hover) {
  .field__input:hover {
    border-color: #40a9ff;
  }
}

.field__input:focus {
  border-color: #1890ff;
  box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.15);
}

.remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 20px;
  font-size: 14px;
  color: #555;
  cursor: pointer;
  user-select: none;
}

.remember input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: #1890ff;
}

.btn-login {
  width: 100%;
  height: 42px;
  border: none;
  border-radius: 2px;
  background: #1890ff;
  color: #fff;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: 0.12em;
  transition: background 0.15s, box-shadow 0.15s;
}

@media (hover: hover) {
  .btn-login:hover {
    background: #40a9ff;
  }
}

.btn-login:active {
  background: #096dd9;
}

/* —— 平板 / 竖屏窄屏：上下分栏 —— */
@media (max-width: 900px) {
  .page {
    flex-direction: column;
    --header-pad-top: 20px;
    --header-side-inset: 24px;
    --login-gutter-x: 20px;
    --brand-title-size: 22px;
  }

  .pane--visual {
    flex: 0 0 220px;
    min-height: 220px;
    flex-direction: column;
  }

  .brand-center {
    display: none;
  }

  .brand-top {
    padding: var(--header-pad-top) var(--header-side-inset) 0;
    /* 兼容刘海屏 */
    padding-top: max(var(--header-pad-top), env(safe-area-inset-top));
    padding-left: max(var(--header-side-inset), env(safe-area-inset-left));
    padding-right: max(var(--header-side-inset), env(safe-area-inset-right));
    font-size: var(--brand-title-size);
  }

  .brand-foot {
    margin-top: auto;
    padding: 12px 24px 16px;
    padding-left: max(24px, env(safe-area-inset-left));
    padding-right: max(24px, env(safe-area-inset-right));
    font-size: 11px;
  }

  .pane--login {
    flex: 1;
    max-width: none;
  }

  .login-toolbar {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  }

  .login-header-icons {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  }

  .login-wrap {
    margin: 24px 20px 40px;
    margin-left: max(20px, env(safe-area-inset-left));
    margin-right: max(20px, env(safe-area-inset-right));
    margin-bottom: max(40px, env(safe-area-inset-bottom));
    padding: 0;
  }

  .pane--login__shade {
    background: rgba(18, 32, 52, 0.4);
    backdrop-filter: blur(12px) saturate(1.1);
    -webkit-backdrop-filter: blur(12px) saturate(1.1);
  }
}

/* —— 手机：进一步紧凑，并修正 iOS 输入框聚焦自动放大、增大点击区域 —— */
@media (max-width: 600px) {
  .page {
    --header-pad-top: 16px;
    --header-side-inset: 16px;
    --login-gutter-x: 16px;
    --brand-title-size: 20px;
  }

  .pane--visual {
    flex: 0 0 160px;
    min-height: 160px;
  }

  .brand-foot {
    padding: 10px 16px 14px;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    font-size: 10.5px;
    letter-spacing: 0;
  }

  .login-wrap {
    margin: 18px 16px 28px;
    margin-left: max(16px, env(safe-area-inset-left));
    margin-right: max(16px, env(safe-area-inset-right));
    margin-bottom: max(28px, env(safe-area-inset-bottom));
  }

  .login-card {
    padding: 22px 18px 22px;
    border-radius: 6px;
  }

  .login-card__title {
    margin: 0 0 18px;
    font-size: 17px;
  }

  .login-toolbar {
    font-size: 12.5px;
    margin-bottom: 10px;
  }

  .login-header-icons {
    gap: 14px;
  }

  /* 加大移动端可点区域 */
  .icon-btn {
    width: 28px;
    height: 28px;
    font-size: 16px;
  }

  /* iOS Safari 在 input 字号 < 16px 时聚焦会自动放大页面，这里设为 16px */
  .field__input {
    height: 44px;
    font-size: 16px;
    padding: 10px 12px 10px 40px;
    border-radius: 4px;
  }

  .field__icon svg {
    width: 20px;
    height: 20px;
  }

  .remember {
    margin: 6px 0 18px;
    font-size: 14px;
  }

  .remember input {
    width: 18px;
    height: 18px;
  }

  .btn-login {
    height: 46px;
    font-size: 16px;
    border-radius: 4px;
  }
}

/* —— 超小屏手机（如 iPhone SE 1 代）—— */
@media (max-width: 380px) {
  .page {
    --header-side-inset: 12px;
    --login-gutter-x: 12px;
  }

  .pane--visual {
    flex: 0 0 132px;
    min-height: 132px;
  }

  .brand-top {
    font-size: 18px;
  }

  .login-wrap {
    margin-left: max(12px, env(safe-area-inset-left));
    margin-right: max(12px, env(safe-area-inset-right));
  }

  .login-card {
    padding: 18px 14px 20px;
  }
}

/* —— 横屏手机：左右仍然展示风景，避免顶部条带过厚浪费空间 —— */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
  .page {
    flex-direction: row;
  }

  .pane--visual {
    flex: 1 1 50%;
    min-height: 0;
  }

  .brand-center {
    display: flex;
  }

  .brand-center__logo {
    font-size: clamp(48px, 10vw, 80px);
  }

  .brand-center__tagline {
    font-size: 15px;
    letter-spacing: 0.25em;
  }

  .pane--login {
    flex: 1 1 50%;
    max-width: 480px;
  }

  .login-wrap {
    margin: auto 24px;
    margin-left: max(24px, env(safe-area-inset-left));
    margin-right: max(24px, env(safe-area-inset-right));
    padding: 24px 0;
  }
}
