/* ==========================================================================
   02 · 基础：重置、纸纹、字号体系、按钮、表单
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; min-height: 100%; }
html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--fs-body);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
  transition: background-color .35s var(--ease), color .35s var(--ease);
}

/* 纸纹 */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .5;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='220' height='220' filter='url(%23n)' opacity='.05'/></svg>");
}
html[data-theme="dark"] body::before { opacity: .9; }

img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
a { color: var(--seal); text-decoration: none; }
::selection { background: var(--seal-soft); color: var(--seal-deep); }
:focus-visible { outline: 2px solid var(--seal); outline-offset: 2px; }
input:focus-visible, textarea:focus-visible { outline: none; }

@media (pointer: fine) {
  ::-webkit-scrollbar { width: 11px; height: 11px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--line); border-radius:999px; border: 3px solid var(--paper); }
  ::-webkit-scrollbar-thumb:hover { background: var(--line-strong); }
}

/* ---------------- 字号体系 ---------------- */
.display {
  font-family: var(--serif); font-size: var(--fs-display); font-weight: 600;
  line-height: 1.14; letter-spacing: -.022em; margin: 0;
}
.h1 { font-family: var(--serif); font-size: var(--fs-h1); font-weight: 600; line-height: 1.22; letter-spacing: -.02em; margin: 0; }
.h2 { font-family: var(--serif); font-size: var(--fs-h2); font-weight: 600; line-height: 1.3; letter-spacing: -.015em; margin: 0; }
.h3 { font-family: var(--serif); font-size: var(--fs-h3); font-weight: 600; line-height: 1.4; margin: 0; letter-spacing: -.005em; }
.lede { font-size: 16px; line-height: 1.78; color: var(--ink-2); margin: 0; }
.small { font-size: var(--fs-sm); }
.muted { color: var(--ink-3); }
.mono { font-family: var(--mono); }

.kicker {
  display: inline-block; font-family: var(--sans); font-size: 10px; font-weight: 700;
  letter-spacing: .42em; text-transform: uppercase; color: var(--bronze);
}
.kicker.seal { color: var(--seal); }

/* 细线章节标题 */
.rule-title { display: flex; align-items: center; gap: 14px; color: var(--ink-3); margin: 0; }
.rule-title::before, .rule-title::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.rule-title span { font-size: 11px; letter-spacing: .3em; text-transform: uppercase; font-weight: 700; white-space: nowrap; }

/* 章节头：左标题右「全部 ›」 */
.section-head { display: flex; align-items: flex-end; gap: 16px; margin: 0 0 18px; }
.section-head h2 { flex: 1; }
.section-head .more {
  display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600;
  color: var(--ink-3); padding: 6px 2px; transition: color .16s;
}
.section-head .more:hover { color: var(--seal); }
.section-head .more svg { width: 14px; height: 14px; }

/* ---------------- 按钮 ---------------- */
.btn {
  --h: 46px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--h); padding: 0 22px; border-radius: var(--r-pill);
  font-size: 15px; font-weight: 600; letter-spacing: .02em; white-space: nowrap;
  border: 1px solid transparent; position: relative;
  transition: background-color .18s var(--ease), border-color .18s, color .18s, transform .12s, box-shadow .18s;
  user-select: none;
}
.btn:active { transform: scale(.975); }
.btn svg { width: 16px; height: 16px; flex: 0 0 auto; }
.btn .arrow { transition: transform .25s var(--ease); }
.btn:hover .arrow { transform: translateX(3px); }

