/*
 * design.css — coding-visualizer 公共样式
 * 从 issues.html (feat-system-prompt-loader) 抽出，作为 6 阶段产物骨架的统一底座。
 * 阶段特有类（.issue / .wave-card / .uc / .risk-* 等）放各骨架局部 style，不在此文件。
 *
 * render.sh 通过占位符注释 INLINE:design.css 将本文件内联进产物 HTML。
 */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --font-body: 'Bricolage Grotesque', 'PingFang SC', system-ui, sans-serif;
  --font-mono: 'Space Mono', 'JetBrains Mono', 'SF Mono', Consolas, monospace;
  --bg: #f6f8f8; --surface: #ffffff; --surface-2: #eef2f1; --surface-elevated: #ffffff;
  --border: rgba(15, 40, 40, 0.08); --border-bright: rgba(15, 40, 40, 0.16);
  --text: #0f2a2a; --text-dim: #5a6b6b;
  --accent: #0d9488; --accent-dim: rgba(13, 148, 136, 0.10);
  --slate: #334155; --slate-dim: rgba(51, 65, 85, 0.10);
  --green: #059669; --green-dim: rgba(5, 150, 105, 0.12);
  --red: #dc2626; --red-dim: rgba(220, 38, 38, 0.10);
  --orange: #c2410c; --orange-dim: rgba(194, 65, 12, 0.10);
  --amber: #b45309; --amber-dim: rgba(180, 83, 9, 0.12);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a1414; --surface: #111d1d; --surface-2: #182626; --surface-elevated: #162121;
    --border: rgba(180, 220, 220, 0.07); --border-bright: rgba(180, 220, 220, 0.15);
    --text: #e3efee; --text-dim: #8aa0a0;
    --accent: #2dd4bf; --accent-dim: rgba(45, 212, 191, 0.13);
    --slate: #94a3b8; --slate-dim: rgba(148, 163, 184, 0.12);
    --green: #34d399; --green-dim: rgba(52, 211, 153, 0.13);
    --red: #f87171; --red-dim: rgba(248, 113, 113, 0.12);
    --orange: #fb923c; --orange-dim: rgba(251, 146, 60, 0.12);
    --amber: #fbbf24; --amber-dim: rgba(251, 191, 36, 0.14);
  }
}
html { scroll-behavior: smooth; }
body { font-family: var(--font-body); color: var(--text); line-height: 1.65; background: var(--bg); background-image: radial-gradient(ellipse at 50% -5%, var(--accent-dim) 0%, transparent 55%); padding: 32px; overflow-wrap: break-word; }
.grid > *, .flex > *, [style*="display:grid"] > *, [style*="display:flex"] > * { min-width: 0; }
h1 { font-size: 38px; font-weight: 700; letter-spacing: -1px; margin-bottom: 6px; text-wrap: balance; }
h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.3px; margin: 56px 0 18px; padding-bottom: 10px; border-bottom: 1px solid var(--border); scroll-margin-top: 70px; }
h3 { font-size: 16px; font-weight: 700; margin: 26px 0 12px; color: var(--accent); font-family: var(--font-mono); letter-spacing: 0.2px; scroll-margin-top: 70px; }
h4 { font-size: 13px; font-weight: 600; margin: 18px 0 8px; color: var(--slate); font-family: var(--font-mono); }
p { margin-bottom: 12px; }
.subtitle { color: var(--text-dim); font-size: 13px; margin-bottom: 8px; font-family: var(--font-mono); }
code { font-family: var(--font-mono); font-size: 0.92em; }
strong { font-weight: 600; }

