/* ============================================================
   望遠鏡模擬（精簡版，2026-11-17）：天空滿版，四周浮動玻璃（無色、單一琥珀強調色；docs/web_design_system.md）。
   桌機：上排（搜尋、地點、日期）／左欄器材／右欄目標＋月亮／下排整晚高度圖；手機（≤ 860 px）改成上下捲動。
   ============================================================ */
.tz {
    --tz-gap: 10px;
    --tz-top-h: 52px;
    --tz-left-w: 300px;
    --tz-right-w: 268px;
    --tz-plot-h: 132px;
    --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);
    --tz-moon-lit: #f1efe6;
    --tz-moon-dark: #24232c;
    --tz-good: #4ade80;
    --tz-warn: #fbbf24;
    --tz-bad: #f87171;
    /* 天空上沒被玻璃蓋住的範圍（沉浸式 HUD 用） */
    --g-t: calc(var(--imm-t) + var(--tz-top-h) + var(--tz-gap));
    --g-l: calc(var(--imm-l) + var(--tz-left-w) + var(--tz-gap));
    --g-r: calc(var(--imm-r) + var(--tz-right-w) + var(--tz-gap));
    --g-max: calc(100% - var(--g-t) - var(--g-b) - 58px);   /* 左右欄最高到這裡：底下留左下膠囊（畫面／底圖、器材箱的視角）那一排 */
    --g-b: calc(var(--imm-b) + var(--tz-plot-h) + var(--tz-gap));
    position: absolute; inset: 0; color: var(--color-text); font-family: var(--font-primary);
}
.tz *, .tz-dlg * { box-sizing: border-box; }
.tz-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tz-mut { color: var(--color-text-muted); }
.tz-mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ── 天空 ── */
.tz-sky { position: absolute; inset: 0; background: #000; overflow: hidden; isolation: isolate; }
.tz-aladin { position: absolute !important; inset: 0; width: 100%; height: 100%; }
.tz-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--color-text-secondary); z-index: 1; }
.tz-loading[hidden] { display: none; }
.tz-spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.2); border-top-color: var(--color-accent); animation: tz-spin 0.9s linear infinite; }
@keyframes tz-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .tz-spin { animation: none; } }
.tz-fov { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; overflow: visible; }
.tz-fov path { fill: none; vector-effect: non-scaling-stroke; }
.tz-fov-halo { stroke: rgba(0, 0, 0, 0.55); stroke-width: 4; }
.tz-fov-line { stroke-width: 1.75; stroke-linecap: round; }
.tz-fov-line.is-pri { stroke-width: 2.5; }
.tz-fov-t { font: 600 12px var(--font-primary); paint-order: stroke; stroke: rgba(0, 0, 0, 0.75); stroke-width: 3px; }
.tz-fov-n { font-weight: 400; font-variant-numeric: tabular-nums; opacity: 0.9; }
.tz-fov-c path { stroke: rgba(255, 255, 255, 0.85); stroke-width: 1.5; stroke-linecap: round; }
.tz.is-imm .tz-fov { display: none; }
/* Aladin 自帶的讀數：座標框不要（右欄有）；畫面大小放在天空左下（沒被玻璃蓋住的地方） */
.tz .aladin-location { display: none !important; }
.tz .aladin-fov, .tz .aladin-status-bar { display: none !important; }
/* 沉浸式 HUD 夾在玻璃中間 */
.tz .sky-hud { inset: var(--g-t) var(--g-r) var(--g-b) var(--g-l); }
.tz .sky-top { padding: 4px 4px 0; }
.tz .sky-bottom { padding: 0 4px 6px; justify-content: center; }
.tz .sky-wx { left: 4px; top: 50px; }
.tz .sky-site { display: none; }   /* 地點用上排那顆（兩種天空共用同一組設定） */

