/* ==========================================================================
   海盐葡萄 · 设计系统
   色卡取自参考图：#B6A9C8 浅紫 / #EFE4D4 米 / #302B58 墨蓝紫 / #9078AC 主紫
   ========================================================================== */

:root {
  /* 四个基色，严格来自色卡 */
  --salt: #b6a9c8;
  --cream: #efe4d4;
  --ink: #302b58;
  --grape: #9078ac;

  /* 派生：提亮/压暗，只做明度变化，不引入新色相 */
  --ink-soft: #423b6e;
  --ink-mute: #5c557f;
  --grape-deep: #7a63a0;
  --salt-light: #d5cce1;
  --cream-light: #f8f2e8;
  --paper: #fffcf8;

  --text: var(--ink);
  --text-mute: #6d6789;
  --text-faint: #948dab;
  --line: rgba(48, 43, 88, 0.13);
  --line-strong: rgba(48, 43, 88, 0.24);
  --line-soft: rgba(48, 43, 88, 0.07);

  --danger: #b04a45;
  --ok: #7a60a0;
  --warn: #a8802f;

  --r-xs: 6px;
  --r-sm: 9px;
  --r: 14px;
  --r-lg: 22px;
  --r-pill: 999px;

  --sh-xs: 0 1px 2px rgba(48, 43, 88, 0.05);
  --sh-sm: 0 2px 8px -2px rgba(48, 43, 88, 0.1);
  --sh: 0 12px 34px -16px rgba(48, 43, 88, 0.34);
  --sh-lg: 0 30px 70px -30px rgba(48, 43, 88, 0.45);

  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", Georgia, serif;
  --mono: "SF Mono", "JetBrains Mono", Consolas, monospace;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* {
  box-sizing: border-box;
}

/* 必须放在组件样式之前生效：很多组件设置了 display，会覆盖 [hidden] 的默认值 */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--cream-light);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 14px;
  line-height: 1.6;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

a {
  color: var(--grape-deep);
  text-decoration: none;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

::selection {
  background: var(--salt-light);
  color: var(--ink);
}

/* ------------------------------------------------------------ 通用控件 */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-mute);
  letter-spacing: 0.02em;
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--paper);
  color: var(--ink);
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), background 0.18s;
  outline: none;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-faint);
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--grape);
  box-shadow: 0 0 0 3px rgba(144, 120, 172, 0.18);
  background: #fff;
}

.input:disabled,
.select:disabled {
  background: var(--cream-light);
  color: var(--text-faint);
}

.textarea {
  resize: vertical;
  min-height: 68px;
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236d6789' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--grape);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s var(--ease), transform 0.12s var(--ease), box-shadow 0.18s, opacity 0.18s;
  white-space: nowrap;
}

.btn:hover {
  background: var(--grape-deep);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn[data-variant='ghost'] {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn[data-variant='ghost']:hover {
  background: rgba(48, 43, 88, 0.05);
}

.btn[data-variant='quiet'] {
  background: transparent;
  color: var(--text-mute);
  padding: 6px 10px;
  font-weight: 500;
}

.btn[data-variant='quiet']:hover {
  background: rgba(48, 43, 88, 0.06);
  color: var(--ink);
}

.btn[data-variant='danger'] {
  background: transparent;
  border-color: rgba(176, 74, 69, 0.36);
  color: var(--danger);
}

.btn[data-variant='danger']:hover {
  background: rgba(176, 74, 69, 0.08);
}

.btn[data-size='sm'] {
  padding: 7px 13px;
  font-size: 12.5px;
}

.btn[data-block] {
  width: 100%;
}

.hint {
  font-size: 12px;
  color: var(--text-faint);
  line-height: 1.55;
}

.alert {
  padding: 11px 14px;
  border-radius: var(--r-sm);
  font-size: 13px;
  border: 1px solid transparent;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  line-height: 1.5;
}

.alert[data-tone='err'] {
  background: rgba(176, 74, 69, 0.08);
  border-color: rgba(176, 74, 69, 0.24);
  color: #8f3a36;
}

.alert[data-tone='ok'] {
  background: rgba(144, 120, 172, 0.12);
  border-color: rgba(144, 120, 172, 0.28);
  color: #5d4a80;
}

.alert[data-tone='info'] {
  background: rgba(144, 120, 172, 0.1);
  border-color: rgba(144, 120, 172, 0.26);
  color: var(--grape-deep);
}

.alert[hidden] {
  display: none !important;
}

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   认证页（登录 / 注册）
   ========================================================================== */

.auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  background: var(--cream-light);
}

/* 左侧品牌区：墨蓝紫底 + 米色手绘弧线 */
.auth__hero {
  position: relative;
  overflow: hidden;
  background: var(--ink);
  color: var(--cream);
  padding: 54px 58px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.auth__hero::before {
  content: '';
  position: absolute;
  inset: -30% -20% auto auto;
  width: 620px;
  height: 620px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 34%, rgba(144, 120, 172, 0.5), transparent 62%);
  pointer-events: none;
}

.auth__hero::after {
  content: '';
  position: absolute;
  left: -8%;
  bottom: -34%;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  background: radial-gradient(circle at 60% 40%, rgba(182, 169, 200, 0.28), transparent 64%);
  pointer-events: none;
}

.auth__brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth__mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--cream);
  color: var(--ink);
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  flex: none;
}

