/* KAPI / Editorial Tech — 登录与注册
   暖白纸面、墨黑蓝、靛蓝与薄荷；原生四模式表单，无外部依赖。 */
/* 登录页保留自身入场动画，不参与主导航的跨页转场。 */
@view-transition { navigation: none; }
:root {
  color-scheme: light;
  --ink: #172026;
  --cream: #f7f8f5;
  --paper: #fff;
  --line: #e1e5df;
  --text: #25302f;
  --muted: #75807b;
  --accent: #5456d8;
  --accent-dark: #4143b2;
  --accent-soft: #eeeffc;
  --mint: #cdebdc;
  --mint-ink: #306e54;
  --danger: #bd4d55;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
.hidden { display: none !important; }
::selection { color: #30337e; background: #dedff9; }
:is(a, button, input):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

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

/* 品牌页：像一张深色技术期刊封面，不用渐变光斑。 */
.brand-panel {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 34px;
  overflow: hidden;
  padding: clamp(30px, 4vw, 58px) clamp(32px, 5vw, 76px) 38px;
  color: #f3f6f1;
  background: var(--ink);
}
.brand-grid {
  position: absolute;
  z-index: -2;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(205, 235, 220, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(205, 235, 220, .045) 1px, transparent 1px);
  background-size: 88px 88px;
  mask-image: linear-gradient(135deg, #000, transparent 78%);
}
.brand-glow {
  position: absolute;
  z-index: -1;
  right: clamp(20px, 5vw, 80px);
  bottom: 24%;
  width: 116px;
  height: 116px;
  border: 1px solid rgba(205, 235, 220, .22);
  border-radius: 50%;
  pointer-events: none;
}
.brand-glow::before,
.brand-glow::after {
  content: "";
  position: absolute;
  background: rgba(205, 235, 220, .18);
}
.brand-glow::before { top: 50%; left: -28px; width: 172px; height: 1px; }
.brand-glow::after { top: -28px; left: 50%; width: 1px; height: 172px; }
.brand-panel::after {
  content: "K";
  position: absolute;
  z-index: -1;
  right: -40px;
  top: 14%;
  color: transparent;
  font-size: clamp(300px, 36vw, 550px);
  font-weight: 600;
  line-height: 1;
  -webkit-text-stroke: 1px rgba(205, 235, 220, .065);
  transform: rotate(-7deg);
  pointer-events: none;
}
.brand-top, .brand-copy, .brand-vendors, .brand-foot { position: relative; z-index: 1; }
.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 {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  color: var(--ink);
  background: var(--mint);
  font-size: 20px;
  font-weight: 700;
}
.brand-word { font-size: 19px; font-weight: 650; letter-spacing: .03em; }
.brand-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #aab9b1;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .14em;
  text-transform: uppercase;
  white-space: nowrap;
}
.brand-status i { width: 6px; height: 6px; border-radius: 50%; background: var(--mint); animation: pulse 2.8s ease-in-out infinite; }
.brand-copy { max-width: 600px; margin-top: auto; animation: rise .7s var(--ease) both; }
.brand-edition {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: clamp(30px, 6vh, 64px);
  padding: 11px 0;
  border-top: 1px solid rgba(205, 235, 220, .18);
  border-bottom: 1px solid rgba(205, 235, 220, .18);
  color: #92a49a;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .16em;
}
.brand-eyebrow { margin: 0 0 17px; color: var(--mint); font-family: var(--mono); font-size: 9px; letter-spacing: .2em; }
.brand-copy h1 { margin: 0 0 23px; color: #f6f7f1; font-size: clamp(38px, 4.1vw, 62px); font-weight: 550; line-height: 1.2; letter-spacing: -.055em; }
.brand-copy h1 span { position: relative; display: inline-block; color: var(--mint); white-space: nowrap; }
.brand-copy h1 span::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -7px;
  left: 0;
  height: 2px;
  background: var(--accent);
  transform-origin: left;
  animation: draw 1s .45s var(--ease) both;
}
.brand-lede { max-width: 47ch; margin: 0; color: #aab8b0; font-size: 13px; line-height: 1.95; }
.brand-points { max-width: 560px; margin: 30px 0 0; padding: 0; list-style: none; animation: rise .7s .1s var(--ease) both; }
.brand-points li { display: flex; gap: 19px; padding: 13px 0; border-top: 1px solid rgba(205, 235, 220, .12); }
.brand-points li:last-child { border-bottom: 1px solid rgba(205, 235, 220, .12); }
.brand-points .index { padding-top: 3px; color: #7d9386; font-family: var(--mono); font-size: 9px; letter-spacing: .1em; }
.brand-points strong { display: block; color: #e8eee8; font-size: 12px; font-weight: 550; }
.brand-points p { margin: 3px 0 0; color: #91a299; font-size: 11px; line-height: 1.7; }
.brand-vendors { animation: rise .7s .15s var(--ease) both; }
.brand-vendors-label { margin: 0 0 11px; color: #7f9187; font-family: var(--mono); font-size: 8px; letter-spacing: .18em; }
.vendor-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.vendor-tile {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(205, 235, 220, .14);
  border-radius: 9px;
  background: #f4f6f0;
  transition: border-color .2s, transform .2s var(--ease);
}
.vendor-tile:hover { border-color: var(--mint); transform: translateY(-2px); }
.vendor-tile.dark { background: #0f1519; }
.vendor-tile img { display: block; width: 68%; height: 68%; object-fit: contain; }
.brand-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 18px; }
.gift-pill { display: inline-flex; align-items: center; gap: 8px; color: #a7b8ad; font-size: 11px; }
.gift-pill strong { color: var(--mint); font-weight: 550; }
.gift-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--mint); }
.brand-link { display: inline-flex; align-items: center; gap: 14px; color: #d8e4dc; font-size: 11px; text-decoration: none; }
.brand-link span { color: var(--mint); transition: transform .2s; }
.brand-link:hover span { transform: translateX(4px); }

/* 账户入口：纸面卡片，控件与业务脚本一一对应。 */
.auth-main { position: relative; display: flex; align-items: center; justify-content: center; padding: 48px 40px; background: var(--cream); }
.auth-main::before {
  content: "ACCESS / 01";
  position: absolute;
  top: 32px;
  right: 36px;
  color: #a2aaa4;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .15em;
}
.auth-wrap { position: relative; display: flex; flex-direction: column; gap: 22px; width: min(440px, 100%); }
.auth-card { padding: 34px 34px 30px; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); box-shadow: 0 18px 55px rgba(23, 32, 38, .055); animation: rise .65s var(--ease) both; }
.auth-section-label { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 30px; padding-bottom: 11px; border-bottom: 1px solid var(--line); color: #929b95; font-family: var(--mono); font-size: 8px; letter-spacing: .14em; }
.auth-kicker { margin: 0 0 10px; color: var(--accent); font-family: var(--mono); font-size: 9px; letter-spacing: .18em; }
.auth-head h2, .session h2 { margin: 0 0 9px; color: var(--ink); font-size: 30px; font-weight: 550; letter-spacing: -.04em; }
.auth-sub { margin: 0 0 22px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.auth-admin-tip { margin: -7px 0 20px; padding: 10px 12px; border-left: 2px solid #c8d4cb; color: #768179; background: #f7f9f5; font-size: 10px; line-height: 1.7; }
.auth-tabs { position: relative; display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 25px; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: #f2f4ef; }
.auth-tab { position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 0; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: 12px; transition: color .2s; }
.auth-tab.active { color: var(--ink); font-weight: 600; }
.tab-gift { padding: 2px 6px; border-radius: 4px; color: var(--mint-ink); background: var(--mint); font-size: 8px; font-weight: 600; }
.tab-ink { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border: 1px solid #e2e5df; border-radius: 8px; background: #fff; box-shadow: 0 2px 5px rgba(23, 32, 38, .04); transition: transform .3s var(--ease); }
.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: #5f6a64; font-size: 11px; }
.auth-field input { width: 100%; min-height: 45px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; outline: 0; color: var(--text); background: #fcfdfb; font-size: 13px; transition: border-color .2s, box-shadow .2s, background .2s; }
.auth-field input::placeholder { color: #a2aaa5; }
.auth-field input:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 4px rgba(84, 86, 216, .09); }
.password-box { position: relative; display: block; }
.password-box input { padding-right: 60px; }
.peek { position: absolute; top: 50%; right: 6px; padding: 6px 8px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; font-size: 10px; transform: translateY(-50%); }
.peek:hover { color: var(--accent); background: var(--accent-soft); }
.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; color: var(--text); background: #fff; font-size: 11px; white-space: nowrap; transition: border-color .2s, background .2s; }
.code-send:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.code-send:disabled { opacity: .5; }
.email-hint { min-height: 16px; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.email-hint.ok { color: var(--mint-ink); }
.email-hint.bad { color: var(--danger); }
.auth-error { min-height: 19px; margin: 2px 0 12px; color: var(--danger); font-size: 11px; line-height: 1.6; }
.auth-error.success { color: var(--mint-ink); }
.auth-error.shake { animation: shake .34s ease; }
.auth-submit { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; min-height: 47px; padding: 12px 17px; border: 1px solid var(--accent); border-radius: 10px; color: #fff; background: var(--accent); box-shadow: 0 7px 16px rgba(84, 86, 216, .14); font-size: 13px; font-weight: 600; transition: background .2s, transform .2s var(--ease), box-shadow .2s; }
.auth-submit:hover { background: var(--accent-dark); box-shadow: 0 10px 22px rgba(84, 86, 216, .2); transform: translateY(-1px); }
.auth-submit:active { transform: none; }
.auth-submit:disabled { opacity: .55; transform: none; }
.auth-submit .arrow { font-family: var(--mono); transition: transform .2s; }
.auth-submit:hover .arrow { transform: translateX(3px); }
.auth-switch { margin: 19px 0 0; color: var(--muted); font-size: 11px; text-align: center; }
.auth-switch button, .auth-alt button { padding: 0; border: 0; color: var(--accent); background: none; font-size: 11px; text-decoration: underline; text-underline-offset: 3px; }
.auth-switch button { font-weight: 600; }
.auth-alt { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 18px; margin: 11px 0 0; text-align: center; }
.auth-alt button { color: var(--muted); font-size: 10px; }
.auth-alt button:hover { color: var(--accent); }
.auth-gift { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 18px 0 0; color: #8b958e; font-size: 10px; text-align: center; }
.auth-gift::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #8ebca3; }

/* 已登录状态仍复用 login.js 的显隐契约。 */
.session-user { display: flex; align-items: center; gap: 13px; margin: 22px 0; padding: 16px; border: 1px solid #d8e7dc; border-radius: 12px; background: #f0f7f1; }
.session-avatar { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; color: var(--mint); background: var(--ink); font-size: 16px; }
.session-name { color: var(--ink); font-size: 13px; font-weight: 600; }
.session-meta { margin-top: 3px; color: var(--muted); font-size: 10px; }
.session-actions { display: flex; flex-direction: column; gap: 10px; }
.btn-dark, .btn-quiet { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 44px; padding: 11px 16px; border-radius: 10px; font-size: 12px; font-weight: 600; text-decoration: none; transition: background .2s, border-color .2s, transform .2s var(--ease); }
.btn-dark { border: 1px solid var(--accent); color: #fff; background: var(--accent); }
.btn-dark:hover { background: var(--accent-dark); transform: translateY(-1px); }
.btn-quiet { border: 1px solid var(--line); color: var(--muted); background: #fff; }
.btn-quiet:hover { border-color: #bdc5be; color: var(--text); background: #f7f9f5; }
.auth-trust { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 12px; margin: 0; color: #89928c; font-size: 9px; letter-spacing: .04em; }
.auth-trust i { width: 3px; height: 3px; border-radius: 50%; background: #aab2ac; }
.auth-foot { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0; color: #9ca49e; font-size: 10px; }
.auth-foot a { color: inherit; text-decoration: none; }
.auth-foot a:hover { color: var(--accent); }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 50% { opacity: .4; } }
@keyframes draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }

@media (max-width: 1120px) {
  .brand-panel { padding-right: 42px; padding-left: 42px; }
  .brand-copy h1 { font-size: 44px; }
  .auth-main { padding-right: 28px; padding-left: 28px; }
}
@media (max-width: 900px) {
  .auth-shell { display: block; }
  .brand-panel { gap: 23px; padding: 25px 30px 28px; }
  .brand-panel::after, .brand-glow, .brand-edition, .brand-points { display: none; }
  .brand-copy { margin-top: 16px; }
  .brand-copy h1 { margin-bottom: 15px; font-size: clamp(30px, 6vw, 44px); }
  .brand-lede { max-width: 70ch; }
  .brand-vendors-label { display: none; }
  .brand-vendors { position: absolute; right: 30px; top: 28px; }
  .vendor-strip { max-width: 175px; justify-content: flex-end; }
  .vendor-tile { width: 30px; height: 30px; border-radius: 7px; }
  .brand-status { display: none; }
  .auth-main { align-items: flex-start; padding: 38px 24px 42px; }
  .auth-main::before { display: none; }
}
@media (max-width: 560px) {
  .brand-panel { gap: 18px; padding: 20px 20px 24px; }
  .brand-badge { width: 33px; height: 33px; border-radius: 8px; font-size: 17px; }
  .brand-word { font-size: 17px; }
  .brand-vendors { display: none; }
  .brand-copy { margin-top: 12px; }
  .brand-eyebrow { margin-bottom: 12px; font-size: 8px; }
  .brand-copy h1 { font-size: clamp(29px, 9vw, 38px); line-height: 1.25; }
  .brand-lede { font-size: 11px; line-height: 1.8; }
  .brand-foot { gap: 12px; }
  .gift-pill { font-size: 10px; }
  .brand-link { font-size: 10px; }
  .auth-main { padding: 24px 14px 34px; }
  .auth-wrap { gap: 18px; }
  .auth-card { padding: 25px 21px 24px; border-radius: 16px; }
  .auth-section-label { margin-bottom: 24px; }
  .auth-head h2, .session h2 { font-size: 27px; }
  .code-send { padding: 0 9px; font-size: 10px; }
}
@media (max-width: 360px) {
  .brand-copy h1 { font-size: 27px; }
  .brand-lede { display: none; }
  .auth-card { padding-right: 17px; padding-left: 17px; }
  .tab-gift { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
