/* ============================================================
   苓简 · 统一视觉系统 v1（墨青 · 宣纸 · 朱砂 · 古金）
   ============================================================ */
:root{
  --ink:#17332e;          /* 墨青 主色 */
  --ink-2:#1f3a4d;        /* 黛蓝 次主色 */
  --ink-3:#2f4f45;        /* 深青灰 */
  --paper:#f7f3ea;        /* 宣纸底 */
  --paper-2:#fbf9f4;
  --line:#e2dbcc;         /* 细线 */
  --line-2:#d3c9b6;
  --text:#26332f;
  --text-2:#5c6b64;
  --text-3:#8a9791;
  --cinnabar:#a8342a;     /* 朱砂 仅点缀 */
  --gold:#b08a4a;         /* 低饱和古金 */
  --ok:#2f7d5c; --warn:#b07d2b; --err:#a8342a;
  --r-sm:6px; --r-md:10px; --r-lg:14px;
  --sh-1:0 1px 2px rgba(23,51,46,.06);
  --sh-2:0 6px 18px rgba(23,51,46,.08);
  --sans:"PingFang SC","Microsoft YaHei","Hiragino Sans GB","Source Han Sans SC",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  --serif:"Songti SC","Noto Serif SC","Source Han Serif SC",STSong,SimSun,Georgia,serif;
  --ctl-h:38px;
}
*{box-sizing:border-box}
html,body{max-width:100%}
body{
  background:var(--paper) !important;
  color:var(--text) !important;
  font-family:var(--sans) !important;
  font-size:15px; line-height:1.75;
  -webkit-font-smoothing:antialiased;
}
/* 宣纸肌理：极淡的斜纹 + 顶部微光 */
body::before{
  content:""; position:fixed; inset:0; pointer-events:none; z-index:0;
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(176,138,74,.06), transparent 70%),
    repeating-linear-gradient(45deg, rgba(23,51,46,.012) 0 2px, transparent 2px 6px);
}
h1,h2,h3,h4,h5{ font-family:var(--serif) !important; color:var(--ink) !important; letter-spacing:.02em; }
h1{font-size:26px; line-height:1.5; margin:.2em 0 .5em}
h2{font-size:20px; line-height:1.55; margin:.2em 0 .45em}
h3{font-size:17px; line-height:1.6}
a{color:var(--ink-2); text-decoration:none}
a:hover{color:var(--cinnabar)}

/* 容器与栅格 */
.container,.wrap{max-width:1180px; margin:0 auto; padding-left:16px; padding-right:16px}

/* 卡片 */
.card,.panel,.box,section{
  background:var(--paper-2) !important;
  border:1px solid var(--line) !important;
  border-radius:var(--r-md) !important;
  box-shadow:var(--sh-1);
}

/* 控件 */
input[type=text],input[type=search],input[type=tel],input[type=number],select,textarea{
  font-family:var(--sans); font-size:14px; color:var(--text);
  background:#fff !important; border:1px solid var(--line-2) !important;
  border-radius:var(--r-sm) !important; padding:6px 10px;
}
input:focus,select:focus,textarea:focus{
  border-color:var(--ink) !important; box-shadow:0 0 0 3px rgba(23,51,46,.12) !important; outline:none;
}
select,input[type=text],input[type=tel],input[type=number]{height:var(--ctl-h)}
textarea{min-height:96px; line-height:1.8}

/* 按钮 */
button,.btn{
  font-family:var(--sans); font-size:14px; min-height:38px; padding:8px 16px;
  border-radius:var(--r-sm) !important; border:1px solid var(--line-2);
  background:#fff; color:var(--ink); cursor:pointer;
  transition:background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .05s ease;
}
button:hover,.btn:hover{border-color:var(--ink); box-shadow:var(--sh-1)}
button:active,.btn:active{transform:translateY(1px)}
/* 主按钮：由站内深绿按钮自动归一到墨青 */
.btn-primary,button[style*="background:#2f7d5c"],button[style*="background: #2f7d5c"],
button[style*="background:#1f4d3a"],button[style*="background:#0f9d58"]{
  background:var(--ink) !important; color:#f6f2e8 !important; border-color:var(--ink) !important;
}
.btn-ghost{background:transparent; color:var(--ink)}
.btn-danger{background:var(--cinnabar) !important; color:#fff !important; border-color:var(--cinnabar) !important}

/* 标签 / 徽章 */
.tag,.badge{background:rgba(23,51,46,.06); color:var(--ink); border:1px solid var(--line); border-radius:999px; padding:2px 10px; font-size:12px}
.tag-cinnabar{background:rgba(168,52,42,.08); color:var(--cinnabar); border-color:rgba(168,52,42,.25)}

/* 导航 */
#jfNav,.nav,header nav{
  background:rgba(247,243,234,.94) !important; backdrop-filter:saturate(140%) blur(8px);
  border-bottom:1px solid var(--line) !important; box-shadow:none !important;
}
#jfNav a,.nav a{color:var(--ink-3) !important; font-weight:500}
#jfNav a:hover,.nav a:hover{color:var(--cinnabar) !important}

