/* =========================================================
   歧络学堂 · 移动端样式
   视觉基调：宣纸米白 + 艾草墨绿 + 朱砂点睛，克制、可信、不花哨
   ========================================================= */

:root {
  --ink: #1B2A25;
  --ink-2: #46564F;
  --ink-3: #85948D;
  --ink-4: #A9B5AF;

  --brand: #1F4B3A;
  --brand-2: #2C6B52;
  --brand-3: #3F8B6C;
  --brand-soft: #E9F2EC;
  --brand-line: #CFE2D7;

  --sand: #FBF8F2;
  --sand-2: #F4EFE5;
  --card: #FFFFFF;
  --line: #EBE4D8;
  --line-2: #F2ECE2;

  --cinnabar: #B5432F;
  --cinnabar-soft: #FBEDEA;
  --cinnabar-line: #F2D3CC;

  --gold: #C09A3E;
  --gold-soft: #FAF2DF;

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-full: 999px;

  --sh-1: 0 1px 2px rgba(27, 42, 37, .04), 0 2px 8px rgba(27, 42, 37, .04);
  --sh-2: 0 4px 16px rgba(27, 42, 37, .08);
  --sh-3: 0 12px 32px rgba(27, 42, 37, .14);

  --tabbar-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --header-h: 0px;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: #EFEAE1;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body { min-height: 100dvh; }

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { border: none; background: none; cursor: pointer; padding: 0; }
img { max-width: 100%; display: block; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p { margin: 0; }

/* ---------------- 应用容器 ---------------- */
#app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--sand);
  position: relative;
  box-shadow: 0 0 60px rgba(27, 42, 37, .08);
}

.boot {
  min-height: 100dvh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
  color: var(--ink-3);
}
.boot-logo {
  width: 64px; height: 64px; border-radius: 20px;
  background: linear-gradient(145deg, var(--brand), var(--brand-2));
  color: #F3E9D2; font-size: 34px; font-family: serif;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--sh-2);
}

/* ---------------- 页面骨架 ---------------- */
.page {
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px);
  min-height: 100dvh;
}
.page.no-tab { padding-bottom: calc(var(--safe-b) + 24px); }