/* 底圖（右下，夾在右欄與高度圖之間） */
.tz-base {
    position: absolute; z-index: 20; left: var(--imm-l); bottom: var(--g-b);
    display: flex; align-items: center; gap: 6px; padding: 4px;
    border-radius: 14px; background: var(--v2-glass, rgba(14, 14, 18, 0.7)); border: 1px solid var(--tz-line);
    -webkit-backdrop-filter: var(--v2-blur, blur(30px)); backdrop-filter: var(--v2-blur, blur(30px));
}
.tz.is-imm .tz-base { display: none; }
.tz-base-fov { padding: 0 6px 0 10px; font-size: 0.82rem; color: var(--color-text-secondary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tz-base-fov b { color: var(--color-text); font-weight: 600; }
.tz-base-fov:empty { display: none; }
.tz-base-btn {
    display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border: 0; border-radius: 10px;
    background: transparent; color: var(--color-text); font: inherit; font-size: 0.86rem; cursor: pointer;
}
.tz-base-btn:hover { background: var(--tz-btn-h); }
.tz-base-btn .ti { font-size: 1.05rem; color: var(--color-text-secondary); }
.tz-base-k { color: var(--color-text-muted); }
.tz-base-btn b { font-weight: 600; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tz-src .eausky-chip { min-height: 36px; }

/* ── 玻璃 ── */
.tz-glass {
    position: absolute; z-index: 20; border-radius: 18px; border: 1px solid var(--tz-line);
    background: var(--v2-glass, rgba(14, 14, 18, 0.7));
    -webkit-backdrop-filter: var(--v2-blur, blur(30px) saturate(130%)); backdrop-filter: var(--v2-blur, blur(30px) saturate(130%));
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
}
.tz-glass-strong {
    background: var(--v2-glass-strong, rgba(22, 22, 28, 0.94)); border: 1px solid var(--tz-line); border-radius: 18px;
    -webkit-backdrop-filter: var(--v2-blur, blur(30px)); backdrop-filter: var(--v2-blur, blur(30px)); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
}
.tz-h { margin: 0 0 8px; font-size: 0.8rem; font-weight: 600; color: var(--color-text-secondary); letter-spacing: 0.02em; }

/* ── 上排 ── */
.tz-top {
    top: var(--imm-t); left: var(--imm-l); right: var(--imm-r); height: var(--tz-top-h);
    display: flex; align-items: center; gap: 8px; padding: 0 8px; z-index: 30;
}
.tz-views { display: contents; }
.tz-seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--tz-btn); flex: none; }
.tz-seg button {
    min-height: 34px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--color-text-secondary);
    font: inherit; font-size: 0.86rem; cursor: pointer; transition: background 0.15s, color 0.15s;
}
.tz-seg button:hover { color: var(--color-text); background: var(--tz-btn-h); }
.tz-seg button[aria-pressed="true"] { background: var(--color-accent); color: var(--color-accent-text); font-weight: 600; }
.tz-search { position: relative; flex: 1 1 260px; min-width: 0; display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 4px 0 12px;
    border-radius: 10px; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--tz-line-soft); }
.tz-search:focus-within { border-color: var(--color-accent); }
.tz-search > .ti { color: var(--color-text-muted); }
.tz-search input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; color: var(--color-text); font: inherit; font-size: 0.92rem; outline: none; }
.tz-search input::placeholder { color: var(--color-text-faint); }
.tz-search-go { min-height: 30px; padding: 0 12px; border: 0; border-radius: 8px; background: var(--tz-btn); color: var(--color-text); font: inherit; font-size: 0.84rem; cursor: pointer; }
.tz-search-go:hover { background: var(--tz-btn-h); }
.tz-qmsg { position: absolute; top: calc(100% + 6px); left: 0; right: 0; margin: 0; padding: 8px 12px; border-radius: 10px; font-size: 0.84rem;
    background: var(--v2-glass-strong, rgba(22, 22, 28, 0.94)); border: 1px solid var(--tz-line); }
