:root {
  --ink: #111318;
  --cream: #f2eee3;
  --paper: #fffdf7;
  --line: #e2dbc9;
  --text: #17181c;
  --muted: #77726a;
  --accent: #3f444d;
  --accent-soft: #e6e8ec;
  --silver: #c8cdd6;
  --silver-bright: #eef0f4;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(0, .94fr);
  min-height: 100vh;
}

/* ---------- 左侧品牌区 ---------- */

.brand-panel {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 36px;
  padding: 42px 52px 38px;
  color: #f2ede1;
  background:
    radial-gradient(120% 90% at 0% 100%, rgba(150, 157, 169, .3) 0%, rgba(150, 157, 169, 0) 58%),
    linear-gradient(158deg, #17191e 0%, #090a0c 52%, #111216 100%);
}

.brand-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 76px 76px;
  -webkit-mask-image: radial-gradient(125% 105% at 30% 0%, #000 18%, transparent 76%);
  mask-image: radial-gradient(125% 105% at 30% 0%, #000 18%, transparent 76%);
}

.brand-glow {
  position: absolute;
  left: -200px;
  bottom: -240px;
  width: 560px;
  height: 560px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(200, 206, 216, .24), transparent 64%);
  filter: blur(34px);
  animation: breathe 13s ease-in-out infinite;
}

.brand-panel::after {
  content: "K";
  position: absolute;
  right: -56px;
  top: 13%;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(300px, 36vw, 540px);
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 255, 255, .07);
  transform: rotate(-9deg);
  pointer-events: none;
}

.brand-top,
.brand-copy,
.brand-vendors,
.brand-foot {
  position: relative;
  z-index: 2;
}

.brand-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-badge {
  width: 35px;
  height: 35px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #f5f6f8 0%, #b7bdc7 100%);
  color: #0b0c0f;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  font-weight: 700;
  box-shadow: 0 10px 24px -8px rgba(200, 206, 216, .45);
}

.brand-word {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 19px;
  letter-spacing: .02em;
}

.brand-word span {
  margin-left: 7px;
  padding: 2px 6px;
  border: 1px solid rgba(255, 255, 255, .24);
  border-radius: 4px;
  color: rgba(242, 237, 225, .68);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 10px;
  letter-spacing: .18em;
  vertical-align: 3px;
}

.brand-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgba(242, 237, 225, .5);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  white-space: nowrap;
}

.brand-status i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--silver);
  box-shadow: 0 0 0 4px rgba(200, 206, 216, .14);
  animation: pulse 2.8s ease-in-out infinite;
}

.brand-copy {
  max-width: 540px;
  margin-top: auto;
  animation: rise .8s cubic-bezier(.2, .7, .2, 1) both;
}

.brand-eyebrow {
  margin: 0 0 18px;
  color: rgba(242, 237, 225, .44);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 10.5px;
  letter-spacing: .24em;
}

.brand-copy h1 {
  margin: 0 0 20px;
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", "SimSun", serif;
  font-size: clamp(34px, 3.4vw, 52px);
  font-weight: 600;
  line-height: 1.26;
  letter-spacing: .01em;
}

.brand-copy h1 span {
  position: relative;
  color: #e4e7ed;
  white-space: nowrap;
}

.brand-copy h1 span::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6px;
  height: 2px;
  background: linear-gradient(90deg, rgba(220, 224, 231, .85), rgba(220, 224, 231, 0));
  transform-origin: left center;
  animation: draw 1.1s .55s cubic-bezier(.2, .7, .2, 1) both;
}

.brand-lede {
  max-width: 46ch;
  margin: 0;
  color: rgba(242, 237, 225, .6);
  font-size: 13.5px;
  line-height: 1.95;
}

.brand-points {
  max-width: 500px;
  margin: 34px 0 0;
  padding: 0;
  list-style: none;
  animation: rise .8s .12s cubic-bezier(.2, .7, .2, 1) both;
}

.brand-points li {
  display: flex;
  gap: 18px;
  padding: 15px 0;
  border-top: 1px solid rgba(255, 255, 255, .09);
}

.brand-points li:last-child {
  border-bottom: 1px solid rgba(255, 255, 255, .09);
}

.brand-points .index {
  padding-top: 2px;
  color: #9aa1ad;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 10.5px;
  letter-spacing: .12em;
}

.brand-points strong {
  display: block;
  color: #f2ede1;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: .01em;
}

.brand-points p {
  margin: 4px 0 0;
  color: rgba(242, 237, 225, .48);
  font-size: 12.5px;
  line-height: 1.7;
}

