/* ============================================================
   器材箱（/night-owl/gear）— 2026-11-17 重寫外觀：跟望遠鏡模擬 v3 同一套版面與外觀。
   版面、玻璃、上排、左右欄、下排、收合全部用 telescope_v3.css 的 .tz-*（模板一起載）；這支只管器材箱自己的元件：
   3D 舞台、器材格（.nog-box，長得跟模擬頁的器材卡一樣）、器材組清單（.nog-slot）、光路鏈、彈窗、電源卡、OWL 面板的位置。
   ============================================================ */
.nog, .nog-portal {
    --nog-ok: #4ade80; --nog-warn: #fbbf24; --nog-bad: var(--color-danger, #f87171);
    --nog-glass-b: var(--color-border);
    --tz-line: var(--color-border, rgba(255, 255, 255, 0.14));
    --tz-line-soft: var(--color-border-subtle, rgba(255, 255, 255, 0.08));
    --tz-btn: rgba(255, 255, 255, 0.07);
    --tz-btn-h: rgba(255, 255, 255, 0.13);
}
.nog.tz { --tz-plot-h: var(--nog-bottom-h, 118px); --tz-left-w: 310px; --tz-right-w: 300px; }
.nog *, .nog *::before, .nog *::after, .nog-portal *, .nog-portal *::before, .nog-portal *::after { box-sizing: border-box; }
.nog-visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── 3D 舞台（天空那一格） ── */
.nog .nog-center { background: radial-gradient(ellipse 60% 55% at 50% 50%, #1d1b2a, #08080c 72%), #08080c; }
.nog-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; outline: none; touch-action: none; cursor: grab; }
.nog-canvas:active { cursor: grabbing; }
.nog-canvas:focus-visible { box-shadow: inset 0 0 0 2px var(--color-accent); }
.nog-callouts { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 4; }
.nog-callout {
    position: absolute; transform: translate(-50%, -100%); white-space: nowrap; font-size: 0.78rem; line-height: 1.3;
    padding: 3px 9px; border-radius: 8px; color: var(--color-text);
    background: var(--v2-glass-strong, rgba(22, 22, 28, 0.92)); border: 1px solid var(--color-accent);
}
.nog-callout.is-sch { border-style: dashed; border-color: var(--color-text-muted); color: var(--color-text-secondary); }
.nog-stage-msg {
    position: absolute; z-index: 4; left: calc((var(--g-l) + 100% - var(--g-r)) / 2); top: calc((var(--g-t) + 100% - var(--g-b)) / 2); transform: translate(-50%, -50%);
    max-width: min(420px, 60%); text-align: center; padding: 14px 18px; border-radius: 14px; font-size: 0.9rem; line-height: 1.6; color: var(--color-text-secondary);
    background: var(--v2-glass, rgba(14, 14, 18, 0.7)); border: 1px dashed var(--tz-line);
}
.nog-stage-msg[hidden] { display: none; }
/* 左下膠囊（同模擬頁「畫面＋底圖」）：比例尺＋視角 */
.nog .nog-base { gap: 2px; }
.nog-scale { margin: 0; padding: 0 10px 0 8px; display: inline-flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--color-text-secondary); white-space: nowrap; font-variant-numeric: tabular-nums; }
.nog-scale-bar { display: inline-block; height: 6px; width: 60px; border: 2px solid currentColor; border-top: 0; }
.nog .nog-ib { min-height: 36px; }
.nog .nog-ib[aria-pressed="true"] { color: var(--color-accent); }
.nog[data-tab="guide"] .nog-base, .nog[data-tab="focus"] .nog-base, .nog[data-tab="power"] .nog-base,
.nog[data-tab="guide"] .nog-callouts, .nog[data-tab="focus"] .nog-callouts { visibility: hidden; }

