/* 聰明投開發者平台：依 smartinvest-design 品牌規範（暖白底、克制品牌紅、深色絲絨只用在 hero 與 footer） */
:root {
  --brand: #A31621; --brand-deep: #7C1019; --brand-tint: #F7ECEA;
  --ink: #201B1A; --muted: #77706C; --line: #E8E2DE; --paper: #FAF9F7; --surface: #FFFFFF;
  --up: #C4372F; --down: #1E7F4F;
  --amber: #A8720F; --amber-bg: #F9F1E0; --green: #2E7D57; --green-bg: #E9F3EE; --slate: #4F5B6E; --slate-bg: #EEF0F4;
  --velvet: #241114; --velvet-2: #160C0E; --velvet-line: rgba(255,244,240,.13); --velvet-muted: #B3A09B;
  --gold: #C89B3C; --gold-bright: #E2B95A;
  --code-bg: #FBF7F4; --code-line: #EDE5DF;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(32,27,26,.05), 0 6px 24px rgba(32,27,26,.06);
  --shadow-lift: 0 2px 4px rgba(32,27,26,.07), 0 14px 36px rgba(32,27,26,.11);
  --ease: cubic-bezier(.2,.7,.3,1);
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, "Liberation Mono", monospace;
  --sans: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.7 var(--sans); -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: .88em; background: var(--code-bg); border: 1px solid var(--code-line); border-radius: 6px; padding: .05em .4em; overflow-wrap: anywhere; }
pre code { background: none; border: 0; padding: 0; font-size: inherit; overflow-wrap: normal; }
h1, h2, h3 { line-height: 1.3; margin: 0; }
h2 { font-size: 26px; font-weight: 800; letter-spacing: .01em; margin-bottom: 14px; }
h3 { font-size: 17px; font-weight: 700; margin: 24px 0 10px; }
p { margin: 0 0 12px; }
svg { flex: none; }

/* ── 頂欄 ── */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 20px; height: 60px; padding: 0 24px;
  background: rgba(250,249,247,.84); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); min-width: 0; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 24px; height: 24px; color: var(--brand); }
.brand-name { font-weight: 800; font-size: 17px; }
.brand-sub { color: var(--muted); font-size: 14px; padding-left: 8px; border-left: 1px solid var(--line); white-space: nowrap; }
.topnav { display: flex; gap: 4px; margin-left: 12px; }
.topnav a { color: var(--ink); padding: 6px 12px; border-radius: 999px; font-size: 14px; }
.topnav a:hover { background: var(--brand-tint); color: var(--brand-deep); text-decoration: none; }
.key-pill { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 500 13px var(--sans); cursor: pointer; transition: box-shadow .16s var(--ease), border-color .16s; }
.key-pill svg { width: 16px; height: 16px; }
.key-pill:hover { border-color: #d8cfc9; box-shadow: var(--shadow); }
.key-pill.set { border-color: rgba(46,125,87,.35); background: var(--green-bg); color: var(--green); }
.menu-btn { display: none; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); cursor: pointer; }
.menu-btn svg { width: 20px; height: 20px; }

/* ── Hero（全站唯一深色帶）── */
.hero { position: relative; overflow: hidden; color: #F6EEEA;
  background: radial-gradient(900px 420px at 85% -10%, rgba(226,185,90,.18), transparent 60%),
              radial-gradient(700px 380px at 0% 120%, rgba(163,22,33,.35), transparent 60%),
              linear-gradient(160deg, var(--velvet), var(--velvet-2)); }