.btn-primary {
  background: var(--ink); color: var(--paper-2);
  box-shadow: 0 1px 2px rgba(21, 18, 14, .18), 0 10px 24px -14px rgba(21, 18, 14, .7);
}
.btn-primary:hover { background: #000; box-shadow: 0 2px 4px rgba(21, 18, 14, .2), 0 16px 30px -16px rgba(21, 18, 14, .8); }
html[data-theme="dark"] .btn-primary:hover { background: #2b241d; }

.btn-seal {
  background: var(--seal); color: #fff;
  box-shadow: 0 2px 4px rgba(150, 43, 30, .22), 0 14px 28px -16px rgba(150, 43, 30, .8);
}
.btn-seal:hover { background: var(--seal-deep); }

.btn-outline { border-color: var(--line-strong); color: var(--ink-2); background: transparent; }
.btn-outline:hover { border-color: var(--ink); color: var(--ink); background: var(--paper-2); }

.btn-ghost { color: var(--ink-2); background: var(--paper-3); }
.btn-ghost:hover { color: var(--ink); background: var(--line-2); }

.btn-quiet { color: var(--ink-3); padding: 0 14px; }
.btn-quiet:hover { color: var(--ink); background: var(--paper-3); }

.btn-lg { --h: 56px; font-size: 16px; padding: 0 30px; }
.btn-sm { --h: 38px; font-size: 13px; padding: 0 16px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.is-on { background: var(--seal-soft); color: var(--seal-deep); border-color: var(--seal-line); }
.btn.danger { color: var(--seal); }
.btn.danger:hover { background: var(--seal-soft); color: var(--seal-deep); }

/* 圆形图标按钮 */
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  color: var(--ink-2); position: relative; flex: 0 0 auto;
  transition: background-color .18s, color .18s, transform .12s;
}
.icon-btn:hover { background: var(--paper-3); color: var(--ink); }
.icon-btn:active { transform: scale(.93); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.is-on { color: var(--seal); }
.icon-btn.bordered { border: 1px solid var(--line); }
.icon-btn .dot-badge {
  position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius:999px; background: var(--seal); color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center; border: 2px solid var(--paper); line-height: 1;
}

/* ---------------- 表单 ---------------- */
.field { margin-bottom: 22px; }
.field > label {
  display: block; font-size: 12px; font-weight: 700; color: var(--ink-2);
  margin: 0 0 9px; letter-spacing: .06em;
}
.field > label em { font-style: normal; font-weight: 400; color: var(--ink-4); letter-spacing: .02em; }
.inp {
  width: 100%; padding: 13px 16px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--paper-2);
  font-size: 15px; outline: none; color: var(--ink);
  transition: border-color .16s, box-shadow .16s, background-color .16s;
}
.inp::placeholder { color: var(--ink-4); }
.inp:focus { border-color: var(--seal); box-shadow: 0 0 0 4px var(--seal-soft); }
textarea.inp { min-height: 118px; line-height: 1.75; resize: vertical; }
.inp-lg { font-family: var(--serif); font-size: 20px; padding: 15px 16px; letter-spacing: -.01em; }

/* 分区章 */
.seal-picker { display: flex; gap: 9px; flex-wrap: wrap; }
.seal-chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 38px; padding: 0 16px; border-radius: var(--r-pill);
  border: 1px solid var(--line-strong); color: var(--ink-2);
  font-size: 13px; font-weight: 600; letter-spacing: .03em; transition: .16s;
}
.seal-chip:hover { border-color: var(--ink); color: var(--ink); }
.seal-chip.on { border-color: var(--ink); color: var(--paper-2); background: var(--ink); }

/* 标签输入 */
.tagbox {
  display: flex; flex-wrap: wrap; gap: 7px; padding: 9px 12px; min-height: 52px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--paper-2);
  align-items: center; transition: .16s;
}
.tagbox:focus-within { border-color: var(--seal); box-shadow: 0 0 0 4px var(--seal-soft); }
.tagbox input { flex: 1; min-width: 100px; border: 0; outline: none; background: transparent; font-size: 14px; padding: 4px 0; }
.tagbox .tg {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px;
  border-radius: var(--r-pill); background: var(--seal-soft); color: var(--seal-deep);
  font-size: 12px; font-weight: 600;
}
.tagbox .tg b { font-weight: 400; opacity: .55; cursor: pointer; font-size: 13px; }

/* 通用小胶囊 */
.chiprow { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 13px;
  border-radius: var(--r-pill); font-size: 13px; font-weight: 600; color: var(--ink-3);
  border: 1px solid var(--line); background: var(--paper-2); transition: .16s;
}
.pill:hover { color: var(--ink); border-color: var(--line-strong); }
.pill.on { background: var(--ink); border-color: var(--ink); color: var(--paper-2); }
.pill.plain { border-color: transparent; background: transparent; }