/* ── 上排：分頁＝模擬頁〔傳統｜沉浸式〕那種分段鈕 ── */
.nog .nog-tabs { overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.nog .nog-tabs::-webkit-scrollbar { display: none; }
.nog .nog-tabs .nog-tab { white-space: nowrap; }
.nog .nog-tabs .nog-tab[aria-selected="true"] { background: var(--color-accent); color: var(--color-accent-text); font-weight: 600; }
.nog-sp { flex: 1 1 0; min-width: 0; }
.nog-acts { display: flex; align-items: center; gap: 8px; flex: none; }
.nog .nog-acts .tz-btn { min-height: 38px; text-decoration: none; white-space: nowrap; }
.nog .nog-auto { border-color: color-mix(in srgb, var(--color-accent) 55%, transparent); color: var(--color-accent); }
.nog .nog-auto[aria-busy="true"] { cursor: progress; opacity: 0.75; }
.nog .nog-pri[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.nog .nog-pri[aria-busy="true"] { cursor: progress; opacity: 0.8; }
.nog-top .tsg-msg { position: absolute; right: 12px; top: calc(100% + 6px); margin: 0; z-index: 5; }
.nog-tip { position: relative; }
.nog-tip > summary {
    list-style: none; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px;
    color: var(--color-text-secondary); font-weight: 600; cursor: pointer; user-select: none; background: var(--tz-btn);
}
.nog-tip > summary::-webkit-details-marker { display: none; }
.nog-tip[open] > summary, .nog-tip > summary:hover { color: var(--color-text); background: var(--tz-btn-h); }
.nog-tip-body {
    position: absolute; top: calc(100% + 8px); right: 0; z-index: 40; width: min(400px, calc(100vw - 32px)); padding: 12px 14px; border-radius: 14px;
    background: var(--v2-glass-strong, rgba(22, 22, 28, 0.96)); border: 1px solid var(--tz-line); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5); font-size: 0.86rem; line-height: 1.6;
}
.nog-tip-body p { margin: 0; }
.nog[data-tab="gear"] [data-nog-help]:not([data-nog-help="gear"]),
.nog[data-tab="train"] [data-nog-help]:not([data-nog-help="train"]),
.nog[data-tab="guide"] [data-nog-help]:not([data-nog-help="guide"]),
.nog[data-tab="focus"] [data-nog-help]:not([data-nog-help="focus"]),
.nog[data-tab="power"] [data-nog-help]:not([data-nog-help="power"]) { display: none; }

.nog-gb:not(.tz-btn) {   /* JS 產生的小按鈕（光路編輯、延長管表單、分享網址）：同模擬頁 .tz-btn */
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 10px;
    border: 1px solid var(--tz-line); background: var(--tz-btn); color: var(--color-text); font: inherit; font-size: 0.84rem; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.nog-gb:not(.tz-btn):hover { background: var(--tz-btn-h); }
.nog-gb:focus-visible, .nog-tab:focus-visible, .nog-add:focus-visible, .nog-x:focus-visible, .nog-item-x:focus-visible, .nog-item-q:focus-visible,
.nog-link:focus-visible, .nog-pick-list button:focus-visible, .nog-seg button:focus-visible, .nog-tip > summary:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* ── 左右欄（.tz-left／.tz-right 的內容）── */
.nog .tz-left .tz-body, .nog .tz-right .tz-body { overflow-y: auto; scrollbar-width: thin; margin-right: -6px; padding-right: 6px; gap: 8px; }
.nog .tz-right { padding: 8px 8px 10px 12px; }
.nog .tz-right:not(.is-folded) > .tz-sec-h { position: static; }
.nog .tz-right .tz-sec-h h2 { margin: 0; font-size: 0.95rem; font-weight: 600; flex: 1; }
.nog .tz-right .tz-body { margin-top: 8px; }
.nog .tz-right.is-folded { width: var(--tz-right-w); max-width: none; padding-bottom: 8px; }
.nog .tz-sec-h h2 { flex: 1; }
.nog-grp { margin: 6px 0 0; }
/* 器材組（存好幾組）：長得跟模擬頁的器材卡一樣 */
.nog-slots { display: flex; flex-direction: column; gap: 6px; }
.nog-slot { display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 14px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--tz-line-soft); transition: border-color 0.15s, background 0.15s; }
.nog-slot.is-on { border-color: color-mix(in srgb, var(--color-accent) 70%, transparent); background: var(--color-accent-soft); }
.nog-slot-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 8px; border: 0; border-radius: 10px;
    background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.nog-slot-main:hover { background: var(--tz-btn); }
.nog-slot-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; border: 2px solid var(--color-text-muted); }
.nog-slot.is-on .nog-slot-dot { background: var(--color-accent); border-color: var(--color-accent); }
.nog-slot-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.nog-slot-tx b { font-size: 0.88rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nog-slot-tx small { font-size: 0.74rem; color: var(--color-text-muted); font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nog-slot-tx small .is-err { color: var(--nog-warn); }
.nog-slot .tz-ib { width: 32px; height: 32px; font-size: 0.95rem; }
.nog-slot-ed { flex: 1; display: flex; gap: 6px; padding: 2px 4px; }
.nog-slot-ed input { flex: 1; min-width: 0; min-height: 36px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--color-accent); background: rgba(255, 255, 255, 0.06); color: var(--color-text); font: inherit; font-size: 0.88rem; }
.nog-slot-del { flex: 1; display: flex; align-items: center; gap: 6px; padding: 2px 4px 2px 10px; font-size: 0.82rem; color: var(--color-text-secondary); }
.nog-slot-del span { flex: 1; }
.nog-slot-msg { margin: 0; font-size: 0.76rem; line-height: 1.45; color: var(--color-text-muted); }
.nog-slot-msg:empty { display: none; }
/* 器材格（每類一張卡；同模擬頁 .tz-rig 的卡片） */
.nog-box { position: relative; padding: 6px 6px 8px 10px; border-radius: 14px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--tz-line-soft); display: flex; flex-direction: column; flex: none; }
.nog-box.is-sel { border-color: var(--color-accent); box-shadow: 0 0 0 1px var(--color-accent); }
.nog-box-h { display: flex; align-items: center; gap: 6px; min-height: 32px; }
.nog-box-t { margin: 0; flex: 1 1 auto; font-size: 0.78rem; color: var(--color-text-secondary); font-weight: 600; }
.nog-box-ok { font-size: 0.74rem; white-space: nowrap; }
.nog-box-ok.ok { color: var(--nog-ok); } .nog-box-ok.warn { color: var(--nog-warn); } .nog-box-ok.bad { color: var(--nog-bad); }
.nog-add { flex: none; width: 32px; height: 32px; border-radius: 10px; border: 0; background: transparent; color: var(--color-text-secondary); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.nog-add:hover, .nog-add[aria-expanded="true"] { color: var(--color-text); background: var(--tz-btn-h); }
.nog-add svg { width: 17px; height: 17px; }
.nog-box-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nog-empty { margin: 0 4px 0 0; font-size: 0.8rem; line-height: 1.45; color: var(--color-text-muted); border: 1px dashed var(--tz-line); border-radius: 10px; padding: 7px 8px; text-align: center; }
.nog-item { display: flex; align-items: center; gap: 8px; min-width: 0; border-radius: 10px; }
.nog-item.is-auto .nog-item-n::before { content: "✨ "; }
.nog-thumb { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--color-text-secondary); background: var(--tz-btn); }
.nog-thumb svg { width: 19px; height: 19px; }
.nog-item-tx { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; }
.nog-item-n { font-size: 0.86rem; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.nog-item-s { font-size: 0.74rem; color: var(--color-text-muted); line-height: 1.35; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.nog-item-x, .nog-item-q { flex: none; width: 32px; height: 32px; border: 0; background: none; color: var(--color-text-muted); border-radius: 10px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.nog-item-q { font-weight: 600; font-size: 0.8rem; }
.nog-item-x:hover, .nog-item-q:hover { color: var(--color-text); background: var(--tz-btn-h); }
.nog-item-x svg { width: 15px; height: 15px; }
/* 赤道儀：〔經緯儀｜赤道儀〕與極軸仰角 */
.nog-mountctl { margin-top: 6px; display: flex; flex-direction: column; gap: 6px; padding-right: 4px; }
.nog-mountctl[hidden] { display: none; }
.nog-seg { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--tz-btn); }
.nog-seg button { flex: 1 1 0; min-height: 34px; border: 0; border-radius: 8px; background: none; color: var(--color-text-secondary); font: inherit; font-size: 0.84rem; cursor: pointer; }
.nog-seg button[aria-checked="true"] { background: var(--color-accent); color: var(--color-accent-text); font-weight: 600; }
.nog-lat { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--color-text-secondary); flex-wrap: wrap; }
.nog-lat label { flex: 1 1 100%; }
.nog-lat input[type="range"] { flex: 1 1 auto; min-width: 0; accent-color: var(--color-accent); }
.nog-lat input[type="number"] { width: 64px; min-height: 34px; padding: 0 6px; border-radius: 10px; border: 1px solid var(--tz-line); background: rgba(255, 255, 255, 0.06); color: var(--color-text); font: inherit; font-size: 0.86rem; }
.nog-mc-note { margin: 0; font-size: 0.76rem; line-height: 1.45; color: var(--color-text-muted); }
.nog-mc-note .warn { color: var(--nog-warn); }

/* ── 下排（.tz-bottom 的內容）：判定＋光路鏈 ── */
.nog .tz-bottom { height: auto; max-height: min(34dvh, 300px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 8px 14px 10px; gap: 6px; }
.nog[data-tab="train"] .tz-bottom { max-height: min(46dvh, 420px); }
.nog .tz-bottom.is-folded .nog-chain, .nog .tz-bottom.is-folded .nog-tedit, .nog .tz-bottom.is-folded .nog-cur,
.nog .tz-bottom.is-folded .nog-bt-gen, .nog .tz-bottom.is-folded .nog-bt-gauto { display: none; }
.nog-bt { display: flex; align-items: center; gap: 4px 12px; flex-wrap: wrap; font-size: 0.84rem; min-width: 0; }
.nog-bt .tz-h { margin: 0; }
.nog-bt .tz-fold { width: 30px; height: 30px; margin: -4px -6px -4px 0; }
.nog-verd { font-weight: 600; white-space: nowrap; }
.nog-verd.ok { color: var(--nog-ok); } .nog-verd.pre, .nog-verd.unk { color: var(--nog-warn); } .nog-verd.bad { color: var(--nog-bad); }
.nog-sum { color: var(--color-text-secondary); min-width: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.nog-sum b { color: var(--color-text); font-weight: 600; }
.nog-cur { margin: 0; font-size: 0.76rem; color: var(--color-text-muted); overflow-wrap: anywhere; }
.nog-cur b { color: var(--color-text-secondary); }
.nog-cur.is-nudge { animation: nog-nudge 260ms ease; }
@keyframes nog-nudge { 30% { transform: translateX(-4px); } 70% { transform: translateX(3px); } }
.nog-chain { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; min-width: 0; }
.nog-chain li { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.nog-chain li + li::before { content: "→"; color: var(--color-text-muted); margin-right: 2px; }
.nog-link {
    display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 2px 10px; border-radius: 10px; font-size: 0.8rem; line-height: 1.3;
    border: 1px solid var(--tz-line-soft); background: var(--tz-btn); color: var(--color-text); overflow-wrap: anywhere; text-align: left; font-family: inherit;
}
button.nog-link { cursor: pointer; }
button.nog-link:hover { background: var(--tz-btn-h); }
.nog-link.is-auto { border-color: color-mix(in srgb, var(--color-accent) 60%, transparent); color: var(--color-accent); }
.nog-link.is-bad { border-color: var(--nog-bad); color: var(--nog-bad); }
.nog-link small { color: var(--color-text-muted); font-size: 0.74rem; }

/* ── 光路分頁：逐件編輯（自訂延長管／轉接環） ── */
.nog:not([data-tab="train"]) .nog-tedit { display: none; }
.nog[data-tab="train"] .nog-chain, .nog[data-tab="train"] .nog-bt-gen, .nog[data-tab="train"] .nog-bt-gauto { display: none; }
.nog-te-acts { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.nog-te-gauto { margin: 0; font-size: 0.82rem; line-height: 1.45; color: var(--color-text-secondary); overflow-wrap: anywhere; }
.nog-gauto-msg { color: var(--color-accent); }
.nog-link.is-gauto { border-style: dashed; }
.nog-tag { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 6px; font-size: 0.72rem; line-height: 1.5; vertical-align: 1px;
    background: color-mix(in srgb, var(--color-text) 10%, transparent); color: var(--color-text-secondary); }
.nog-tag.is-auto { background: none; color: var(--color-accent); }
.nog-tedit { display: grid; gap: 6px; font-size: 0.86rem; }
.nog-te-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: space-between; }
.nog-te-bf { margin: 0; font-weight: var(--font-weight-semibold, 600); }
.nog-te-bf.ok, .nog-te-j.ok { color: var(--nog-ok); } .nog-te-bf.unk, .nog-te-j.unk { color: var(--nog-warn); } .nog-te-bf.bad, .nog-te-j.bad { color: var(--nog-bad); }
.nog-te-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nog-te-row { display: flex; align-items: center; gap: 6px; min-height: 48px; padding: 2px 6px; border-radius: 10px; border: 1px solid var(--nog-glass-b);
    background: color-mix(in srgb, var(--color-surface-elevated) 88%, transparent); touch-action: none; position: relative; }
.nog-te-row.is-gen { border-style: dashed; }
.nog-te-row.is-drag { z-index: 3; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25); opacity: 0.92; }
.nog-te-row.is-over { outline: 2px solid var(--color-accent); }
.nog-te-grip { flex: 0 0 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; cursor: grab; color: var(--color-text-muted); border-radius: 8px; letter-spacing: -2px; user-select: none; }
.nog-te-grip.is-fixed { cursor: default; }
.nog-te-grip:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.nog-te-n { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; line-height: 1.35; }
.nog-te-n small { display: block; color: var(--color-text-muted); font-size: 0.76rem; }
.nog-te-bs { display: inline-flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.nog-te-b { min-width: 44px; min-height: 44px; padding: 0 8px; border-radius: 9px; border: 1px solid var(--color-border); background: none; color: var(--color-text); cursor: pointer; font: inherit; font-size: 0.8rem; display: inline-flex; align-items: center; justify-content: center; }
.nog-te-b svg { width: 16px; height: 16px; }
.nog-te-b:disabled { opacity: 0.35; cursor: default; }
.nog-te-b:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.nog-te-j { padding: 0 6px 0 56px; font-size: 0.8rem; line-height: 1.4; }
.nog-te-help { margin: 0; font-size: 0.76rem; color: var(--color-text-muted); }
.nog-swap.nog-gen { width: min(440px, calc(100% - 20px)); max-height: calc(100% - 20px); overflow-y: auto; }
.nog-gen form { display: grid; gap: 8px; }
.nog-gen fieldset { margin: 0; padding: 6px 8px 8px; border: 1px solid var(--color-border); border-radius: 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.nog-gen legend { font-size: 0.8rem; color: var(--color-text-secondary); padding: 0 4px; }
.nog-gen select, .nog-gen input[type="number"] { min-height: 44px; border-radius: 9px; border: 1px solid var(--color-border); background: var(--color-bg, transparent); color: var(--color-text); font: inherit; padding: 0 8px; }
.nog-gen-g { display: inline-flex; gap: 2px; }
.nog-gen-g label { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; justify-content: center; cursor: pointer; }
.nog-gen-g label { position: relative; }
.nog-gen-g input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.nog-gen-g span { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--color-border); font-size: 0.82rem; }
.nog-gen-g input:checked + span { border-color: var(--color-accent); color: var(--color-accent); font-weight: var(--font-weight-semibold, 600); }
.nog-gen-g input:focus-visible + span { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.nog-gen-q { display: flex; flex-wrap: wrap; gap: 4px; width: 100%; }
.nog-gen-q button { min-height: 44px; padding: 0 9px; border-radius: 8px; border: 1px solid var(--color-border); background: none; color: var(--color-text-secondary); cursor: pointer; font: inherit; font-size: 0.78rem; }
.nog-gen-len { display: flex; align-items: center; gap: 8px; font-size: 0.86rem; }
.nog-gen-len input { width: 110px; }
.nog-gen-err { margin: 0; min-height: 1em; color: var(--nog-bad); font-size: 0.82rem; }
.nog-gen-act { display: flex; gap: 8px; }
.nog-gb.is-primary { border-color: var(--color-accent); color: var(--color-accent); }

/* ── 挑器材／換接法的小視窗 ── */
.nog-pick, .nog-swap {
    position: absolute; z-index: 20; width: min(380px, calc(100% - 28px)); max-height: min(560px, calc(100% - 100px)); display: flex; flex-direction: column; gap: 8px;
    padding: 10px 12px 12px; background: color-mix(in srgb, var(--color-surface-elevated) 92%, transparent); box-shadow: var(--shadow-lg);
}
/* 10-19：所有彈窗置中（fixed、最上層、不在版面流裡 → 開關不會推擠下排或左右欄）；遮罩點了關 */
.nog-scrim { position: fixed; inset: 0; z-index: 2000; background: color-mix(in srgb, #05040c 46%, transparent); }
:root[data-theme="light"] .nog-scrim { background: color-mix(in srgb, #2a2230 26%, transparent); }
.nog-scrim[hidden] { display: none; }
.nog-pick.nog-dlg, .nog-swap.nog-dlg {
    position: fixed; z-index: 2001; left: 50%; top: 50%; right: auto; bottom: auto; transform: translate(-50%, -50%);
    width: min(460px, calc(100vw - 32px)); max-height: min(640px, calc(100dvh - 48px)); overflow-y: auto; overscroll-behavior: contain;
    padding: 14px 16px 16px; border-radius: 18px;
}
.nog-pick.nog-dlg { width: min(480px, calc(100vw - 32px)); height: min(640px, calc(100dvh - 48px)); overflow: hidden; }
.nog-swap.nog-gen.nog-dlg { width: min(520px, calc(100vw - 32px)); max-height: min(720px, calc(100dvh - 48px)); }
@media (prefers-reduced-motion: no-preference) {
    .nog-dlg:not([hidden]) { animation: nog-dlg-in 160ms ease-out; }
    @keyframes nog-dlg-in { from { opacity: 0; transform: translate(-50%, calc(-50% + 8px)); } to { opacity: 1; transform: translate(-50%, -50%); } }
}
.nog-pick[hidden], .nog-swap[hidden] { display: none; }
.nog-pick-h { display: flex; align-items: center; gap: 8px; }
.nog-pick-t { margin: 0; flex: 1 1 auto; font-size: 1rem; }
.nog-x { width: 44px; height: 44px; border: 0; background: none; color: var(--color-text-secondary); border-radius: 10px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.nog-x svg { width: 18px; height: 18px; }
.nog-pick-q { width: 100%; min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text); font: inherit; font-size: 16px; }
.nog-pick-cats { display: flex; gap: 6px; flex-wrap: wrap; }
.nog-pick-cats:empty { display: none; }
.nog-pick-cats button { min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--color-border); background: none; color: var(--color-text-secondary); cursor: pointer; font-size: 0.84rem; }
.nog-pick-cats button[aria-pressed="true"] { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-accent-text); }
.nog-pick-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; min-height: 0; flex: 1 1 auto; overscroll-behavior: contain; }
.nog-pick-list .nog-pick-g { position: sticky; top: 0; z-index: 1; font-size: 0.74rem; color: var(--color-text-muted); padding: 6px 4px 2px; background: color-mix(in srgb, var(--color-surface-elevated) 96%, transparent); }
.nog-pick-list button {
    width: 100%; min-height: 44px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 1px; text-align: left;
    padding: 4px 8px; border: 0; border-radius: 9px; background: none; color: var(--color-text); cursor: pointer; font-size: 0.9rem;
}
.nog-pick-list button:hover, .nog-pick-list button[aria-selected="true"] { background: color-mix(in srgb, var(--color-text) 9%, transparent); }
.nog-pick-list button small { font-size: 0.76rem; color: var(--color-text-muted); }
.nog-pick-list .nog-pick-brand { flex-direction: row; justify-content: space-between; align-items: center; font-weight: var(--font-weight-semibold, 600); }
.nog-pick-list .nog-pick-back { color: var(--color-accent); }
.nog-pick-more { margin: 0; font-size: 0.8rem; color: var(--color-text-muted); }
.nog-swap { width: min(420px, calc(100% - 28px)); }
.nog-swap ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; overflow-y: auto; }
.nog-swap li button { width: 100%; min-height: 44px; text-align: left; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--color-border); background: none; color: var(--color-text); cursor: pointer; font-size: 0.86rem; line-height: 1.4; }
.nog-swap li button[aria-current="true"] { border-color: var(--color-accent); }
.nog-swap p { margin: 0; font-size: 0.82rem; color: var(--color-text-secondary); }


/* 彈窗外觀跟模擬頁的對話框一樣（無色玻璃、18 px 圓角） */
.nog-pick, .nog-swap { background: var(--v2-glass-strong, rgba(22, 22, 28, 0.96)); border: 1px solid var(--tz-line); color: var(--color-text);
    -webkit-backdrop-filter: var(--v2-blur, blur(30px)); backdrop-filter: var(--v2-blur, blur(30px)); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55); font-family: var(--font-primary); }
.nog-scrim { background: rgba(0, 0, 0, 0.55); }
.nog-pick-q { background: rgba(255, 255, 255, 0.06); border-color: var(--tz-line); }
.nog-pick-q:focus { outline: none; border-color: var(--color-accent); box-shadow: 0 0 0 3px var(--color-accent-soft); }

/* ── 電源・重量卡、OWL 的槽（導星／對焦）：放在沒被玻璃蓋住的那一塊 ── */
.nog-sheet, .nog-host { position: absolute; z-index: 15; left: var(--g-l); right: var(--g-r); top: var(--g-t); bottom: var(--g-b); }
.nog-sheet { padding: 14px 16px; overflow-y: auto; font-size: 0.88rem; line-height: 1.55; }
.nog-sheet[hidden] { display: none; }
.nog-sheet h3 { margin: 0 0 6px; font-size: 0.92rem; }
.nog-sheet table { width: 100%; border-collapse: collapse; font-size: 0.84rem; margin: 4px 0 12px; }
.nog-sheet th, .nog-sheet td { text-align: left; padding: 5px 6px; border-bottom: 1px solid var(--tz-line-soft); }
.nog-sheet td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nog-sheet .big { font-size: 1.25rem; font-weight: 600; }
.nog-sheet .ok { color: var(--nog-ok); } .nog-sheet .warn { color: var(--nog-warn); } .nog-sheet .bad { color: var(--nog-bad); }
.nog-sheet .muted { color: var(--color-text-muted); font-size: 0.8rem; }
.nog-host { overflow: hidden; display: none; padding: 0; border-radius: 18px; border: 1px solid var(--tz-line); background: var(--color-surface-elevated); }
.nog[data-tab="guide"] .nog-host, .nog[data-tab="focus"] .nog-host { display: block; }
.nog-host .owl-host-state { padding: 24px; }
.nog-host #owl-guide-fit, .nog-host #owl-focus-fit { display: none !important; }
.nog-guidesky { position: absolute; right: 12px; bottom: 12px; z-index: 4; display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; border-radius: 10px;
    border: 1px solid var(--tz-line); background: var(--v2-glass-strong, rgba(22, 22, 28, 0.94)); color: var(--color-text); text-decoration: none; font-size: 0.86rem; }
.nog:not([data-tab="guide"]) .nog-guidesky { display: none; }

@media (prefers-reduced-motion: reduce) { .nog-cur.is-nudge { animation: none; } }

/* 中寬：上排放不下 → 按鈕只留圖示 */
@media (max-width: 1280px) and (min-width: 861px) {
    .nog .nog-acts .tz-btn:not(.nog-pri) span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }   /* 只剩圖示；字留給讀屏 */
    .nog.tz { --tz-left-w: 280px; --tz-right-w: 270px; }
}

/* ── 手機（≤ 860）：跟模擬頁一樣上下捲動（上排 → 3D → 下排 → 左欄 → 右欄） ── */
@media (max-width: 860px) {
    .nog .nog-tabs { order: 2; flex: 1 1 100%; }
    .nog .nog-sp { display: none; }
    .nog .nog-acts { order: 3; flex: 1 1 100%; flex-wrap: wrap; }
    .nog .nog-acts .nog-pri { flex: 1 1 auto; justify-content: center; }
    .nog .nog-acts { flex-wrap: nowrap; }
    .nog .nog-acts .tz-btn:not(.nog-pri) span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .nog .nog-acts .tz-btn:not(.nog-pri) { padding: 0 11px; }
    .nog .tz-bottom { max-height: none; overflow: visible; }
    .nog .nog-sheet { left: 8px; right: 8px; top: 8px; bottom: 56px; }
    .nog .nog-stage-msg { left: 50%; top: 45%; max-width: 80%; }
    .nog-host { position: relative; inset: auto; order: 2; height: 82vh; min-height: 520px; flex-shrink: 0; }
    .nog[data-tab="guide"] .nog-center, .nog[data-tab="focus"] .nog-center { display: none; }
    .nog .tz-right.is-folded { width: auto; }
    .nog-pick.nog-dlg, .nog-swap.nog-dlg, .nog-swap.nog-gen.nog-dlg { left: 0; top: 0; right: 0; bottom: 0; transform: none; width: 100%; height: 100%; max-height: none;
        border-radius: 0; padding: max(12px, var(--app-safe-t, env(safe-area-inset-top, 0px))) 16px max(16px, env(safe-area-inset-bottom)); }
    @keyframes nog-dlg-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
}
.nog-sys { margin: 4px 0 0; font-size: 0.78rem; color: var(--color-text-secondary); }
.nog-flange { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 0.82rem; margin-top: 4px; }
.nog-flange input { width: 96px; min-height: 44px; border-radius: 9px; border: 1px solid var(--color-border); background: var(--color-bg, transparent); color: var(--color-text); font: inherit; padding: 0 8px; }
.nog-flange small { color: var(--color-text-muted); }
.nog-share-url { width: min(420px, 100%); min-height: 36px; font: inherit; font-size: 0.78rem; }