.hero::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255,244,240,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,244,240,.035) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: linear-gradient(180deg, #000 0%, transparent 85%); }
.hero-inner { position: relative; z-index: 1; max-width: 1320px; margin: 0 auto; padding: 64px 32px 72px; display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); gap: 48px; align-items: center; }
.eyebrow { color: var(--gold-bright); font-size: 13px; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 14px; }
.hero h1 { font-size: 42px; font-weight: 800; letter-spacing: .01em; margin-bottom: 18px; }
.hero-lead { color: var(--velvet-muted); font-size: 16px; max-width: 620px; margin-bottom: 22px; }
.base-url { display: flex; align-items: center; gap: 10px; max-width: 640px; padding: 8px 8px 8px 14px; border: 1px solid var(--velvet-line); border-radius: 12px; background: rgba(255,244,240,.05); }
.base-label { font: 700 11px var(--mono); color: var(--gold); letter-spacing: .1em; }
.base-url code { flex: 1; min-width: 0; background: none; border: 0; color: #F6EEEA; font-size: 13px; overflow-wrap: anywhere; }
.copy-mini { flex: none; height: 30px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--velvet-line); background: rgba(255,244,240,.08); color: #F6EEEA; font: 500 12px var(--sans); cursor: pointer; }
.copy-mini:hover { background: rgba(255,244,240,.16); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 22px 0 28px; }
.hero-stats { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 28px; }
.hero-stats li { display: flex; flex-direction: column; min-width: 0; }
.hero-stats b { font-size: 28px; font-weight: 800; color: var(--gold-bright); line-height: 1.1; }
.hero-stats span { color: var(--velvet-muted); font-size: 13px; }
.hero-demo { min-width: 0; }
.demo-card { background: var(--surface); color: var(--ink); border-radius: 18px; box-shadow: 0 30px 80px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.06); overflow: hidden; }
.demo-head { display: flex; align-items: center; gap: 6px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fdfbfa; }
.demo-head .dot { width: 9px; height: 9px; border-radius: 50%; background: #E3DAD5; }
.demo-head code { margin-left: 8px; background: none; border: 0; color: var(--muted); font-size: 12px; }
.demo-req { margin: 0; padding: 14px 18px; font: 12.5px/1.6 var(--mono); background: var(--code-bg); border-bottom: 1px solid var(--line); overflow-x: auto; }
.demo-res { padding: 18px; }
.demo-plain { font-size: 13.5px; line-height: 1.75; margin-bottom: 14px; color: #3a3330; }
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.kpi { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.kpi span { display: block; color: var(--muted); font-size: 12px; }
.kpi b { display: block; font-size: 22px; font-weight: 800; line-height: 1.25; }
.kpi small { color: var(--muted); font-size: 12px; }
.up { color: var(--up); } .down { color: var(--down); }

/* ── 按鈕 ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 20px; border-radius: 12px; font: 600 15px var(--sans); cursor: pointer; border: 1px solid transparent; transition: transform .16s var(--ease), box-shadow .16s var(--ease), background .16s; text-decoration: none !important; }
.btn-primary { color: #fff; background: linear-gradient(180deg, #B31B27, var(--brand)); box-shadow: 0 6px 18px rgba(163,22,33,.32); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(163,22,33,.38); }
.btn-ghost-gold { color: var(--gold-bright); border-color: rgba(226,185,90,.5); background: transparent; }
.btn-ghost-gold:hover { background: rgba(226,185,90,.1); }
.btn-outline { color: var(--ink); background: var(--surface); border-color: var(--line); }
.btn-outline:hover { border-color: #d8cfc9; box-shadow: var(--shadow); }
.btn.block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }

/* ── 版面 ── */
.layout { max-width: 1320px; margin: 0 auto; padding: 0 32px; display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 48px; }
.sidebar { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 92px); overflow-y: auto; padding: 32px 0 40px; }
.side-group { margin-bottom: 22px; }
.side-title { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .08em; margin-bottom: 6px; }
.sidebar a { display: block; padding: 5px 10px; margin: 1px 0; border-radius: 8px; color: var(--ink); font-size: 14px; border-left: 2px solid transparent; }
.sidebar a:hover { background: var(--brand-tint); text-decoration: none; }
.sidebar a.active { color: var(--brand-deep); background: var(--brand-tint); border-left-color: var(--brand); font-weight: 600; }
.sidebar a.sub { font-size: 13px; color: var(--muted); padding-left: 18px; }
.content { min-width: 0; padding-bottom: 80px; }
.doc-section { padding: 56px 0; border-bottom: 1px solid var(--line); }
.doc-section:last-child { border-bottom: 0; }
.kicker { color: var(--brand); font-size: 12px; font-weight: 700; letter-spacing: .12em; margin-bottom: 6px; }
.lead { color: #4d4542; font-size: 15.5px; max-width: 780px; margin-bottom: 24px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: start; }
.split.annotated { margin-top: 36px; }
.prose { min-width: 0; }
.code-col { min-width: 0; position: sticky; top: 84px; }
.code-col pre, pre.block { position: relative; margin: 0 0 12px; padding: 16px 18px; background: var(--code-bg); border: 1px solid var(--code-line); border-radius: 12px; font: 12.8px/1.65 var(--mono); overflow-x: auto; }
pre.tall { max-height: 560px; overflow: auto; }
.code-note { color: var(--muted); font-size: 13px; }
.sub { margin-top: 40px; }
ul.dense, ol.dense { padding-left: 20px; margin: 8px 0 14px; }
ul.dense li { margin: 4px 0; }

.steps { list-style: none; padding: 0; margin: 8px 0 20px; counter-reset: s; }
.steps li { position: relative; padding: 0 0 18px 52px; counter-increment: s; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: var(--brand); background: var(--brand-tint); }
.steps li::after { content: ""; position: absolute; left: 16px; top: 38px; bottom: 4px; width: 2px; background: var(--line); }
.steps li:last-child::after { display: none; }
.steps b { display: block; font-size: 16px; margin-bottom: 2px; }
.steps span { color: #4d4542; }
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; background: var(--amber-bg); border: 1px solid rgba(168,114,15,.2); }
.callout svg { width: 20px; height: 20px; color: var(--amber); margin-top: 3px; }
.callout p { margin: 0; color: #5b4a2c; font-size: 14px; }

/* code tabs */
.code-tabs { border: 1px solid var(--code-line); border-radius: 12px; background: var(--code-bg); overflow: hidden; margin-bottom: 14px; }
.tab-bar { display: flex; align-items: center; gap: 2px; padding: 6px 8px; border-bottom: 1px solid var(--code-line); background: #F7F1EC; }
.tab-bar button { height: 30px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font: 600 12.5px var(--sans); cursor: pointer; }
.tab-bar button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(32,27,26,.08); }
.tab-bar .copy { margin-left: auto; }
.code-tabs pre { margin: 0; padding: 16px 18px; font: 12.8px/1.65 var(--mono); overflow-x: auto; background: transparent; border: 0; border-radius: 0; }
.copy { height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--code-line); background: var(--surface); color: var(--muted); font: 600 12px var(--sans); cursor: pointer; }
.copy:hover { color: var(--ink); }

.result-card { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); padding: 18px; }
.result-card h4 { margin: 0 0 8px; font-size: 13px; color: var(--muted); font-weight: 600; }

/* tables */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--surface); }
.prose .tbl { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; border-collapse: separate; border-spacing: 0; margin: 12px 0; }
.tbl th, .tbl td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { font-size: 12.5px; color: var(--muted); font-weight: 600; background: #FCFAF9; white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.num { text-align: right; white-space: nowrap; }
.tbl.strategies td:first-child b { display: block; }
.tbl.strategies td:first-child small { color: var(--muted); }

/* envelope */
.envelope-diagram { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0 18px; }
.env-box { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--surface); min-width: 0; }
.env-box h4 { margin: 0 0 8px; font: 700 13px var(--mono); }
.env-box h4 span { font-family: var(--sans); font-weight: 500; color: var(--muted); }
.env-box ul { list-style: none; margin: 0; padding: 0; }
.env-box li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-top: 1px dashed var(--line); font-size: 13px; }
.env-box li:first-child { border-top: 0; }
.env-box li code { font-size: 12px; }
.env-box li span { color: var(--muted); text-align: right; }
.env-box.meta { background: linear-gradient(180deg, #FFFDFB, var(--surface)); }

/* blocks */
.block-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.block { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 18px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.block-head { display: flex; align-items: center; gap: 10px; }
.block-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-tint); color: var(--brand); }
.block-icon svg { width: 20px; height: 20px; }
.block-head b { font-size: 16px; }
.block-head small { display: block; color: var(--muted); font: 12px var(--mono); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); background: #FCFAF9; font-size: 12.5px; max-width: 100%; }
.chip.mono { font-family: var(--mono); font-size: 12px; }
.block ul { margin: 0; padding-left: 18px; color: #4d4542; font-size: 13.5px; }
.block pre { margin: auto 0 0; padding: 10px 12px; background: var(--code-bg); border: 1px solid var(--code-line); border-radius: 10px; font: 12px/1.55 var(--mono); overflow-x: auto; }
.anno-list { padding-left: 20px; }
.anno-list li { margin: 6px 0; }
.try-btn { margin-top: 4px; }

/* indicators */
.indicator-groups { display: flex; flex-direction: column; gap: 26px; }
.ind-cat h3 { margin: 0 0 12px; display: flex; align-items: center; gap: 10px; }
.ind-cat h3 span { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.ind-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.ind { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 14px; min-width: 0; }
.ind-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.ind-top b { font-size: 15px; }
.ind-top code { font-size: 11.5px; }
.ind p { color: #5b524e; font-size: 13px; margin: 6px 0 8px; }
.ind-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge.lag { background: var(--amber-bg); color: var(--amber); }
.badge.now { background: var(--green-bg); color: var(--green); }
.badge.num { background: var(--slate-bg); color: var(--slate); }
.score-panel { margin-top: 30px; display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 28px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.score-panel h3 { margin-top: 0; }
.score-bars { display: flex; flex-direction: column; gap: 6px; }
.sbar { display: grid; grid-template-columns: minmax(0, 1fr) 140px 34px; gap: 10px; align-items: center; font-size: 13px; }
.sbar .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sbar .track { position: relative; height: 10px; background: #F3EEEA; border-radius: 99px; }
.sbar .track i { position: absolute; top: 0; bottom: 0; border-radius: 99px; }
.sbar .track i.pos { left: 50%; background: linear-gradient(90deg, #d9b25a, var(--gold)); }
.sbar .track i.neg { right: 50%; background: linear-gradient(270deg, #9aa3b2, var(--slate)); }
.sbar .track::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: #cfc6c0; }
.sbar b { text-align: right; }

/* methodology */
.method-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.mcard { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 16px; min-width: 0; }
.mcard h4 { margin: 0 0 6px; font-size: 14px; }
.mcard p { margin: 0; font-size: 13.5px; color: #4d4542; }

/* templates */
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.tpl { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 16px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tpl-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tpl-head b { font-size: 15px; }
.tpl p { margin: 0; color: #5b524e; font-size: 13.5px; }
.tpl .note { font-size: 12.5px; color: var(--amber); background: var(--amber-bg); border-radius: 8px; padding: 6px 10px; }
.tpl .btn { height: 36px; font-size: 13px; margin-top: auto; }

/* reference */
.ref-group { margin-top: 36px; }
.ref-group > h3 { display: flex; align-items: center; gap: 10px; font-size: 19px; margin: 0 0 4px; }
.ref-group > p { color: var(--muted); font-size: 14px; margin-bottom: 16px; }
.op { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 10px; scroll-margin-top: 80px; transition: box-shadow .16s var(--ease); }
.op:hover { box-shadow: var(--shadow); }
.op-head { display: grid; grid-template-columns: auto minmax(0, auto) minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; border-radius: var(--radius); }
.op-head:focus-visible { outline: 2px solid rgba(163,22,33,.35); }
.op.open .op-head { border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.op-body { display: none !important; }
.op.open .op-body { display: grid !important; }
.chev { width: 18px; height: 18px; color: var(--muted); transition: transform .16s var(--ease); }
.op.open .chev { transform: rotate(180deg); }
.ref-group .count { font-size: 12px; font-weight: 600; color: var(--muted); background: #F3EEEA; border-radius: 999px; padding: 1px 8px; }
.expand-all { margin-left: auto; height: 30px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--muted); font: 600 12.5px var(--sans); cursor: pointer; }
.expand-all:hover { color: var(--ink); }
.op-head code.path { background: none; border: 0; font-size: 14px; font-weight: 600; color: var(--ink); }
.op-head .op-sum { color: #4d4542; font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
span.method { font: 700 11.5px var(--mono); display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 7px; letter-spacing: .04em; }
span.method.get { background: var(--slate-bg); color: var(--slate); }
span.method.post { background: var(--brand-tint); color: var(--brand-deep); }
span.method.put, span.method.patch { background: var(--amber-bg); color: var(--amber); }
span.method.delete { background: #F6E6E5; color: #8D1A22; }
.op-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; padding: 18px; }
.op-body h5 { margin: 0 0 8px; font-size: 13px; color: var(--muted); font-weight: 700; letter-spacing: .04em; }
.op-desc { font-size: 14px; color: #3d3633; margin-bottom: 12px; white-space: pre-line; }
.fields { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 14px; }
.fields td { padding: 7px 8px; border-top: 1px solid var(--line); vertical-align: top; }
.fields tr:first-child td { border-top: 0; }
.fields td:first-child { width: 38%; }
.fields code { font-size: 12px; }
.fields .type { display: block; color: var(--muted); font: 11.5px var(--mono); margin-top: 2px; }
.fields .req { color: var(--brand); font-size: 11px; font-weight: 700; margin-left: 4px; }
.fields .enum { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
details.nested > summary { cursor: pointer; color: var(--muted); font-size: 12.5px; margin: 4px 0; }
details.nested .fields { margin-left: 10px; width: calc(100% - 10px); }

/* MCP */
.client-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.client { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 18px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.client-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.client-head b { font-size: 16px; }
.client p { margin: 0; font-size: 13.5px; color: #4d4542; }
.client pre { margin: 0; padding: 12px 14px; background: var(--code-bg); border: 1px solid var(--code-line); border-radius: 10px; font: 12px/1.6 var(--mono); overflow-x: auto; }
.client .copy { align-self: flex-start; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.tool { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 10px 12px; min-width: 0; }
.tool code { background: none; border: 0; font-size: 12.5px; padding: 0; }
.tool span { color: var(--muted); font-size: 12.5px; }
.tool div { min-width: 0; flex: 1; }
.tool .badge { margin-left: auto; }
.badge.ro { background: var(--green-bg); color: var(--green); }
.badge.rw { background: var(--amber-bg); color: var(--amber); }
.badge.danger { background: #F6E6E5; color: #8D1A22; }

/* changelog & terms */
.timeline { border-left: 2px solid var(--line); margin-left: 6px; padding-left: 22px; }
.timeline article { position: relative; padding-bottom: 22px; }
.timeline article::before { content: ""; position: absolute; left: -29px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 3px solid var(--brand); }
.timeline header { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.ver { font-weight: 800; font-size: 17px; }
.timeline time { color: var(--muted); font-size: 13px; }
.terms { padding-left: 20px; }
.terms li { margin: 8px 0; }

/* footer（深色帶）*/
.footer { background: linear-gradient(160deg, var(--velvet), var(--velvet-2)); color: var(--velvet-muted); }
.footer-inner { max-width: 1320px; margin: 0 auto; padding: 36px 32px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; font-size: 13px; }
.footer-brand { color: var(--gold-bright); font-weight: 800; font-size: 15px; margin-bottom: 6px; }
.footer-dis { color: #E8DCD7; }
.footer-attr { list-style: none; margin: 0; padding: 0; }
.footer-attr li { padding: 3px 0; }

/* drawer */
.drawer-mask { position: fixed; inset: 0; background: rgba(32,27,26,.28); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); z-index: 41; background: var(--surface); box-shadow: -20px 0 60px rgba(32,27,26,.18);
  transform: translateX(100%); transition: transform .22s var(--ease); display: flex; flex-direction: column; }
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.drawer-head div { display: flex; align-items: center; gap: 8px; min-width: 0; }
.drawer-head code { background: none; border: 0; font-weight: 600; overflow-wrap: anywhere; }
.drawer-body { padding: 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; font-weight: 600; }
.field small { font-weight: 400; color: var(--muted); margin-left: 8px; }
.field input, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: 13px/1.55 var(--mono); color: var(--ink); background: #fff; }
.field input:focus, .field textarea:focus { outline: 2px solid rgba(163,22,33,.25); border-color: var(--brand); }
.try-result { border-top: 1px solid var(--line); padding-top: 14px; }
.try-status { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12.5px; margin-bottom: 10px; color: var(--muted); }
.try-status span:first-child { font-weight: 700; }
.try-status .ok { color: var(--green); } .try-status .err { color: var(--brand); }
.try-plain { padding: 10px 12px; border-radius: 10px; background: var(--green-bg); color: #24533c; font-size: 13.5px; }
.try-result pre { margin: 0; max-height: 420px; overflow: auto; padding: 14px; background: var(--code-bg); border: 1px solid var(--code-line); border-radius: 10px; font: 12px/1.6 var(--mono); }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 60; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13.5px; transition: opacity .18s, transform .18s var(--ease); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* highlight.js：暖色調 */
.hljs { background: transparent !important; color: #3a3330; }
.hljs-attr, .hljs-name, .hljs-variable { color: #3B4FA0; }
.hljs-string { color: #0F6B5C; }
.hljs-number, .hljs-literal { color: #9A5B13; }
.hljs-keyword, .hljs-built_in, .hljs-title { color: #7C1019; }
.hljs-comment, .hljs-meta { color: #958b86; font-style: italic; }
.hljs-section, .hljs-bullet { color: #7C1019; font-weight: 700; }

/* ── 響應式 ── */
@media (max-width: 1180px) {
  .split, .op-body { grid-template-columns: minmax(0, 1fr); }
  .code-col { position: static; }
  .hero-inner { grid-template-columns: minmax(0, 1fr); }
  .score-panel { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 920px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding: 0 16px; }
  .sidebar { position: fixed; top: 60px; left: 0; bottom: 0; width: 280px; max-height: none; z-index: 35; background: var(--paper); padding: 20px 16px; border-right: 1px solid var(--line); transform: translateX(-100%); transition: transform .2s var(--ease); }
  .sidebar.open { transform: none; box-shadow: 20px 0 50px rgba(32,27,26,.14); }
  .topnav { display: none; }
  .menu-btn { display: grid; place-items: center; }
  .brand-sub { display: none; }
  .topbar { padding: 0 16px; gap: 10px; }
  .hero-inner { padding: 40px 16px 48px; gap: 28px; }
  .hero h1 { font-size: 30px; }
  .hero-stats { gap: 18px; }
  .hero-stats b { font-size: 22px; }
  .footer-inner { grid-template-columns: minmax(0, 1fr); padding: 28px 16px; }
  .envelope-diagram { grid-template-columns: minmax(0, 1fr); }
  .doc-section { padding: 40px 0; }
  h2 { font-size: 22px; }
}
@media (max-width: 680px) {
  .op-head { grid-template-columns: auto minmax(0, 1fr) auto; }
  .op-head .op-sum { grid-column: 1 / -1; white-space: normal; }
  .op-head .chev { grid-column: 3; grid-row: 1; }
}
@media (max-width: 480px) {
  .kpis { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .key-pill span { max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sbar { grid-template-columns: minmax(0, 1fr) 90px 28px; }
  .client-grid, .method-grid, .template-grid, .block-grid, .ind-grid, .tool-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* v1.2 提醒範例 */
.notice-demo { display: grid; gap: 8px; margin: 16px 0 4px; }
.notice-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: baseline; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 14px; line-height: 1.6; }
.notice-row > span:last-child { flex: 1 1 260px; min-width: 0; }
.notice-code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--state-draft-bg, #F9F1E0); color: var(--state-draft, #A8720F); white-space: nowrap; }
/* 金鑰保存選項（v1.2） */
.key-opts { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; margin: -4px 0 14px; min-width: 0; font-size: 13px; color: var(--muted); }
.key-opts .check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; min-height: 40px; }
.key-opts .check input { width: 18px; height: 18px; accent-color: var(--brand); }
.link-btn { background: none; border: 0; padding: 8px 0; min-height: 40px; color: var(--brand); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
