/* 作品畫面：真實截圖的外框（瀏覽器、手機），以及照功能重畫的示意畫面。
   沒有 JS 時每個畫面都是完整的靜態版；main.js 只負責讓它們「動起來」。
   視窗預設是淺色介面；只有現實中本來就是深色的東西（終端機、iPad 狀態看板）用深色。 */

:root {
  --w-bg: #ffffff;
  --w-bar: #f7f8fa;
  --w-ink: #111827;
  --w-text: #374151;
  --w-muted: #6b7280;
  --w-dim: #737a87;
  --w-line: #e7e9ee;
  --w-line2: #d8dce4;
  --w-soft: #f5f6f9;
  --w-node: #ffffff;
}
.term, .console, .ipad-screen {
  color-scheme: dark;
  --w-bg: #0d1117;
  --w-bar: #151a22;
  --w-ink: #f0f3f8;
  --w-text: #c9d1d9;
  --w-muted: #8b949e;
  --w-dim: #6e7681;
  --w-line: rgb(255 255 255 / .08);
  --w-line2: rgb(255 255 255 / .14);
  --w-soft: rgb(255 255 255 / .04);
  --w-node: #161b22;
  --ok-ink: #3fb950;
  --bad-ink: #ff7b72;
  --warn-ink: #e3b341;
  --cyan-ink: #39c5cf;
  --violet-ink: #a5a0ff;
  --info-ink: #58a6ff;
  --pink-ink: #f778ba;
}