.brand-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  animation: rise .8s .2s cubic-bezier(.2, .7, .2, 1) both;
}

.gift-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 15px;
  border: 1px solid rgba(200, 206, 216, .38);
  border-radius: 999px;
  background: rgba(200, 206, 216, .09);
  color: #cfd4dd;
  font-size: 12.5px;
}

.gift-pill strong {
  color: #fff;
  font-size: 14px;
}

.gift-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--silver);
  box-shadow: 0 0 0 4px rgba(200, 206, 216, .14);
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgba(242, 237, 225, .7);
  font-size: 12.5px;
  text-decoration: none;
}

.brand-link span {
  transition: transform .22s ease;
}

.brand-link:hover { color: #fff; }
.brand-link:hover span { transform: translateX(4px); }

.brand-vendors {
  margin-top: 4px;
  animation: rise .8s .16s cubic-bezier(.2, .7, .2, 1) both;
}

.brand-vendors-label {
  margin: 0 0 10px;
  color: rgba(242, 237, 225, .38);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 10px;
  letter-spacing: .22em;
}

.vendor-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.vendor-tile {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 10px;
  background: linear-gradient(145deg, #f0f2f5 0%, #b9bfc9 100%);
  box-shadow: 0 8px 18px -12px rgba(0, 0, 0, .9);
  transition: transform .2s ease, box-shadow .2s ease;
}

.vendor-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 22px -12px rgba(0, 0, 0, .95);
}

.vendor-tile.dark { background: linear-gradient(145deg, #2a2d34 0%, #101114 100%); border-color: rgba(255, 255, 255, .12); }

.vendor-tile img {
  display: block;
  width: 70%;
  height: 70%;
  object-fit: contain;
}

/* ---------- 右侧表单区 ---------- */

.auth-main {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
  background:
    radial-gradient(circle at 18% 14%, rgba(255, 255, 255, .9), transparent 42%),
    var(--cream);
}

.auth-main::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(23, 24, 28, .07) .6px, transparent .6px);
  background-size: 18px 18px;
  opacity: .55;
}

.auth-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 26px;
  width: min(424px, 100%);
}

.auth-card {
  padding: 34px 32px 30px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 253, 247, .94);
  box-shadow:
    0 30px 70px -34px rgba(40, 28, 12, .45),
    inset 0 1px 0 #fff;
  animation: rise .72s cubic-bezier(.2, .7, .2, 1) both;
}

.auth-kicker {
  margin: 0 0 10px;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 10.5px;
  letter-spacing: .22em;
}

.auth-head h2,
.session h2 {
  margin: 0 0 8px;
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", "SimSun", serif;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: .01em;
}

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

.auth-admin-tip {
  margin: -12px 0 20px;
  padding: 8px 11px;
  border: 1px solid rgba(140, 130, 110, .22);
  border-radius: 8px;
  background: rgba(255, 255, 255, .5);
  color: #7d776b;
  font-size: 11.5px;
  line-height: 1.6;
}

/* 登录 / 注册切换 */

.auth-tabs {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 24px;
  padding: 4px;
  border-radius: 12px;
  background: #ece6d8;
}

.auth-tab {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #6f6a60;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: color .25s ease;
}

.auth-tab.active {
  color: var(--text);
  font-weight: 600;
}

.tab-gift {
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #3f444d;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .02em;
}

.tab-ink {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  border-radius: 9px;
  background: var(--paper);
  box-shadow: 0 1px 3px rgba(40, 30, 15, .14);
  transition: transform .32s cubic-bezier(.2, .8, .2, 1);
}

.auth-tabs[data-mode="register"] .tab-ink {
  transform: translateX(100%);
}

/* 表单 */

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 16px;
}

.field-label {
  color: #5f5a51;
  font-size: 12px;
  letter-spacing: .02em;
}

.auth-field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fffefa;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.auth-field input::placeholder { color: #aaa297; }

.auth-field input:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(120, 126, 138, .18);
}

.password-box {
  position: relative;
  display: block;
}

.password-box input { padding-right: 58px; }

.peek {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  padding: 6px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 11.5px;
  cursor: pointer;
}

.peek:hover {
  background: #f1ebdf;
  color: var(--text);
}

.code-box {
  display: flex;
  gap: 8px;
}

.code-box input {
  flex: 1;
  min-width: 0;
}

.code-send {
  flex: none;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffefa;
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease;
}

.code-send:hover:not(:disabled) {
  border-color: #aeb4c0;
  background: #f6f3ec;
}

