:root {
  --bg: #f3f7f4;
  --surface: #ffffff;
  --surface-2: #eaf1ec;
  --ink: #18352f;
  --muted: #6d817b;
  --line: #dce7e1;
  --green: #1e6a59;
  --green-2: #2d8b75;
  --mint: #dceee7;
  --coral: #db775e;
  --amber: #d99431;
  --danger: #b84d4d;
  --shadow: 0 14px 40px rgba(29, 70, 60, .08);
  --radius: 22px;
  --font-size: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font: var(--font-size)/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
body.large-text { --font-size: 18px; }
body.dark {
  --bg: #10201d;
  --surface: #172a26;
  --surface-2: #203730;
  --ink: #eff8f4;
  --muted: #a8bbb4;
  --line: #304840;
  --mint: #23453c;
  --green: #65bda7;
  --green-2: #7acbb6;
  --shadow: 0 14px 40px rgba(0,0,0,.22);
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.skip-link { position: fixed; left: 16px; top: -60px; z-index: 30; padding: 10px 16px; background: var(--surface); border-radius: 8px; }
.skip-link:focus { top: 12px; }

.topbar {
  height: 76px; padding: 0 30px; display: flex; align-items: center; justify-content: space-between;
  background: rgba(255,255,255,.88); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(16px);
}
body.dark .topbar { background: rgba(23,42,38,.9); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; color: white; background: var(--green); border-radius: 13px 13px 13px 4px; font-weight: 800; }
.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: .16em; }
.brand small { color: var(--muted); font-size: 11px; letter-spacing: .08em; }
.top-actions { display: flex; gap: 8px; }
.icon-button { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.icon-button:hover { border-color: var(--green-2); color: var(--green); }

.shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); max-width: 1500px; margin: auto; }
.sidebar { min-height: calc(100vh - 76px); padding: 30px 20px; border-right: 1px solid var(--line); position: sticky; top: 76px; height: calc(100vh - 76px); display: flex; flex-direction: column; }
.nav-label { padding: 0 12px 10px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .14em; }
.nav-item { width: 100%; border: 0; background: transparent; color: var(--muted); display: flex; align-items: center; gap: 12px; padding: 11px 12px; margin: 2px 0; border-radius: 12px; text-align: left; cursor: pointer; }
.nav-item span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; background: var(--surface-2); }
.nav-item:hover, .nav-item.active { background: var(--mint); color: var(--green); font-weight: 700; }
.sidebar-note { margin-top: auto; padding: 14px 12px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.sidebar-note strong, .sidebar-note small { display: block; }
.sidebar-note strong { font-size: 13px; }
.sidebar-note small { color: var(--muted); font-size: 10px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #44a887; box-shadow: 0 0 0 5px rgba(68,168,135,.14); }

main { min-width: 0; padding: 44px clamp(24px, 5vw, 72px) 80px; }
.hero { min-height: 190px; display: grid; grid-template-columns: .8fr 1.2fr; gap: clamp(30px, 6vw, 88px); align-items: center; padding: 12px 0 20px; position: relative; }
.hero::after { content:""; position:absolute; width:230px; height:230px; border-radius:50%; background:radial-gradient(circle, rgba(83,171,144,.16), transparent 70%); right:4%; top:-20px; pointer-events:none; }
.eyebrow { margin: 0 0 8px; font-size: 11px; font-weight: 800; color: var(--coral); letter-spacing: .18em; }
h1, h2, h3, h4, p { margin-top: 0; }
h1 { font-family: Georgia, "Songti SC", serif; font-size: clamp(34px, 4vw, 52px); line-height: 1.12; letter-spacing: -.04em; margin-bottom: 10px; }
h1 span { color: var(--green-2); }
.hero-copy > p:last-child { color: var(--muted); max-width: 480px; margin-bottom:0; }
.search-wrap { position: relative; z-index: 1; }
.search-wrap label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .06em; }
.search-box { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 8px; padding: 8px 10px 8px 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.search-box > span { color: var(--green); font-size: 26px; line-height: 1; }
.search-box input { width: 100%; padding: 10px 0; border: 0; outline: 0; color: var(--ink); background: transparent; }
kbd { color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; font: 11px ui-monospace, monospace; }
.search-hints { min-height: 28px; padding-top: 10px; color: var(--muted); font-size: 12px; }
.hint { border:0; background:transparent; color:var(--green); cursor:pointer; padding:0 10px 0 0; }

.notice { display: flex; gap: 10px; margin: 4px 0 30px; padding: 10px 14px; border: 1px solid #ecd9b8; border-radius: 12px; background: #fff8e9; color: #775929; font-size: 12px; }
body.dark .notice { background: #382f1d; border-color: #66542f; color: #efd59d; }
.notice > span { flex: 0 0 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: #f3d9a8; font-weight: 800; }
.notice p { margin: 0; }

.reference-bar { display:flex; flex-wrap:wrap; align-items:center; gap:8px 14px; margin:0 0 24px; padding:11px 14px; border:1px solid var(--line); border-radius:12px; background:var(--surface); color:var(--muted); font-size:11px; }
.reference-bar strong { color:var(--ink); }
.reference-bar a { color:var(--green); text-decoration:none; border-bottom:1px solid transparent; }
.reference-bar a:hover { border-bottom-color:currentColor; }
.reference-bar span { margin-left:auto; }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-heading h2 { font: 700 clamp(26px, 3vw, 38px)/1.2 Georgia, "Songti SC", serif; margin: 0; }
.section-heading > span { color: var(--muted); font-size: 13px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.filter-button { padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); cursor: pointer; }
.filter-button:hover, .filter-button.active { color: white; background: var(--green); border-color: var(--green); }
.morphology-search { display:flex; align-items:flex-start; gap:14px; margin:0 0 14px; padding:14px 16px; border:1px solid var(--line); border-radius:14px; background:var(--surface-2); }
.morphology-search > strong { flex:0 0 auto; padding-top:5px; font-size:12px; }
.morphology-search > div { display:flex; flex-wrap:wrap; gap:6px; }
.morph-button { padding:4px 10px; border:1px solid var(--line); border-radius:999px; background:var(--surface); color:var(--muted); font-size:11px; cursor:pointer; }
.morph-button:hover { border-color:var(--green); color:var(--green); }

.disease-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.disease-card { min-height: 205px; display: flex; flex-direction: column; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 1px 0 rgba(0,0,0,.02); cursor: pointer; transition: transform .2s, box-shadow .2s, border-color .2s; }
.disease-card:hover { transform: translateY(-3px); border-color: #afcfc4; box-shadow: var(--shadow); }
.card-top { display:flex; justify-content:space-between; gap:12px; align-items:start; }
.card-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 15px; background: var(--mint); color: var(--green); font-size: 23px; }
.card-arrow { color: var(--muted); font-size: 20px; }
.disease-card h3 { margin: 16px 0 2px; font-size: 18px; }
.en-name { color: var(--muted); font: italic 12px Georgia, serif; }
.disease-card p { margin: 10px 0 14px; color: var(--muted); font-size: 12px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.tag-row { margin-top: auto; display: flex; flex-wrap: wrap; gap: 6px; }
.tag { padding: 4px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 11px; }
.empty-state { text-align:center; padding:70px 20px; color:var(--muted); }
.empty-state > span { font-size:44px; color:var(--green); }

.detail-view { max-width: 1080px; margin: 0 auto; }
.back-button { border:0; background:transparent; color:var(--green); padding:0; margin-bottom:24px; cursor:pointer; font-weight:700; }
.detail-hero { display:grid; grid-template-columns:minmax(0,1.1fr) minmax(280px,.9fr); gap:24px; margin-bottom:24px; }
.detail-title { padding: 34px; border-radius: var(--radius); background: var(--green); color: white; min-height: 300px; display:flex; flex-direction:column; justify-content:end; position:relative; overflow:hidden; }
.detail-title::before { content:""; position:absolute; width:200px; height:200px; border:1px solid rgba(255,255,255,.15); border-radius:50%; right:-40px; top:-50px; box-shadow:0 0 0 40px rgba(255,255,255,.04),0 0 0 80px rgba(255,255,255,.03); }
.detail-title .eyebrow { color:#ffd4c9; }
.detail-title h1 { font-size:clamp(36px,5vw,60px); margin-bottom:4px; }
.detail-title .en-name { color:rgba(255,255,255,.7); }
.detail-title p { margin:18px 0 0; max-width:600px; color:rgba(255,255,255,.82); }
.clinical-image { position:relative; min-height:300px; overflow:hidden; border-radius:var(--radius); background:var(--surface-2); }
.clinical-image img { width:100%; height:100%; object-fit:cover; position:absolute; }
.clinical-image.image-missing img { display:none; }
.clinical-image.image-missing::before { content:"临床图片暂未加载\A请使用下方来源链接查看原图"; white-space:pre; position:absolute; inset:0; display:grid; place-items:center; text-align:center; color:var(--muted); }
.image-label { position:absolute; left:14px; bottom:14px; right:14px; padding:10px 12px; border-radius:10px; color:white; background:rgba(13,29,25,.78); backdrop-filter:blur(8px); font-size:11px; }
.image-label a { text-decoration:underline; }
.morphology-figure { min-height:300px; display:grid; place-items:center; padding:30px; text-align:center; background:linear-gradient(145deg,var(--mint),var(--surface-2)); }
.morphology-figure .lesion { width:160px; height:110px; border-radius:48% 52% 42% 58%; background:radial-gradient(circle at 52% 48%, #edd4c9 0 28%, #cc6f5e 30% 45%, #a94f47 47% 50%, transparent 52%), #e7c0b1; box-shadow:0 0 0 12px rgba(255,255,255,.35); }
.morphology-figure small { display:block; color:var(--muted); margin-top:20px; max-width:260px; }
.atlas-card { border:1px solid var(--line); border-radius:var(--radius); text-align:left; }
.atlas-card > div { max-width:360px; }
.atlas-card .atlas-icon { width:52px; height:52px; display:grid; place-items:center; margin-bottom:14px; border-radius:16px; background:var(--surface); color:var(--green); font-size:24px; }
.atlas-card strong { display:block; font-size:18px; }
.atlas-card p { margin:14px 0 0; color:var(--ink); font-size:13px; }
.atlas-tags { display:flex; flex-wrap:wrap; gap:6px; margin-top:10px; }
.atlas-tags span { padding:3px 8px; border-radius:999px; background:var(--surface); color:var(--green); font-size:10px; }

.quick-strip { display:grid; grid-template-columns:repeat(4,1fr); gap:1px; margin:0 0 24px; border:1px solid var(--line); border-radius:18px; overflow:hidden; background:var(--line); }
.quick-item { padding:18px; background:var(--surface); }
.quick-item small { display:block; color:var(--muted); }
.quick-item strong { display:block; margin-top:4px; font-size:14px; }
.content-grid { display:grid; grid-template-columns:minmax(0,1fr) 280px; gap:24px; align-items:start; }
.content-stack { display:grid; gap:18px; }
.panel { padding:26px; border:1px solid var(--line); border-radius:18px; background:var(--surface); }
.panel h2 { margin-bottom:18px; font-size:20px; }
.panel h3 { margin:22px 0 9px; font-size:15px; }
.atlas-triad { display:grid; grid-template-columns:repeat(3,1fr); gap:1px; overflow:hidden; margin:0 0 18px; border:1px solid var(--line); border-radius:12px; background:var(--line); }
.atlas-triad > div { padding:11px 12px; background:var(--surface-2); }
.atlas-triad small, .atlas-triad strong { display:block; }
.atlas-triad small { color:var(--muted); font-size:10px; }
.atlas-triad strong { margin-top:2px; font-size:12px; }
.clean-list { margin:0; padding-left:20px; }
.clean-list li { margin:6px 0; }
.red-list li::marker { color:var(--danger); }
.compare-list { display:grid; gap:10px; }
.compare-item { padding:12px 14px; border-left:3px solid var(--amber); background:var(--surface-2); border-radius:0 10px 10px 0; }
.compare-item strong { display:block; }
.compare-item span { color:var(--muted); font-size:13px; }
.side-stack { display:grid; gap:16px; position:sticky; top:96px; }
.side-panel { padding:20px; border-radius:16px; background:var(--surface); border:1px solid var(--line); }
.side-panel.danger { background:#fff1ef; border-color:#efcbc5; }
body.dark .side-panel.danger { background:#3a2322; border-color:#69413e; }
.side-panel h3 { margin-bottom:10px; font-size:15px; }
.side-panel p, .side-panel li { color:var(--muted); font-size:12px; }
.side-panel ul { margin:0; padding-left:18px; }

.med-card { margin:14px 0; border:1px solid var(--line); border-radius:14px; overflow:hidden; }
.med-head { padding:14px 16px; display:flex; justify-content:space-between; gap:14px; background:var(--surface-2); }
.med-head strong { color:var(--green); }
.med-badge { flex:0 0 auto; padding:2px 8px; height:max-content; border:1px solid #b7d6ca; border-radius:999px; color:var(--green); font-size:10px; }
.med-body { padding:16px; display:grid; gap:12px; }
.med-row { display:grid; grid-template-columns:88px 1fr; gap:12px; font-size:13px; }
.med-row dt { color:var(--muted); }
.med-row dd { margin:0; }
.rx-warning { padding:10px 12px; border-radius:10px; background:#fff4df; color:#775929; }
body.dark .rx-warning { background:#382f1d; color:#efd59d; }
.source-list { display:grid; gap:10px; }
.source-link { padding:12px 14px; display:flex; justify-content:space-between; gap:12px; border:1px solid var(--line); border-radius:10px; text-decoration:none; font-size:13px; }
.source-link:hover { border-color:var(--green); color:var(--green); }
.source-link small { color:var(--muted); }

footer { margin-left:230px; padding:22px clamp(24px,5vw,72px); display:flex; justify-content:space-between; gap:20px; border-top:1px solid var(--line); color:var(--muted); font-size:11px; }
footer p { margin:0; }

@media (max-width: 1240px) {
  .disease-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
}
@media (max-width: 1060px) {
  .disease-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .detail-hero { grid-template-columns:1fr; }
  .clinical-image, .morphology-figure { min-height:360px; }
}
@media (max-width: 800px) {
  .topbar { padding:0 18px; }
  .shell { display:block; }
  .sidebar { min-height:0; height:auto; position:static; padding:12px 16px; border-right:0; border-bottom:1px solid var(--line); overflow-x:auto; }
  .sidebar nav { display:flex; gap:6px; min-width:max-content; }
  .nav-label, .sidebar-note { display:none; }
  .nav-item { width:auto; padding:8px 11px; }
  .nav-item span { display:none; }
  main { padding:28px 18px 60px; }
  .hero { grid-template-columns:1fr; min-height:0; gap:22px; padding-top:10px; }
  .hero h1 { font-size:42px; }
  .notice { margin-bottom:34px; }
  .reference-bar span { width:100%; margin-left:0; }
  .morphology-search { display:block; }
  .morphology-search > strong { display:block; margin-bottom:8px; }
  .content-grid { grid-template-columns:1fr; }
  .side-stack { position:static; }
  footer { margin-left:0; flex-direction:column; padding:20px 18px; }
}
@media (max-width: 560px) {
  .brand small, kbd { display:none; }
  .disease-grid { grid-template-columns:1fr; }
  .disease-card { min-height:210px; }
  .quick-strip { grid-template-columns:repeat(2,1fr); }
  .detail-title { padding:26px; min-height:270px; }
  .clinical-image, .morphology-figure { min-height:280px; }
  .med-row { grid-template-columns:1fr; gap:3px; }
  .atlas-triad { grid-template-columns:1fr; }
}

@media print {
  .topbar, .sidebar, .hero, .notice, #homeView, .back-button, footer { display:none !important; }
  .shell { display:block; }
  main { padding:0; }
  .detail-view { display:block !important; max-width:none; }
  .detail-title { color:#000; background:#fff; min-height:0; padding:0; }
  .detail-title::before { display:none; }
  .detail-title p, .detail-title .en-name { color:#444; }
  .content-grid { grid-template-columns:1fr; }
  .side-stack { position:static; }
  .panel, .med-card, .side-panel { break-inside:avoid; }
}