.auth__brand-name {
  font-family: var(--serif);
  font-size: 19px;
  letter-spacing: 0.08em;
}

.auth__brand-sub {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(239, 228, 212, 0.55);
  margin-top: 1px;
}

.auth__headline {
  position: relative;
  z-index: 1;
  margin: 44px 0 0;
}

.auth__headline h1 {
  font-family: var(--serif);
  font-size: clamp(34px, 4.4vw, 58px);
  line-height: 1.14;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--cream);
}

.auth__headline h1 em {
  font-style: normal;
  color: var(--salt);
}

.auth__headline p {
  margin-top: 20px;
  max-width: 30em;
  font-size: 14px;
  line-height: 1.85;
  color: rgba(239, 228, 212, 0.72);
}

/* 手绘感弧线，呼应参考图 */
.auth__arc {
  position: relative;
  z-index: 1;
  margin-top: 34px;
  width: min(340px, 74%);
  height: auto;
  opacity: 0.85;
}

.auth__foot {
  position: relative;
  z-index: 1;
  margin-top: 40px;
  display: flex;
  gap: 26px;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: rgba(239, 228, 212, 0.5);
  flex-wrap: wrap;
}

.auth__foot span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.auth__foot i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--grape);
  display: inline-block;
}

/* 右侧表单区 */
.auth__panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
  background: var(--cream-light);
}

.auth__card {
  width: 100%;
  max-width: 396px;
}

.auth__card h2 {
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.auth__card > p.sub {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-mute);
}

.auth__form {
  margin-top: 30px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 2px;
}

.auth__check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-mute);
  cursor: pointer;
  user-select: none;
}

.auth__check input {
  width: 15px;
  height: 15px;
  accent-color: var(--grape);
  cursor: pointer;
}

.auth__submit {
  margin-top: 6px;
  padding: 13px;
  font-size: 14.5px;
  letter-spacing: 0.03em;
  border-radius: var(--r-sm);
}

.auth__alt {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--text-mute);
  text-align: center;
}

.auth__alt a {
  font-weight: 600;
  border-bottom: 1px solid rgba(122, 99, 160, 0.34);
}

/* 小屏：品牌区收成顶部条 */
@media (max-width: 880px) {
  .auth {
    grid-template-columns: 1fr;
  }

  .auth__hero {
    padding: 30px 26px 34px;
    min-height: auto;
  }

  .auth__headline {
    margin: 28px 0 0;
  }

  .auth__headline h1 {
    font-size: clamp(28px, 8vw, 38px);
  }

  .auth__headline p {
    margin-top: 14px;
    font-size: 13px;
  }

  .auth__arc {
    display: none;
  }

  .auth__foot {
    display: none;
  }

  .auth__panel {
    padding: 34px 24px 56px;
    align-items: flex-start;
  }

  .auth__card h2 {
    font-size: 23px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   登录页 · 左侧背景底部的「清空数据」入口
   ========================================================================== */
.auth__danger {
  position: relative;
  z-index: 1;
  /* 弹性空间：把按钮压到左侧背景的最底部 */
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(239, 228, 212, 0.16);
}

.auth__danger-btn {
  border: 1px solid rgba(239, 228, 212, 0.28);
  background: transparent;
  color: rgba(239, 228, 212, 0.78);
  font-size: 12.5px;
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}

.auth__danger-btn:hover {
  border-color: rgba(208, 120, 140, 0.7);
  color: #f3d3da;
  background: rgba(208, 120, 140, 0.12);
}

.auth__danger-hint {
  margin: 10px 0 0;
  font-size: 11px;
  color: rgba(239, 228, 212, 0.42);
  line-height: 1.6;
}

/* 二次确认弹窗 */
.wipe {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 20px;
}

.wipe[hidden] {
  display: none !important;
}

.wipe__mask {
  position: absolute;
  inset: 0;
  background: rgba(20, 17, 38, 0.62);
  backdrop-filter: blur(4px);
}

.wipe__card {
  position: relative;
  width: min(420px, 100%);
  background: #fff;
  border-radius: 20px;
  padding: 24px 22px 20px;
  box-shadow: 0 30px 70px -30px rgba(20, 17, 38, 0.7);
}

.wipe__card h3 {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 650;
  color: var(--ink);
}

.wipe__text {
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-mute);
}

.wipe__field {
  margin-bottom: 12px;
}

.wipe__field label {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
  color: var(--text-mute);
}

.wipe__err {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--danger);
}

.wipe__foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}