/* ---------------- 头像 ---------------- */
.ava {
  width: 32px; height: 32px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
  font-family: var(--serif); background: var(--paper-3); color: var(--ink-2);
  border: 1px solid var(--line); overflow: hidden; letter-spacing: 0;
}
.ava-lg { width: 64px; height: 64px; font-size: 26px; }
.ava-sm { width: 26px; height: 26px; font-size: 11px; }

/* ---------------- 骨架 ---------------- */
.sk {
  background: linear-gradient(100deg, var(--paper-3) 30%, var(--paper-2) 50%, var(--paper-3) 70%);
  background-size: 300% 100%; animation: sk 1.5s linear infinite; border-radius: var(--r-md);
}
@keyframes sk { from { background-position: 150% 0; } to { background-position: -50% 0; } }

/* ---------------- 动效 ---------------- */
@keyframes riseIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetUp { from { transform: translateY(26px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes popIn { from { transform: scale(.975); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes zoomIn { from { transform: scale(1.06); opacity: .6; } to { transform: none; opacity: 1; } }
.spin {
  width: 15px; height: 15px; border-radius: 50%; border: 2px solid currentColor;
  border-top-color: transparent; display: inline-block; animation: spin .7s linear infinite; opacity: .8;
}

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

/* ==========================================================================
   鎏金纹样底：两团柔光 + 细线菱形格，纸张上淡淡一层
   ========================================================================== */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    radial-gradient(58% 40% at 50% -6%, rgba(176, 138, 70, .16), transparent 72%),
    radial-gradient(46% 34% at 6% 104%, rgba(176, 138, 70, .13), transparent 72%),
    radial-gradient(38% 30% at 96% 88%, rgba(198, 158, 92, .11), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='none' stroke='%238e6b2e' stroke-opacity='0.17' stroke-width='0.8'%3E%3Cpath d='M40 3 77 40 40 77 3 40Z'/%3E%3Cpath d='M40 25 55 40 40 55 25 40Z'/%3E%3C/g%3E%3Ccircle cx='40' cy='40' r='1.5' fill='%238e6b2e' fill-opacity='0.3'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat, no-repeat, repeat;
  background-size: auto, auto, auto, 80px 80px;
}

/* 深色主题：换成亮一点的鎏金，照样淡 */
html[data-theme="dark"] body::before {
  background-image:
    radial-gradient(58% 40% at 50% -6%, rgba(207, 168, 92, .13), transparent 72%),
    radial-gradient(46% 34% at 6% 104%, rgba(207, 168, 92, .10), transparent 72%),
    radial-gradient(38% 30% at 96% 88%, rgba(224, 187, 116, .07), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='none' stroke='%23cfa85c' stroke-opacity='0.115' stroke-width='0.8'%3E%3Cpath d='M40 3 77 40 40 77 3 40Z'/%3E%3Cpath d='M40 25 55 40 40 55 25 40Z'/%3E%3C/g%3E%3Ccircle cx='40' cy='40' r='1.5' fill='%23cfa85c' fill-opacity='0.26'/%3E%3C/svg%3E");
}
/* ==========================================================================
   头像：图片模式
   用 inline-flex + 固定尺寸 + object-fit，避免各系统默认样式差异
   ========================================================================== */
.ava.ava-img {
  padding: 0; overflow: hidden; display: inline-flex;
  align-items: center; justify-content: center;
  line-height: 0; -webkit-mask-image: -webkit-radial-gradient(#fff, #000);
}
.ava.ava-img img {
  width: 100%; height: 100%; object-fit: cover; object-position: center;
  display: block; border-radius: inherit;
}
/* 头像上传按钮 */
.ava-edit {
  position: relative; display: inline-flex; cursor: pointer;
}
.ava-edit::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: rgba(21,20,15,.0); transition: background .18s;
}
.ava-edit:hover::after { background: rgba(21,20,15,.28); }
.ava-edit-tip {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  font-size: 11px; color: #fff; opacity: 0; transition: opacity .18s; white-space: nowrap;
  pointer-events: none; z-index: 2;
}
.ava-edit:hover .ava-edit-tip { opacity: 1; }