:root {
  --bg: #e7e9e3;
  --card: #f6f6f2;
  --line: #d6d9d0;
  --ink: #1e2925;
  --muted: #5d6762;
  --brand: #2c5949;
  --brand-ink: #f4f6f2;
  --wood: #c9a46f;
  --wood-dark: #9c774a;
  --cut: #24598a;
  --lead: #2f8a57;
  --tab: #c47a12;
  --rapid: #8f9893;
  --rest: #b3262e;
  --plunge: #7a5bb5;
  --warn-bg: #fbf0dc;
  --err-bg: #f8e1df;
  --radius: 14px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 system-ui, -apple-system, 'PingFang TC', 'Noto Sans TC', 'Microsoft JhengHei', sans-serif;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hidden { display: none !important; }

.top { padding: 22px 24px 8px; }
.brand { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.logo { font-weight: 700; font-size: 30px; letter-spacing: -0.02em; color: var(--ink); text-decoration: none; }
.brand h1 { margin: 0; font-size: 26px; font-weight: 700; }
.pill { border: 1px solid var(--line); border-radius: 999px; padding: 1px 10px; font-size: 13px; color: var(--muted); background: var(--card); }
.lede { margin: 6px 0 0; color: var(--muted); }

.layout { display: grid; grid-template-columns: 340px 1fr; gap: 18px; padding: 12px 24px 32px; align-items: start; }
.panel { display: flex; flex-direction: column; gap: 14px; }
.stage { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.card h2 { margin: 0 0 12px; font-size: 16px; font-weight: 700; }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.field label { font-size: 13px; color: var(--muted); }
input[type=number], input[type=text], select {
  width: 100%; font: inherit; color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px;
}
input:focus, select:focus, .btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
input:disabled { background: #eef0ea; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; margin: 4px 0 10px; }
.sub { font-size: 13px; color: var(--muted); }
.hint { font-size: 13px; color: var(--muted); margin: 8px 0 10px; }

.row-btn { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 500; cursor: pointer; user-select: none;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 10px; padding: 8px 14px;
}
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.small { padding: 5px 11px; font-size: 14px; }
.btn:disabled { opacity: .45; cursor: default; }

.layers > div { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; max-height: 160px; overflow: auto; }
.layers label { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.layers .count { color: var(--muted); font-size: 12px; }

.viewer { position: relative; padding: 12px; }
.viewer-tools { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.seg-btn { font: inherit; font-size: 14px; border: 0; background: transparent; padding: 5px 12px; cursor: pointer; color: var(--muted); }
.seg-btn.on { background: var(--brand); color: var(--brand-ink); }
.canvas-wrap { position: relative; height: 520px; }
#view { display: block; width: 100%; height: 100%; border-radius: 10px; background: #fbfbf8; cursor: grab; touch-action: none; }
.view3d { position: absolute; inset: 0; border-radius: 10px; overflow: hidden; background: #fbfbf8; }
.view3d canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.tools-left { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.opt3d { display: inline-flex; gap: 12px; margin-left: 4px; }
.check-inline { display: inline-flex; gap: 5px; align-items: center; font-size: 13.5px; color: var(--muted); }
.player { display: flex; align-items: center; gap: 10px; margin: 10px 4px 0; }
.player input[type=range] { flex: 1; accent-color: var(--brand); min-width: 80px; }
.player select { width: auto; padding: 4px 8px; }
.play { width: 40px; }
.clock { font: 13px var(--mono); color: var(--muted); white-space: nowrap; }
#view.dragging { cursor: grabbing; }
.empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); pointer-events: none; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 0; margin: 10px 4px 0; font-size: 13px; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 16px; height: 10px; border-radius: 3px; }
.sw-part { background: var(--wood); }
.sw-cut { background: var(--cut); }
.sw-lead { background: var(--lead); }
.sw-tab { background: var(--tab); }
.sw-rapid { background: repeating-linear-gradient(90deg, var(--rapid) 0 4px, transparent 4px 7px); }
.sw-rest { background: var(--rest); }
.sw-plunge { background: var(--plunge); }

.cards2 { display: grid; grid-template-columns: minmax(260px, 1fr) 1.4fr; gap: 14px; }
.stats { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; font-size: 14px; }
.stats dt { color: var(--muted); }
.stats dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 500; }
.stats .big { font-size: 22px; font-weight: 700; }
.warns { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 6px; }
.warns li { background: var(--warn-bg); border-radius: 9px; padding: 7px 10px; font-size: 13.5px; }
.warns li.err { background: var(--err-bg); }
.warns li.ok { background: #e3efe6; }

.nc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.nc-head h2 { margin: 0; }
.code { margin: 0; font: 12.5px/1.5 var(--mono); background: #20251f; color: #e7ece4; border-radius: 10px; padding: 12px 14px; height: 330px; overflow: auto; white-space: pre; }
.fine { font-size: 12.5px; color: var(--muted); margin: 0 4px; }

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; padding: 10px 16px 28px; }
  .cards2 { grid-template-columns: 1fr; }
  .canvas-wrap { height: 380px; }
  .top { padding: 18px 16px 4px; }
}

.code .ln { display: block; padding: 0 4px; margin: 0 -4px; border-radius: 3px; cursor: pointer; }
.code .ln:hover { background: rgba(255,255,255,.06); }
.code .ln.cur { background: #3d5c4f; color: #fff; }

/* ---- 3D 自動加工 ---- */
:root { --free: #7fa6c9; --under: #c8423d; }
a.pill.link { text-decoration: none; color: var(--brand); }
a.pill.link:hover { border-color: var(--brand); }
.sw-free { background: var(--free); }
.sw-under { background: var(--under); }
.busy-badge { position: absolute; top: 10px; right: 10px; display: inline-flex; align-items: center; gap: 8px; padding: 5px 11px; border-radius: 999px; background: rgba(246,246,242,.85); border: 1px solid var(--line); color: var(--muted); font-size: 12.5px; pointer-events: none; }
.spin { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }
.ops { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13.5px; }
.ops th { text-align: left; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--line); padding: 4px 6px; }
.ops td { padding: 5px 6px; border-bottom: 1px solid #ebede7; font-variant-numeric: tabular-nums; }
.ops tr.total td { font-weight: 700; border-bottom: 0; }

/* ---- 加工流程預覽（v0.5.2 preview，/cam3d-flow） ---- */
.flow-bar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; margin: 8px 24px 0; padding: 10px 16px; background: rgba(246,246,242,.94); border: 1px solid var(--line); border-radius: var(--radius); backdrop-filter: blur(6px); }
.fb-item { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13.5px; }
.fb-k { color: var(--muted); font-size: 12px; letter-spacing: .04em; white-space: nowrap; }
.fb-v { font-weight: 500; font-variant-numeric: tabular-nums; }
.fb-select { width: auto; padding: 3px 8px; font-size: 13.5px; }
.fb-ai { font-size: 12.5px; padding: 2px 9px; border-radius: 999px; background: #eceee8; color: var(--muted); border: 1px dashed var(--line); }
.flow-bar #editEnv { margin-left: auto; }
.env-panel { margin: 10px 24px 0; }
.env-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.flow-steps { display: none; }

.flow-stages { scroll-margin-top: 76px; display: grid; gap: 12px; padding: 14px 24px 18px; align-items: stretch; transition: grid-template-columns .25s ease; }
.flow-stages.a1 { grid-template-columns: minmax(0, 1fr) 64px 64px; }
.flow-stages.a2 { grid-template-columns: 64px minmax(0, 1fr) 64px; }
.flow-stages.a3 { grid-template-columns: 64px 64px minmax(0, 1fr); }
.stage { padding: 0; min-width: 0; overflow: hidden; overflow: clip; } /* v1.1.0：clip 不形成捲動容器，3D 視窗的 sticky 才有效 */
.stage-body { display: none; padding: 16px 18px; }
.stage.expanded .stage-body { display: block; }
.stage.expanded .stage-rail { display: none; }
.stage-rail { width: 100%; height: 100%; min-height: 520px; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 16px 0; border: 0; background: transparent; cursor: pointer; font: inherit; color: var(--ink); }
.stage-rail:hover { background: #eef0ea; }
.rail-no, .st-no { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); font-size: 13px; font-weight: 700; flex: none; }
.rail-title { display: block; width: 1.1em; font-size: 15px; line-height: 1.3; word-break: break-all; text-align: center; font-weight: 700; }
.rail-badge { display: block; width: 56px; font-size: 11.5px; line-height: 1.35; text-align: center; color: var(--muted); word-break: break-all; }
.rail-badge.bad { color: var(--rest); }
.stage-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.stage-head h2 { margin: 0; display: flex; align-items: center; gap: 10px; }
.stage-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
.slot3d { position: sticky; top: 76px; min-width: 0; }
.stage-side { min-width: 0; }
.side-h { margin: 16px 0 8px; font-size: 14px; font-weight: 700; }
.nc-head .side-h { margin: 0; }
.flow-canvas { height: 500px; }
.viewer-shell .legend { margin-top: 8px; }
.viewer-shell.design-mode .lg-path { display: none; }
.reasons { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.reasons li { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; padding: 7px 10px; border-radius: 9px; background: #eef0ea; font-size: 13.5px; }
.reasons li.err { background: var(--err-bg); }
.reasons li.warn { background: var(--warn-bg); }
.reasons li.muted { color: var(--muted); background: transparent; border: 1px dashed var(--line); }
.reasons li.muted:only-child { display: block; }
.r-tag { font-weight: 700; color: var(--brand); white-space: nowrap; }
.reasons li.err .r-tag { color: var(--rest); }
.r-ref { grid-column: 2; font: 11.5px var(--mono); color: var(--muted); }
.reasons li:not(:has(.r-tag)) { display: block; }
.verify dd.v-ok::before { content: '✓ '; color: var(--lead); font-weight: 700; }
.verify dd.v-bad { color: var(--rest); }
.verify dd.v-bad::before { content: '✕ '; font-weight: 700; }
.verify dd.v-warn::before { content: '! '; color: var(--tab); font-weight: 700; }
.verify dd.v-na { color: var(--muted); font-weight: 400; }
.verify dd { font-weight: 400; }
.params { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 10px; }
.params summary { cursor: pointer; font-weight: 500; margin-bottom: 10px; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist .check { align-items: flex-start; margin: 4px 0; }
.checklist input { margin-top: 4px; accent-color: var(--brand); }
.gate { margin: 10px 0 14px; padding: 8px 12px; border-radius: 9px; background: var(--warn-bg); font-size: 13.5px; }
.gate.ok { background: #e3efe6; }
.flow-code { height: 300px; }
.stage .ops td:nth-child(3), .stage .ops td:first-child { white-space: nowrap; }
.flow-fine { margin: 0 28px 28px; }

@media (max-width: 1240px) {
  .stage-grid { grid-template-columns: 1fr; }
  .slot3d { position: static; }
}
@media (max-width: 980px) {
  .flow-bar { position: static; margin: 8px 16px 0; padding: 8px 12px; gap: 6px 14px; }
  .flow-stages { scroll-margin-top: 8px; }
  .flow-bar #editEnv { margin-left: 0; }
  .env-panel { margin: 10px 16px 0; }
  .env-grid { grid-template-columns: 1fr; gap: 6px; }
  .flow-steps { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 10px 16px 0; }
  .flow-dots { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0; font-size: 13px; color: var(--muted); }
  .flow-dots li { padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); }
  .flow-dots li.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
  .flow-stages, .flow-stages.a1, .flow-stages.a2, .flow-stages.a3 { grid-template-columns: 1fr; padding: 10px 16px 16px; }
  .stage:not(.expanded) { display: none; }
  .stage-body { padding: 14px; }
  .flow-canvas { height: 360px; }
  .flow-fine { margin: 0 18px 24px; }
}

/* ---- v0.5.3 preview：毛胚、模擬、刀具庫 ---- */
:root { --stock-fill: #a3a865; --sim-ok: #3fae5a; --sim-rest-l: #8f9ef0; --sim-rest-d: #4053c9; --sim-gouge: #d64040; --sim-through: #c9ccc4; }
.sw-stock { background: var(--stock-fill); opacity: .55; outline: 1px solid #8d915a; }
.sw-ok { background: var(--sim-ok); }
.sw-rest-l { background: var(--sim-rest-l); }
.sw-rest-d { background: var(--sim-rest-d); }
.sw-gouge { background: var(--sim-gouge); }
.sw-through { background: var(--sim-through); }
.viewer-shell .lg-sim, .viewer-shell .sim-only { display: none; }
.viewer-shell.sim-mode .lg-sim { display: flex; }
.viewer-shell.sim-mode .sim-only { display: inline-flex; }
.viewer-shell.sim-mode .lg-design { display: none; }
.stock-info { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 6px; padding: 9px 12px; border-radius: 9px; background: #eef0e4; border-left: 3px solid var(--stock-fill); font-size: 13.5px; }
.stock-info .err { color: var(--rest); }
.fb-btn { font: inherit; color: inherit; background: transparent; border: 1px solid transparent; border-radius: 9px; padding: 3px 8px; margin: -3px -8px; cursor: pointer; text-align: left; }
.fb-btn:hover { border-color: var(--brand); background: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--brand); padding: 3px 8px; }
.btn.ghost:hover { border-color: var(--brand); }
.side-h.first { margin-top: 0; display: flex; justify-content: space-between; align-items: center; }
.env-tabs { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; margin-bottom: 14px; }
.env-sec { margin-bottom: 4px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 12px; }
.tool-lib { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 12px; margin-bottom: 12px; }
.tool-card { display: grid; grid-template-columns: 154px 1fr; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.tool-pic { display: flex; align-items: center; justify-content: center; background: #f4f5f1; border-radius: 9px; }
.tool-pic.small { width: 64px; flex: none; }
.tool-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.tool-fields .field { margin-bottom: 6px; }
.tool-fields input, .tool-fields select { padding: 5px 8px; }
.tool-warn { grid-column: 1 / -1; margin: 0; color: var(--rest); font-size: 13px; }
.tool-svg { display: block; overflow: visible; }
.tool-svg .tl-holder { fill: #6d7479; stroke: #4c5357; stroke-width: .8; }
.tool-svg .tl-shank { fill: #b4bbbf; stroke: #6b747a; stroke-width: .8; }
.tool-svg .tl-flute { fill: #d7dcdf; stroke: #56606a; stroke-width: .9; }
.tool-svg .tl-helix { stroke: #8b959b; stroke-width: .8; }
.tool-svg .tl-dim { stroke: var(--brand); stroke-width: .8; }
.tool-svg .tl-ext { stroke: #9aa39e; stroke-width: .6; stroke-dasharray: 2 2; }
.tool-svg .tl-txt { fill: var(--ink); font: 500 10.5px var(--mono); }
.tool-svg .tl-lbl { fill: var(--muted); font: 400 9.5px system-ui, -apple-system, 'PingFang TC', sans-serif; }
.tool-use { display: flex; flex-wrap: wrap; gap: 10px; }
.tool-chip { display: flex; gap: 10px; align-items: center; padding: 8px 12px 8px 8px; border: 1px solid var(--line); border-radius: 12px; background: #fff; min-width: 220px; flex: 1 1 220px; }
.tool-chip-text { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.tool-chip-text .muted, .muted { color: var(--muted); }
@media (max-width: 980px) {
  .grid4 { grid-template-columns: 1fr 1fr; }
  .tool-lib { grid-template-columns: 1fr; }
  .tool-card { grid-template-columns: 1fr; }
  .tool-pic { padding: 6px 0; }
}
.viewer-shell .opt3d { flex-wrap: wrap; gap: 6px 12px; }
.viewer-shell .check-inline { white-space: nowrap; }
.stage .ops td:last-child { white-space: nowrap; }
@media (max-width: 980px) { .stage .ops td:nth-child(3) { white-space: normal; } }
:root { --tape: #e9dfbf; }
.allow-row { margin-bottom: 4px; }
.ops tr.step-start td { border-top: 2px solid var(--line); }
.sw-tape { background: var(--tape); outline: 1px solid #cbbf98; }
/* v0.5.5：工序排序 */
.ops .ord { white-space: nowrap; text-align: right; }
.ops .ord-btn { padding: 1px 8px; font-size: 13px; margin-left: 3px; }
.ops th.ord-h { text-align: right; }
.order-msg { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin: 8px 0 0; padding: 8px 12px; border-radius: 9px; background: var(--warn-bg); font-size: 13.5px; }
.order-msg.err { background: var(--err-bg); }
.order-msg .err { color: var(--rest); font-weight: 500; }
/* v0.5.7：刀具顏色與分段下載 */
:root { --tc1: #b8862b; --tc2: #8a5cc2; --tc3: #4f8a8b; --tc4: #c25b7a; --tc5: #7d8a3a; --tc6: #a0603a; }
.tool-dot { display: inline-block; vertical-align: -1px; flex: none; }
.tool-card, .tool-chip, .seg-item { border-left-width: 4px; }
.tc-1.tool-card, .tc-1.tool-chip, .tc-1.seg-item { border-left-color: var(--tc1); }
.tc-2.tool-card, .tc-2.tool-chip, .tc-2.seg-item { border-left-color: var(--tc2); }
.tc-3.tool-card, .tc-3.tool-chip, .tc-3.seg-item { border-left-color: var(--tc3); }
.tc-4.tool-card, .tc-4.tool-chip, .tc-4.seg-item { border-left-color: var(--tc4); }
.tc-5.tool-card, .tc-5.tool-chip, .tc-5.seg-item { border-left-color: var(--tc5); }
.tc-6.tool-card, .tc-6.tool-chip, .tc-6.seg-item { border-left-color: var(--tc6); }
.code .ln.nc-tool { font-weight: 500; }
.code .ln.nc-tool.tc-1 { color: #e3b867; }
.code .ln.nc-tool.tc-2 { color: #c3a0f0; }
.code .ln.nc-tool.tc-3 { color: #8fc9c9; }
.code .ln.nc-tool.tc-4 { color: #f0a0b8; }
.code .ln.nc-tool.tc-5 { color: #c3cf7d; }
.code .ln.nc-tool.tc-6 { color: #e0a07a; }
.seg-list { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; gap: 8px; }
.seg-item { border: 1px solid var(--line); border-left-width: 4px; border-radius: 10px; background: #fff; padding: 9px 12px; font-size: 13.5px; }
.seg-head { display: flex; align-items: center; gap: 4px; }
.seg-ops { margin-top: 2px; }
.seg-prep { color: var(--muted); margin-top: 2px; }
.seg-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.seg-foot .v-ok { color: var(--lead); }
.seg-foot .v-bad { color: var(--rest); }

/* ---------- v1.0.0：正式首頁（語系、檔案說明、頁尾） ---------- */
:lang(zh-Hans) body, body:lang(zh-Hans) { font-family: system-ui, -apple-system, 'PingFang SC', 'Noto Sans SC', 'Microsoft YaHei', sans-serif; }
:lang(ja) body, body:lang(ja) { font-family: system-ui, -apple-system, 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic UI', 'Yu Gothic', 'Noto Sans JP', sans-serif; }
:lang(en) body, body:lang(en) { font-family: system-ui, -apple-system, 'Segoe UI', 'Noto Sans TC', sans-serif; }
.lang-sel { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.lang-sel select { width: auto; padding: 4px 8px; font-size: 13px; }
.linkbtn { background: none; border: 0; padding: 0; margin-left: 6px; font: inherit; color: var(--brand); text-decoration: underline; cursor: pointer; }
.flow-foot { margin: 0 28px 28px; }
.flow-foot .fine { margin: 4px 0; }
.flow-foot a { color: var(--brand); }
.privacy-dlg { max-width: 560px; width: calc(100% - 32px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink); padding: 22px 24px; }
.privacy-dlg::backdrop { background: rgba(0, 0, 0, .35); }
.privacy-dlg h2 { margin: 0 0 10px; font-size: 18px; }
.privacy-dlg dl { margin: 0 0 16px; }
.privacy-dlg dt { font-weight: 600; margin-top: 12px; }
.privacy-dlg dd { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
@media (max-width: 980px) {
  .flow-foot { margin: 0 18px 24px; }
  .lang-sel { margin-left: 0; }
}
/* 英文的側欄標題改直排（中日文維持逐字換行） */
:lang(en) .rail-title { width: auto; writing-mode: vertical-rl; word-break: normal; white-space: nowrap; line-height: 1.1; }
.stage .ops td:nth-child(4) { white-space: nowrap; }
:lang(en) .rail-badge { word-break: normal; }

/* ---------- v1.0.1：WKidea.com 連結與理念區 ---------- */
.site-link { text-decoration: none; }
.lang-sel + .site-link { margin-left: 4px; }
.about { margin: 8px 28px 20px; padding: 26px 28px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px 40px; align-items: end; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); border-left: 4px solid var(--wood-dark); }
.about h2 { margin: 0 0 10px; font-size: 20px; letter-spacing: .02em; }
.about p { margin: 0 0 8px; max-width: 46em; color: var(--ink); }
.about p + p { color: var(--muted); }
.about-actions { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.about-actions .btn { text-decoration: none; text-align: center; white-space: nowrap; }
@media (max-width: 980px) {
  .about { margin: 8px 18px 18px; padding: 20px; grid-template-columns: 1fr; }
  .about-actions { flex-direction: row; flex-wrap: wrap; }
  .about-actions .btn { white-space: normal; }
}

/* v1.0.3：頁首捲出後，固定的機台列左側顯示品牌（手機的機台列不固定，所以不顯示） */
.fb-brand { display: none; font-weight: 700; font-size: 16px; letter-spacing: -0.01em; color: var(--ink); text-decoration: none; padding-right: 14px; border-right: 1px solid var(--line); }
.fb-brand:hover { color: var(--brand); }
.head-out .fb-brand { display: inline-block; }
@media (max-width: 980px) { .head-out .fb-brand { display: none; } }

/* ---------- v1.1.0 ---------- */
.row-gap { flex: 1; }
/* 螢幕較矮時縮小 3D 視窗，讓固定的視窗整個看得到 */
@media (min-width: 981px) and (max-height: 820px) { .flow-canvas { height: calc(100vh - 300px); min-height: 320px; } }
.hint.err { color: var(--rest); }
