/* ==========================================================================
   创金A · 登录 / 注册 v20
   PC：左侧墨金品牌封面 + 右侧冷白表单
   移动：深色品牌顶栏 + 单列表单，注册分两步
   ========================================================================== */

body[data-page="login"] {
  background: var(--bg);
}

body[data-page="login"] .app {
  min-height: 100dvh;
}

.auth-page {
  --auth-red: #c8102e;
  --auth-red-deep: #a80d26;
  --auth-red-text: #b01028;
  --auth-focus: rgba(200, 16, 46, 0.16);
  --auth-gold: #e8b45c;
  --auth-brand-bg: #090c12;
  --auth-pane-bg: #f7f8fa;
  --auth-text: #0b1220;
  --auth-muted: #5f6b7a;
  --auth-faint: #6f7a8a;
  --auth-border: #e2e6ec;
  --auth-border-strong: #cbd3de;
  --auth-input-bg: #ffffff;
  --auth-sunken: #eceef2;
  --auth-tab-active: #ffffff;
  --auth-brand-text: #edf2f9;
  --auth-brand-muted: #98a3b4;
  --auth-brand-line: rgba(255, 255, 255, 0.09);
  --auth-glow: rgba(200, 16, 46, 0.04);

  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: 100dvh;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--auth-text);
}

:root[data-theme="dark"] .auth-page {
  --auth-red: #d92d3c;
  --auth-red-deep: #ef4755;
  --auth-red-text: #ff8a94;
  --auth-focus: rgba(217, 45, 60, 0.24);
  --auth-gold: #e8b45c;
  --auth-brand-bg: #090c12;
  --auth-pane-bg: #0c1016;
  --auth-text: #eef2f8;
  --auth-muted: #8a95a6;
  --auth-faint: #7c8797;
  --auth-border: #202835;
  --auth-border-strong: #334052;
  --auth-input-bg: #10151d;
  --auth-sunken: #141a23;
  --auth-tab-active: #1a2230;
  --auth-brand-text: #edf2f9;
  --auth-brand-muted: #98a3b4;
  --auth-brand-line: rgba(255, 255, 255, 0.09);
  --auth-glow: rgba(217, 45, 60, 0.05);
}

/* ---------- 左侧：墨金品牌封面 ---------- */
.auth-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  padding: clamp(26px, 3.4vw, 48px) clamp(28px, 4vw, 56px) 24px;
  background:
    radial-gradient(120% 90% at 82% -10%, rgba(232, 180, 92, 0.2), transparent 55%),
    radial-gradient(90% 80% at -10% 110%, rgba(200, 16, 46, 0.22), transparent 60%),
    var(--auth-brand-bg);
  color: var(--auth-brand-text);
}

.auth-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(232, 240, 255, 0.055) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(232, 240, 255, 0.055) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 82%);
  mask-image: linear-gradient(180deg, #000 0%, transparent 82%);
  pointer-events: none;
}

.auth-brand > * {
  position: relative;
  z-index: 1;
}

.auth-brand-top {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.auth-logo {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid rgba(232, 180, 92, 0.42);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
}

.auth-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.auth-brand-name {
  color: var(--auth-brand-text);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.auth-brand-chip {
  padding: 3px 7px;
  border: 1px solid var(--auth-brand-line);
  border-radius: 3px;
  color: var(--auth-brand-muted);
  font-size: 10px;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.auth-brand .theme-toggle {
  margin-left: auto;
  flex: 0 0 auto;
  border-color: rgba(232, 240, 255, 0.2);
  background: rgba(232, 240, 255, 0.06);
  color: rgba(232, 240, 255, 0.72);
}

.auth-brand .theme-toggle:hover {
  border-color: rgba(232, 240, 255, 0.36);
  background: rgba(232, 240, 255, 0.12);
  color: #fff8ee;
}

.auth-brand .theme-toggle:focus-visible {
  outline-color: var(--auth-gold);
}

.auth-brand-main {
  margin: auto 0;
  padding: 42px 0 34px;
  min-width: 0;
}

.auth-brand-main h1 {
  margin: 0;
  color: var(--auth-brand-text);
  font-size: clamp(34px, 3.6vw, 48px);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.035em;
}

.auth-brand-main h1 em {
  font-style: normal;
  color: var(--auth-gold);
}

.auth-visual {
  width: 100%;
  max-width: 540px;
  margin-top: 26px;
}

.auth-visual svg {
  display: block;
  width: 100%;
  height: 150px;
  overflow: visible;
}

.auth-brand-foot {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--auth-brand-line);
  color: var(--auth-brand-muted);
  font-size: 10px;
  letter-spacing: 0.04em;
}

/* ---------- 右侧：香槟金表单 ---------- */
.auth-pane {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(90% 55% at 100% 0%, var(--auth-glow), transparent 60%),
    var(--auth-pane-bg);
}

.auth-pane::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 2;
  width: 1px;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(232, 180, 92, 0.48) 24%,
    rgba(232, 180, 92, 0.16) 68%,
    transparent 100%
  );
  pointer-events: none;
}