.code-send:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.email-hint {
  min-height: 16px;
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
}

.email-hint.ok { color: #2c7a52; }
.email-hint.bad { color: #bf3b2a; }

.auth-error {
  min-height: 19px;
  margin: 2px 0 12px;
  color: #bf3b2a;
  font-size: 12.5px;
  line-height: 1.5;
}

.auth-error.shake { animation: shake .34s ease; }

.auth-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 13px 18px;
  border: 0;
  border-radius: 12px;
  background: var(--ink);
  color: #fbf7ee;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .02em;
  cursor: pointer;
  box-shadow: 0 14px 26px -14px rgba(17, 19, 24, .72);
  transition: transform .18s ease, background .2s ease, box-shadow .2s ease;
}

.auth-submit:hover {
  background: #232630;
  transform: translateY(-1px);
}

.auth-submit:active { transform: translateY(0); }

.auth-submit:disabled {
  opacity: .6;
  cursor: progress;
  transform: none;
}

.auth-submit .arrow {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  transition: transform .2s ease;
}

.auth-submit:hover .arrow { transform: translateX(3px); }

.auth-switch {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}

.auth-switch button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.auth-alt {
  margin: 8px 0 0;
  text-align: center;
}

.auth-alt button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

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

.auth-gift {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 14px 0 0;
  color: #9a9387;
  font-size: 11.5px;
  text-align: center;
}

.auth-gift::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #8b919c;
  opacity: .75;
}

/* 已登录状态 */

.session-user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 22px;
  padding: 15px 16px;
  border: 1px solid #e8e0cf;
  border-radius: 14px;
  background: #f5efe2;
}

.session-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
}

.session-name {
  font-size: 14px;
  font-weight: 600;
}

.session-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11.5px;
}

.session-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-dark,
.btn-quiet {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 11px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.btn-dark {
  border: 0;
  background: var(--ink);
  color: #fbf7ee;
}

.btn-dark:hover { background: #232630; }

.btn-dark span {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  transition: transform .2s ease;
}

.btn-dark:hover span { transform: translateX(3px); }

.btn-quiet {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
}

.btn-quiet:hover {
  background: #f5efe2;
  color: var(--text);
}

/* 页脚 */

.auth-trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0;
  color: #8d8678;
  font-size: 11px;
  letter-spacing: .04em;
}

.auth-trust i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #c9c1b1;
}

.auth-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  color: #a49c8d;
  font-size: 11.5px;
}

.auth-foot a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.auth-foot a:hover {
  color: var(--text);
  border-bottom-color: currentColor;
}

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

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}

@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: .78; }
  50% { transform: scale(1.09); opacity: 1; }
}

@keyframes draw {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  22% { transform: translateX(-5px); }
  44% { transform: translateX(4px); }
  66% { transform: translateX(-3px); }
  88% { transform: translateX(2px); }
}

/* ---------- 响应式 ---------- */

@media (max-width: 980px) {
  .auth-shell { display: block; }

  .brand-panel {
    gap: 22px;
    padding: 22px 24px 26px;
  }

  .brand-status,
  .brand-eyebrow,
  .brand-points,
  .brand-panel::after { display: none; }

  .brand-copy {
    margin-top: 10px;
    animation-delay: .05s;
  }

  .brand-copy h1 {
    margin-bottom: 10px;
    font-size: clamp(26px, 6vw, 36px);
  }

  .brand-lede {
    max-width: none;
    font-size: 12.5px;
    line-height: 1.8;
  }

  .brand-foot {
    justify-content: flex-start;
    animation-delay: .1s;
  }

  .brand-link { display: none; }

  .brand-vendors { margin-top: 0; }

  .brand-vendors-label { display: none; }

  .vendor-tile {
    width: 32px;
    height: 32px;
    border-radius: 8px;
  }

  .brand-glow {
    left: auto;
    right: -90px;
    bottom: -180px;
    width: 300px;
    height: 300px;
  }

  .auth-main {
    align-items: flex-start;
    padding: 28px 20px 42px;
  }

  .auth-wrap { gap: 20px; }
}

@media (max-width: 520px) {
  .brand-panel { padding: 18px 18px 22px; }

  .brand-copy h1 { font-size: 25px; }

  .brand-lede { display: none; }

  .auth-main { padding: 22px 16px 36px; }

  .auth-card {
    padding: 26px 22px 24px;
    border-radius: 18px;
  }

  .auth-head h2,
  .session h2 { font-size: 24px; }
}

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