/* 表格 */
table{border-collapse:collapse; width:100%; background:#fff; border:1px solid var(--line); border-radius:var(--r-sm); overflow:hidden}
th{background:rgba(23,51,46,.05); color:var(--ink); font-weight:600; text-align:left}
th,td{padding:8px 10px; border-bottom:1px solid var(--line)}
tr:last-child td{border-bottom:none}

/* 结果卡与提示 */
.result,.card-result{border-left:4px solid var(--ink) !important; background:#fff !important}
.notice,.alert{border-radius:var(--r-sm); border:1px solid var(--line); background:rgba(176,138,74,.07); color:var(--text)}
.danger,.error{color:var(--err); border-color:rgba(168,52,42,.3); background:rgba(168,52,42,.06)}

/* 进度条 */
progress,.bar{accent-color:var(--ink)}

/* 滚动条 */
::-webkit-scrollbar{width:10px;height:10px}
::-webkit-scrollbar-thumb{background:#cfc6b4; border-radius:8px}
::-webkit-scrollbar-thumb:hover{background:#b8ad97}

/* 焦点可见（无障碍） */
:focus-visible{outline:3px solid rgba(23,51,46,.45); outline-offset:2px}

/* 响应式 */
@media (max-width:900px){
  :root{--ctl-h:36px}
  .container,.wrap{padding-left:12px;padding-right:12px}
  h1{font-size:22px} h2{font-size:18px}
}
@media (max-width:640px){
  body{font-size:14px}
  button,.btn{min-height:44px; width:100%}
  .btn-inline{width:auto}
}
@media (min-width:1440px){ .container,.wrap{max-width:1320px} }

/* 尊重系统"减少动态效果" */
@media (prefers-reduced-motion: reduce){
  *{animation:none !important; transition:none !important; scroll-behavior:auto !important}
}

/* ================= v1.1 弹窗与警示色统一 ================= */
/* 首屏免责弹窗 */
#jfIntroMask,[id*="IntroMask"],.intro-mask{
  background:rgba(23,51,46,.42) !important;
  backdrop-filter:blur(2px);
}
#jfIntroMask > div,[class*="intro-"] > div,.intro-card{
  background:#fffdf8 !important;
  border:1px solid var(--line-2) !important;
  border-radius:var(--r-lg) !important;
  box-shadow:0 18px 48px rgba(23,51,46,.22) !important;
  color:var(--text) !important;
}
#jfIntroMask h1,#jfIntroMask h2,#jfIntroMask h3,.intro-card h1,.intro-card h2{color:var(--ink) !important}
#jfIntroMask p,#jfIntroMask div,.intro-card p{color:var(--text) !important}
#jfIntroMask button:not(:disabled){
  background:var(--ink) !important; color:#f7f3ea !important; border-color:var(--ink) !important;
}
#jfIntroMask button:disabled{background:#e5e0d5 !important; color:#4f4a40 !important}
/* 结果区里的大面积红/黄块 → 只保留左侧细条，底色转纸色 */
div[style*="background:#fef0f0"],div[style*="background: #fef0f0"],
div[style*="background:#fff5f5"],div[style*="background: #fff5f5"],
div[style*="background:#ffe"],div[style*="background:#fff8e6"],
div[style*="background: #fff8e6"],div[style*="background:#fff3cd"]{
  background:var(--paper-2) !important;
  border-color:var(--line) !important;
  border-left-width:4px !important;
  border-left-color:var(--cinnabar) !important;
  box-shadow:none !important;
}
/* 红色文字统一降到朱砂 */
div[style*="color:#d9534f"],span[style*="color:#d9534f"],
font[color="#d9534f"],div[style*="color:#c00"],span[style*="color:#c00"]{
  color:var(--cinnabar) !important;
}
/* 弹窗内表格与输入 */
#jfIntroMask input[type=checkbox]{accent-color:var(--ink)}

/* ================= v1.2 结果区排版分层 ================= */
#result{ font-size:14.5px; line-height:1.8; }
#result > div{ margin-bottom:12px !important; }
/* 卡片统一：白底、细线、左墨青条 */
#result div[style*="border-left:5px solid"],
#result div[style*="border-left: 5px solid"]{
  background:#fff !important;
  border:1px solid var(--line) !important;
  border-left:4px solid var(--ink) !important;
  border-radius:var(--r-md) !important;
  box-shadow:var(--sh-1) !important;
  padding:14px 16px !important;
}
/* 方名（1. 2. 3. 开头的大字） */
#result div[style*="font-size:16px"],#result div[style*="font-size: 16px"]{
  font-family:var(--serif) !important; color:var(--ink) !important;
  letter-spacing:.02em;
}
/* 段内标签：【条文出处】【逐条对照】【道·六经病机】【法·组方逻辑】 */
#result b{ color:var(--ink) !important; font-weight:600; }
/* 条文引用块：竖线 + 纸底 */
#result div[style*="border-left:3px solid"],
#result div[style*="border-left: 3px solid"]{
  background:var(--paper) !important;
  border-left:3px solid var(--gold) !important;
  border-radius:0 8px 8px 0 !important;
  color:var(--text) !important;
}
/* 命中/缺失 用色弱化 */
#result span[style*="color:#2e7d32"],#result font[color="#2e7d32"]{ color:var(--ok) !important; }
/* 依据栏（蓝底）转纸底 + 墨青条 */
#result div[style*="background:#e3f2fd"],#result div[style*="background: #e3f2fd"]{
  background:var(--paper) !important; border-color:var(--line) !important;
  border-left:4px solid var(--ink-2) !important; color:var(--text) !important;
}

