/* 咒语集 — 暖黑 / 宣纸 / 朱砂（「迹」同族设计语言） */

:root {
  --bg: #14110f;
  --surface: #1d1a17;
  --surface-2: #25211d;
  --fg: #eae5dc;
  --muted: #97908a;
  --line: #2e2a25;
  --ac: #cf7f6f;
  --ok: #7fae8f;
  --mono: ui-monospace, "SF Mono", Consolas, Menlo, monospace;
  --serif: "ZCOOL XiaoWei", "Songti SC", "Noto Serif SC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
}

html:not(.dark) {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #efece5;
  --fg: #22201d;
  --muted: #86817a;
  --line: #e6e1d8;
  --ac: #b0524a;
}

* { box-sizing: border-box; }

body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: "ZCOOL XiaoWei", "Songti SC", -apple-system, BlinkMacSystemFont,
               "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
               "Segoe UI", Roboto, sans-serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background .3s, color .3s;
}

a { color: inherit; }
::selection { background: var(--ac); color: #fff; }

.mode-switch {
  position: fixed; top: 16px; right: 16px; z-index: 30;
  width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  color: var(--fg); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: border-color .2s, transform .2s;
}
.mode-switch:hover { border-color: var(--ac); transform: scale(1.06); }

/* ---------- Hero ---------- */

.hero { text-align: center; padding: clamp(48px, 10vh, 92px) 20px 4px; position: relative; }
.hero .cap { margin: 0; font-size: 12px; letter-spacing: .5em; text-indent: .5em; color: var(--muted); }
.hero .title {
  margin: 8px 0 6px;
  font-size: clamp(40px, 8vw, 72px);
  font-weight: 400; letter-spacing: .16em; text-indent: .16em; line-height: 1.15;
}
.hero .meta { margin: 0; font-size: 13px; color: var(--muted); }

.add-btn {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 22px;
  padding: 10px 22px; border: 1px solid var(--ac); border-radius: 999px;
  background: transparent; color: var(--ac); font-size: 14px; cursor: pointer;
  font-family: inherit; letter-spacing: .08em;
  transition: background .2s, color .2s, transform .2s;
}
.add-btn:hover { background: var(--ac); color: #fff; transform: translateY(-1px); }

/* ---------- 提示条 ---------- */

.flash {
  max-width: 760px; margin: 20px auto 0; padding: 10px 18px;
  border-radius: 10px; font-size: 13.5px; text-align: center;
}
.flash.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.flash.err { background: color-mix(in srgb, var(--err, #c96a5a) 14%, transparent); color: var(--err); }

.flash-js {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ac); color: #fff; font-size: 13px;
  padding: 8px 18px; border-radius: 999px; z-index: 60;
}

/* ---------- 分类页签 ---------- */

.wrap { max-width: 900px; margin: 0 auto; padding: 26px 20px 70px; }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 22px; }
.tab {
  padding: 6px 15px; font-size: 13.5px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px;
  background: transparent; cursor: pointer; transition: all .2s;
}
.tab:hover { color: var(--fg); }
.tab.active {
  color: var(--ac); border-color: var(--ac);
  background: color-mix(in srgb, var(--ac) 12%, transparent);
}
.tab i { font-style: normal; opacity: .65; font-size: 11.5px; margin-left: 4px; }

/* ---------- 咒语卡片 ---------- */

.cards { display: grid; gap: 14px; }

.pcard {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 16px 18px 13px;
  transition: border-color .25s;
}
.pcard:hover { border-color: color-mix(in srgb, var(--ac) 45%, var(--line)); }

.pc-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.p-title { margin: 0; font-size: 18px; letter-spacing: .05em; font-weight: 400; }
.p-cat {
  flex: none; font-size: 11px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 1px 10px;
}

.p-text {
  margin: 10px 0 0; font-size: 14.5px; line-height: 1.85;
  color: var(--fg);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.pcard.open .p-text { -webkit-line-clamp: unset; display: block; }

.p-remarks {
  margin: 10px 0 0; padding: 8px 12px;
  background: var(--surface-2); border-radius: 8px;
  font-size: 12px; color: var(--muted); font-family: var(--mono);
  word-break: break-all;
}

.p-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line);
}
.p-date { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.p-acts { display: flex; gap: 6px; }
.mini {
  width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: color .2s, border-color .2s;
}
.mini:hover { color: var(--ac); border-color: var(--ac); }
.mini.act-copy.done { color: var(--ok); border-color: var(--ok); }

.clamp-btn {
  border: 0; background: transparent; color: var(--ac); cursor: pointer;
  font-size: 12px; padding: 4px 0 0; font-family: inherit;
  display: none;
}
.pcard.clampable .clamp-btn { display: inline-block; }

/* ---------- 空态 ---------- */

.empty { text-align: center; color: var(--muted); padding: 60px 0; }

/* ---------- 表单弹层 ---------- */

.modal {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(10, 8, 6, .72);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal[hidden] { display: none; }

.sheet {
  width: min(560px, 100%); max-height: 90vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 22px 22px 18px;
  animation: pop .28s cubic-bezier(.2, .8, .3, 1);
}
@keyframes pop { from { opacity: 0; transform: scale(.97); } }
.sheet h3 { margin: 0 0 16px; font-size: 19px; font-weight: 400; letter-spacing: .08em; }

.sheet label { display: block; font-size: 12.5px; color: var(--muted); margin: 12px 0 0; }
.sheet input, .sheet textarea {
  display: block; width: 100%; margin-top: 5px;
  padding: 10px 12px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 9px;
  color: var(--fg); font-size: 14px; font-family: inherit; line-height: 1.7;
  outline: none; transition: border-color .2s; resize: vertical;
}
.sheet input:focus, .sheet textarea:focus { border-color: var(--ac); }
.sheet .f-acts { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.btn { padding: 9px 22px; border-radius: 9px; font-size: 14px; cursor: pointer; transition: all .2s; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.btn.ghost:hover { color: var(--fg); }
.btn.main { background: var(--ac); border: 1px solid var(--ac); color: #fff; }
.btn.main:hover { filter: brightness(1.08); }

/* ---------- 页脚 ---------- */

.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 0 20px 40px; }

/* ---------- 小屏 ---------- */

@media (max-width: 640px) {
  .wrap { padding: 20px 14px 50px; }
  .hero { padding-top: 42px; }
  .hero .title { font-size: clamp(34px, 10vw, 52px); }
  .p-text { font-size: 14px; }
}