/* ───────── 共用視窗外框 ───────── */
.win {
  position: relative; margin: 0; overflow: hidden;
  border: 1px solid var(--w-line2); border-radius: 14px;
  background: var(--w-bg); color: var(--w-text);
  box-shadow: var(--shadow);
}
.win-bar {
  display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px;
  border-bottom: 1px solid var(--w-line); background: var(--w-bar);
  font: 500 .7rem/1 var(--f-mono); color: var(--w-dim);
}
.win-bar i { width: 9px; height: 9px; border-radius: 50%; background: #d1d5db; flex: none; }
.win-bar i:nth-child(1) { background: #ff5f57; } .win-bar i:nth-child(2) { background: #febc2e; } .win-bar i:nth-child(3) { background: #28c840; }
.win-bar span { margin-left: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-dot { margin-left: auto; display: inline-flex; align-items: center; gap: .35rem; font: 700 .6rem/1 var(--f-mono); color: var(--ok-ink); letter-spacing: .06em; white-space: nowrap; }
.live-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .3; } }

.ok { color: var(--ok-ink); }
.bad { color: var(--bad-ink); }
.warn { color: var(--warn-ink); }

/* ───────── agent 終端機（工作方式） ───────── */
.console { box-shadow: var(--shadow-lg); }
.console-steps { list-style: none; display: flex; flex-wrap: wrap; gap: .35rem; margin: 0; padding: .8rem 1rem 0; }
.console-steps li {
  padding: .12rem .6rem; border: 1px solid var(--w-line2); border-radius: 999px;
  font: 500 .66rem/1.6 var(--f-mono); color: var(--w-dim); transition: all .3s ease;
}
.console-steps li.is-on { color: #fff; background: #6366f1; border-color: transparent; }
.console-steps li.is-done { color: var(--ok-ink); border-color: color-mix(in srgb, var(--ok-ink) 40%, transparent); }
.console-body { padding: .9rem 1.1rem 1rem; font: 400 .8rem/1.6 var(--f-mono); min-height: 16.5em; color: var(--w-text); }
.ln { display: flex; gap: .7em; margin: 0 0 .3em; }
.who { flex: none; width: 5.4em; font-weight: 700; }
.who.you { color: var(--w-ink); }
.who.c1 { color: #ff8a5c; }
.who.c2 { color: #6aa5ff; }
.who.c3 { color: #b4a8ff; }
/* JS 接手後才逐行出現；沒有 JS 就是整段靜態文字 */
.console.is-live .ln { visibility: hidden; }
.console.is-live .ln.is-in { visibility: visible; animation: type-in .55s steps(24, end) both; }
.console.is-live .ln.is-cur::after { content: "▍"; color: #39c5cf; animation: blink 1s steps(1) infinite; }
@keyframes type-in { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.console .mock-cap { margin: 0; padding: 0 1.1rem .8rem; color: var(--w-dim); }

/* ───────── Munvia：瀏覽器、手機、助理 ───────── */
.mv-stage {
  display: grid; grid-template-columns: minmax(0, 1fr) 236px; grid-template-rows: auto auto;
  gap: 1.1rem 1.4rem; align-items: start;
  padding: clamp(1rem, 2.4vw, 1.8rem); border-radius: 26px; background: var(--stage); border: 1px solid var(--line);
}
.browser {
  grid-column: 1; grid-row: 1 / span 2;
  border: 1px solid var(--w-line2); border-radius: 14px; overflow: hidden; background: var(--w-bg);
  box-shadow: var(--shadow-lg);
}
.browser-tabs { display: flex; gap: 4px; padding: 7px 10px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--w-line); background: var(--w-bg); }
.browser-tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; padding: .28rem .75rem; border: 0; border-radius: 8px; background: transparent; color: var(--w-muted); font-size: .8rem; cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--w-ink); background: var(--w-soft); }
.tab.is-on { color: var(--accent); background: rgb(79 70 229 / .08); box-shadow: inset 0 0 0 1px rgb(79 70 229 / .28); font-weight: 700; }
.browser-view { display: block; width: 100%; padding: 0; border: 0; background: #f5f6f8; cursor: zoom-in; aspect-ratio: 16 / 10; overflow: hidden; }
.browser-view img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; transition: object-position 3.5s ease, opacity .18s ease; }
.browser-view:hover img, .browser-view:focus-visible img { object-position: 50% 100%; }
.browser-view img.is-swapping { opacity: 0; }

.phone { grid-column: 2; grid-row: 1; width: 100%; max-width: 236px; justify-self: center; }
.phone-screen {
  position: relative; aspect-ratio: 520 / 1125; border-radius: 34px; overflow: hidden;
  border: 8px solid #111827; background: #f3f4f6; box-shadow: var(--shadow-lg);
}
.phone-screen::before { content: ""; position: absolute; z-index: 2; top: 6px; left: 50%; width: 64px; height: 17px; margin-left: -32px; border-radius: 10px; background: #111827; }
.phone-screen img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; opacity: 0; transition: opacity .5s ease; }
.phone-screen img.is-on { opacity: 1; }
.phone-dots { display: flex; justify-content: center; gap: 6px; margin-top: .7rem; }
.phone-dots button { width: 7px; height: 7px; padding: 0; border: 0; border-radius: 4px; background: rgb(15 23 42 / .18); cursor: pointer; transition: width .3s ease, background .3s ease; }
.phone-dots button.is-on { width: 20px; background: var(--accent); }
.phone-cap { margin: .4rem 0 0; text-align: center; font: 500 .7rem/1.4 var(--f-mono); color: var(--dim); }

.assistant-shot { grid-column: 2; grid-row: 2; margin: 0; border: 1px solid var(--w-line2); border-radius: 14px; overflow: hidden; background: var(--w-bg); box-shadow: var(--shadow); }
.assistant-shot img { width: 100%; background: #fff; border-bottom: 1px solid var(--w-line); }
.assistant-shot figcaption { padding: .55rem .75rem .65rem; font-size: .74rem; color: var(--muted); line-height: 1.5; }
.assistant-shot b { display: block; color: var(--ink); font-size: .82rem; }

.mv-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .9rem; margin-top: 1.6rem; }
.tile {
  margin: 0; padding: .9rem; display: flex; flex-direction: column; gap: .7rem; min-width: 0;
  border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-sm);
}
.tile figcaption b { display: block; font-size: .95rem; }
.tile figcaption span { font-size: .76rem; color: var(--muted); }
.tile-foot { margin: auto 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; font: 500 .64rem/1.5 var(--f-mono); color: var(--dim); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; }
.dot-ok { background: var(--ok); } .dot-bad { background: var(--bad); }

/* 雙引擎驗算格子（384 格 = 384 個情境） */
.oracle {
  display: grid; grid-template-columns: repeat(32, minmax(0, 1fr)); gap: 2px; min-height: 84px;
  background: repeating-linear-gradient(90deg, rgb(16 185 129 / .5) 0 5px, transparent 5px 7px);
}
.oracle.has-cells { background: none; }
.oracle i { aspect-ratio: 1; border-radius: 1.5px; background: #eceef2; transition: background .25s ease; }
.oracle i.is-ok { background: rgb(16 185 129 / .75); }
.oracle i.is-bad { background: var(--bad); box-shadow: 0 0 0 1.5px rgb(239 68 68 / .3); }

/* 壓測延遲 */
.lat-row { display: grid; grid-template-columns: 8.6em minmax(0, 1fr) 3em; align-items: center; gap: .5rem; margin: .35rem 0; font-size: .7rem; color: var(--muted); }
.lat-row span { white-space: nowrap; }
.lat-row i { position: relative; height: 8px; border-radius: 4px; background: #eef0f4; overflow: hidden; }
.lat-row i::before { content: ""; position: absolute; inset: 0 auto 0 0; width: calc(max(var(--v), .02) * 100%); border-radius: 4px; background: var(--info); }
.lat-row.is-hot i::before { background: linear-gradient(90deg, var(--warn), var(--bad)); }
.lat-row b { font: 700 .72rem var(--f-mono); color: var(--ink); text-align: right; }
.lat-row.is-hot span, .lat-row.is-hot b { color: var(--bad-ink); }

/* 法規可追溯 */
.chain { list-style: none; margin: 0; padding: 0; display: grid; gap: .7rem; }
.chain li {
  position: relative; display: flex; justify-content: space-between; align-items: center; gap: .5rem;
  padding: .32rem .6rem; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); font-size: .76rem;
}
.chain li:not(:last-child)::after { content: "↓"; position: absolute; left: 50%; bottom: -1.05rem; transform: translateX(-50%); font-size: .7rem; color: var(--accent); }
.chain code { font: 500 .64rem var(--f-mono); color: var(--cyan-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 影片 */
.video-poster { position: relative; display: block; width: 100%; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; cursor: pointer; background: #000; aspect-ratio: 16 / 9; }
.video-poster img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.video-poster:hover img { transform: scale(1.04); }
.play { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: rgb(15 18 25 / .78); box-shadow: 0 0 0 6px rgb(255 255 255 / .35); }
.play::after { content: ""; position: absolute; left: 18px; top: 14px; border-style: solid; border-width: 9px 0 9px 14px; border-color: transparent transparent transparent #fff; }
.tile video { width: 100%; aspect-ratio: 16 / 9; border-radius: 10px; background: #000; }

/* ───────── 觀測看板（淺色 Grafana） ───────── */
.dash-filters { display: flex; flex-wrap: wrap; gap: .35rem; padding: .55rem .8rem; border-bottom: 1px solid var(--w-line); }
.dash-filters span { font: 500 .62rem/1.6 var(--f-mono); color: var(--w-muted); padding: .05rem .5rem; border: 1px solid var(--w-line); border-radius: 6px; background: var(--w-soft); }
.dash-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; padding: .7rem .8rem 0; }
.dash-stats > div { min-width: 0; padding: .5rem .65rem; border: 1px solid var(--w-line); border-radius: 9px; background: var(--w-soft); }
.dash-stats span { display: block; font-size: .62rem; color: var(--w-dim); }
.dash-stats b { display: block; font: 700 1.15rem/1.35 var(--f-mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.dash-stats > div:nth-child(1) b { color: var(--cyan-ink); }
.dash-stats > div:nth-child(2) b { color: var(--warn-ink); }
.dash-stats > div:nth-child(3) b { color: var(--ok-ink); }
.dash-stats > div:nth-child(4) b { color: var(--violet-ink); }
.dash-stats em { font: normal 500 .58rem var(--f-mono); color: var(--w-dim); }
.dash-stats em.good { color: var(--ok-ink); }
.panel-title { margin: 0 0 .35rem; font: 500 .64rem var(--f-mono); color: var(--w-muted); }
.dash-chart { padding: .7rem .8rem 0; }
.dash-chart svg { display: block; width: 100%; height: 118px; }
.dash-chart .grid line { stroke: rgb(15 23 42 / .07); stroke-width: 1; vector-effect: non-scaling-stroke; }
.dash-chart .line { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.dash-chart .l1 { stroke: #0891b2; } .dash-chart .l2 { stroke: #6366f1; } .dash-chart .l3 { stroke: #f97316; }
.dash-chart .area { fill: rgb(8 145 178 / .09); }
.legend { margin: .3rem 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .9rem; font-size: .62rem; color: var(--w-muted); }
.legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: .3rem; vertical-align: middle; }
.legend .k1 { background: #0891b2; } .legend .k2 { background: #6366f1; } .legend .k3 { background: #f97316; }
.dash-row { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: .6rem; padding: .7rem .8rem .8rem; }
.trace, .audit { min-width: 0; padding: .55rem .65rem; border: 1px solid var(--w-line); border-radius: 9px; background: var(--w-soft); }
.trace { isolation: isolate; }
.span { position: relative; display: flex; justify-content: space-between; align-items: center; height: 19px; margin: .2rem 0; padding: 0 .4rem; font: 500 .6rem var(--f-mono); color: var(--w-ink); }
.span::before { content: ""; position: absolute; top: 0; bottom: 0; left: calc(var(--s) * 100%); width: calc(var(--w) * 100%); z-index: -1; border-radius: 3px; background: rgb(59 130 246 / .22); }
.span.s-llm::before { background: rgb(99 102 241 / .28); }
.span.s-tool::before { background: rgb(249 115 22 / .28); }
.span b { font-weight: 500; color: var(--w-muted); }
.audit ul { list-style: none; margin: 0; padding: 0; }
.audit li { display: grid; grid-template-columns: 2.9em 6.2em minmax(0, 1fr); gap: .35rem; padding: .3rem 0; border-bottom: 1px dashed var(--w-line2); font-size: .6rem; color: var(--w-text); }
.audit li:last-child { border-bottom: 0; }
.audit time { font-family: var(--f-mono); color: var(--w-dim); }
.audit span { font-family: var(--f-mono); color: var(--cyan-ink); white-space: nowrap; }
.audit em { font-style: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audit li.is-new { animation: row-in .5s ease both; }
@keyframes row-in { from { opacity: 0; transform: translateY(-6px); background: rgb(8 145 178 / .1); } to { opacity: 1; transform: none; } }
.dash .mock-cap { margin: 0; padding: 0 .8rem .75rem; }

/* ───────── MCP 架構與驗票 ───────── */
.platform-visual, .rag, .kg, .tower-visual { min-width: 0; }
.topo {
  display: grid; grid-template-columns: minmax(0, 1fr) 20px minmax(0, .95fr) 20px minmax(0, .95fr) 20px minmax(0, 1fr);
  align-items: center; padding: 1.1rem .9rem; border: 1px solid var(--w-line2); border-radius: 14px;
  background: radial-gradient(circle at 50% 50%, rgb(99 102 241 / .07), transparent 70%), var(--w-bg);
  box-shadow: var(--shadow);
}
.topo-col { display: grid; gap: .45rem; min-width: 0; }
.node {
  display: block; padding: .45rem .4rem; border: 1px solid var(--w-line2); border-radius: 9px; background: var(--w-node);
  font-size: .72rem; font-weight: 700; text-align: center; line-height: 1.35; color: var(--w-ink);
  transition: border-color .3s ease, box-shadow .3s ease;
}
.node small { display: block; font-weight: 500; font-size: .6rem; color: var(--w-muted); }
.node-key { border-color: rgb(8 145 178 / .5); box-shadow: 0 0 0 3px rgb(8 145 178 / .08); }
.node-hub { border-color: rgb(99 102 241 / .55); box-shadow: 0 0 0 3px rgb(99 102 241 / .1); background: linear-gradient(180deg, #eef0ff, #fff); }
.node small.s-live { color: var(--ok-ink); } .node small.s-done { color: var(--cyan-ink); } .node small.s-eval { color: var(--warn-ink); }
.node.is-hot { border-color: #0891b2; box-shadow: 0 0 0 3px rgb(8 145 178 / .18); }
.wire { position: relative; height: 2px; background: linear-gradient(90deg, #e2e5eb, #c7ccd6); }
.wire::after { content: ""; position: absolute; top: -2px; left: 0; width: 6px; height: 6px; border-radius: 50%; background: #0891b2; box-shadow: 0 0 0 3px rgb(8 145 178 / .18); animation: wire-x 1.5s linear infinite; }
.topo .wire:nth-of-type(4)::after { animation-delay: .5s; }
.topo .wire:nth-of-type(6)::after { animation-delay: 1s; }
@keyframes wire-x { from { left: 0; } to { left: calc(100% - 6px); } }
@keyframes wire-y { from { top: 0; } to { top: calc(100% - 6px); } }

.inspect { margin-top: .9rem; }
.req { margin: 0; padding: .7rem .9rem; border-bottom: 1px solid var(--w-line); font: 400 .68rem/1.7 var(--f-mono); color: var(--w-muted); white-space: pre-wrap; word-break: break-all; }
.req b { color: var(--ok-ink); }
.req [data-token] { transition: color .3s ease; }
.req [data-token].is-bad { color: var(--bad-ink); }
.checks { list-style: none; margin: 0; padding: .55rem .9rem .2rem; display: grid; gap: .28rem; }
.checks li { display: flex; justify-content: space-between; gap: .5rem; padding: .24rem .55rem; border-radius: 7px; background: var(--w-soft); font-size: .74rem; color: var(--w-text); transition: opacity .25s ease; }
.checks li b { font-family: var(--f-mono); color: var(--ok-ink); }
.inspect.is-live .checks li { opacity: .35; }
.inspect.is-live .checks li.is-pass, .inspect.is-live .checks li.is-fail { opacity: 1; }
.checks li.is-fail b { color: var(--bad-ink); }
.verdict { margin: 0; padding: .55rem .9rem .8rem; display: flex; align-items: center; gap: .6rem; font-size: .74rem; color: var(--w-muted); }
.code { display: inline-block; padding: .05rem .45rem; border-radius: 6px; font: 700 .68rem/1.5 var(--f-mono); }
.code.ok { color: #fff; background: #059669; }
.code.bad { color: #fff; background: #dc2626; }

/* ───────── GraphRAG ───────── */
.rag { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: .8rem; align-items: stretch; }
.rag .mock-cap { grid-column: 1 / -1; margin-top: 0; }
.rag-graph canvas { display: block; width: 100%; height: 230px; }
.rag-audit { display: flex; flex-wrap: wrap; gap: .35rem; padding: .5rem .7rem .7rem; }
.rag-audit span { font-size: .64rem; color: var(--w-muted); padding: .1rem .5rem; border: 1px solid var(--w-line); border-radius: 6px; background: var(--w-soft); }
.rag-audit b { font-family: var(--f-mono); color: var(--w-ink); }
.rag-chat { display: flex; flex-direction: column; }
.rag-chat .q { align-self: flex-end; max-width: 92%; margin: .8rem .9rem 0; padding: .5rem .75rem; border-radius: 12px 12px 3px 12px; background: rgb(79 70 229 / .08); color: var(--w-ink); font-size: .78rem; line-height: 1.6; }
.rag-chat .a { padding: .7rem .9rem .9rem; font-size: .8rem; line-height: 1.75; color: var(--w-text); }
.rag-chat .a p { margin: 0 0 .7rem; }
.cite {
  display: inline-grid; place-items: center; width: 1.4em; height: 1.4em; margin: 0 .15em; padding: 0; vertical-align: .1em;
  border: 1px solid rgb(8 145 178 / .5); border-radius: 5px; background: rgb(8 145 178 / .08); color: var(--cyan-ink);
  font: 700 .62rem/1 var(--f-mono); cursor: pointer;
}
.cite:hover, .cite.is-on { background: #0891b2; border-color: #0891b2; color: #fff; }
.pipe { display: flex; flex-wrap: wrap; gap: .3rem; }
.pipe span { padding: .08rem .45rem; border: 1px solid var(--w-line2); border-radius: 5px; font: 500 .6rem/1.6 var(--f-mono); color: var(--w-muted); }
.pipe span.ok { color: var(--ok-ink); border-color: rgb(16 185 129 / .45); background: rgb(16 185 129 / .06); }

/* ───────── Agent Watchtower（iPad，螢幕是深色看板） ───────── */
.ipad {
  max-width: 560px; margin-inline: auto; padding: 14px; border-radius: 26px;
  background: linear-gradient(145deg, #eceef2, #c9ced8);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .7), var(--shadow-lg);
}
.ipad-screen { aspect-ratio: 4 / 3; display: flex; flex-direction: column; gap: .5rem; padding: .8rem; border-radius: 10px; background: #070a10; color: var(--w-text); overflow: hidden; font-size: .7rem; }
.tw-top { display: flex; align-items: center; gap: .6rem; }
.tw-top b { font-size: .8rem; color: var(--w-ink); }
.tw-top [data-clock] { margin-left: auto; font-family: var(--f-mono); color: var(--w-muted); }
.tw-conn { color: var(--ok-ink); font-size: .62rem; }
.tw-alert { padding: .4rem .65rem; border-radius: 8px; border: 1px solid rgb(251 191 36 / .5); background: rgb(251 191 36 / .12); color: #fde68a; font-size: .72rem; animation: alert-glow 2.2s ease-in-out infinite; }
.tw-alert b { color: #fff3c4; }
@keyframes alert-glow { 50% { box-shadow: 0 0 18px -2px rgb(251 191 36 / .5); } }
.tw-alert.is-calm { border-color: rgb(52 211 153 / .35); background: rgb(52 211 153 / .08); color: #a7f3d0; animation: none; }
.tw-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; }
.tw-card { display: flex; flex-direction: column; gap: .05rem; min-width: 0; padding: .5rem .6rem; border: 1px solid var(--w-line); border-radius: 9px; background: var(--w-node); transition: border-color .5s ease, background .5s ease; }
.tw-card p { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tw-who { font: 500 .58rem var(--f-mono); color: var(--w-dim); }
.tw-title { font-weight: 700; font-size: .76rem; color: var(--w-ink); }
.tw-state { display: flex; align-items: center; gap: .35rem; font-size: .68rem; }
.tw-state i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.tw-meta { margin-top: auto !important; font: 500 .58rem var(--f-mono); color: var(--w-dim); }
.tw-card.is-run .tw-state { color: var(--cyan-ink); }
.tw-card.is-run .tw-state i { animation: blink 1.2s ease-in-out infinite; }
.tw-card.is-wait { border-color: rgb(251 191 36 / .55); background: rgb(251 191 36 / .07); }
.tw-card.is-wait .tw-state { color: var(--warn-ink); }
.tw-card.is-ask { border-color: rgb(244 114 182 / .5); background: rgb(244 114 182 / .06); }
.tw-card.is-ask .tw-state { color: var(--pink-ink); }
.tw-card.is-done .tw-state { color: var(--ok-ink); }
.tw-card.is-flash { animation: row-in .6s ease both; }
.tw-usage { display: grid; grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: .45rem; font-size: .6rem; color: var(--w-dim); }
.tw-usage i { position: relative; height: 6px; border-radius: 3px; background: rgb(255 255 255 / .08); overflow: hidden; }
.tw-usage i::before { content: ""; position: absolute; inset: 0 auto 0 0; width: calc(var(--v) * 100%); background: linear-gradient(90deg, #8b7bff, #22d3ee); transition: width 1s ease; }
.tw-svc { display: flex; flex-wrap: wrap; gap: .3rem .7rem; font-size: .6rem; color: var(--w-dim); }
.tw-svc b { font: 500 .6rem var(--f-mono); color: var(--ok-ink); }
.arch { list-style: none; margin: 1rem 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: .45rem 1.3rem; }
.arch li { position: relative; padding: .2rem .6rem; border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface); font: 500 .64rem/1.6 var(--f-mono); color: var(--muted); }
.arch li + li::before { content: "→"; position: absolute; left: -1.05rem; color: var(--accent); }
.tower-visual .mock-cap { text-align: center; }

/* ───────── 知識圖譜 ───────── */
.kg-box canvas { display: block; width: 100%; height: 330px; cursor: grab; touch-action: pan-y; }
.kg-box canvas:active { cursor: grabbing; }
.kg-hover { position: absolute; left: .8rem; bottom: .7rem; margin: 0; padding: .2rem .55rem; border-radius: 6px; background: rgb(255 255 255 / .94); border: 1px solid var(--w-line2); box-shadow: var(--shadow-sm); font: 500 .66rem var(--f-mono); color: var(--w-text); pointer-events: none; max-width: calc(100% - 1.6rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kg-legend { list-style: none; margin: .8rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .35rem .9rem; font-size: .74rem; color: var(--muted); }
.kg-legend i { display: inline-block; width: 8px; height: 8px; margin-right: .35rem; border-radius: 50%; background: var(--c); }

/* ───────── 小卡畫面 ───────── */
.mini-visual { position: relative; }
.mini .win { box-shadow: none; }
.mini-visual > canvas, .mini-visual > svg { display: block; width: 100%; height: calc(100% - 34px); }

/* Task RAM 班機看板 */
.board { padding: .3rem .7rem; font: 500 .68rem/1.4 var(--f-mono); }
.board-row { display: grid; grid-template-columns: minmax(0, 1fr) 7.4em 3.3em; gap: .5rem; align-items: center; padding: .3rem .15rem; white-space: nowrap; border-bottom: 1px solid var(--w-line); transition: background .4s ease; }
.board-row:last-child { border-bottom: 0; }
.board-row.head { font-size: .58rem; color: var(--w-dim); letter-spacing: .08em; }
.board-row span:first-child { overflow: hidden; text-overflow: ellipsis; color: var(--w-ink); }
.board-row span:last-child { text-align: right; color: var(--w-muted); font-variant-numeric: tabular-nums; }
.b-wait { color: var(--warn-ink); } .b-wait::before { content: "✈ "; }
.b-go { color: var(--cyan-ink); } .b-go::before { content: "● "; }
.b-done { color: var(--ok-ink); } .b-done::before { content: "✓ "; }
.board-row.is-flip { background: rgb(8 145 178 / .08); }

/* 台股 */
.heat { padding: .35rem .8rem .1rem; }
.heat-row { display: grid; grid-template-columns: 5.2em minmax(0, 1fr) 2em; align-items: center; gap: .5rem; margin: .1rem 0; font-size: .68rem; color: var(--w-muted); }
.heat-row i { position: relative; height: 9px; border-radius: 5px; background: #eef0f4; overflow: hidden; }
.heat-row i::before { content: ""; position: absolute; inset: 0 auto 0 0; width: calc(var(--v) * 100%); border-radius: 5px; background: linear-gradient(90deg, var(--warn), var(--bad)); transition: width 1s ease; }
.heat-row b { font: 700 .72rem var(--f-mono); color: var(--w-ink); text-align: right; }
.debate { display: grid; gap: .25rem; padding: .2rem .8rem .5rem; }
.debate p { margin: 0; padding: .2rem .55rem; border-radius: 8px; font-size: .66rem; color: var(--w-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: opacity .35s ease; }
.debate p.is-out { opacity: 0; }
.debate b { margin-right: .45rem; }
.debate .bull { background: rgb(16 185 129 / .08); border: 1px solid rgb(16 185 129 / .3); }
.debate .bull b { color: var(--ok-ink); }
.debate .bear { background: rgb(239 68 68 / .07); border: 1px solid rgb(239 68 68 / .28); }
.debate .bear b { color: var(--bad-ink); }

/* 終端機類（深色） */
.term-body { padding: .6rem .85rem; font: 400 .68rem/1.78 var(--f-mono); color: var(--w-text); }
.term-body p { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.term-body b { color: var(--w-ink); }
.term-body .ag { color: #b4a8ff; }
.term.is-live .term-body p { visibility: hidden; }
.term.is-live .term-body p.is-in { visibility: visible; animation: type-in .4s steps(18, end) both; }

/* 工作流節點 */
.wf {
  height: calc(100% - 34px); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: auto auto;
  align-content: center; column-gap: 22px; row-gap: 26px; padding: 0 1rem;
  background: radial-gradient(rgb(15 23 42 / .07) 1px, transparent 1.2px) 0 0 / 14px 14px;
}
.wf-node {
  position: relative; padding: .45rem .3rem; border: 1px solid var(--w-line2); border-radius: 9px; background: var(--w-node);
  font-size: .68rem; font-weight: 700; text-align: center; white-space: nowrap; color: var(--w-ink); box-shadow: var(--shadow-sm);
}
.wf-node:nth-child(4) { grid-area: 2 / 3; }
.wf-node:nth-child(5) { grid-area: 2 / 2; }
.wf-ai { border-color: rgb(99 102 241 / .55); box-shadow: 0 0 0 3px rgb(99 102 241 / .1); background: linear-gradient(180deg, #eef0ff, #fff); }
.wf-node::after { content: none; position: absolute; background: linear-gradient(90deg, #d5d9e1 0 35%, #6366f1 45% 55%, #d5d9e1 65%); background-size: 300% 100%; animation: flow-x 1.6s linear infinite; }
.wf-node.to-r::after { content: ""; left: 100%; top: 50%; width: 22px; height: 2px; }
.wf-node.to-l::after { content: ""; right: 100%; top: 50%; width: 22px; height: 2px; animation-direction: reverse; }
.wf-node.to-d::after { content: ""; left: 50%; top: 100%; width: 2px; height: 26px; background: linear-gradient(180deg, #d5d9e1 0 35%, #6366f1 45% 55%, #d5d9e1 65%); background-size: 100% 300%; animation-name: flow-y; }
@keyframes flow-x { from { background-position: 100% 0; } to { background-position: 0 0; } }
@keyframes flow-y { from { background-position: 0 100%; } to { background-position: 0 0; } }

/* 新聞分群 */
.cluster-num { position: absolute; left: .7rem; bottom: .55rem; margin: 0; padding: .1rem .5rem; border-radius: 6px; background: rgb(255 255 255 / .92); border: 1px solid var(--w-line); font-size: .7rem; color: var(--w-muted); }
.cluster-num b { font-family: var(--f-mono); color: var(--w-ink); }

/* OTLP */
.otlp { padding: .3rem .4rem; }
.otlp .restart { stroke: var(--warn); stroke-dasharray: 3 3; }
.otlp text { font-family: var(--f-mono); font-size: 9px; fill: var(--w-dim); }
.otlp .t-restart { fill: var(--warn-ink); }
.otlp .before { fill: none; stroke: var(--bad); stroke-width: 2; opacity: .7; }
.otlp .after { fill: none; stroke: #059669; stroke-width: 2.5; }
.otlp .t-after { fill: var(--ok-ink); }
.otlp .t-before { fill: var(--bad-ink); }
.is-seen .otlp .after { stroke-dasharray: 1; animation: draw 2.2s ease both; }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }

/* Guardrail */
.guard { display: grid; gap: .4rem; padding: .65rem .8rem; font-size: .7rem; }
.g-in { justify-self: end; max-width: 92%; margin: 0; padding: .32rem .6rem; border-radius: 10px 10px 3px 10px; background: rgb(79 70 229 / .08); color: var(--w-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-out { margin: 0; display: flex; align-items: center; gap: .45rem; font-size: .66rem; color: var(--w-muted); }

/* 官網截圖 */
.browser-mini { overflow: hidden; border: 1px solid var(--w-line2); border-radius: 14px; background: var(--w-bg); }
.browser-mini img { width: 100%; height: calc(100% - 34px); object-fit: cover; object-position: top; background: #fff; transition: object-position 3s ease; }
.mini:hover .browser-mini img { object-position: bottom; }

/* SysMonitor */
.sessions { display: grid; gap: .3rem; padding: .55rem .8rem; }
.ses { display: grid; grid-template-columns: 9px minmax(0, 1fr) auto; align-items: center; gap: .55rem; padding: .3rem .5rem; border-radius: 7px; background: var(--w-soft); font: 500 .66rem var(--f-mono); color: var(--w-ink); }
.ses i { width: 8px; height: 8px; border-radius: 50%; }
.ses i.on { background: var(--ok); }
.ses i.wait { background: var(--warn); animation: blink 1.4s ease-in-out infinite; }
.ses i.idle { background: #cbd2dc; }
.ses span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ses b { font: 500 .64rem var(--f-body); color: var(--w-muted); }
.ses-foot { margin: .15rem 0 0; font-size: .64rem; color: var(--w-dim); }
.ses-foot b { color: var(--cyan-ink); font-family: var(--f-mono); }

/* reptile-passport 手機 */
.phone-mini { position: relative; display: flex; justify-content: center; align-items: flex-end; overflow: hidden; border: 1px solid var(--w-line2); border-radius: 14px; background: radial-gradient(circle at 50% 35%, rgb(16 185 129 / .12), transparent 70%), var(--w-soft); }
.pm-tag { position: absolute; top: .55rem; right: .6rem; }
.pm-screen { width: 136px; height: calc(100% - 16px); padding: .7rem .6rem; border: 5px solid #111827; border-bottom: 0; border-radius: 20px 20px 0 0; background: #f7f5ef; color: #1b1d22; }
.pm-top { margin: 0 0 .45rem; font-size: .66rem; font-weight: 900; color: #0f766e; }
.pm-card { display: grid; gap: .12rem; padding: .5rem; border-radius: 9px; background: #fff; box-shadow: 0 2px 10px rgb(0 0 0 / .08); font-size: .56rem; color: #4b5563; }
.pm-card b { font-size: .68rem; color: #111; }
.pm-share { margin: .5rem 0 0; font-size: .56rem; color: #6b7280; }

/* agent-radar */
.radar { position: relative; height: calc(100% - 34px); overflow: hidden; background: radial-gradient(circle at 50% 50%, rgb(8 145 178 / .07), transparent 70%); }
.radar .ring { position: absolute; left: 50%; top: 50%; border: 1px solid rgb(8 145 178 / .22); border-radius: 50%; transform: translate(-50%, -50%); }
.radar .r1 { width: 110px; height: 110px; } .radar .r2 { width: 220px; height: 220px; }
.radar .sweep { position: absolute; left: 50%; top: 50%; width: 260px; height: 260px; margin: -130px 0 0 -130px; border-radius: 50%; background: conic-gradient(from 0deg, rgb(8 145 178 / .2), transparent 70deg); animation: spin 4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.radar span { position: absolute; left: var(--x); top: var(--y); z-index: 1; transform: translate(-50%, -50%); padding: .08rem .4rem; border: 1px solid var(--w-line2); border-radius: 5px; background: rgb(255 255 255 / .92); font: 500 .6rem/1.5 var(--f-mono); color: var(--w-text); white-space: nowrap; }
.radar span::before { content: ""; display: inline-block; width: 5px; height: 5px; margin-right: .3rem; border-radius: 50%; background: #0891b2; vertical-align: middle; }

/* 碩士研究 */
.ml { height: calc(100% - 34px); display: flex; align-items: center; justify-content: center; gap: .45rem; padding: .5rem .7rem; }
.ml-col { display: grid; gap: .25rem; }
.ml-col span { padding: .16rem .45rem; border: 1px solid var(--w-line2); border-radius: 6px; background: var(--w-node); font: 500 .6rem/1.5 var(--f-mono); color: var(--w-text); text-align: center; white-space: nowrap; }
.ml-col .ml-hub { padding: .55rem .6rem; border-color: rgb(99 102 241 / .55); box-shadow: 0 0 0 3px rgb(99 102 241 / .1); background: linear-gradient(180deg, #eef0ff, #fff); font-size: .68rem; color: var(--w-ink); line-height: 1.4; }
.ml-arrow { position: relative; flex: 0 1 26px; min-width: 12px; height: 2px; background: linear-gradient(90deg, var(--w-line2), #0891b2); }
.ml-arrow::after { content: ""; position: absolute; right: -1px; top: -3px; border: 4px solid transparent; border-left: 6px solid #0891b2; border-right: 0; }

/* 控制器：離開畫面（或還沒被蓋出來）就暫停所有無限動畫 */
[data-live]:not(.is-playing) *, [data-live]:not(.is-playing)::before, [data-live]:not(.is-playing)::after,
[data-live]:not(.is-playing) *::before, [data-live]:not(.is-playing) *::after { animation-play-state: paused !important; }

/* ───────── 響應式 ───────── */
@media (max-width: 1020px) {
  .mv-stage { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .browser { grid-column: 1 / -1; grid-row: auto; }
  .phone { grid-column: 1; grid-row: auto; max-width: 230px; }
  .assistant-shot { grid-column: 2; grid-row: auto; align-self: center; }
  .mv-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .console-body { font-size: .72rem; min-height: 0; }
  .who { width: 4.8em; }
  .dash-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-row { grid-template-columns: minmax(0, 1fr); }
  .rag { grid-template-columns: minmax(0, 1fr); }
  .mv-tiles { grid-template-columns: minmax(0, 1fr); }
  .mv-stage { gap: .9rem; border-radius: 20px; }
  .assistant-shot img { max-height: 320px; object-fit: cover; object-position: top; }
  .topo { grid-template-columns: minmax(0, 1fr); gap: 0; padding: .9rem; }
  .topo-col { grid-template-columns: repeat(auto-fit, minmax(6.2rem, 1fr)); }
  .wire { justify-self: center; width: 2px; height: 20px; background: linear-gradient(180deg, #e2e5eb, #c7ccd6); }
  .wire::after { left: -2px; top: 0; animation-name: wire-y; }
  .ipad { padding: 9px; border-radius: 20px; }
  .ipad-screen { aspect-ratio: auto; }
  .tw-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .tw-usage { grid-template-columns: auto minmax(0, 1fr); }
  .kg-box canvas { height: 280px; }
}

@media (prefers-reduced-motion: reduce) {
  .live-dot::before, .pulse, .wire::after, .wf-node::after, .radar .sweep, .tw-alert, .tw-card.is-run .tw-state i, .ses i.wait { animation: none !important; }
  .browser-view img, .browser-mini img { transition: none; }
}
