/* ============================================================
 * 中医技术速查 · 样式
 * 风格：克制的单强调色 + 纸感底色，Sarasa Gothic SC / Noto Sans SC
 * ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
  --paper: #F4F1EB;
  --card: #FFFFFF;
  --ink: #2E2823;
  --muted: #8B8076;
  --line: #E7E0D4;
  --accent: #8F3B2A;
  --accent-soft: #F5E8E3;
  --accent-ink: #6E2C1F;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body { height: 100%; }
body {
  font-family: "Sarasa Gothic SC", "Sarasa Term SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  background: #E9E4DA;
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 40px rgba(60, 45, 30, 0.12);
}

.page { flex: 1; padding-bottom: calc(64px + var(--safe-bottom)); }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 12px 16px 10px;
}
.topbar .app-title { font-size: 17px; font-weight: 600; letter-spacing: 0.5px; }
.topbar .app-sub { font-size: 11px; color: var(--muted); margin-top: 1px; }
.topbar .back-btn {
  float: right; margin-top: -2px;
  border: 1px solid var(--line); background: var(--paper);
  color: var(--muted); font-size: 12px;
  border-radius: 14px; padding: 3px 12px; cursor: pointer;
}

/* ---------- 通用 ---------- */
.wrap { padding: 12px 14px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
}
.card h3 {
  font-size: 13px; color: var(--accent-ink); font-weight: 600;
  margin-bottom: 8px; letter-spacing: 1px;
}
.chip {
  display: inline-block;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  margin: 0 6px 6px 0;
  cursor: pointer;
  user-select: none;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.point { border-color: #E3C9BF; background: var(--accent-soft); color: var(--accent-ink); }
.tag {
  display: inline-block; font-size: 11px; color: var(--accent-ink);
  background: var(--accent-soft); border-radius: 4px; padding: 1px 7px; margin-left: 8px;
}
.muted { color: var(--muted); font-size: 12px; }

/* ---------- 首页 ---------- */
.hero {
  background: linear-gradient(160deg, #9C4A36 0%, #8F3B2A 55%, #7C3223 100%);
  color: #F7EFE9;
  padding: 22px 16px 20px;
  border-radius: 0 0 16px 16px;
}
.hero .t1 { font-size: 20px; font-weight: 600; letter-spacing: 1px; }
.hero .t2 { font-size: 12px; opacity: 0.85; margin-top: 4px; }
.search-box {
  margin-top: 14px;
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.94);
  border-radius: 10px; padding: 8px 12px;
}
.search-box input {
  flex: 1; border: 0; outline: 0; background: transparent;
  font-size: 14px; font-family: inherit; color: var(--ink);
}
.search-box .icon { color: #A79A8B; font-size: 14px; }
.search-results { margin-top: 10px; background: #fff; border-radius: 10px; overflow: hidden; }
.search-results .sr-item { padding: 10px 12px; border-top: 1px solid var(--line); cursor: pointer; font-size: 13px; }
.search-results .sr-item:first-child { border-top: 0; }
.search-results .sr-item:active { background: var(--accent-soft); }
.search-results .sr-kind { float: right; font-size: 11px; color: var(--muted); }

.stat-row { display: flex; gap: 10px; margin-bottom: 12px; }
.stat-row .stat {
  flex: 1; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 0; text-align: center;
}
.stat b { display: block; font-size: 20px; color: var(--accent); font-weight: 600; }
.stat span { font-size: 11px; color: var(--muted); }

.cat-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-item {
  width: calc(33.33% - 6px);
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 6px 8px; text-align: center; cursor: pointer;
}
.cat-item .ci-icon {
  display: inline-block; width: 34px; height: 34px; line-height: 34px;
  border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink);
  font-size: 12px; font-weight: 600;
}
.cat-item .ci-name { display: block; font-size: 12px; margin-top: 6px; }
.cat-item .ci-n { font-size: 10px; color: var(--muted); }

/* ---------- 技术列表/详情 ---------- */
.tech-item {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 14px; margin-bottom: 10px; cursor: pointer;
}
.tech-item:active { background: #FBF7F2; }
.tech-item .ti-name { font-size: 15px; font-weight: 600; }
.tech-item .ti-brief {
  font-size: 12px; color: var(--muted); margin-top: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.chips-row { margin-top: 10px; }

.sect { margin-top: 14px; }
.sect-title {
  font-size: 13px; font-weight: 600; color: var(--accent-ink);
  border-left: 3px solid var(--accent); padding-left: 8px; margin-bottom: 8px;
  letter-spacing: 1px;
}
.sect ul { list-style: none; }
.sect ul li {
  font-size: 13px; padding: 6px 0 6px 0; border-bottom: 1px dashed var(--line);
}
.sect ul li:last-child { border-bottom: 0; }
.sect ul li .li-no { color: var(--accent); font-weight: 600; margin-right: 6px; }
.warn-box { background: #FBF3EF; border: 1px solid #EAD2C8; }
.ref-note { font-size: 11px; color: var(--muted); text-align: center; padding: 6px 0 2px; }

.tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.tbl th, .tbl td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.tbl th { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; white-space: nowrap; }
.tbl td.mono { white-space: nowrap; }

/* ---------- 穴位图谱 ---------- */
.atlas-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.atlas-stage {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 8px 6px 4px; text-align: center;
}
.atlas-stage svg { width: 100%; height: auto; display: block; }
.pt-dot { cursor: pointer; }
.pt-dot circle { transition: r 0.12s; }
.pt-dot:hover circle, .pt-dot.on circle { fill: #C4523C; }
.pt-dot text { pointer-events: none; }
.atlas-hint { font-size: 11px; color: var(--muted); text-align: center; margin-top: 6px; }
.pt-index {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; margin-top: 12px;
}
.pt-index .pi-row { display: inline-block; font-size: 12px; margin: 0 10px 6px 0; cursor: pointer; color: var(--accent-ink); }
.pt-index .pi-row:hover { text-decoration: underline; }

/* ---------- 底部弹层 ---------- */
.mask {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(30, 22, 16, 0.45);
}
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 95;
  max-width: 430px; margin: 0 auto;
  background: var(--card);
  border-radius: 16px 16px 0 0;
  padding: 18px 18px calc(18px + var(--safe-bottom));
  box-shadow: 0 -8px 30px rgba(40, 28, 18, 0.2);
  animation: sheetUp 0.22s ease-out;
}
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0.4; } to { transform: none; opacity: 1; } }
.sheet .sh-name { font-size: 18px; font-weight: 600; }
.sheet .sh-ch { font-size: 12px; color: var(--accent-ink); margin-left: 8px; }
.sheet .sh-close {
  float: right; width: 26px; height: 26px; line-height: 24px; text-align: center;
  border: 1px solid var(--line); border-radius: 50%; color: var(--muted);
  font-size: 14px; cursor: pointer; margin-top: -4px;
}
.sheet .sh-row { margin-top: 12px; font-size: 13px; }
.sheet .sh-row .sh-k { color: var(--accent-ink); font-weight: 600; margin-right: 6px; }

/* ---------- toast ---------- */
.toast-wrap {
  position: fixed; left: 0; right: 0; bottom: 90px; z-index: 120;
  display: flex; flex-direction: column; align-items: center;
  pointer-events: none;
}
.toast {
  background: rgba(40, 32, 26, 0.88); color: #F3EDE5;
  font-size: 13px; border-radius: 8px; padding: 8px 16px; margin-top: 8px;
  animation: toastIn 0.2s ease-out;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- tabbar ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  max-width: 430px; margin: 0 auto;
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-bottom);
}
.tab {
  flex: 1; text-align: center; padding: 8px 0 6px;
  font-size: 11px; color: var(--muted); cursor: pointer; user-select: none;
}
.tab .tab-icon { font-size: 18px; display: block; line-height: 1.2; }
.tab.on { color: var(--accent); }

@media (min-width: 460px) {
  .tabbar { border-radius: 0; }
}