.auth-scroll {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: safe center;
  justify-content: center;
  overflow-y: auto;
  padding: 40px clamp(28px, 5vw, 72px);
}

.auth-box {
  width: 100%;
  max-width: 380px;
}

.auth-title {
  margin: 0;
  color: var(--auth-text);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.auth-sub {
  margin: 8px 0 0;
  color: var(--auth-muted);
  font-size: 12.5px;
  line-height: 1.6;
}

/* 登录 / 注册切换 */
.auth-tabs {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  height: 44px;
  margin-top: 26px;
  padding: 3px;
  border: 1px solid var(--auth-border);
  border-radius: 8px;
  background: var(--auth-sunken);
}

.auth-tabs-thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc(50% - 4px);
  border: 1px solid var(--auth-border);
  border-radius: 6px;
  background: var(--auth-tab-active);
  box-shadow: 0 1px 3px rgba(60, 35, 20, 0.1);
  transition: transform 0.24s cubic-bezier(0.2, 0, 0, 1);
}

.auth-tabs-thumb[data-mode="register"] {
  transform: translateX(calc(100% + 2px));
}

.auth-tab {
  position: relative;
  z-index: 1;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--auth-muted);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.16s;
}

.auth-tab:hover {
  color: var(--auth-text);
}

.auth-tab.is-on {
  color: var(--auth-red-text);
  font-weight: 650;
}

.auth-tab:disabled {
  cursor: default;
  opacity: 0.6;
}

.auth-panel {
  margin-top: 20px;
  animation: auth-panel-in 0.24s cubic-bezier(0.2, 0, 0, 1) both;
}

/* 表单字段 */
.auth-form {
  display: flex;
  flex-direction: column;
}

.auth-field {
  margin-bottom: 15px;
}

.auth-field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  min-height: 16px;
  margin-bottom: 7px;
}

.auth-field-head label {
  color: var(--auth-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.auth-inp {
  display: flex;
  align-items: center;
  height: 48px;
  border: 1px solid var(--auth-border-strong);
  border-radius: 8px;
  background: var(--auth-input-bg);
  transition: border-color 0.16s, box-shadow 0.16s;
}

.auth-inp:hover {
  border-color: color-mix(in srgb, var(--auth-border-strong) 72%, var(--auth-muted));
}

.auth-inp:focus-within {
  border-color: var(--auth-red);
  box-shadow: 0 0 0 3px var(--auth-focus);
}

.auth-inp.bad {
  border-color: var(--danger);
}

.auth-prefix {
  display: flex;
  align-items: center;
  height: 18px;
  padding: 0 11px 0 13px;
  border-right: 1px solid var(--auth-border);
  color: var(--auth-muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
  white-space: nowrap;
}

.auth-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 13px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--auth-text);
  font-size: 14px;
  letter-spacing: 0.01em;
}

.auth-input::placeholder {
  color: var(--auth-faint);
  letter-spacing: 0;
}

/* 输入框自身的 :focus-visible 会叠出第二圈；外层 .auth-inp 已负责焦点环 */
.auth-page .auth-input:focus,
.auth-page .auth-input:focus-visible {
  outline: 0 !important;
}

.auth-page .auth-eye:focus-visible,
.auth-page .auth-back-step:focus-visible,
.auth-page .auth-change-phone:focus-visible,
.auth-page .auth-tab:focus-visible,
.auth-page .auth-submit:focus-visible,
.auth-page .auth-check input:focus-visible {
  outline: 2px solid var(--auth-red);
  outline-offset: 2px;
}

.auth-eye {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  margin-right: 4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--auth-faint);
  cursor: pointer;
}

