/* ============================================================
   设计令牌：低饱和暖色纸张风格
   ============================================================ */
:root {
  --paper:          #f7f1e8;
  --paper-deep:     #efe6d9;
  --surface:        #fffcf7;
  --surface-alt:    #faf4eb;
  --surface-sunken: #f3ebe0;

  --ink:            #3d3733;
  --ink-soft:       #5f564e;
  --ink-muted:      #85786b;
  --ink-faint:      #a99c8d;

  --line:           #e8ded2;
  --line-strong:    #d9ccbc;

  --accent:         #b08968;
  --accent-deep:    #96714f;
  --accent-soft:    #e7d7c5;
  --accent-wash:    #f0e4d6;

  --danger:         #b5675e;
  --danger-soft:    #f6e3e0;
  --success:        #7f9276;
  --success-soft:   #e8eee4;

  --radius-xs: 6px;
  --radius-sm: 9px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --shadow-xs: 0 1px 2px rgba(97, 74, 53, 0.06);
  --shadow-sm: 0 2px 8px rgba(97, 74, 53, 0.07);
  --shadow-md: 0 6px 20px rgba(97, 74, 53, 0.10);
  --shadow-lg: 0 18px 48px rgba(74, 55, 39, 0.16);

  --font-ui: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif;
  --font-serif: "Noto Serif SC", "Songti SC", "SimSun", Georgia, serif;

  --ease: cubic-bezier(0.32, 0.72, 0.3, 1);
  --dur: 180ms;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

html {
  /* 顶部导航是 sticky，滚动定位时预留出它的高度，避免目标被盖住 */
  scroll-padding-top: 84px;
}

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(214, 188, 158, 0.20), transparent 42%),
    radial-gradient(circle at 88% 92%, rgba(199, 176, 150, 0.16), transparent 46%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--accent-deep); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--accent-soft); color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* 滚动条 */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background-clip: padding-box; background-color: var(--ink-faint); }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- 通用按钮 ---------- */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--ink);
  --btn-border: var(--line-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 15px;
  border: 1px solid var(--btn-border);
  border-radius: var(--radius-sm);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              color var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
              transform var(--dur) var(--ease);
  box-shadow: var(--shadow-xs);
}
.btn:hover { background: var(--surface-alt); border-color: var(--ink-faint); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-primary {
  --btn-bg: var(--accent);
  --btn-fg: #fffaf3;
  --btn-border: var(--accent);
  box-shadow: 0 2px 10px rgba(176, 137, 104, 0.26);
}
.btn-primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }

.btn-ghost {
  --btn-bg: transparent;
  --btn-border: transparent;
  box-shadow: none;
}
.btn-ghost:hover { background: var(--accent-wash); border-color: transparent; }

.btn-danger {
  --btn-fg: var(--danger);
  --btn-border: #e3c7c3;
  --btn-bg: transparent;
  box-shadow: none;
}
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }

.btn-danger-solid {
  --btn-bg: var(--danger);
  --btn-fg: #fff8f6;
  --btn-border: var(--danger);
}
.btn-danger-solid:hover { filter: brightness(0.94); background: var(--danger); }

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
}

.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-sm.btn-icon { width: 30px; height: 30px; }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
}
.input, .select, .textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  box-shadow: inset 0 1px 1px rgba(97, 74, 53, 0.03);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-faint); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(176, 137, 104, 0.16);
}
.textarea { resize: vertical; min-height: 80px; line-height: 1.6; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%2385786b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 32px;
}

/* ---------- 徽标 / 状态 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.6;
}
.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.badge-draft { color: #9a7f5f; background: #f3ece2; }
.badge-published { color: #6d7f65; background: var(--success-soft); }
.badge-guest { color: var(--ink-muted); background: var(--surface-sunken); }

/* ---------- 工具类 ---------- */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.spacer { flex: 1 1 auto; }
.muted { color: var(--ink-muted); }
.small { font-size: 12.5px; }

/* ---------- 加载 ---------- */
.boot-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 10px;
  text-align: center;
  background: var(--paper);
}
.boot-mark {
  font-family: var(--font-serif);
  font-size: 26px;
  letter-spacing: 0.04em;
  color: var(--accent-deep);
}
.boot-text { font-size: 13px; color: var(--ink-faint); }

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--accent-soft);
  border-top-color: var(--accent);
  animation: spin 720ms linear infinite;
  flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(100deg, var(--surface-sunken) 30%, #f9f3ea 50%, var(--surface-sunken) 70%);
  background-size: 240% 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: var(--radius-xs);
}
@keyframes shimmer { to { background-position: -240% 0; } }

/* ---------- 动效偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