.tz-pill {
    display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px; border-radius: 10px; flex: none; max-width: 240px;
    border: 1px solid var(--tz-line-soft); background: rgba(255, 255, 255, 0.06); color: var(--color-text); font: inherit; cursor: pointer; text-align: left;
}
.tz-pill:hover { background: var(--tz-btn-h); }
.tz-pill > .ti { color: var(--color-text-muted); flex: none; }
.tz-pill-t { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.tz-pill-t b { font-size: 0.86rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tz-pill-t small { font-size: 0.7rem; color: var(--color-text-muted); white-space: nowrap; }
.tz-date { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 4px 0 10px; border-radius: 10px; flex: none;
    border: 1px solid var(--tz-line-soft); background: rgba(255, 255, 255, 0.06); }
.tz-date > .ti { color: var(--color-text-muted); }
.tz-date input { border: 0; background: transparent; color: var(--color-text); font: inherit; font-size: 0.86rem; color-scheme: dark; min-height: 30px; }
.tz-link { min-height: 30px; padding: 0 10px; border: 0; border-radius: 8px; background: var(--tz-btn); color: var(--color-text); font: inherit; font-size: 0.82rem; cursor: pointer; }
.tz-link:hover { background: var(--tz-btn-h); }

/* 下拉清單（目標、型號） */
.tz-list {
    position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; right: 0; max-height: 320px; overflow: auto; margin: 0; padding: 4px; list-style: none;
    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);
}
.tz-list[hidden] { display: none; }
.tz-list li { display: flex; flex-direction: column; gap: 1px; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.tz-list li b { font-size: 0.9rem; font-weight: 600; }
.tz-list li small { font-size: 0.76rem; color: var(--color-text-muted); }
.tz-list li:hover, .tz-list li[aria-selected="true"] { background: var(--tz-btn-h); }
.tz-src-tag { margin-left: 8px; padding: 1px 6px; border-radius: 6px; font-style: normal; font-size: 0.66rem; font-weight: 600; letter-spacing: 0.03em;
    color: var(--color-text-secondary); border: 1px solid var(--tz-line); vertical-align: 1px; }
.tz-spin-xs { display: inline-block; width: 12px; height: 12px; border-width: 1.5px; margin-right: 8px; vertical-align: -2px; }
.tz-list li.tz-none { flex-direction: row; align-items: center; }
.tz-list li.tz-none { cursor: default; color: var(--color-text-muted); font-size: 0.86rem; }
.tz-list li.tz-none:hover { background: none; }

/* ── 左欄：器材 ── */
.tz-left, .tz-right { top: var(--g-t); max-height: var(--g-max); display: flex; flex-direction: column; overflow: hidden; }
.tz-left { left: var(--imm-l); width: var(--tz-left-w); padding: 8px 8px 10px 12px; }
.tz-right { right: var(--imm-r); width: var(--tz-right-w); padding: 12px 12px 12px 14px; }
.tz-body { display: flex; flex-direction: column; gap: 10px; min-height: 0; flex: 0 1 auto; }
.tz-left .tz-body { margin-top: 8px; }
.tz-right .tz-body { gap: 16px; overflow-y: auto; scrollbar-width: thin; margin-right: -6px; padding-right: 6px; }
.is-folded .tz-body { display: none; }
.tz-left.is-folded { padding-bottom: 8px; }
.tz-mini-sw { display: none; gap: 4px; align-items: center; margin-left: auto; }
.tz-mini-sw svg { width: 18px; height: 10px; }
.tz-left.is-folded .tz-mini-sw { display: inline-flex; }
.tz-left.is-folded #tzAddRig { display: none; }
.tz-sec-h .tz-fold { width: 32px; height: 32px; }
/* 右欄：展開時收合鈕浮在右上，摘要只在收起時出現 */
.tz-right:not(.is-folded) > .tz-sec-h { position: absolute; top: 6px; right: 6px; z-index: 2; }
.tz-right:not(.is-folded) .tz-sum { display: none; }
.tz-right.is-folded { padding: 6px 6px 6px 12px; width: auto; max-width: var(--tz-right-w); }
.tz-sum { display: inline-flex; align-items: center; gap: 8px; font-size: 0.84rem; color: var(--color-text-secondary); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tz-sum b { color: var(--color-text); font-weight: 600; }
.tz-sum-moon { display: inline-flex; align-items: center; gap: 4px; }
.tz-moon-xs { width: 16px !important; height: 16px !important; }
.tz-sec-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tz-sec-h h2 { margin: 0; font-size: 0.95rem; font-weight: 600; }
.tz-sec-h h2 small { font-weight: 400; font-size: 0.76rem; }
.tz-rigs { flex: 0 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; scrollbar-width: thin; margin: 0 -4px; padding: 0 4px; }
.tz-empty { padding: 16px 12px; border-radius: 14px; border: 1px dashed var(--tz-line); text-align: center; }
.tz-empty p { margin: 0 0 12px; font-size: 0.86rem; color: var(--color-text-secondary); line-height: 1.55; }
.tz-rig { border-radius: 14px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--tz-line-soft); transition: border-color 0.15s; }
.tz-rig.is-open { border-color: var(--tz-line); background: rgba(255, 255, 255, 0.06); }
.tz-rig.is-off .tz-rig-txt { opacity: 0.5; }
.tz-rig-h { display: flex; align-items: center; gap: 2px; padding: 4px; }
.tz-rig-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; }
.tz-rig-main:hover { background: var(--tz-btn); }
.tz-sw { width: 28px; height: 10px; flex: none; }
.tz-rig-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.tz-rig-txt b { font-size: 0.88rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tz-rig-txt small { font-size: 0.74rem; color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.tz-chev { color: var(--color-text-muted); transition: transform 0.2s; }
.tz-rig.is-open .tz-chev { transform: rotate(180deg); }
.tz-ib { flex: none; width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 10px;
    background: transparent; color: var(--color-text-secondary); cursor: pointer; font-size: 1.05rem; }
.tz-ib:hover { background: var(--tz-btn-h); color: var(--color-text); }
.tz-rig-p { padding: 0 12px 12px; }
.tz-rig-p[hidden] { display: none; }
.tz-frame { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--tz-line-soft); display: flex; flex-direction: column; gap: 8px; }
.tz-frame-h { font-size: 0.76rem; font-weight: 600; color: var(--color-text-secondary); }
.tz-mos { display: flex; gap: 12px; flex-wrap: wrap; }
.tz-mos label { display: inline-flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--color-text-secondary); }
.tz-mos-in { display: inline-flex; align-items: center; gap: 4px; color: var(--color-text-muted); }
.tz-in.tz-in-sm { width: 52px; min-height: 32px; padding: 0 6px; text-align: center; font-size: 0.84rem; }
.tz-rot { display: grid; grid-template-columns: auto 1fr 3.2em; align-items: center; gap: 10px; font-size: 0.8rem; color: var(--color-text-secondary); }
.tz-rot output { text-align: right; font-variant-numeric: tabular-nums; color: var(--color-text); }
.tz-see { display: grid; grid-template-columns: auto 1fr 3em; align-items: center; gap: 10px; padding: 8px 4px 0; border-top: 1px solid var(--tz-line-soft); font-size: 0.82rem; color: var(--color-text-secondary); }
.tz-see output { text-align: right; color: var(--color-text); font-variant-numeric: tabular-nums; }
.tz input[type="range"], .tz-dlg input[type="range"] { accent-color: var(--color-accent); width: 100%; min-height: 24px; }
.tz-gearbox { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 10px; border-radius: 10px; color: var(--color-text-secondary);
    text-decoration: none; font-size: 0.84rem; background: var(--tz-btn); }
.tz-gearbox:hover { color: var(--color-text); background: var(--tz-btn-h); }
.tz-gearbox .ti-arrow-right { margin-left: auto; }

/* 參數表（器材、目標、月亮共用） */
.tz-params { margin: 0; display: flex; flex-direction: column; }
.tz-pr { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--tz-line-soft); font-size: 0.82rem; }
.tz-pr:last-child { border-bottom: 0; }
.tz-pr dt { color: var(--color-text-secondary); display: inline-flex; align-items: center; gap: 4px; flex: none; }
.tz-pr dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.tz-pr dd small { color: var(--color-text-muted); font-size: 0.72rem; }
.tz-q { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; font-size: 0.64rem;
    border: 1px solid var(--tz-line); color: var(--color-text-muted); cursor: help; position: relative; }