.auth-eye:hover {
  background: var(--auth-sunken);
  color: var(--auth-text);
}

.auth-field-error {
  margin: 5px 0 0;
  color: var(--danger);
  font-size: 10.5px;
  line-height: 1.45;
}

.auth-banner {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-bottom: 14px;
  padding: 9px 11px;
  border: 1px solid color-mix(in srgb, var(--danger) 22%, transparent);
  border-left: 2px solid var(--danger);
  border-radius: 6px;
  background: color-mix(in srgb, var(--danger) 6%, transparent);
  color: var(--auth-red-text);
  font-size: 11.5px;
  line-height: 1.55;
}

.auth-banner-icon {
  display: inline-flex;
  flex: 0 0 auto;
  margin-top: 1px;
}

.auth-banner[hidden],
.auth-field-error[hidden],
.auth-back-step[hidden],
.auth-panel[hidden] {
  display: none !important;
}

.auth-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 18px;
  color: var(--auth-muted);
  font-size: 11.5px;
  cursor: pointer;
  user-select: none;
}

.auth-check input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--auth-red);
  cursor: pointer;
}

.auth-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 48px;
  border: 0;
  border-radius: 8px;
  background: var(--auth-red);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  box-shadow: 0 12px 24px -16px color-mix(in srgb, var(--auth-red) 75%, transparent);
  transition: background 0.16s, transform 0.08s, opacity 0.16s;
}

.auth-submit:hover:not(:disabled) {
  background: var(--auth-red-deep);
}

.auth-submit:active:not(:disabled) {
  transform: translateY(1px);
}

.auth-submit:disabled {
  cursor: default;
  opacity: 0.65;
}

.auth-submit:focus-visible {
  outline: 2px solid var(--auth-red);
  outline-offset: 3px;
}

.auth-submit-arrow {
  position: absolute;
  right: 16px;
  display: inline-flex;
}

.auth-submit {
  position: relative;
  padding: 0 38px;
}

.auth-submit.is-busy .auth-submit-arrow {
  display: none;
}

.auth-legal {
  margin: 16px 0 0;
  color: var(--auth-faint);
  font-size: 10px;
  line-height: 1.7;
  text-align: center;
}

.auth-pane-foot {
  position: relative;
  z-index: 1;
  margin: 0 clamp(28px, 5vw, 72px) 18px;
  padding-top: 12px;
  border-top: 1px solid var(--auth-border);
  color: var(--auth-faint);
  font-size: 9.5px;
}

.auth-pane-foot span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* 注册分步：默认（PC）全部显示，移动端按 data-step 切换 */
.auth-step-head,
.auth-step-bar {
  display: none;
}

.auth-step-count {
  color: var(--auth-faint);
  font-size: 9.5px;
  letter-spacing: 0.06em;
}

.auth-back-step,
.auth-change-phone {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--auth-muted);
  font-size: 11px;
  cursor: pointer;
}

.auth-back-step:hover,
.auth-change-phone:hover {
  color: var(--auth-red-text);
}

.auth-phone-summary {
  display: none;
  align-items: center;
  gap: 9px;
  padding: 11px 13px;
  margin-bottom: 15px;
  border: 1px solid var(--auth-border);
  border-radius: 8px;
  background: var(--auth-input-bg);
}

.auth-phone-label {
  color: var(--auth-faint);
  font-size: 10px;
}

.auth-phone-summary b {
  color: var(--auth-text);
  font-size: 12.5px;
  font-weight: 500;
}

.auth-phone-summary .auth-change-phone {
  margin-left: auto;
  color: var(--auth-red-text);
}