/* ================= v1.3 红色描边降噪 ================= */
/* 任何内联红边框 → 统一细线（只保留必要状态时的朱砂） */
div[style*="#e53935"],div[style*="#d9534f"],div[style*="#f44336"],
div[style*="#ef5350"],div[style*="#ffcdd2"],div[style*="#ef9a9a"],
div[style*="#e57373"],div[style*="#c62828"]{
  border-color:var(--line-2) !important;
  background:var(--paper-2) !important;
  box-shadow:none !important;
}
/* 四诊分组卡片：统一纸底 */
div[style*="background:#ffe"],div[style*="background:#fff2f2"],
div[style*="background:#ffebee"],div[style*="background:#fdecea"],
div[style*="background:#fff8e1"]{
  background:var(--paper-2) !important;
}
/* 必填星标保留朱砂，其余红字统一 */
span[style*="#e53935"],font[color="#e53935"]{color:var(--cinnabar) !important}
/* 快速鉴别卡：去掉整块红底，改左侧细条 */
div[id*="jfAskTree"],#jfAskTree{
  background:var(--paper) !important;
  border:1px solid var(--line) !important;
  border-left:4px solid var(--gold) !important;
}

/* 关闭滚动越界回弹光条（App 内底部红线） */
html,body{overscroll-behavior:none;background-attachment:fixed;}

/* ===== jfDensity2：充分利用屏宽，减少无谓换行 ===== */
@media (min-width: 380px){
  .dim-list{ display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:8px; }
  .symptom-row{ min-width:0; }
  .symptom-row .symptom-name{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
}
@media (min-width: 560px){
  .dim-list{ grid-template-columns:repeat(auto-fit,minmax(170px,1fr)); }
}
/* 按钮组尽量一行排布 */
.actions, .btn-row{ display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.actions > button, .btn-row > button{ flex:0 1 auto; }

/* ===== jfSpacingV3：各端各屏统一板块间距 ===== */
:root{ --jf-gap:14px; }
@media (max-width:480px){ :root{ --jf-gap:10px; } }
@media (min-width:1024px){ :root{ --jf-gap:18px; } }

/* 板块之间统一留白，去掉零散 margin 造成的忽大忽小 */
body .container, body section, body .card-block{ margin-bottom:var(--jf-gap) !important; }
body .container + .container, body section + section{ margin-top:0 !important; }

/* 板块内最后一个子元素不额外产生底部空隙 */
body .container > *:last-child, body section > *:last-child{ margin-bottom:0 !important; }

/* 标题与正文间距统一 */
h1,h2,h3{ margin-top:0 !important; }

/* 正文行距与段距在窄屏略收紧 */
@media (max-width:480px){
  body p, body li{ margin-bottom:6px !important; line-height:1.72 !important; }
}
/* 页面最底部留出安全距离，避免内容贴边 */
body{ padding-bottom:calc(16px + env(safe-area-inset-bottom, 0px)) !important; }