/* ---------------- 顶部栏 ---------------- */
.hero {
  position: relative;
  padding: calc(env(safe-area-inset-top, 0px) + 22px) 20px 0;
  background:
    radial-gradient(120% 80% at 85% 0%, rgba(192, 154, 62, .22) 0%, rgba(192, 154, 62, 0) 55%),
    radial-gradient(100% 70% at 0% 100%, rgba(63, 139, 108, .35) 0%, rgba(63, 139, 108, 0) 60%),
    linear-gradient(160deg, #17392C 0%, #1F4B3A 45%, #27604A 100%);
  color: #F0EBDF;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%23F3E9D2' stroke-width='1' stroke-opacity='.10'%3E%3Ccircle cx='60' cy='60' r='44'/%3E%3Ccircle cx='60' cy='60' r='30'/%3E%3Ccircle cx='60' cy='60' r='16'/%3E%3Cpath d='M60 8v104M8 60h104M23 23l74 74M97 23l-74 74'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 260px;
  background-position: right -70px top -50px;
  background-repeat: no-repeat;
  opacity: .5;
  pointer-events: none;
}
.hero-top {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.brand-line { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-seal {
  width: 40px; height: 40px; flex: 0 0 40px; border-radius: 12px;
  background: rgba(243, 233, 210, .12);
  border: 1px solid rgba(243, 233, 210, .35);
  display: flex; align-items: center; justify-content: center;
  font-family: serif; font-size: 21px; color: #F3E9D2;
  letter-spacing: 0;
}
.brand-text { min-width: 0; }
.brand-name {
  font-size: 19px; font-weight: 700; letter-spacing: 2px; line-height: 1.2;
  font-family: "Songti SC", "SimSun", serif;
}
.brand-sub {
  font-size: 11.5px; color: rgba(240, 235, 223, .62);
  margin-top: 2px; letter-spacing: .3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hero-icon-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(243, 233, 210, .1);
  border: 1px solid rgba(243, 233, 210, .22);
  display: flex; align-items: center; justify-content: center;
  color: #F0EBDF; flex: 0 0 auto;
}
.hero-icon-btn svg { width: 19px; height: 19px; fill: currentColor; }

/* 搜索框 */
.searchbar {
  position: relative; z-index: 3;
  margin: 18px 0 0;
  display: flex; align-items: center; gap: 9px;
  background: rgba(255, 255, 255, .96);
  border-radius: var(--r-full);
  padding: 10px 16px;
  box-shadow: 0 6px 20px rgba(10, 25, 18, .18);
}
.searchbar svg { width: 17px; height: 17px; fill: var(--ink-4); flex: 0 0 17px; }
.searchbar input {
  flex: 1; min-width: 0; border: none; outline: none; background: transparent;
  font-size: 14.5px; padding: 0;
}
.searchbar input::placeholder { color: var(--ink-4); }
.searchbar .sb-go {
  font-size: 13px; color: var(--brand); font-weight: 600; flex: 0 0 auto;
}

/* 头部统计 */
.hero-stats {
  position: relative; z-index: 2;
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin: 16px -4px 0;
  padding: 14px 0 18px;
  border-top: 1px solid rgba(243, 233, 210, .12);
}
.hero-stats .hs { text-align: center; position: relative; }
.hero-stats .hs + .hs::before {
  content: ""; position: absolute; left: 0; top: 12%;
  width: 1px; height: 76%; background: rgba(243, 233, 210, .14);
}
.hero-stats b {
  display: block; font-size: 19px; font-weight: 700; color: #F3E9D2;
  font-variant-numeric: tabular-nums; letter-spacing: .5px;
}
.hero-stats span { font-size: 11px; color: rgba(240, 235, 223, .55); }

/* ---------------- 通用版块 ---------------- */
.section { padding: 22px 16px 0; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}
.section-title {
  font-size: 17px; font-weight: 700; letter-spacing: .4px;
  display: flex; align-items: center; gap: 8px;
}
.section-title::before {
  content: ""; width: 3px; height: 15px; border-radius: 2px;
  background: linear-gradient(var(--brand-2), var(--brand-3));
}
.section-sub { font-size: 12px; color: var(--ink-4); }
.section-more {
  font-size: 12.5px; color: var(--brand-2); display: inline-flex; align-items: center; gap: 2px;
  flex: 0 0 auto;
}
.section-more svg { width: 12px; height: 12px; fill: currentColor; }

/* ---------------- 合规提示条 ---------------- */
.notice-bar {
  margin: 14px 16px 0;
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 13px;
  background: var(--gold-soft);
  border: 1px solid #F0E3C4;
  border-radius: var(--r-md);
  font-size: 12.5px; line-height: 1.55; color: #7A5F22;
}
.notice-bar .nb-icon {
  flex: 0 0 16px; width: 16px; height: 16px; margin-top: 1px;
  fill: #B8902F;
}
.notice-bar b { font-weight: 700; }

.notice-danger {
  background: var(--cinnabar-soft);
  border-color: var(--cinnabar-line);
  color: #8E3B2B;
}
.notice-danger .nb-icon { fill: var(--cinnabar); }

/* ---------------- 快捷入口 ---------------- */
.quick-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px;
}
.quick-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 13px 4px 11px;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  transition: transform .16s ease, box-shadow .16s ease;
}
.quick-item:active { transform: scale(.96); box-shadow: var(--sh-1); }
.quick-icon {
  width: 38px; height: 38px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}
.quick-icon svg { width: 19px; height: 19px; }
.quick-item span { font-size: 12px; color: var(--ink-2); letter-spacing: .2px; }

.qi-1 { background: var(--brand-soft); } .qi-1 svg { fill: var(--brand-2); }
.qi-2 { background: #EEF3F8; } .qi-2 svg { fill: #3B6E96; }
.qi-3 { background: var(--cinnabar-soft); } .qi-3 svg { fill: var(--cinnabar); }
.qi-4 { background: var(--gold-soft); } .qi-4 svg { fill: #B8902F; }

/* ---------------- 顶部推荐（横滑） ---------------- */
.scroll-x {
  display: flex; gap: 12px; overflow-x: auto; padding: 2px 16px 4px;
  scroll-snap-type: x mandatory; scrollbar-width: none;
}
.scroll-x::-webkit-scrollbar { display: none; }

.feature-card {
  flex: 0 0 78%; scroll-snap-align: start;
  background: linear-gradient(150deg, #FFFFFF 0%, #FCFAF6 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--sh-1);
  position: relative; overflow: hidden;
}
.feature-card::before {
  content: ""; position: absolute; right: -28px; top: -28px;
  width: 96px; height: 96px; border-radius: 50%;
  background: var(--brand-soft); opacity: .7;
}
.feature-card .fc-tag {
  position: relative; z-index: 1;
  display: inline-block; font-size: 11px; padding: 2px 9px;
  border-radius: var(--r-full); background: var(--brand-soft); color: var(--brand-2);
  font-weight: 600; letter-spacing: .3px;
}
.feature-card h3 {
  position: relative; z-index: 1;
  font-size: 16.5px; line-height: 1.45; margin: 9px 0 7px; font-weight: 700;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.feature-card p {
  position: relative; z-index: 1;
  font-size: 12.5px; color: var(--ink-3); line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.feature-card .fc-foot {
  position: relative; z-index: 1;
  margin-top: 11px; display: flex; align-items: center; justify-content: space-between;
  font-size: 11.5px; color: var(--ink-4);
}

/* ---------------- 文章列表 ---------------- */
.article-item {
  display: flex; gap: 12px; padding: 14px 0;
  border-bottom: 1px solid var(--line-2);
}
.article-item:last-child { border-bottom: none; }
.ai-body { flex: 1; min-width: 0; }
.ai-title {
  font-size: 15.5px; font-weight: 600; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ai-desc {
  margin-top: 5px; font-size: 12.5px; color: var(--ink-3); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ai-meta {
  margin-top: 7px; display: flex; align-items: center; gap: 10px;
  font-size: 11.5px; color: var(--ink-4);
}
.ai-thumb {
  flex: 0 0 88px; width: 88px; height: 66px; border-radius: var(--r-sm);
  background: linear-gradient(140deg, #EDF4F0, #E4EDE7);
  display: flex; align-items: center; justify-content: center;
  font-family: serif; font-size: 22px; color: var(--brand-3);
  border: 1px solid var(--brand-line);
}

/* ---------------- 穴位 / 病症 卡片 ---------------- */
.acu-card {
  display: block;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 13px 14px;
  margin-bottom: 10px; position: relative; overflow: hidden;
  transition: transform .16s ease;
}
.acu-card:active { transform: scale(.985); }
.acu-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(var(--brand-3), var(--brand-2));
  opacity: .85;
}
.acu-head { display: flex; align-items: baseline; gap: 8px; }
.acu-name { font-size: 16.5px; font-weight: 700; letter-spacing: .5px; }
.acu-pinyin { font-size: 11.5px; color: var(--ink-4); letter-spacing: .2px; }
.acu-code {
  margin-left: auto; font-size: 10.5px; color: var(--brand-2);
  background: var(--brand-soft); padding: 1px 7px; border-radius: 5px;
  font-family: ui-monospace, Menlo, monospace; letter-spacing: .3px;
  flex: 0 0 auto; white-space: nowrap;
}
.acu-meta {
  margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px;
}
.chip {
  font-size: 11px; padding: 1.5px 8px; border-radius: var(--r-full);
  background: var(--sand-2); color: var(--ink-2); border: 1px solid var(--line);
}
.chip.brand { background: var(--brand-soft); color: var(--brand-2); border-color: var(--brand-line); }
.chip.red { background: var(--cinnabar-soft); color: var(--cinnabar); border-color: var(--cinnabar-line); }
.chip.gold { background: var(--gold-soft); color: #96721F; border-color: #EFE0BC; }
.acu-desc {
  margin-top: 8px; font-size: 12.5px; color: var(--ink-3); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ---------------- 筛选栏 ---------------- */
.filter-tabs {
  display: flex; gap: 8px; overflow-x: auto; padding: 0 16px 12px;
  scrollbar-width: none;
}
.filter-tabs::-webkit-scrollbar { display: none; }
.ftab {
  flex: 0 0 auto; font-size: 13px; padding: 6px 14px; border-radius: var(--r-full);
  background: var(--card); border: 1px solid var(--line); color: var(--ink-2);
  transition: .18s;
}
.ftab.active {
  background: var(--brand); border-color: var(--brand); color: #F5EFE2; font-weight: 600;
}

.seg {
  display: flex; gap: 4px; background: var(--sand-2);
  padding: 3px; border-radius: var(--r-full); margin: 0 16px 14px;
}
.seg button {
  flex: 1; font-size: 13.5px; padding: 7px 0; border-radius: var(--r-full);
  color: var(--ink-2); transition: .18s;
}
.seg button.active {
  background: var(--card); color: var(--brand); font-weight: 600;
  box-shadow: var(--sh-1);
}

/* ---------------- 详情页 ---------------- */
.navbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 10px;
  background: rgba(251, 248, 242, .92);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line-2);
}
.nav-btn {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--sand-2); flex: 0 0 32px;
}
.nav-btn svg { width: 16px; height: 16px; fill: var(--ink-2); }
.nav-title {
  font-size: 15.5px; font-weight: 600; flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nav-actions { display: flex; gap: 6px; flex: 0 0 auto; }

.detail-head {
  padding: 18px 18px 16px;
  background: linear-gradient(160deg, #1F4B3A, #27604A);
  color: #F0EBDF;
  position: relative; overflow: hidden;
}
.detail-head::after {
  content: ""; position: absolute; right: -40px; bottom: -60px;
  width: 160px; height: 160px; border-radius: 50%;
  border: 1px solid rgba(243, 233, 210, .18);
  box-shadow: 0 0 0 26px rgba(243, 233, 210, .05), 0 0 0 58px rgba(243, 233, 210, .03);
}
.detail-head .dh-kicker {
  font-size: 11.5px; letter-spacing: 1.5px; color: rgba(243, 233, 210, .55);
  text-transform: uppercase;
}
.detail-head h1 {
  font-size: 24px; font-weight: 700; letter-spacing: 2px; margin: 6px 0 0;
  font-family: "Songti SC", "SimSun", serif; position: relative; z-index: 1;
}
.detail-head .dh-sub {
  margin-top: 6px; font-size: 12.5px; color: rgba(243, 233, 210, .68);
  position: relative; z-index: 1;
}
.detail-head .dh-chips {
  margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; position: relative; z-index: 1;
}
.detail-head .chip {
  background: rgba(243, 233, 210, .13);
  border-color: rgba(243, 233, 210, .25);
  color: #EDE5D4;
}

.field {
  padding: 15px 18px;
  border-bottom: 1px solid var(--line-2);
  background: var(--card);
}
.field:last-child { border-bottom: none; }
.field-label {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--ink-4); letter-spacing: .8px; margin-bottom: 6px;
}
.field-label::before {
  content: ""; width: 12px; height: 2px; border-radius: 2px; background: var(--brand-3);
}
.field-value { font-size: 14.5px; line-height: 1.78; color: var(--ink); }
.field-value.muted { color: var(--ink-2); }

.panel {
  margin: 12px 16px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden;
}

/* Markdown 正文 */
.md {
  padding: 18px;
  font-size: 15px; line-height: 1.85; color: #2A3A34;
  word-break: break-word;
}
.md h2 {
  font-size: 17.5px; font-weight: 700; margin: 26px 0 10px;
  padding-left: 11px; border-left: 3px solid var(--brand-2);
  line-height: 1.4; letter-spacing: .3px;
}
.md h2:first-child { margin-top: 0; }
.md h3 {
  font-size: 15.5px; font-weight: 700; margin: 20px 0 8px; color: var(--brand);
}
.md p { margin: 11px 0; }
.md strong { font-weight: 700; color: #17251F; }
.md em { font-style: normal; color: var(--cinnabar); font-weight: 600; }
.md ul, .md ol { margin: 11px 0; padding-left: 4px; }
.md li {
  position: relative; padding-left: 18px; margin: 6px 0; color: var(--ink-2);
}
.md ul > li::before {
  content: ""; position: absolute; left: 4px; top: .72em;
  width: 5px; height: 5px; border-radius: 50%; background: var(--brand-3);
}
.md ol { counter-reset: n; }
.md ol > li { counter-increment: n; }
.md ol > li::before {
  content: counter(n); position: absolute; left: 0; top: .18em;
  font-size: 11px; font-weight: 700; color: var(--brand-2);
  background: var(--brand-soft); width: 15px; height: 15px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
}
.md blockquote {
  margin: 14px 0; padding: 11px 14px;
  background: var(--gold-soft);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: 13.5px; color: #7A5F22; line-height: 1.7;
}
.md blockquote p { margin: 0; }
.md blockquote strong { color: #6B5218; }
.md code {
  background: var(--sand-2); padding: 1px 5px; border-radius: 4px;
  font-family: ui-monospace, Menlo, monospace; font-size: 13px;
}
.md pre {
  background: #fff; border: 1px dashed var(--line);
  padding: 12px; border-radius: var(--r-sm); overflow-x: auto;
  font-size: 12.5px; line-height: 1.7; color: var(--ink-2);
}
.md pre code { background: none; padding: 0; }
.md table {
  width: 100%; border-collapse: collapse; margin: 14px 0;
  font-size: 12.5px; display: block; overflow-x: auto;
}
.md th, .md td {
  border: 1px solid var(--line); padding: 7px 9px; text-align: left;
  vertical-align: top;
}
.md th { background: var(--sand-2); font-weight: 700; white-space: nowrap; }
.md tr:nth-child(even) td { background: #FCFAF7; }
.md hr { border: none; border-top: 1px solid var(--line); margin: 20px 0; }
.md a { color: var(--brand-2); border-bottom: 1px solid var(--brand-line); }

/* 文献来源条 */
.source-tag {
  display: flex; gap: 8px; align-items: flex-start;
  margin: 12px 16px; padding: 11px 13px;
  background: #F6F3EC; border: 1px dashed var(--line);
  border-radius: var(--r-md);
  font-size: 12px; color: var(--ink-3); line-height: 1.6;
}
.source-tag svg { width: 14px; height: 14px; fill: var(--ink-4); flex: 0 0 14px; margin-top: 2px; }

/* 相关推荐 */
.rel-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--line-2);
}
.rel-item:last-child { border-bottom: none; }
.rel-item .ri-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--brand-3); flex: 0 0 6px;
}
.rel-item .ri-t {
  flex: 1; min-width: 0; font-size: 14px; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rel-item .ri-s { font-size: 11.5px; color: var(--ink-4); flex: 0 0 auto; }

/* 底部操作条 */
.action-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  max-width: 520px; margin: 0 auto;
  padding: 10px 16px calc(10px + var(--safe-b));
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  display: flex; gap: 10px; align-items: center;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 18px; border-radius: var(--r-full);
  font-size: 14.5px; font-weight: 600; letter-spacing: .3px;
  white-space: nowrap;
  transition: transform .14s ease, opacity .14s;
}
.action-bar .btn { flex: 0 0 auto; }
.action-bar .btn-primary, .action-bar .btn-danger { flex: 1; }
.action-bar .btn svg { width: 16px; height: 16px; fill: currentColor; }
.btn svg { width: 15px; height: 15px; fill: currentColor; flex: 0 0 15px; }
.btn:active { transform: scale(.97); opacity: .9; }
.btn-primary { background: var(--brand); color: #F5EFE2; flex: 1; }
.btn-ghost { background: var(--sand-2); color: var(--ink-2); }
.btn-danger { background: var(--cinnabar); color: #fff; flex: 1; }
.btn-outline {
  background: transparent; color: var(--brand); border: 1px solid var(--brand-line);
}
.btn-sm { padding: 7px 13px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.icon-act {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  flex: 0 0 auto; width: 46px; font-size: 10.5px; color: var(--ink-3);
}
.icon-act svg { width: 21px; height: 21px; fill: none; stroke: var(--ink-2); stroke-width: 1.7; }
.icon-act.on svg { fill: var(--cinnabar); stroke: var(--cinnabar); }
.icon-act.on { color: var(--cinnabar); }

/* ---------------- 学习中心 ---------------- */
.chapter {
  margin: 0 16px 12px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden;
}
.chapter-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 15px; border-bottom: 1px solid var(--line-2);
  background: linear-gradient(180deg, #FCFAF6, #FFFFFF);
}
.chapter-no {
  width: 26px; height: 26px; border-radius: 8px; flex: 0 0 26px;
  background: var(--brand); color: #F3E9D2;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.chapter-name { flex: 1; min-width: 0; font-size: 15px; font-weight: 700; }
.chapter-meta { font-size: 11.5px; color: var(--ink-4); flex: 0 0 auto; }

.lesson {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 15px; border-bottom: 1px solid var(--line-2);
}
.lesson:last-child { border-bottom: none; }
.lesson:active { background: #FCFAF7; }
.lesson-idx {
  font-size: 11px; color: var(--ink-4); font-family: ui-monospace, monospace;
  flex: 0 0 18px;
}
.lesson-body { flex: 1; min-width: 0; }
.lesson-title { display: block; font-size: 14.5px; line-height: 1.45; }
.lesson-sub { display: block; margin-top: 3px; font-size: 11.5px; color: var(--ink-4); }
.lesson-play {
  flex: 0 0 24px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--brand-soft); display: flex; align-items: center; justify-content: center;
}
.lesson-play svg { width: 10px; height: 10px; fill: var(--brand-2); margin-left: 1px; }

/* ---------------- 个人中心 ---------------- */
.profile-head {
  padding: calc(env(safe-area-inset-top, 0px) + 26px) 20px 60px;
  background:
    radial-gradient(110% 70% at 100% 0%, rgba(192, 154, 62, .2), transparent 60%),
    linear-gradient(160deg, #17392C, #1F4B3A 50%, #27604A);
  color: #F0EBDF; position: relative; overflow: hidden;
}
.profile-head::after {
  content: ""; position: absolute; left: -50px; bottom: -80px;
  width: 200px; height: 200px; border-radius: 50%;
  border: 1px solid rgba(243, 233, 210, .13);
}
.ph-row { display: flex; align-items: center; gap: 14px; position: relative; z-index: 1; }
.avatar {
  width: 58px; height: 58px; border-radius: 20px; flex: 0 0 58px;
  background: rgba(243, 233, 210, .14);
  border: 1px solid rgba(243, 233, 210, .3);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-family: serif; color: #F3E9D2;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar svg { width: 28px; height: 28px; fill: rgba(243, 233, 210, .55); }
.ph-name { font-size: 19px; font-weight: 700; letter-spacing: .5px; }
.ph-tip { font-size: 12px; color: rgba(240, 235, 223, .6); margin-top: 3px; }

.stat-row {
  margin: -40px 16px 0; position: relative; z-index: 2;
  background: var(--card); border-radius: var(--r-lg);
  border: 1px solid var(--line); box-shadow: var(--sh-2);
  display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 16px 0;
}
.stat-row a { text-align: center; position: relative; }
.stat-row a + a::before {
  content: ""; position: absolute; left: 0; top: 14%;
  width: 1px; height: 72%; background: var(--line-2);
}
.stat-row b { display: block; font-size: 20px; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }
.stat-row span { font-size: 11.5px; color: var(--ink-4); }

.menu-group {
  margin: 16px 16px 0; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden;
}
.menu-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--line-2);
}
.menu-item:last-child { border-bottom: none; }
.menu-item:active { background: #FCFAF7; }
.menu-icon {
  width: 30px; height: 30px; border-radius: 9px; flex: 0 0 30px;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft);
}
.menu-icon svg { width: 15px; height: 15px; fill: var(--brand-2); }
.menu-text { flex: 1; font-size: 14.5px; }
.menu-value { font-size: 12.5px; color: var(--ink-4); }
.menu-arrow { width: 7px; height: 7px; border-right: 1.6px solid var(--ink-4); border-bottom: 1.6px solid var(--ink-4); transform: rotate(-45deg); flex: 0 0 7px; }

/* ---------------- 空态 / 加载 ---------------- */
.empty {
  padding: 56px 24px; text-align: center; color: var(--ink-4);
}
.empty-icon {
  width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 18px;
  background: var(--sand-2); display: flex; align-items: center; justify-content: center;
}
.empty-icon svg { width: 24px; height: 24px; fill: var(--ink-4); }
.empty p { font-size: 13.5px; }
.empty .btn { margin-top: 16px; }

.skeleton { padding: 16px; }
.sk-line {
  height: 12px; border-radius: 6px; background: linear-gradient(90deg, #F0EBE2 25%, #F8F4EC 37%, #F0EBE2 63%);
  background-size: 400% 100%; animation: sk 1.4s ease infinite; margin-bottom: 10px;
}
.sk-line.w40 { width: 40%; } .sk-line.w70 { width: 70%; } .sk-line.w90 { width: 90%; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.loading-dots { display: flex; justify-content: center; gap: 5px; padding: 20px; }
.loading-dots i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--brand-line);
  animation: ld 1s ease-in-out infinite;
}
.loading-dots i:nth-child(2) { animation-delay: .15s; }
.loading-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes ld { 0%, 100% { opacity: .3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-4px); } }

/* ---------------- TabBar ---------------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  max-width: 520px; margin: 0 auto;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--line);
  display: flex;
}
.tab {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
  color: var(--ink-4); font-size: 10.5px; letter-spacing: .3px;
  transition: color .18s;
}
.tab svg { width: 21px; height: 21px; fill: currentColor; opacity: .85; transition: .18s; }
.tab.active { color: var(--brand); font-weight: 600; }
.tab.active svg { fill: var(--brand); opacity: 1; transform: translateY(-1px); }

/* ---------------- Toast / 弹层 ---------------- */
#toast-wrap {
  position: fixed; left: 50%; bottom: calc(90px + var(--safe-b));
  transform: translateX(-50%); z-index: 200;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; max-width: 86vw;
}
.toast {
  background: rgba(27, 42, 37, .92); color: #F5EFE2;
  font-size: 13.5px; padding: 10px 18px; border-radius: var(--r-full);
  box-shadow: var(--sh-2); animation: tin .22s ease;
  text-align: center; max-width: 100%;
}
.toast.ok { background: rgba(31, 107, 78, .94); }
.toast.bad { background: rgba(181, 67, 47, .94); }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }

.modal-mask {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(20, 30, 26, .45);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 520px;
  background: var(--sand); border-radius: 22px 22px 0 0;
  padding: 20px 20px calc(18px + var(--safe-b));
  animation: up .26s cubic-bezier(.22, 1, .36, 1);
  max-height: 82dvh; overflow-y: auto;
}
@keyframes up { from { transform: translateY(100%); } }
.modal h3 { font-size: 17px; margin-bottom: 6px; }
.modal .modal-sub { font-size: 12.5px; color: var(--ink-3); margin-bottom: 16px; }

/* ---------------- 表单 ---------------- */
.input, .textarea, .select {
  width: 100%; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 12px 14px; font-size: 14.5px; outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--brand-3); box-shadow: 0 0 0 3px rgba(63, 139, 108, .1);
}
.textarea { min-height: 120px; resize: vertical; line-height: 1.7; }
.form-row { margin-bottom: 14px; }
.form-label {
  display: block; font-size: 12.5px; color: var(--ink-2);
  margin-bottom: 6px; font-weight: 600;
}
.form-hint { font-size: 11.5px; color: var(--ink-4); margin-top: 5px; line-height: 1.5; }

/* ---------------- 搜索页 ---------------- */
.search-head {
  position: sticky; top: 0; z-index: 20;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 12px;
  background: var(--sand); border-bottom: 1px solid var(--line-2);
  display: flex; gap: 10px; align-items: center;
}
.search-head .searchbar { margin: 0; flex: 1; background: var(--card); border: 1px solid var(--line); box-shadow: none; padding: 9px 14px; }
.search-head .cancel { font-size: 14px; color: var(--ink-2); flex: 0 0 auto; }

.hot-words { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px; }
.hot-word {
  font-size: 13px; padding: 6px 13px; border-radius: var(--r-full);
  background: var(--card); border: 1px solid var(--line); color: var(--ink-2);
}
.hot-word.hl { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-2); }

mark { background: rgba(192, 154, 62, .25); color: inherit; border-radius: 3px; padding: 0 1px; }

/* ---------------- 提示块 ---------------- */
.tip-card {
  margin: 14px 16px;
  background: var(--card); border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: var(--r-sm) var(--r-md) var(--r-md) var(--r-sm);
  padding: 13px 15px;
}
.tip-card.danger { border-left-color: var(--cinnabar); }
.tip-card h4 { font-size: 13.5px; margin-bottom: 5px; display: flex; align-items: center; gap: 6px; color: #8B6A1C; }
.tip-card h4 svg { width: 15px; height: 15px; flex: 0 0 15px; fill: var(--gold); }
.tip-card.danger h4 svg { fill: var(--cinnabar); }
.tip-card p { font-size: 12.5px; color: var(--ink-2); line-height: 1.7; }
.tip-card.danger h4 { color: var(--cinnabar); }

/* ---------------- 底部版权 ---------------- */
.foot-note {
  padding: 26px 24px calc(28px + var(--safe-b));
  text-align: center; font-size: 11.5px; color: var(--ink-4); line-height: 1.8;
}
.foot-note a { color: var(--brand-2); }
