/* =========================================================
   Narrative Radar — 介面樣式
   色彩語意：
   --pass  Gate 通過      --ready  Entry Ready（可準備進場）
   --wait  等待/警示      --stop   拒絕/停損
   --up/--down 只用在價格漲跌，可切換「綠漲紅跌／紅漲綠跌」
   ========================================================= */
:root {
  --bg: #EEF1F5;
  --surface: #FFFFFF;
  --surface-2: #F6F8FA;
  --ink: #132033;
  --ink-2: #3A475A;
  --muted: #667387;
  --line: #D9DFE7;
  --line-2: #E8ECF1;
  --ready: #2B59D9;
  --ready-soft: #E3EAFC;
  --pass: #0E8A6B;
  --pass-soft: #DDF2EB;
  --wait: #A86A0C;
  --wait-soft: #FBEFD9;
  --stop: #B53A31;
  --stop-soft: #F8E1DE;
  --neutral-soft: #E9EDF2;
  --green: #0E8A6B;
  --red: #C23B32;
  --up: var(--green);
  --down: var(--red);
  --btc: #8A94A6;
  --shadow: 0 1px 0 rgba(19, 32, 51, .04), 0 8px 24px -16px rgba(19, 32, 51, .25);
  --r-lg: 14px;
  --r-md: 10px;
  --r-sm: 6px;
  --font: "IBM Plex Sans", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --font-tc: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1520; --surface: #151E2A; --surface-2: #1A2431; --ink: #E7ECF2; --ink-2: #C3CCD8;
    --muted: #8D99AA; --line: #273343; --line-2: #1F2A38;
    --ready: #7096FF; --ready-soft: #1D2A4A; --pass: #3CC59D; --pass-soft: #14322B;
    --wait: #E6AC48; --wait-soft: #35290F; --stop: #F2776D; --stop-soft: #3A1E1D; --neutral-soft: #1E2835;
    --green: #3CC59D; --red: #F2776D; --btc: #6F7B8D;
    --shadow: 0 1px 0 rgba(0,0,0,.2), 0 10px 30px -18px rgba(0,0,0,.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1520; --surface: #151E2A; --surface-2: #1A2431; --ink: #E7ECF2; --ink-2: #C3CCD8;
  --muted: #8D99AA; --line: #273343; --line-2: #1F2A38;
  --ready: #7096FF; --ready-soft: #1D2A4A; --pass: #3CC59D; --pass-soft: #14322B;
  --wait: #E6AC48; --wait-soft: #35290F; --stop: #F2776D; --stop-soft: #3A1E1D; --neutral-soft: #1E2835;
  --green: #3CC59D; --red: #F2776D; --btc: #6F7B8D;
  --shadow: 0 1px 0 rgba(0,0,0,.2), 0 10px 30px -18px rgba(0,0,0,.7);
  color-scheme: dark;
}
:root[data-colors="tw"] { --up: var(--red); --down: var(--green); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 15px; line-height: 1.55;
  font-feature-settings: "tnum" 1;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ready); outline-offset: 2px; border-radius: 4px; }
.num { font-variant-numeric: tabular-nums; }
.up { color: var(--up); }
.down { color: var(--down); }
.muted { color: var(--muted); }

/* ---------------- Top bar ---------------- */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1320px; margin: 0 auto; padding: 12px 24px 6px; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: none; }
.brand-mark { width: 26px; height: 26px; fill: none; stroke: var(--ready); stroke-width: 2.6; }
.brand-mark .blip { fill: var(--pass); stroke: none; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.brand-ver { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 1px 8px; }
.status { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; font-size: 13px; color: var(--ink-2); flex-wrap: wrap; }
.status .pill { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--pass); box-shadow: 0 0 0 3px var(--pass-soft); }
.dot.bad { background: var(--stop); box-shadow: 0 0 0 3px var(--stop-soft); }
.dot.wait { background: var(--wait); box-shadow: 0 0 0 3px var(--wait-soft); }
.dot.live { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px transparent; } }
.top-actions { display: flex; gap: 8px; align-items: center; flex: none; }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 6px 14px;
  font-size: 13px; font-weight: 600; cursor: pointer; }
