/* 拼好寮小助手 · Web 版样式
 * 设计沿用小程序那套：白底 + 柠檬绿点缀 + 近黑文字 + 大圆角 + 极浅投影
 */
:root {
  --ink: #141414;
  --ink-2: #3f3f3a;
  --muted: #6f6f6a;
  --faint: #8a8a87;
  --line: #f1f1ec;
  --tile: #f7f7f6;
  --lime: #c9f53f;
  --lime-2: #a6e31f;
  --red: #e2402f;
  --blue: #3c74c9;
  --bg: #ffffff;
  --radius: 20px;
  --tab-h: 58px;
  --safe: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { padding-bottom: calc(var(--tab-h) + var(--safe) + 8px); }

h1, h2, h3, p { margin: 0; }
button { font: inherit; border: 0; background: none; color: inherit; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 18px 12px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar h1 { font-size: 22px; font-weight: 800; letter-spacing: 0.4px; }

main { padding: 12px 14px 24px; }

/* ---------- 卡片 ---------- */
.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
  box-shadow: 0 1px 2px rgba(20, 20, 18, 0.05), 0 8px 24px rgba(20, 20, 18, 0.07);
}
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-title { font-size: 17px; font-weight: 800; letter-spacing: 0.3px; }
.card-sub { font-size: 12px; color: var(--faint); margin-top: 3px; }
.grow { flex: 1; min-width: 0; }

/* ---------- 通用小件 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 20px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s, opacity 0.12s;
}
.btn:active { transform: scale(0.97); }
.btn-lime { background: var(--lime-2); color: var(--ink); box-shadow: 0 4px 14px rgba(166, 227, 31, 0.3); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-ghost { background: var(--tile); color: var(--ink-2); }
.btn-sm { height: 34px; padding: 0 14px; font-size: 13px; }
.btn-block { width: 100%; }

.pill { display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill-gray { background: var(--tile); color: var(--ink-2); }

.empty { padding: 34px 12px; text-align: center; color: var(--faint); font-size: 13px; line-height: 1.7; }
.empty-ico { display: block; font-size: 30px; margin-bottom: 8px; opacity: 0.75; }

.foot { text-align: center; font-size: 11px; color: var(--faint); padding: 10px 0 4px; }

/* ---------- 环形进度 ---------- */
.ring {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ring-hole { width: 41px; height: 41px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; }
.ring-p { font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------- 分段控件 ---------- */
.seg { display: flex; background: #f2f2ee; border-radius: 12px; padding: 3px; margin: 12px 0 6px; }
.seg-i { flex: 1; text-align: center; line-height: 34px; font-size: 14px; color: var(--muted); border-radius: 9px; cursor: pointer; }
.seg-i.on { background: #fff; color: var(--ink); font-weight: 700; box-shadow: 0 1px 4px rgba(20, 20, 18, 0.1); }

/* ---------- 待办行 ---------- */
.td-row { display: flex; align-items: center; padding: 13px 0; border-bottom: 1px solid #f3f3ee; cursor: pointer; }
.td-row:last-child { border-bottom: 0; }
.td-dot {
  width: 22px; height: 22px; flex-shrink: 0; margin-right: 12px;
  border-radius: 50%; border: 2px solid #cfcfc7;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; color: #3d4a0e;
}
.td-dot.on { background: var(--lime-2); border-color: var(--lime-2); }
.td-tx { font-size: 15px; color: #1a1a1a; }
.td-tx.on { color: #9a9a94; text-decoration: line-through; }

/* ---------- 碎片 / 式神小卡 ---------- */
.chips { display: flex; flex-wrap: wrap; margin: -3px; }
.fchip {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 3px; padding: 4px 10px 4px 4px;
  background: var(--tile); border-radius: 999px;
  font-size: 13px; color: var(--ink-2);
  border: 1px solid transparent;
}
.fchip.hit { background: #f4fbd6; border-color: #dff0a8; }
.fchip-av { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; background: #eee; flex-shrink: 0; }
.fchip-q { color: var(--faint); font-size: 11px; }
.grp-lb { font-size: 12px; color: var(--faint); margin: 12px 0 6px; letter-spacing: 0.4px; }
.grp-lb.blue { color: var(--blue); }
.grp-lb.red { color: var(--red); }

/* ---------- 交换板 ---------- */
.bs-bar {
  display: flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 12px; margin: 10px 0 0;
  background: #fff; border-radius: 14px; cursor: pointer;
  box-shadow: 0 1px 2px rgba(20, 20, 18, 0.05), 0 4px 14px rgba(20, 20, 18, 0.05);
}
.bs-ico { opacity: 0.5; font-size: 14px; }
.bs-ph { font-size: 14px; color: #a9a9a4; }
.bs-tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 0; }
.bs-tag { font-size: 12px; background: #edf7c6; border-radius: 999px; padding: 3px 10px; }
.bs-clr { font-size: 12px; color: var(--muted); background: #f2f2ee; padding: 5px 10px; border-radius: 999px; }
.bs-res { margin-top: 8px; font-size: 12px; color: var(--muted); }

.row-card {
  background: #fff; border-radius: 18px; margin-bottom: 10px;
  box-shadow: 0 1px 2px rgba(20, 20, 18, 0.05), 0 6px 20px rgba(20, 20, 18, 0.06);
  overflow: hidden;
}
.rc-hd { display: flex; align-items: center; gap: 10px; padding: 14px; cursor: pointer; }
.rc-av { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: #eee; flex-shrink: 0; }
.rc-main { flex: 1; min-width: 0; }
.rc-nick { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.rc-meta { font-size: 12px; color: var(--faint); margin-top: 3px; }
.rc-gid { font-size: 11px; color: #6c7a8c; margin-top: 3px; }
.rc-badges { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.hb { font-size: 11px; padding: 3px 8px; border-radius: 8px; font-weight: 600; }
.hb-both { background: #edf7c6; color: #3d4a0e; }
.hb-get { background: #e6f0fb; color: var(--blue); }
.hb-give { background: #fdeceb; color: var(--red); }
.hb-none { background: var(--tile); color: var(--faint); }
.rc-body { padding: 0 14px 14px; }
.rc-tip { font-size: 12px; color: var(--faint); margin-top: 10px; }
.rc-self-tag { font-size: 10px; background: var(--ink); color: #fff; border-radius: 4px; padding: 1px 5px; }

.self-bar { display: flex; align-items: center; gap: 8px; padding: 12px 14px; }
.self-until { font-size: 12px; color: var(--faint); }

/* ---------- 底部 tab ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: center; gap: 4px;
  padding: 8px 10px calc(8px + var(--safe));
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1; max-width: 110px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 0; border-radius: 12px;
  font-size: 11px; color: var(--faint); cursor: pointer;
}
.tab.on { color: var(--ink); font-weight: 700; background: var(--tile); }
.tab-ico { font-size: 20px; line-height: 1; }

/* ---------- 弹层（式神选择器等） ---------- */
#overlay { position: fixed; inset: 0; z-index: 50; display: none; }
#overlay.show { display: block; }
.mask { position: absolute; inset: 0; background: rgba(20, 20, 18, 0.42); }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: 86vh; display: flex; flex-direction: column;
  background: #fff; border-radius: 22px 22px 0 0;
  padding-bottom: calc(10px + var(--safe));
  animation: sheet-in 0.26s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.sheet-hd { display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px; }
.sheet-title { font-size: 16px; font-weight: 800; flex: 1; }
.sheet-body { flex: 1; overflow: auto; padding: 0 16px 8px; -webkit-overflow-scrolling: touch; }
.sheet-ft { display: flex; gap: 10px; padding: 10px 16px 4px; }

.sp-search { display: flex; align-items: center; gap: 8px; background: var(--tile); border-radius: 12px; padding: 0 12px; height: 42px; margin-bottom: 10px; }
.sp-search input { flex: 1; border: 0; background: none; font-size: 15px; outline: none; }

.sp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sp-cell {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 4px; border-radius: 12px; background: var(--tile); cursor: pointer;
  border: 2px solid transparent;
}
.sp-cell.on { border-color: var(--lime-2); background: #f7fce0; }
.sp-cell img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: #eee; }
.sp-name { font-size: 11px; color: var(--ink-2); text-align: center; line-height: 1.2; }
.sp-tick {
  position: absolute; top: 4px; right: 4px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--lime-2); color: #141414;
  font-size: 10px; font-weight: 800; line-height: 16px; text-align: center;
}

/* toast */
#toast {
  position: fixed; left: 50%; bottom: calc(90px + var(--safe)); transform: translateX(-50%) translateY(8px);
  z-index: 60; padding: 10px 18px; border-radius: 999px;
  background: rgba(20, 20, 18, 0.9); color: #fff; font-size: 13px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 设置提示 */
.setup { font-size: 14px; line-height: 1.8; color: var(--ink-2); }
.setup code { background: var(--tile); padding: 2px 6px; border-radius: 6px; font-size: 12px; }
.setup ol { margin: 8px 0 0; padding-left: 18px; }

/* ================= 二级页（碎片库 / 交换板 / 发布） ================= */
.topbar .back {
  width: 34px;
  height: 34px;
  margin-right: 6px;
  border-radius: 10px;
  font-size: 26px;
  line-height: 30px;
  color: var(--ink);
  cursor: pointer;
}
body.no-tab { padding-bottom: 16px; }

.board-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }

/* 排序条 */
.sort-row { display: flex; align-items: center; gap: 8px; margin: 0 2px 10px; flex-wrap: wrap; }
.pill-dark { background: var(--ink); color: #fff; cursor: pointer; }
.pill-gray { background: var(--tile); color: var(--ink-2); cursor: pointer; }

/* ================= 碎片库栅格 ================= */
.lib-count { font-size: 12px; font-weight: 400; color: var(--faint); }

.sec-dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  margin-right: 7px;
  vertical-align: 1px;
}
.sec-dot.give { background: var(--lime-2); }
.sec-dot.need { background: #e9a23b; }

.lib-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px 8px;
  margin-top: 4px;
}

.lib-cell { cursor: pointer; }

.lib-pic {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: #efeeea;
  box-shadow: 0 1px 3px rgba(20, 20, 18, 0.10);
}
.lib-pic img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 稀有度角标 */
.lib-rar {
  position: absolute;
  left: 3px;
  bottom: 3px;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  color: #fff;
  background: rgba(20, 20, 18, 0.55);
}
.lib-rar.r-UR { background: #c8442e; }
.lib-rar.r-SP { background: #7b4bd8; }
.lib-rar.r-SSR { background: #b8892b; }
.lib-rar.r-SR { background: #5b6ee1; }
.lib-rar.r-R { background: #8a8a87; }

/* 数量角标 */
.lib-q {
  position: absolute;
  right: 3px;
  bottom: 3px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #e2402f;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(226, 64, 47, 0.4);
}

.lib-name {
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.3;
  color: var(--ink-2);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 添加入口 */
.lib-acts { display: flex; gap: 8px; margin-bottom: 8px; }
.lib-act {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 0;
  border-radius: 14px;
  background: var(--tile);
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
}
.lib-act:active { background: #ededea; }
.lib-act-ico { font-size: 20px; line-height: 1; }

/* 首页功能格 */
.fn-grid { display: flex; gap: 10px; }
.fn-item {
  flex: 1;
  padding: 14px 12px;
  border-radius: 16px;
  background: var(--tile);
  box-shadow: 0 2px 8px rgba(20, 20, 18, 0.05);
  cursor: pointer;
}
.fn-ico { font-size: 22px; line-height: 1; margin-bottom: 8px; }
.fn-name { font-size: 15px; font-weight: 700; }
.fn-desc { font-size: 11px; color: var(--faint); margin-top: 3px; }

/* ================= 截图识别 ================= */
.scan-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 30px 16px;
  border: 2px dashed #d9d9d2;
  border-radius: 16px;
  background: #fafaf7;
  color: var(--ink-2);
  font-size: 14px;
  cursor: pointer;
}
.scan-drop.over { border-color: var(--lime-2); background: #f7fce0; }
.scan-ico { font-size: 28px; line-height: 1; }

.scan-sides { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

.scan-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid #f3f3ee;
}
.scan-check {
  width: 22px; height: 22px; flex-shrink: 0;
  border-radius: 8px;
  border: 2px solid #cfcfc7;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; color: #3d4a0e;
  cursor: pointer;
}
.scan-check.on { background: var(--lime-2); border-color: var(--lime-2); }
.scan-av { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: #eee; flex-shrink: 0; }
.scan-name { font-size: 15px; font-weight: 600; }
.scan-name.bad { color: #e2402f; }
.scan-raw { font-size: 11px; color: var(--faint); }
.scan-side { font-size: 11px; color: var(--blue); }
.scan-qty { width: 26px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ================= 碎片库（对齐 pages/exchange） ================= */
.toolbar { display: flex; align-items: center; padding: 0 4px 10px; flex-wrap: wrap; }
.tb-lb { font-size: 11px; color: #70706D; margin-right: 8px; }
.sort-chip {
  font-size: 11px;
  color: #7C7C79;
  background: #fff;
  border-radius: 999px;
  padding: 4px 9px;
  margin-right: 5px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.sort-chip.on { background: #F7F7F6; color: #141414; font-weight: 700; }

.card.sec { padding: 15px 16px 12px; }

.sec-hd { display: flex; align-items: center; margin-bottom: 4px; }
.sec-dot { width: 8px; height: 8px; border-radius: 2px; margin-right: 7px; flex-shrink: 0; }
.sec-dot.owned { background: linear-gradient(135deg, #C9F53F, #A6E31F); }
.sec-title { font-size: 16px; font-weight: 700; color: #141414; }
.sec-stat { font-size: 11px; color: #70706D; margin-left: 8px; }
.sec-clear {
  font-size: 11px; color: #9AA9A1; padding: 3px 6px; border-radius: 6px; cursor: pointer;
}
.sec-clear:active { color: #D4483B; }

.grid { display: flex; flex-wrap: wrap; margin: 8px -2.5px 0; }
.cell { width: 25%; padding: 2.5px; cursor: pointer; box-sizing: border-box; }
.cell-av {
  position: relative;
  width: 100%;
  padding-top: 100%;
  border-radius: 9px;
  background: #EDEDEB;
  overflow: hidden;
}
.cell-img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; object-fit: cover; }

/* 稀有度：左下白底彩字 */
.cell-tag {
  position: absolute; left: 2px; bottom: 2px;
  font-size: 8px; line-height: 1; padding: 2px 4px;
  border-radius: 3px; font-weight: 700;
  background: rgba(255, 255, 255, 0.95);
}
.cell-tag.tag-UR { color: #C8442E; }
.cell-tag.tag-SP { color: #7B4BD8; }
.cell-tag.tag-SSR { color: #B8892B; }
.cell-tag.tag-SR { color: #5B6EE1; }
.cell-tag.tag-R { color: #8A8A87; }
.cell-tag.tag-N { color: #A9A9A4; }

/* 数量：右下白底红字 */
.cell-q {
  position: absolute; right: 2px; bottom: 2px;
  min-width: 19px; height: 16px; line-height: 16px;
  padding: 0 4px; border-radius: 4px;
  background: rgba(255, 255, 255, 0.95);
  color: #E2402F; font-size: 11px; font-weight: 800;
  text-align: center; font-variant-numeric: tabular-nums;
}
.cell-nm {
  font-size: 10px; color: #1A1A1A; margin-top: 4px;
  line-height: 1.3; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  text-align: center;
}

.tap-hint { text-align: center; font-size: 10px; color: #8A8A87; margin-top: 8px; }
.empty-inline { font-size: 12px; color: #7C7C79; line-height: 1.6; margin-top: 10px; text-align: center; }

.add-bar { display: flex; margin: 10px -2.5px 0; padding-top: 3px; }
.add-btn {
  flex: 1; margin: 0 2.5px; padding: 7px 2px 6px;
  background: #F7F7F6; border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  cursor: pointer; transition: background .15s;
}
.add-btn:active { background: #EAF4EF; }
.ab-ico { font-size: 14px; line-height: 1.2; }
.ab-tx { font-size: 10px; color: #4A4A47; }

.manual-box { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.manual-input {
  flex: 1; height: 38px; border: 0; background: #F7F7F6; border-radius: 8px;
  padding: 0 11px; font-size: 14px; outline: none; color: #141414;
}
.manual-go {
  width: 59px; height: 38px; line-height: 38px; text-align: center;
  background: #A6E31F; color: #141414; font-weight: 700; font-size: 14px;
  border-radius: 8px; cursor: pointer;
}

/* 交换板入口卡 */
.board-entry { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.be-ico { font-size: 20px; line-height: 1; }
.be-title { font-size: 15px; font-weight: 700; }
.be-sub { font-size: 11px; color: #8A8A87; margin-top: 2px; }
.be-arrow { font-size: 20px; color: #C6C6C0; }

/* 用法说明 */
.step { display: flex; align-items: flex-start; gap: 9px; margin-top: 10px; }
.step-no {
  width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px;
  border-radius: 50%; background: #F2F2EE; color: #6F6F6A;
  font-size: 10px; font-weight: 700; text-align: center; line-height: 17px;
}
.step-tx { font-size: 12px; color: #3F3F3A; line-height: 1.65; }
.step-tx b { font-weight: 700; color: #141414; }
.hint { font-size: 11px; color: #8A8A87; line-height: 1.7; margin-top: 12px; }

/* 粘贴预览 */
.sheet-preview { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.sp-item {
  display: flex; align-items: center; gap: 5px;
  background: #F7F7F6; border-radius: 999px; padding: 3px 9px 3px 3px;
}
.sp-av { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; background: #eee; }
.sp-nm { font-size: 12px; color: #3F3F3A; }
.sp-nm.unknown { color: #E2402F; }
.sp-q { font-size: 11px; color: #8A8A87; }

/* ================= 我的（对齐 pages/me） ================= */
.profile { display: flex; align-items: center; gap: 12px; padding: 6px 4px 14px; }
.profile .rc-av { width: 56px; height: 56px; font-size: 22px; }
.pf-main { flex: 1; min-width: 0; }
.pf-nick {
  width: 100%; border: 0; background: none; outline: none;
  font-size: 20px; font-weight: 800; color: var(--ink); padding: 2px 0;
}
.pf-nick::placeholder { color: #B9B9B4; font-weight: 600; }
.pf-meta { display: flex; align-items: center; gap: 6px; margin-top: 5px; font-size: 11px; color: var(--faint); }
.pf-dot { width: 6px; height: 6px; border-radius: 50%; background: #D9D9D2; }
.pf-dot.ok { background: #17A673; }

.stat-row { display: flex; align-items: center; padding: 4px 0 14px; }
.stat-cell { flex: 1; text-align: center; cursor: pointer; }
.stat-num { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; }
.stat-num.red { color: #E2402F; }
.stat-lb { font-size: 11px; color: var(--muted); margin-top: 3px; }
.stat-line { width: 1px; height: 30px; background: var(--line); }
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; }

.set-row { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.set-row:first-of-type { border-top: 0; }
.set-row.link { cursor: pointer; }
.set-tx { font-size: 14px; font-weight: 600; color: var(--ink); }
.set-sub { font-size: 11px; color: var(--faint); margin-top: 3px; line-height: 1.5; }
.set-arrow { font-size: 20px; color: #C6C6C0; }

/* 开关 */
.sw {
  width: 46px; height: 28px; border-radius: 999px; background: #E4E4DF;
  position: relative; flex-shrink: 0; cursor: pointer; transition: background .18s;
}
.sw.on { background: #17A673; }
.sw-knob {
  position: absolute; top: 2px; left: 2px; width: 24px; height: 24px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: transform .18s;
}
.sw.on .sw-knob { transform: translateX(18px); }

.sync-tag { font-size: 11px; padding: 3px 8px; border-radius: 6px; background: #EAF5F0; color: #17A673; }
.sync-tag.saving { background: #EEF3FF; color: #3C74C9; }

.btn-danger { background: #FDECEA; color: #D4483B; }
.btn-danger:active { background: #F9DCD7; }

.fault {
  display: flex; align-items: center; gap: 10px;
  background: #FDECEA; border: 1px solid #F7C9C2; border-radius: 14px;
  padding: 10px 12px; margin-bottom: 10px;
}
.fault-ico {
  width: 18px; height: 18px; flex-shrink: 0; border-radius: 50%;
  background: #E2402F; color: #fff; font-size: 12px; font-weight: 800;
  text-align: center; line-height: 18px;
}
.fault-title { font-size: 13px; font-weight: 700; color: #B4322A; }
.fault-hint { font-size: 11px; color: #B4322A; opacity: .8; margin-top: 2px; }
.fault-btn { font-size: 12px; font-weight: 700; color: #fff; background: #E2402F; border-radius: 999px; padding: 5px 12px; }

/* ================= 发布（对齐 subpages/publish） ================= */
.pub-page { padding-bottom: 76px; }
.tip {
  display: flex; gap: 10px; padding: 12px 14px; margin-bottom: 10px;
  background: #F7F7F6; border-radius: 14px;
}
.tip-ico { font-size: 16px; line-height: 1.4; }
.tip-t { font-size: 14px; font-weight: 700; }
.tip-s { font-size: 11px; color: var(--faint); margin-top: 3px; line-height: 1.5; }
.tip-pub { font-size: 11px; color: var(--muted); margin-top: 5px; }

.gid-card { padding-bottom: 14px; }
.gid-row { display: flex; align-items: center; background: #F7F7F6; border-radius: 12px; padding: 0 12px; height: 44px; }
.gid-in { flex: 1; min-width: 0; height: 44px; border: 0; background: none; font-size: 15px; outline: none; color: var(--ink); }
.gid-clr { font-size: 11px; color: var(--muted); background: #EDEDEA; padding: 4px 8px; border-radius: 999px; cursor: pointer; }

.sec-dot.gid { background: #8AA6C8; }
.sec-dot.need { background: #E9A23B; }
.mini-act { font-size: 11px; color: var(--muted); padding: 3px 7px; border-radius: 6px; background: var(--tile); margin-left: 5px; cursor: pointer; }

/* 勾选覆盖在头像右上角 */
.cell-pick {
  position: absolute; right: 2px; top: 2px;
  width: 17px; height: 17px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid #CFCFC7;
  font-size: 10px; font-weight: 800; line-height: 13px; text-align: center;
  color: #3D4A0E;
}
.cell-pick.on { background: var(--lime-2); border-color: var(--lime-2); }

/* 底部固定发布条 */
.pub-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--line);
}
.pb-info { flex: 1; font-size: 13px; color: var(--muted); }
.pb-num { font-size: 17px; font-weight: 800; color: var(--ink); }
.pb-btn {
  padding: 11px 22px; border-radius: 999px;
  background: var(--lime-2); color: var(--ink); font-size: 15px; font-weight: 800;
  box-shadow: 0 4px 14px rgba(166, 227, 31, .32); cursor: pointer;
}
.pb-btn:active { transform: scale(0.97); }

/* ================= 首页叠卡 ================= */
.deck { position: relative; }
.deck-slot { position: relative; }
.deck-card {
  overflow: hidden;
  border-radius: 20px;
  box-shadow: 0 2px 4px rgba(20, 20, 18, .05), 0 12px 30px rgba(20, 20, 18, .09);
  transform-origin: 50% 0;
  transition: height .46s cubic-bezier(.16, 1, .3, 1),
              transform .46s cubic-bezier(.16, 1, .3, 1),
              margin .46s cubic-bezier(.16, 1, .3, 1);
}
.deck-card .card {
  margin: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}
.deck.closed .card { padding-bottom: 0; }

/* 收拢时整块可点 */
.deck-hit { position: absolute; inset: 0; z-index: 40; cursor: pointer; }

.deck-cap { display: flex; align-items: center; margin: 0 2px 8px; }
.cap-l { font-size: 11px; color: var(--faint); }
.cap-r {
  font-size: 11px; color: var(--ink-2); background: var(--tile);
  padding: 4px 10px; border-radius: 999px; cursor: pointer;
}
.deck-collapse {
  display: flex; align-items: center; justify-content: center; gap: 5px;
  width: 96px; height: 32px; margin: 10px auto 14px;
  border-radius: 999px; background: #F2F2EE; color: var(--muted);
  font-size: 12px; cursor: pointer;
}

/* 叠卡里的卡片内部元素 */
.fn-grid { display: flex; gap: 8px; }
.fn-item { flex: 1; padding: 12px 10px; border-radius: 14px; background: rgba(255,255,255,.72); cursor: pointer; }
.fn-ico { font-size: 20px; line-height: 1; margin-bottom: 7px; }
.fn-name { font-size: 14px; font-weight: 700; }
.fn-desc { font-size: 11px; color: var(--faint); margin-top: 2px; }

.hot-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; }
.hot-item:first-of-type { border-top: 0; }
.hot-nick { font-size: 14px; font-weight: 600; }
.hot-meta { font-size: 11px; color: var(--faint); margin-top: 2px; }
.hot-badges { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }

/* 深色卡：文字翻白 */
.deck-card.is-dark .card-title,
.deck-card.is-dark .fn-name,
.deck-card.is-dark .hot-nick,
.deck-card.is-dark .td-tx { color: #FFFFFF; }
.deck-card.is-dark .card-sub,
.deck-card.is-dark .fn-desc,
.deck-card.is-dark .hot-meta,
.deck-card.is-dark .tf-hint { color: #C9C9C3; }
.deck-card.is-dark .td-row { border-bottom-color: rgba(255,255,255,.10); }
.deck-card.is-dark .td-dot { border-color: rgba(255,255,255,.34); }
.deck-card.is-dark .seg { background: rgba(255,255,255,.12); }
.deck-card.is-dark .seg-i { color: #C9C9C3; }
.deck-card.is-dark .seg-i.on { background: #FFFFFF; color: #141414; }
.deck-card.is-dark .ring-hole { background: #141414; }
.deck-card.is-dark .ring-p { color: #FFFFFF; }
.deck-card.is-dark .fn-item { background: rgba(255,255,255,.10); }
.deck-card.is-dark .hot-item { border-top-color: rgba(255,255,255,.12); }

/* 配色面板 */
.pal-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.pal-tab {
  flex: 1; text-align: center; font-size: 12px; color: var(--muted);
  line-height: 30px; border-radius: 8px; background: var(--tile); cursor: pointer;
}
.pal-tab.on { background: var(--ink); color: #fff; font-weight: 700; }
.pal-row { display: flex; flex-wrap: wrap; margin: 0 -4px; }
.pal-i {
  width: calc(33.333% - 8px); height: 58px; margin: 4px; border-radius: 13px;
  border: 2px solid rgba(20,20,18,.10); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.pal-i.on { border-color: #141414; box-shadow: 0 0 0 3px #fff, 0 0 0 6px rgba(20,20,18,.85); }
.pal-tick { font-size: 20px; font-weight: 800; color: #141414; }
.pal-i.dark .pal-tick { color: #fff; }

/* ================= OCR 进度条 ================= */
.prog { height: 6px; border-radius: 999px; background: #EFEFEA; overflow: hidden; margin-top: 14px; }
.prog-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, #C9F53F, #A6E31F);
  border-radius: 999px;
  transition: width .3s cubic-bezier(.16,1,.3,1);
}
.prog-tx { font-size: 11px; color: var(--blue); margin-top: 6px; }

/* ================= 式神库（对齐 subpages/picker） ================= */
.pk-page { padding-bottom: 64px; }
.pk-head { padding: 0 0 8px; }
.pk-search {
  display: flex; align-items: center; gap: 8px;
  background: #F7F7F6; border-radius: 12px; height: 42px; padding: 0 12px;
}
.pk-ico { font-size: 14px; opacity: .5; }
.pk-input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 15px; color: var(--ink); }
.pk-clr { font-size: 12px; color: var(--faint); padding: 2px 6px; cursor: pointer; }

.pk-chips { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 2px; -webkit-overflow-scrolling: touch; }
.pk-chip {
  flex-shrink: 0; font-size: 12px; color: #7C7C79; background: #fff;
  border-radius: 999px; padding: 5px 11px; cursor: pointer;
  box-shadow: 0 1px 4px rgba(20,20,18,.05);
}
.pk-chip.on { background: #141414; color: #fff; font-weight: 700; }

.pk-sortrow { display: flex; align-items: center; gap: 6px; padding: 2px 0 8px; flex-wrap: wrap; }
.pk-sortlb { font-size: 11px; color: var(--faint); }
.pk-sortchip { font-size: 11px; color: #7C7C79; background: #F7F7F6; border-radius: 999px; padding: 4px 9px; cursor: pointer; }
.pk-sortchip.on { background: #141414; color: #fff; font-weight: 700; }
.pk-cnt { font-size: 11px; color: var(--faint); }

.pk-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 8px; }
.pk-cell { cursor: pointer; }
.pk-av { position: relative; width: 100%; padding-top: 100%; border-radius: 12px; background: #EDEDEB; overflow: hidden; }
.pk-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pk-check {
  position: absolute; right: 3px; top: 3px;
  width: 17px; height: 17px; border-radius: 50%;
  background: var(--lime-2); color: #141414;
  font-size: 10px; font-weight: 800; line-height: 17px; text-align: center;
}
.pk-added { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(20,20,18,.55); color: #fff; font-size: 9px; text-align: center; line-height: 15px; }
.pk-cell.on .pk-av { outline: 2px solid var(--lime-2); outline-offset: 1px; }
.pk-cell.added .pk-av { opacity: .72; }
.pk-nm { font-size: 11px; color: var(--ink-2); margin-top: 4px; text-align: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pk-meta { font-size: 9px; text-align: center; margin-top: 1px; color: var(--faint); }
.pk-meta.tag-UR { color: #C8442E; }
.pk-meta.tag-SP { color: #7B4BD8; }
.pk-meta.tag-SSR { color: #B8892B; }
.pk-meta.tag-SR { color: #5B6EE1; }

.pk-pad { height: 16px; }
.pk-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(255,255,255,.96);
  backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--line);
}
.pk-barcnt { flex: 1; font-size: 13px; color: var(--muted); }
.pk-barnum { font-size: 17px; font-weight: 800; color: var(--ink); }
.pk-cancel { font-size: 14px; color: var(--muted); padding: 9px 14px; border-radius: 999px; background: var(--tile); cursor: pointer; }
.pk-ok {
  font-size: 15px; font-weight: 800; color: var(--ink);
  background: var(--lime-2); padding: 10px 22px; border-radius: 999px;
  box-shadow: 0 4px 14px rgba(166,227,31,.3); cursor: pointer;
}
.pk-ok.dis { background: #E4E4DF; color: #A9A9A4; box-shadow: none; }

/* ================= 截图识别结果 ================= */
.res-tip { font-size: 11px; color: #B4322A; background: #FDECEA; border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; }
.res-item { display: flex; align-items: center; gap: 9px; padding: 9px 0; border-top: 1px solid var(--line); }
.res-item:first-of-type { border-top: 0; }
.res-av { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; background: #eee; flex-shrink: 0; }
.res-main { flex: 1; min-width: 0; }
.res-nm { font-size: 15px; font-weight: 600; }
.res-nm.unknown { color: #E2402F; }
.res-meta { font-size: 11px; color: var(--faint); margin-top: 2px; }
.stepper { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.step-btn {
  width: 26px; height: 26px; line-height: 24px; text-align: center;
  border-radius: 8px; background: var(--tile); font-size: 15px; color: var(--ink-2); cursor: pointer;
}
.step-num { width: 30px; text-align: center; font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; }