.tz-q:hover::after, .tz-q:focus::after {
    content: attr(data-tip); position: absolute; left: 0; top: calc(100% + 6px); z-index: 50; width: max-content; max-width: 220px; padding: 8px 10px;
    border-radius: 10px; background: var(--v2-glass-strong, #16161c); border: 1px solid var(--tz-line); color: var(--color-text); font-size: 0.76rem; line-height: 1.45; white-space: normal;
}
.tz-badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.7rem; border: 1px solid var(--tz-line); color: var(--color-text-secondary); }
.tz-badge.is-ok { color: var(--tz-good); border-color: rgba(74, 222, 128, 0.4); }
.tz-badge.is-under, .tz-badge.is-over { color: var(--tz-warn); border-color: rgba(251, 191, 36, 0.4); }

/* ── 右欄：目標、月亮 ── */
.tz-tgt-h { display: flex; flex-direction: column; margin-bottom: 6px; }
.tz-tgt-h b { font-size: 1.05rem; font-weight: 600; }
.tz-tgt-h small { color: var(--color-text-muted); font-size: 0.76rem; }
.tz-good { color: var(--tz-good); }
.tz-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tz-chip { min-height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--tz-line); background: var(--tz-btn); color: var(--color-text); font: inherit; font-size: 0.82rem; cursor: pointer; }
.tz-chip:hover { background: var(--tz-btn-h); border-color: var(--color-accent); }
#tzTgt > .tz-mut { margin: 0; font-size: 0.84rem; line-height: 1.55; }
.tz-moon-h { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.tz-moon-ic { width: 44px; height: 44px; flex: none; }
.tz-moon-h b { display: block; font-size: 0.98rem; font-weight: 600; }
.tz-moon-h small { color: var(--color-text-muted); font-size: 0.78rem; }
.tz-impact { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0 0; padding: 8px 10px; border-radius: 10px; font-size: 0.8rem; line-height: 1.45; background: rgba(255, 255, 255, 0.05); }
.tz-impact .ti { font-size: 1rem; flex: none; margin-top: 1px; }
.tz-impact.is-ok .ti { color: var(--tz-good); }
.tz-impact.is-warn .ti { color: var(--tz-warn); }
.tz-impact.is-bad .ti { color: var(--tz-bad); }

/* ── 下排：整晚高度圖 ── */
.tz.fold-tzBottom { --tz-plot-h: 46px; }
.tz.fold-tzLeft { --g-l: var(--imm-l); }
.tz.fold-tzRight { --g-r: var(--imm-r); }
.tz-bottom.is-folded .tz-plot-box, .tz-bottom.is-folded .tz-legend { display: none; }
.tz-bottom .tz-fold { width: 30px; height: 30px; margin: -4px -6px -4px 0; }
.tz-bottom.is-folded .tz-legend + .tz-fold, .tz-bottom .tz-legend + .tz-fold { flex: none; }
.tz-bottom.is-folded .tz-plot-h .tz-fold { margin-left: auto; }
.tz-bottom { left: var(--imm-l); right: var(--imm-r); bottom: var(--imm-b); height: var(--tz-plot-h); padding: 8px 14px 6px; display: flex; flex-direction: column; gap: 4px; }
.tz-plot-h { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; min-height: 24px; }
.tz-plot-h .tz-h { margin: 0; }
.tz-plot-read { display: flex; gap: 12px; font-size: 0.8rem; color: var(--color-text-secondary); font-variant-numeric: tabular-nums; flex-wrap: wrap; }
.tz-plot-read b { color: var(--color-text); font-weight: 600; }
.tz-legend { display: flex; gap: 12px; margin: 0 0 0 auto; padding: 0; list-style: none; font-size: 0.74rem; color: var(--color-text-muted); }
.tz-legend li { display: inline-flex; align-items: center; gap: 6px; }
.tz-legend i { display: inline-block; width: 18px; height: 0; }
.tz-lg-tgt { border-top: 2.5px solid var(--color-text); }
.tz-lg-moon { border-top: 2px dashed rgba(220, 220, 235, 0.75); }
.tz-lg-good { height: 4px !important; background: var(--tz-good); border-radius: 2px; }
.tz-lg-now { width: 8px !important; height: 8px !important; border-radius: 50%; background: var(--color-accent); }
.tz-plot-box { position: relative; flex: 1; min-height: 0; }
.tz-plot-box canvas { position: absolute; inset: 0; display: block; cursor: ew-resize; touch-action: pan-y; border-radius: 10px; }
.tz-plot-box canvas:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* ── 小視窗、按鈕、表單 ── */
.tz-pop { position: fixed; z-index: 1500; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.tz-pop[hidden] { display: none; }
.tz-lab { display: block; font-size: 0.76rem; color: var(--color-text-secondary); margin-bottom: 4px; }
.tz-in {
    width: 100%; min-height: 40px; padding: 0 10px; 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.9rem; color-scheme: dark;
}
.tz-in:focus { outline: none; border-color: var(--color-accent); box-shadow: 0 0 0 3px var(--color-accent-soft); }
select.tz-in option, select.tz-in optgroup { background: #16161c; color: var(--color-text); }
.tz-custom { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--tz-line-soft); }
.tz-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tz-err { margin: 0; font-size: 0.8rem; color: var(--color-danger, #f87171); }
.tz-err[hidden] { display: none; }
.tz-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 10px;
    border: 1px solid var(--tz-line); background: var(--tz-btn); color: var(--color-text); font: inherit; font-size: 0.86rem; cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}
.tz-btn:hover { background: var(--tz-btn-h); }
.tz-btn:active { transform: scale(0.98); }
.tz-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.tz-btn-sm { min-height: 34px; padding: 0 12px; font-size: 0.82rem; }
.tz-btn-pri { background: var(--color-accent); color: var(--color-accent-text); border-color: transparent; font-weight: 600; }
.tz-btn-pri:hover { background: var(--color-accent-hover); }
.tz-btn-ghost { background: transparent; }
.tz-btn-danger { color: var(--color-danger, #f87171); background: transparent; border-color: rgba(248, 113, 113, 0.35); }
.tz-btn-danger[hidden] { display: none; }
.tz :focus-visible, .tz-dlg :focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* ── 新增／編輯器材（置中） ── */
.tz-dlg {
    position: fixed; inset: 0; margin: auto; height: fit-content;
    width: min(560px, calc(100vw - 24px)); max-height: min(88dvh, 760px); padding: 0; border-radius: 18px; border: 1px solid var(--tz-line, rgba(255, 255, 255, 0.14));
    background: var(--v2-glass-strong, rgba(22, 22, 28, 0.96)); color: var(--color-text); font-family: var(--font-primary);
    -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);
    --tz-line: var(--color-border); --tz-line-soft: var(--color-border-subtle); --tz-btn: rgba(255, 255, 255, 0.07); --tz-btn-h: rgba(255, 255, 255, 0.13);
}
.tz-dlg::backdrop { background: rgba(0, 0, 0, 0.55); }
.tz-dlg[open] { display: flex; }
.tz-dlg form { display: flex; flex-direction: column; width: 100%; min-height: 0; }
.tz-dlg-h { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 6px 18px; }
.tz-dlg-h h2 { margin: 0; font-size: 1.05rem; font-weight: 600; }
.tz-tabs { display: flex; gap: 4px; margin: 4px 18px 0; padding: 3px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); }
.tz-tabs button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; border: 0; border-radius: 8px;
    background: transparent; color: var(--color-text-secondary); font: inherit; font-size: 0.84rem; cursor: pointer; }
.tz-tabs button:hover { color: var(--color-text); }
.tz-tabs button[aria-selected="true"] { background: var(--tz-btn-h); color: var(--color-text); font-weight: 600; }
.tz-dlg-b { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 18px; display: flex; flex-direction: column; gap: 14px; }
.tz-pane { display: flex; flex-direction: column; gap: 10px; }
.tz-pane[hidden] { display: none; }
.tz-combo { position: relative; }
.tz-mines { display: flex; flex-direction: column; gap: 6px; }
.tz-mines .tz-mut { margin: 0; font-size: 0.84rem; line-height: 1.55; }
.tz-mines a { color: var(--color-accent); }
.tz-mine { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 12px; border-radius: 12px; border: 1px solid var(--tz-line-soft);
    background: rgba(255, 255, 255, 0.04); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.tz-mine:hover { background: var(--tz-btn-h); }
.tz-mine:disabled { opacity: 0.5; cursor: not-allowed; }
.tz-mine .ti { font-size: 1.1rem; color: var(--color-text-secondary); }
.tz-mine span { display: flex; flex-direction: column; min-width: 0; }
.tz-mine b { font-size: 0.88rem; font-weight: 600; }
.tz-mine small { font-size: 0.74rem; color: var(--color-text-muted); }
.tz-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; padding-top: 12px; border-top: 1px solid var(--tz-line-soft); }
.tz-f { display: block; min-width: 0; }
.tz-f-full { grid-column: 1 / -1; }
.tz-colors, .tz-dashes { display: flex; gap: 8px; flex-wrap: wrap; }
.tz-color { width: 36px; height: 36px; border-radius: 50%; border: 2px solid transparent; background: var(--c); cursor: pointer; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.35); }
.tz-color[aria-checked="true"] { border-color: #fff; }
.tz-dash { width: 64px; height: 36px; border-radius: 10px; border: 1px solid var(--tz-line); background: rgba(255, 255, 255, 0.04); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.tz-dash svg { width: 44px; height: 10px; }
.tz-dash[aria-checked="true"] { border-color: var(--color-accent); background: var(--color-accent-soft); }
.tz-prev { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-height: 44px; padding: 8px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); font-size: 0.86rem; font-variant-numeric: tabular-nums; }
.tz-prev svg { width: 36px; height: 10px; }
.tz-prev span { color: var(--color-text-secondary); }
.tz-dlg-f { display: flex; align-items: center; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--tz-line-soft); }
.tz-grow { flex: 1; }

/* ── 中寬（861–1180）：右欄收窄、上排緊一點 ── */
@media (max-width: 1180px) and (min-width: 861px) {
    .tz { --tz-left-w: 280px; --tz-right-w: 240px; }
    .tz-pill { max-width: 170px; }
    .tz-pill-t small, .tz-legend { display: none; }
}

/* ── 手機（≤ 860）：上下捲動 ── */
@media (max-width: 860px) {
    .tz {
        --g-t: 0px; --g-l: 0px; --g-r: 0px; --g-b: 0px;
        display: flex; flex-direction: column; gap: 10px; overflow-y: auto; -webkit-overflow-scrolling: touch;
        padding: var(--imm-t) var(--imm-r) calc(var(--imm-b) + 12px) var(--imm-l);
    }
    .tz > * { flex-shrink: 0; }
    .tz-glass, .tz-sky, .tz-base { position: relative; inset: auto; top: auto; left: auto; right: auto; bottom: auto; width: auto; height: auto; }
    .tz-top { order: 1; flex-wrap: wrap; height: auto; padding: 8px; gap: 8px; }
    .tz-views { display: none; }
    .tz-search { order: 3; flex-basis: 100%; }
    .tz-pill { flex: 1; max-width: none; }
    .tz-date { flex: 1; }
    .tz-date input { flex: 1; min-width: 0; }
    .tz-sky { order: 2; flex: none; height: 56dvh; min-height: 300px; border-radius: 18px; border: 1px solid var(--tz-line); }
    .tz-sky .tz-base { position: absolute; left: 8px; right: auto; bottom: 8px; max-width: calc(100% - 16px); }
    .tz-base-k { display: none; }
    .tz-base-btn b { max-width: 110px; }
    .tz-bottom { order: 3; height: 190px; }
    .tz-bottom.is-folded { height: 46px; }
    .tz-left, .tz-right { max-height: none; }
    .tz-right.is-folded { width: auto; max-width: none; }
    .tz-legend { margin-left: 0; }
    .tz-left { order: 4; padding: 12px; }
    .tz-rigs { overflow: visible; }
    .tz-right { order: 5; overflow: visible; }
    .tz .sky-hud { inset: 0; }
    .tz .sky-wx { display: none; }
    .tz-fields { grid-template-columns: 1fr 1fr; }
    .tz-dlg { max-height: 92dvh; }
}
@media (max-width: 400px) {
    .tz-seg button { padding: 0 10px; }
    .tz-tabs button span { font-size: 0.78rem; }
}