/* Layout: TOC + main 双栏 */
.wrap { max-width: 1380px; margin: 0 auto; display: grid; grid-template-columns: 168px 1fr; gap: 0 44px; }
.main { min-width: 0; }
header.doc-head { margin-bottom: 28px; }
.badge-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.tag { font-family: var(--font-mono); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; padding: 4px 10px; border-radius: 20px; background: var(--accent-dim); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.tag--slate { background: var(--slate-dim); color: var(--slate); border-color: color-mix(in srgb, var(--slate) 30%, transparent); }
.tag--green { background: var(--green-dim); color: var(--green); border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.tag--amber { background: var(--amber-dim); color: var(--amber); border-color: color-mix(in srgb, var(--amber) 30%, transparent); }

/* TOC sidebar + scroll-spy */
.toc { position: sticky; top: 24px; align-self: start; padding: 14px 0; grid-row: 1/-1; max-height: calc(100dvh - 48px); overflow-y: auto; }
.toc-title { font-family: var(--font-mono); font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 2px; color: var(--text-dim); padding: 0 0 10px; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
.toc a { display: block; font-size: 11px; color: var(--text-dim); text-decoration: none; padding: 4px 8px; border-radius: 5px; border-left: 2px solid transparent; transition: all .15s; line-height: 1.35; margin-bottom: 1px; }
.toc a:hover { color: var(--text); background: var(--surface-2); }
.toc a.active { color: var(--text); border-left-color: var(--accent); background: var(--accent-dim); }

/* TL;DR 摘要框 */
.tldr { background: var(--surface-elevated); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); border-radius: 14px; padding: 20px 24px; margin: 24px 0 8px; box-shadow: 0 4px 18px rgba(13,148,136,.06); }
.tldr__label { font-family: var(--font-mono); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.8px; color: var(--accent); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.tldr__label::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.tldr ul { list-style: none; padding: 0; }
.tldr li { padding: 5px 0 5px 18px; position: relative; font-size: 14px; line-height: 1.55; }
.tldr li::before { content: '→'; position: absolute; left: 0; color: var(--accent); font-weight: 600; }
.tldr code { font-family: var(--font-mono); font-size: 12px; background: var(--accent-dim); color: var(--accent); padding: 1px 6px; border-radius: 3px; }

/* Mermaid zoom/pan 外壳（与 zoom.js 的选择器契约绑定，勿改名） */
.mermaid-wrap { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 32px 24px; overflow: auto; margin-bottom: 24px; display: flex; justify-content: center; align-items: center; min-height: 400px; cursor: grab; }
.mermaid-wrap.is-panning { cursor: grabbing; user-select: none; }
.zoom-controls { position: absolute; top: 8px; right: 8px; display: flex; gap: 2px; z-index: 10; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 2px; }
.zoom-controls button { width: 28px; height: 28px; border: none; background: transparent; color: var(--text-dim); font-family: var(--font-mono); font-size: 14px; cursor: pointer; border-radius: 4px; display: flex; align-items: center; justify-content: center; transition: background .15s, color .15s; }
.zoom-controls button:hover { background: var(--border); color: var(--text); }
.diagram-shell { position: relative; }
.diagram-shell__hint { font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); margin-bottom: 8px; opacity: .7; }
.mermaid-viewport { position: relative; overflow: hidden; width: 100%; height: 100%; min-height: 300px; }
.mermaid-canvas { position: absolute; top: 0; left: 0; }
.zoom-label { font-family: var(--font-mono); font-size: 10px; color: var(--text-dim); padding: 0 6px; white-space: nowrap; }
.mermaid .nodeLabel { font-family: var(--font-body) !important; font-size: 14px !important; }
.mermaid .edgeLabel { font-family: var(--font-mono) !important; font-size: 12px !important; }
.mermaid .node rect, .mermaid .node circle, .mermaid .node polygon { stroke-width: 1.5px !important; }

/* 数据表格（功能清单/AC 清单/追溯表/签名表/决策记录） */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin: 16px 0 24px; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 1.55; }
.data-table thead { position: sticky; top: 0; z-index: 2; }
.data-table th { background: var(--surface-2); font-family: var(--font-mono); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--text-dim); text-align: left; padding: 13px 16px; border-bottom: 2px solid var(--border-bright); white-space: nowrap; }
.data-table td { padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table tbody tr:nth-child(even) { background: var(--accent-dim); }
.data-table tbody tr:hover { background: var(--border); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table code { font-family: var(--font-mono); font-size: 11px; background: var(--accent-dim); color: var(--accent); padding: 1px 5px; border-radius: 3px; }

/* Callout 提示框 */
.callout { background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; padding: 14px 18px; font-size: 13px; line-height: 1.6; color: var(--text-dim); margin: 20px 0; }
.callout strong { color: var(--text); font-weight: 600; }
.callout code { font-family: var(--font-mono); font-size: 11px; background: var(--accent-dim); color: var(--accent); padding: 1px 5px; border-radius: 3px; }

/* 章节小标题（mono 大写，区别于 h2） */
.sec-head { font-family: var(--font-mono); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; color: var(--accent); margin: 40px 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }

/* 卡片组件（架构概览 / 决策记录 / 模块概览） */
.ve-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; }
.ve-card--elevated { box-shadow: 0 4px 18px rgba(13,148,136,.06); }
.ve-card__label { font-family: var(--font-mono); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; color: var(--accent); display: flex; align-items: center; gap: 6px; }
.ve-card__label::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.ve-card h3 { margin: 0; color: var(--text); font-family: var(--font-body); font-size: 17px; letter-spacing: -0.2px; }
.ve-card p { margin: 0; font-size: 13.5px; color: var(--text-dim); line-height: 1.55; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin: 18px 0 28px; }
.node-list { list-style: none; padding: 0; margin: 0; }
.node-list li { padding: 4px 0 4px 16px; position: relative; font-size: 13px; line-height: 1.5; color: var(--text-dim); }
.node-list li::before { content: '›'; position: absolute; left: 0; color: var(--accent); font-weight: 700; }
.node-list code { font-family: var(--font-mono); font-size: 11.5px; background: var(--accent-dim); color: var(--accent); padding: 1px 5px; border-radius: 3px; }

/* 状态药丸（AC 清单 / 追溯表状态列） */
.status { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 5px; white-space: nowrap; }
.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status--match { background: var(--green-dim); color: var(--green); }
.status--warn { background: var(--amber-dim); color: var(--amber); }
.status--gap { background: var(--red-dim); color: var(--red); }
.status--na { background: var(--slate-dim); color: var(--slate); }

/* 热力图单元格（④ NFR 风险矩阵） */
.heatmap-cell { text-align: center; font-size: 15px; padding: 8px; }
.heatmap-cell--good { background: var(--green-dim); }
.heatmap-cell--warn { background: var(--amber-dim); }
.heatmap-cell--bad { background: var(--red-dim); }
.heatmap-cell--na { background: transparent; color: var(--text-dim); }

/* 图例 */
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 16px 0; font-size: 12px; color: var(--text-dim); font-family: var(--font-mono); }
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-swatch { width: 14px; height: 14px; border-radius: 3px; }

/* Footer */
footer.doc-foot { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-dim); font-family: var(--font-mono); }

/* 入场动画 */
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.animate { animation: fadeUp .35s ease-out both; animation-delay: calc(var(--i, 0) * .04s); }

/* 响应式 */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
@media (max-width: 1000px) {
  .wrap { grid-template-columns: 1fr; }
  .toc { position: sticky; top: 0; z-index: 200; max-height: none; display: flex; gap: 4px; align-items: center; overflow-x: auto; background: var(--bg); border-bottom: 1px solid var(--border); padding: 10px 0; grid-row: auto; }
  .toc-title { display: none; }
  .toc a { white-space: nowrap; flex-shrink: 0; border-left: none; border-bottom: 2px solid transparent; border-radius: 4px 4px 0 0; padding: 6px 10px; font-size: 10px; }
  .toc a.active { border-left: none; border-bottom-color: var(--accent); background: var(--surface); }
  h2, h3 { scroll-margin-top: 60px; }
  body { padding: 16px; }
}
@media (max-width: 768px) { body { padding: 12px; } h1 { font-size: 26px; } }