.btn:hover { border-color: var(--ink-2); }
.btn[disabled] { opacity: .55; cursor: progress; }
.icon-btn { width: 34px; height: 32px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px;
  cursor: pointer; display: grid; place-items: center; font-size: 12px; font-weight: 700; padding: 0; }
.icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.tabs { max-width: 1320px; margin: 0 auto; padding: 0 24px; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { text-decoration: none; padding: 9px 12px 10px; font-size: 14px; color: var(--muted); white-space: nowrap;
  border-bottom: 2px solid transparent; font-family: var(--font-tc); font-weight: 500; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ready); }
.tabs .count { font-size: 11px; margin-left: 5px; background: var(--ready); color: #fff; border-radius: 99px; padding: 0 6px; }

.banner { max-width: 1320px; margin: 14px auto 0; padding: 10px 16px; border-radius: var(--r-md);
  background: var(--wait-soft); color: var(--ink); font-size: 14px; border: 1px solid color-mix(in srgb, var(--wait) 35%, transparent); }
.banner.demo { background: var(--ready-soft); border-color: color-mix(in srgb, var(--ready) 30%, transparent); }
.banner .bar { height: 4px; background: color-mix(in srgb, var(--ready) 18%, transparent); border-radius: 4px; margin-top: 8px; overflow: hidden; }
.banner .bar i { display: block; height: 100%; background: var(--ready); transition: width .4s; }

main { max-width: 1320px; margin: 0 auto; padding: 28px 24px 80px; }
.view[hidden] { display: none; }

/* ---------------- Section headings ---------------- */
.sec { margin-top: 44px; }
.sec:first-child { margin-top: 0; }
.sec-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.sec-head h2 { margin: 0; font-family: var(--font-tc); font-size: 20px; font-weight: 700; letter-spacing: .01em; }
.sec-head p { margin: 0; color: var(--muted); font-size: 13.5px; }
.sec-head .right { margin-left: auto; font-size: 13px; color: var(--muted); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.panel-pad { padding: 20px 22px; }

/* ---------------- Hero (decision) ---------------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: 28px; align-items: stretch; }
.decision { padding: 6px 0 4px; display: flex; flex-direction: column; }
.decision .when { font-size: 13px; color: var(--muted); display: flex; gap: 10px; align-items: center; }
.decision h1 { font-family: var(--font-tc); font-weight: 900; font-size: clamp(28px, 3.6vw, 44px); line-height: 1.22;
  letter-spacing: -.01em; margin: 14px 0 12px; max-width: 18em; text-wrap: pretty; }
.decision .action { font-size: 16.5px; color: var(--ink-2); max-width: 46em; margin: 0; line-height: 1.7; }
.tone-mark { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; padding: 4px 10px 4px 8px;
  border-radius: 99px; }
.tone-mark i { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.tone-idle { color: var(--ink-2); background: var(--neutral-soft); }
.tone-go { color: var(--ready); background: var(--ready-soft); }
.tone-warn { color: var(--wait); background: var(--wait-soft); }
.tone-danger { color: var(--stop); background: var(--stop-soft); }

.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: auto; padding-top: 28px; gap: 0; }
.fact { padding: 14px 18px 4px 0; border-top: 2px solid var(--ink); margin-right: 18px; }
.fact .k { font-size: 12.5px; color: var(--muted); font-family: var(--font-tc); }
.fact .v { font-size: 22px; font-weight: 600; margin-top: 2px; line-height: 1.25; }
.fact .s { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* market regime panel */
.regime { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.regime-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.regime-head h3 { margin: 0; font-size: 14px; font-family: var(--font-tc); font-weight: 600; color: var(--muted); }
.regime-name { font-family: var(--font-tc); font-size: 24px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.regime-name small { font-size: 13px; font-weight: 500; color: var(--muted); }
.ladder { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.ladder span { height: 8px; border-radius: 3px; background: var(--line-2); }
.ladder span.on.r0 { background: var(--pass); } .ladder span.on.r1 { background: var(--wait); }
.ladder span.on.r2 { background: #D9772B; } .ladder span.on.r3 { background: var(--stop); }
.ladder-l { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; font-size: 11px; color: var(--muted); margin-top: -8px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 13.5px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; text-align: right; font-weight: 500; }
.strip { display: flex; gap: 1px; height: 22px; border-radius: 4px; overflow: hidden; }
.strip i { flex: 1; background: var(--line-2); }
.strip i.r0 { background: color-mix(in srgb, var(--pass) 55%, transparent); }
.strip i.r1 { background: var(--wait); } .strip i.r2 { background: #D9772B; } .strip i.r3 { background: var(--stop); }
.strip-l { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.reasons { font-size: 12.5px; color: var(--muted); margin: 0; padding-left: 16px; }

/* ---------------- Funnel ---------------- */
.funnel { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: start; gap: 0; }
.fstep { position: relative; padding: 0 16px 0 0; }
.fstep .bar { height: 10px; border-radius: 5px; background: var(--ink-2); opacity: .85; }
.fstep:nth-child(2) .bar { opacity: .7 } .fstep:nth-child(3) .bar { opacity: .55 } .fstep:nth-child(4) .bar { background: var(--ready); opacity: .8 }
.fstep:last-child .bar { background: var(--pass); opacity: 1; }
.fstep .n { font-size: 30px; font-weight: 600; line-height: 1; margin-bottom: 8px; letter-spacing: -.02em; }
.fstep .l { font-size: 13px; color: var(--ink-2); margin-top: 10px; font-family: var(--font-tc); font-weight: 500; }
.fstep .d { font-size: 12px; color: var(--muted); }
.fstep.zero .n { color: var(--muted); }

/* ---------------- Candidate cards ---------------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; }
.cand { padding: 18px 20px 16px; display: flex; flex-direction: column; gap: 14px; position: relative; }
.cand.is-ready { border-color: var(--ready); box-shadow: 0 0 0 1px var(--ready), var(--shadow); }
.cand-top { display: flex; align-items: flex-start; gap: 12px; }
.cand-sym { font-size: 22px; font-weight: 700; letter-spacing: -.01em; line-height: 1.1; }
.cand-sym small { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 2px; }
.cand-px { font-size: 13.5px; color: var(--ink-2); }
.cand-score { margin-left: auto; text-align: right; }
.cand-score .v { font-size: 26px; font-weight: 600; line-height: 1; }
.cand-score .k { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.cand-sub { display: flex; align-items: center; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.spark { width: 112px; height: 40px; flex: none; }
.spark path.l { fill: none; stroke-width: 1.6; }
.spark path.a { stroke: none; opacity: .12; }
.state { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px;
  white-space: nowrap; font-family: var(--font-tc); }
.state i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-ENTRY_READY { color: var(--ready); background: var(--ready-soft); }
.st-CONFIRMING { color: var(--pass); background: var(--pass-soft); }
.st-WATCH_EARLY { color: var(--wait); background: var(--wait-soft); }
.st-REJECTED { color: var(--stop); background: var(--stop-soft); }
.st-NEW { color: var(--ink-2); background: var(--neutral-soft); }

/* gate rail: 6 segments */
.rail { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.gate { display: flex; flex-direction: column; gap: 6px; min-width: 0; cursor: help; }
.gate .seg { height: 6px; border-radius: 3px; background: transparent; border: 1.5px solid var(--line); }
.gate.ok .seg { background: var(--pass); border-color: var(--pass); }
.gate.no .seg { border-color: var(--wait); border-style: dashed; }
.gate .gl { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--font-tc); }
.gate .gv { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gate.no .gv { color: var(--wait); }
.missing { font-size: 13.5px; color: var(--ink-2); margin: 0; }
.missing b { color: var(--wait); font-weight: 600; }
.missing.ready b { color: var(--ready); }

/* price ladder */
.pl { position: relative; height: 54px; margin: 2px 4px 0; }
.pl .track { position: absolute; left: 0; right: 0; top: 22px; height: 4px; border-radius: 2px;
  background: linear-gradient(90deg, var(--stop-soft), var(--line-2) 30%, var(--pass-soft)); }
.pl .risk { position: absolute; top: 22px; height: 4px; background: color-mix(in srgb, var(--stop) 45%, transparent); border-radius: 2px; }
.pl .reward { position: absolute; top: 22px; height: 4px; background: color-mix(in srgb, var(--pass) 50%, transparent); border-radius: 2px; }
.pl .zone { position: absolute; top: 15px; height: 18px; background: color-mix(in srgb, var(--ready) 16%, transparent);
  border-left: 1.5px solid var(--ready); border-right: 1.5px solid var(--ready); border-radius: 2px; }
.pl .tick { position: absolute; top: 0; transform: translateX(-50%); font-size: 10.5px; color: var(--muted); white-space: nowrap; text-align: center; line-height: 1.2; }
.pl .tick.b { top: 36px; }
.pl .tick::after { content: ""; position: absolute; left: 50%; width: 1px; height: 6px; background: var(--muted); }
.pl .tick:not(.b)::after { top: 13px; } .pl .tick.b::after { top: -8px; }
.pl .now { position: absolute; top: 17px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: var(--surface);
  border: 3px solid var(--ink); z-index: 2; }
.plan-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; font-size: 12px; }
.plan-row div { min-width: 0; }
.plan-row .k { color: var(--muted); font-size: 11.5px; }
.plan-row .v { font-weight: 600; font-size: 13.5px; }
.cand-foot { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; border-top: 1px solid var(--line-2); padding-top: 10px; }

/* ---------------- Tables ---------------- */
.tbl-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.t th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 10px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap; font-family: var(--font-tc); }
.t td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; white-space: nowrap; }
.t tr:last-child td { border-bottom: none; }
.t td.r, .t th.r { text-align: right; }
.t tbody tr:hover { background: var(--surface-2); }
.sym { font-weight: 600; }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 99px; background: var(--neutral-soft); color: var(--ink-2); margin-left: 6px; }
.tag.hot { background: var(--wait-soft); color: var(--wait); }
.tag.deep { background: var(--ready-soft); color: var(--ready); }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); font-size: 14px; }
.empty b { color: var(--ink); display: block; font-size: 15px; margin-bottom: 4px; font-family: var(--font-tc); }

/* ---------------- Paper ---------------- */
.paper-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 16px; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.kpi { padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.kpi:nth-child(odd) { border-right: 1px solid var(--line-2); }
.kpi .k { font-size: 12.5px; color: var(--muted); font-family: var(--font-tc); }
.kpi .v { font-size: 22px; font-weight: 600; line-height: 1.3; }
.kpi .s { font-size: 12px; color: var(--muted); }
.chart { width: 100%; display: block; }
.chart.mini { height: 150px; }
.more { display: block; margin: 14px auto 0; }
.chart .grid line { stroke: var(--line-2); }
.chart .axis text { fill: var(--muted); font-size: 11px; }
.chart .eq { fill: none; stroke: var(--ready); stroke-width: 2; }
.chart .eqa { fill: var(--ready); opacity: .08; }
.chart .btc { fill: none; stroke: var(--btc); stroke-width: 1.5; stroke-dasharray: 4 3; }
.chart .base { stroke: var(--muted); stroke-dasharray: 2 3; }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.note { font-size: 12.5px; color: var(--muted); margin: 10px 0 0; }

/* ---------------- History lanes ---------------- */
.lanes .t td { white-space: nowrap; }
.lane { position: relative; height: 18px; min-width: 260px; }
.lane .seg { position: absolute; top: 5px; height: 8px; border-radius: 2px; }
.lane .seg.s-ENTRY_READY { background: var(--ready); }
.lane .seg.s-CONFIRMING { background: var(--pass); }
.lane .seg.s-WATCH_EARLY { background: var(--wait); opacity: .75; }
.lane .seg.s-REJECTED { background: var(--stop); opacity: .8; }
.lane .first { position: absolute; top: 1px; width: 2px; height: 16px; background: var(--ink); }
.lane-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); min-width: 260px; }
.legend-states { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legend-states i { display: inline-block; width: 12px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
details.trs summary { cursor: pointer; color: var(--ready); font-size: 12.5px; list-style: none; }
details.trs summary::-webkit-details-marker { display: none; }
.tr-list { margin: 8px 0 2px; padding: 0; list-style: none; font-size: 12.5px; white-space: normal; max-width: 520px; }
.tr-list li { display: grid; grid-template-columns: 104px 120px 1fr; gap: 8px; padding: 3px 0; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 4px 12px; font-size: 13px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }

/* ---------------- Lab ---------------- */
.lab-top { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.lab-top .kpi { border-right: 1px solid var(--line-2); border-bottom: none; }
.lab-top .kpi:last-child { border-right: none; }
.warnline { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: var(--r-md);
  background: var(--wait-soft); font-size: 13.5px; margin-bottom: 16px; }
.warnline b { color: var(--wait); }
.stack { display: flex; height: 30px; border-radius: 6px; overflow: hidden; gap: 2px; }
.stack div { display: grid; place-items: center; font-size: 12px; font-weight: 600; color: #fff; min-width: 2px; }
.c-GOOD_SKIP { background: var(--pass); } .c-BAD_SKIP { background: var(--wait); } .c-NEUTRAL { background: var(--btc); }
.c-TRADED { background: var(--ready); } .c-PENDING { background: var(--line); color: var(--muted) !important; }
.lab-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar { display: grid; grid-template-columns: 76px 1fr 46px; gap: 10px; align-items: center; font-size: 13px; }
.hbar .b { height: 10px; background: var(--line-2); border-radius: 5px; overflow: hidden; }
.hbar .b i { display: block; height: 100%; border-radius: 5px; }
.cls { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.cls i { width: 8px; height: 8px; border-radius: 2px; }
.path { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }

/* ---------------- Events ---------------- */
.events { list-style: none; margin: 0; padding: 0; }
.events li { display: grid; grid-template-columns: 92px 22px 1fr; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line-2); font-size: 13.5px; }
.events li:last-child { border-bottom: none; }
.events .t { color: var(--muted); font-size: 12.5px; }
.events .ttl { font-weight: 500; }
.events .det { color: var(--muted); font-size: 12.5px; }
.ov-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: 28px; }

/* ---------------- Rules ---------------- */
.rules { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.rules h3 { margin: 0 0 8px; font-size: 16px; font-family: var(--font-tc); }
.rules p, .rules li { font-size: 14px; color: var(--ink-2); line-height: 1.75; }
.rules ul { padding-left: 18px; margin: 6px 0; }
.rules code { font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 4px; padding: 0 5px; }
.flow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0 4px; }
.flow span { font-size: 12.5px; }

/* ---------------- Tooltip ---------------- */
.tooltip { position: fixed; z-index: 50; max-width: 280px; background: var(--ink); color: var(--surface); font-size: 12.5px;
  padding: 8px 10px; border-radius: 8px; pointer-events: none; line-height: 1.5; box-shadow: var(--shadow); }
.tooltip b { display: block; }

/* ---------------- Responsive ---------------- */
@media (max-width: 1020px) {
  .hero, .ov-grid, .paper-grid, .lab-grid, .rules { grid-template-columns: 1fr; }
  .lab-top { grid-template-columns: repeat(3, 1fr); }
  .lab-top .kpi { border-bottom: 1px solid var(--line-2); }
}
@media (max-width: 720px) {
  body { font-size: 14.5px; }
  .topbar-inner { padding: 10px 16px 4px; flex-wrap: wrap; gap: 10px; }
  .status { order: 3; flex-basis: 100%; gap: 10px; font-size: 12px; }
  .top-actions { margin-left: auto; }
  .brand-ver { display: none; }
  .tabs { padding: 0 16px; }
  main { padding: 20px 16px 60px; }
  .banner { margin: 12px 16px 0; }
  .facts { grid-template-columns: 1fr 1fr; }
  .fact { margin-right: 12px; }
  .funnel { grid-template-columns: repeat(3, 1fr); row-gap: 20px; }
  .fstep .n { font-size: 24px; }
  .cards { grid-template-columns: 1fr; }
  .rail { grid-template-columns: repeat(3, 1fr); row-gap: 10px; }
  .lab-top { grid-template-columns: 1fr 1fr; }
  .spark { width: 84px; }
  .kpis { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 440px) {
  .brand-name { font-size: 14.5px; }
  .brand-mark { width: 22px; height: 22px; }
  .btn { padding: 6px 9px; font-size: 12px; }
  .topbar-inner { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ML 訓練進度 */
.ml-train { margin: 0 0 12px; padding: 12px 14px; border-radius: 10px; background: color-mix(in srgb, var(--wait) 10%, transparent); }
.ml-train-head { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; margin-bottom: 8px; }
.ml-train-head .dot { display: inline-block; vertical-align: middle; }
.ml-bar { height: 6px; border-radius: 4px; background: color-mix(in srgb, var(--wait) 22%, transparent); overflow: hidden; }
.ml-bar i { display: block; height: 100%; background: var(--wait); transition: width .4s; }