/* ---------- PC 分栏 ---------- */
@media (min-width: 901px) {
  .auth-brand-main {
    padding: 0;
  }
}

/* ---------- 移动端：深色顶栏 + 单列表单 ---------- */
@media (max-width: 900px) {
  .auth-page {
    display: block;
    height: auto;
    min-height: 100dvh;
    overflow: visible;
    background: var(--bg);
  }

  .auth-brand {
    position: sticky;
    top: 0;
    z-index: 20;
    display: block;
    min-height: calc(54px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 18px 0;
    background:
      radial-gradient(80% 180% at 88% -60%, rgba(232, 180, 92, 0.16), transparent 60%),
      var(--auth-brand-bg);
    overflow: hidden;
  }

  .auth-brand::before {
    display: none;
  }

  .auth-brand-top {
    height: 54px;
    gap: 9px;
  }

  .auth-logo {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.24);
  }

  .auth-brand-name {
    font-size: 14.5px;
    letter-spacing: 0.01em;
  }

  .auth-brand-chip {
    padding: 2px 5px;
    font-size: 8px;
  }

  .auth-brand-main,
  .auth-brand-foot {
    display: none;
  }

  .auth-pane {
    height: auto;
    min-height: calc(100dvh - 54px - env(safe-area-inset-top));
    overflow: visible;
    background: var(--auth-pane-bg);
  }

  .auth-pane::before {
    display: none;
  }

  .auth-scroll {
    display: block;
    overflow: visible;
    padding: 28px 20px calc(40px + env(safe-area-inset-bottom));
  }

  .auth-box {
    max-width: 460px;
    margin: 0 auto;
  }

  .auth-title {
    font-size: 27px;
  }

  .auth-sub {
    margin-top: 7px;
    font-size: 12px;
  }

  .auth-tabs {
    height: 43px;
    margin-top: 18px;
    padding: 0;
    border: 0;
    border-bottom: 1px solid var(--auth-border);
    border-radius: 0;
    background: transparent;
  }

  .auth-tabs-thumb {
    display: none;
  }

  .auth-tab {
    border-radius: 0;
    font-size: 13px;
  }

  .auth-tab.is-on::after {
    content: "";
    position: absolute;
    right: 25%;
    bottom: -1px;
    left: 25%;
    height: 2px;
    border-radius: 2px;
    background: var(--auth-red);
  }

  .auth-panel {
    margin-top: 18px;
  }

  .auth-field {
    margin-bottom: 15px;
  }

  .auth-inp {
    height: 52px;
    border-radius: 9px;
  }

  .auth-input {
    padding: 0 14px;
    font-size: 16px;
  }

  .auth-prefix {
    height: 19px;
    padding: 0 12px 0 14px;
    font-size: 12px;
  }

  .auth-eye {
    width: 42px;
    height: 42px;
  }

  .auth-field-error {
    font-size: 10.5px;
  }

  .auth-check {
    margin: 2px 0 18px;
    font-size: 11px;
  }

  .auth-check input {
    width: 18px;
    height: 18px;
  }

  .auth-submit {
    height: 52px;
    font-size: 15px;
  }

  .auth-legal {
    margin-top: 16px;
    font-size: 9.5px;
  }

  .auth-pane-foot {
    display: none;
  }

  .auth-step-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
  }

  .auth-step-bar {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
  }

  .auth-step-bar i {
    flex: 1;
    height: 2px;
    border-radius: 2px;
    background: var(--auth-border);
    transition: background 0.2s;
  }

  .auth-step-bar i.on {
    background: var(--auth-red);
  }

  .auth-step-bar i.is-done {
    background: color-mix(in srgb, var(--auth-red) 32%, transparent);
  }

  .auth-register[data-step="1"] .auth-reg-secret,
  .auth-register[data-step="1"] .auth-phone-summary {
    display: none;
  }

  .auth-register[data-step="2"] .auth-reg-phone {
    display: none;
  }

  .auth-register[data-step="2"] .auth-phone-summary {
    display: flex;
  }
}

@media (max-width: 359px) {
  .auth-brand-chip {
    display: none;
  }
}

@keyframes auth-panel-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-panel,
  .auth-tabs-thumb {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
