/* 歲悅動態島 — 介面樣式（布偶風）
   Layout: plush archipelago in the middle; felt panels stitched to the left (latest by unit) and right (live feedback). */
:root {
  --bg: #fbf3e8;
  --paper: #fffaf3;
  --panel: rgb(255 250 243 / 0.96);
  --ink: #5a3d2b;
  --muted: #8a6d58;
  --line: #ead9c3;
  --soft: #f4e9da;
  --stitch: #d9bf9f;
  --accent: #ee9a4d;
  --accent-strong: #a8581a;
  --on-accent: #3b2414;
  --blush: #f2c6c2;
  --sage: #b9c8a7;
  --sky: #bcd9e6;
  --butter: #f6dc9a;
  --line-green: #06c755;
  --ok: #5f9a4c;
  --warn: #b98010;
  --bad: #cf5039;
  --shadow: 0 14px 34px rgb(150 105 70 / 0.18);
  --puff: inset 0 2px 0 rgb(255 255 255 / 0.7), inset 0 -3px 0 rgb(150 105 70 / 0.1);
  --radius: 22px;
  --font: "Huninn", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --news-w: 300px;
  --feed-w: 330px;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #241b16; --paper: #2f241d; --panel: rgb(47 36 29 / 0.95); --ink: #f6e7d6; --muted: #cdb39b; --line: #4e3c2f; --soft: #3a2d24;
    --stitch: #6b5442; --accent: #f2a462; --accent-strong: #f6b77f; --on-accent: #3b2414; --ok: #8fc07a; --warn: #e6b452; --bad: #f08670;
    --shadow: 0 14px 34px rgb(0 0 0 / 0.45); --puff: inset 0 2px 0 rgb(255 255 255 / 0.08), inset 0 -3px 0 rgb(0 0 0 / 0.2); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #241b16; --paper: #2f241d; --panel: rgb(47 36 29 / 0.95); --ink: #f6e7d6; --muted: #cdb39b; --line: #4e3c2f; --soft: #3a2d24;
  --stitch: #6b5442; --accent: #f2a462; --accent-strong: #f6b77f; --on-accent: #3b2414; --ok: #8fc07a; --warn: #e6b452; --bad: #f08670;
  --shadow: 0 14px 34px rgb(0 0 0 / 0.45); --puff: inset 0 2px 0 rgb(255 255 255 / 0.08), inset 0 -3px 0 rgb(0 0 0 / 0.2); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; overflow: hidden; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { text-wrap: balance; margin: 0; font-weight: 400; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.eyebrow { font-size: 12px; letter-spacing: 0.1em; color: var(--accent-strong); margin: 0; }
.stars { color: #e3a33a; letter-spacing: 1px; font-size: 12px; }
.stars em { color: var(--line); font-style: normal; }

#app { position: relative; height: 100%; overflow: hidden; }
#stage { position: absolute; inset: 0; }
#stage canvas { display: block; width: 100% !important; height: 100% !important; touch-action: none; }

/* ── 布標名牌 ── */
.labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 4; }
.tag {
  position: absolute; left: 0; top: 0; pointer-events: auto; white-space: nowrap; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 7px;
  background: var(--panel); color: var(--ink); border: 1.5px solid var(--line); border-radius: 999px;
  font-size: 12.5px; line-height: 1.3; box-shadow: 0 4px 10px rgb(150 105 70 / 0.16);
  outline: 1px dashed var(--stitch); outline-offset: -4px; transition: opacity .2s, border-color .2s;
}
.tag i { width: 8px; height: 8px; border-radius: 50%; background: var(--zone, #ccc); flex: none; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.1); }
.tag[data-health="ok"] i { background: #8fc07a; }
.tag[data-health="warn"] i { background: #f2c14e; }
.tag[data-health="bad"] i { background: #e36d5f; box-shadow: 0 0 0 3px rgb(227 109 95 / 0.28); }
.tag b { font-size: 10.5px; line-height: 1; background: var(--bad); color: #fff; border-radius: 999px; padding: 3px 6px; font-weight: 400; }
.tag.prep { border-style: dashed; color: var(--muted); }
.tag.on { border-color: var(--accent); box-shadow: 0 0 0 3px rgb(238 154 77 / 0.3), 0 4px 10px rgb(150 105 70 / 0.18); }
.labels.off .tag:not(.on):not(.hot) { display: none; }
.labels.far .tag[data-zone="back"]:not(.on):not(.hot) span, .labels.far .tag[data-zone="gov"]:not(.on):not(.hot) span, .labels.far .tag[data-zone="partner"]:not(.on):not(.hot) span { display: none; }
.labels.far .tag[data-zone="back"]:not(.on):not(.hot), .labels.far .tag[data-zone="gov"]:not(.on):not(.hot), .labels.far .tag[data-zone="partner"]:not(.on):not(.hot) { padding: 3px; gap: 0; }

/* ── 品牌與工具列 ── */
.brand {
  position: absolute; top: 12px; left: var(--gutter-l); display: flex; align-items: center; gap: 10px; z-index: 20;
  padding: 6px 14px 6px 8px; background: var(--panel); border: 1.5px solid var(--line); border-radius: 999px; box-shadow: var(--shadow), var(--puff);
  outline: 1.5px dashed var(--stitch); outline-offset: -6px;
}
.brand img { width: 34px; height: auto; }
.brand h1 { font-size: 18px; letter-spacing: 0.04em; line-height: 1.1; }
.brand p { margin: 0; font-size: 11.5px; color: var(--muted); }
.conn { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; padding: 3px 9px; border-radius: 999px; background: var(--soft); color: var(--muted); margin-left: 4px; }
.conn i { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.conn[data-kind="supabase"] i { background: var(--line-green); animation: blink 1.6s infinite; }

.toolbar { position: absolute; top: 12px; right: var(--gutter-r); display: flex; gap: 6px; z-index: 20; flex-wrap: wrap; justify-content: flex-end; }
.toolbar button:not(.jc-theme-switch) {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: 999px;
  background: var(--panel); border: 1.5px solid var(--line); box-shadow: var(--shadow), var(--puff); font-size: 14px;
}
.toolbar button:not(.jc-theme-switch):hover { border-color: var(--accent); transform: translateY(-1px); }
.toolbar button[aria-expanded="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.toolbar svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#btn-tour svg { fill: currentColor; stroke: none; }
.toolbar .icon { width: 40px; justify-content: center; padding: 0; }
.toolbar .jc-theme-switch { align-self: center; margin: 0 2px; }
.badge { font-size: 10.5px; line-height: 1; background: var(--bad); color: #fff; border-radius: 999px; padding: 3px 6px; }

/* ── 開場文字（左欄收起時才出現）── */
.hero { position: absolute; top: 80px; left: var(--gutter-l); width: min(340px, calc(100% - 32px)); z-index: 5; pointer-events: none; }
.hero-num { display: flex; align-items: baseline; gap: 6px; color: var(--accent-strong); }
.hero-num b { font-size: 50px; line-height: 1; font-weight: 400; }
.hero h2 { font-size: 25px; line-height: 1.3; margin-top: 6px; text-shadow: 0 1px 0 var(--bg), 0 0 16px var(--bg); }
.hero p { margin: 8px 0 0; font-size: 14px; text-shadow: 0 0 12px var(--bg), 0 0 4px var(--bg); }
.zone-key { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; pointer-events: auto; }
.zone-key button { display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid var(--line); background: var(--panel); border-radius: 999px; padding: 3px 11px 3px 6px; font-size: 12.5px; box-shadow: var(--puff); }
.zone-key button:hover { border-color: var(--accent); }
.zone-key i { width: 13px; height: 13px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.1); }
body.dark-scene .hero h2, body.dark-scene .hero p, body.dark-scene .hero-num { color: #fbefe0; text-shadow: 0 1px 10px rgb(0 0 0 / 0.6); }

/* ── 毛氈面板 ── */
.panel {
  position: absolute; z-index: 15; background: var(--panel); border: 1.5px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); outline: 1.5px dashed var(--stitch); outline-offset: -8px; display: flex; flex-direction: column; min-height: 0;
}
.sheet-close { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--paper); font-size: 18px; line-height: 1; z-index: 2; box-shadow: var(--puff); }
.sheet-close:hover { border-color: var(--accent); }
.search { width: 100%; height: 38px; border: 1.5px solid var(--line); background: var(--paper); border-radius: 999px; padding: 0 14px; }

/* 左欄：各單位最新訊息 */
.news { top: 64px; left: var(--gutter-l); bottom: 16px; width: var(--news-w); }
.news-head { padding: 18px 18px 10px; min-width: 0; display: grid; gap: 8px; border-bottom: 1.5px dashed var(--stitch); margin: 0 6px; }
.news-head h2 { font-size: 21px; }
.news-list { list-style: none; margin: 0; padding: 4px 10px 14px; overflow-y: auto; flex: 1; min-height: 0; }
.news-group { font-size: 12px; color: var(--muted); letter-spacing: 0.08em; margin: 12px 6px 4px; }
.news-row { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 10px; align-items: start; width: 100%; text-align: left; border: 0; background: none; padding: 7px 8px; border-radius: 16px; position: relative; }
.news-row:hover, .news-row.on { background: var(--soft); }
.news-row.on { box-shadow: inset 0 0 0 1.5px var(--accent); }
.news-row.fresh::after { content: ""; position: absolute; left: 50px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--panel); animation: blink 1.6s infinite; }
.news-row.flash { animation: flash 2.2s ease-out; }
.nr-body { display: grid; gap: 2px; min-width: 0; }
.nr-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.nr-top b { font-weight: 400; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nr-top time { margin-left: auto; font-size: 11.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.nr-text { font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.nr-meta { display: flex; gap: 6px; align-items: center; }
.nr-src { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); }
.nr-src::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: #d6c8b6; }
.dot[data-lv="ok"] { background: #8fc07a; } .dot[data-lv="warn"] { background: #f2c14e; } .dot[data-lv="bad"] { background: #e36d5f; }

/* 布偶縮圖 */
.thumb { width: 52px; height: 52px; border-radius: 16px; background: radial-gradient(circle at 50% 42%, var(--paper) 0 30%, var(--c) 100%); display: grid; place-items: center; overflow: hidden; flex: none; box-shadow: inset 0 0 0 1.5px rgb(150 105 70 / 0.12); }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.thumb.big { width: 104px; height: 104px; border-radius: 26px; }
.thumb.card-thumb { width: 84px; height: 84px; border-radius: 22px; }

/* 右欄：即時回饋 */
.feed { top: 64px; right: var(--gutter-r); bottom: 16px; width: var(--feed-w); }
.feed-head { padding: 16px 16px 10px; display: grid; gap: 10px; border-bottom: 1.5px dashed var(--stitch); margin: 0 6px; }
.feed-head h2 { font-size: 20px; }
.eyebrow.live { display: flex; align-items: center; gap: 6px; }
.eyebrow.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--line-green); animation: blink 1.6s infinite; }
@keyframes blink { 50% { opacity: 0.3; } }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.kpis div { background: var(--soft); border-radius: 16px; padding: 7px 10px; display: grid; box-shadow: var(--puff); }
.kpis b { font-size: 21px; line-height: 1.15; font-weight: 400; font-variant-numeric: tabular-nums; }
.kpis span { font-size: 11.5px; color: var(--muted); }
#kpi-open { color: var(--bad); }
.seg { display: inline-flex; background: var(--soft); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; border-radius: 999px; padding: 4px 14px; font-size: 13px; color: var(--muted); }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgb(150 105 70 / 0.2); }
.mode { justify-self: start; }
.mode-note { margin: -2px 0 0; font-size: 12.5px; color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { display: inline-flex; align-items: center; gap: 5px; border: 1.5px solid var(--line); background: var(--paper); border-radius: 999px; padding: 2px 10px; font-size: 12.5px; }
.chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--muted)); }
.filters .chip[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.filters .chip.open-only[aria-pressed="true"] { background: var(--bad); border-color: var(--bad); color: #fff; }
.feed-list { list-style: none; margin: 0; padding: 4px 10px 8px; overflow-y: auto; flex: 1; min-height: 0; }
.fb { padding: 10px 8px; border-bottom: 1.5px dashed var(--line); display: grid; gap: 5px; border-radius: 12px; }
.fb:last-child { border-bottom: 0; }
.fb.flash, .flash { animation: flash 2.2s ease-out; }
@keyframes flash { 0% { background: rgb(238 154 77 / 0.3); } 100% { background: transparent; } }
.fb-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; }
.src { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; padding: 1px 8px; border-radius: 999px; color: #fff; }
.src[data-src="line"] { background: #06a948; }
.src[data-src="satisfaction"] { background: #c96a10; }
.src[data-src="staff"] { background: #137e97; }
.fb-unit { border: 0; background: none; padding: 0; color: var(--ink); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.fb-unit:hover { text-decoration-color: var(--accent); }
.fb time { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.fb p { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.fb p.hidden-text { color: var(--muted); font-size: 13px; }
.fb-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; }
.pill { font-size: 11.5px; border-radius: 999px; padding: 1px 9px; border: 1.5px solid currentColor; }
.pill.st-new { color: var(--bad); } .pill.st-in_progress { color: var(--warn); } .pill.st-resolved { color: var(--ok); }
.fb-admin { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12.5px; }
.fb-admin select { height: 28px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--paper); padding: 0 6px; font-size: 12.5px; max-width: 100%; }
.fb-admin label { display: inline-flex; gap: 4px; align-items: center; }
.feed-empty { padding: 24px 12px; color: var(--muted); text-align: center; list-style: none; }
.feed-foot { border-top: 1.5px dashed var(--stitch); margin: 0 6px; padding: 10px 10px 12px; display: flex; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); align-items: center; }
.feed-foot a { color: var(--accent-strong); text-decoration: none; }
.feed-foot a:hover { text-decoration: underline; }
.link { border: 0; background: none; color: var(--muted); text-decoration: underline; padding: 0; margin-left: auto; }

/* ── 詳情卡 ── */
.card { top: 64px; right: var(--gutter-r); bottom: 16px; width: var(--feed-w); z-index: 19; overflow: hidden; background: var(--paper); }
#card-body { overflow-y: auto; overflow-x: hidden; padding: 18px 18px 22px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; min-height: 0; }
.card-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; padding-right: 30px; }
.card h2 { font-size: 24px; line-height: 1.25; }
.card h3 { font-size: 13px; color: var(--muted); margin-bottom: 6px; letter-spacing: 0.04em; }
.card p { margin: 0; }
.card .desc { font-size: 14.5px; }
.card .sites { font-size: 13.5px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.card .sites b { color: var(--ink); font-weight: 400; }
.health { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.health .pill { font-size: 12.5px; padding: 2px 11px; }
.h-ok { color: var(--ok); } .h-warn { color: var(--warn); } .h-bad { color: var(--bad); } .h-none, .h-prep { color: var(--muted); }
.h-prep { border-style: dashed !important; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.chips li { background: var(--soft); border-radius: 12px; padding: 4px 10px; font-size: 13.5px; box-shadow: var(--puff); }
.links { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.links button { display: flex; width: 100%; gap: 8px; align-items: baseline; text-align: left; border: 0; background: none; padding: 6px; border-radius: 12px; font-size: 13.5px; }
.links button:hover { background: var(--soft); }
.links i { width: 10px; height: 4px; border-radius: 2px; background: var(--c); flex: none; transform: translateY(-3px); }
.links b { font-weight: 400; }
.links span { color: var(--muted); }
.updates ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.updates li { background: var(--soft); border-radius: 14px; padding: 8px 11px; display: grid; gap: 2px; box-shadow: var(--puff); }
.updates li p { font-size: 13.5px; }
.post { display: grid; gap: 6px; margin-top: 8px; }
.post label { font-size: 13px; }
.post textarea { width: 100%; border: 1.5px solid var(--line); border-radius: 14px; background: var(--paper); padding: 8px 10px; resize: vertical; min-height: 56px; }
.post .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.post .row label { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; }
.hours { position: relative; height: 18px; background: var(--soft); border-radius: 9px; overflow: hidden; }
.hours i { position: absolute; top: 0; bottom: 0; background: var(--sage); }
.hours u { position: absolute; top: -2px; bottom: -2px; width: 3px; border-radius: 2px; background: var(--accent); }
.hours-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 3px; }
.fb-stats { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.fb-stats span { background: var(--soft); border-radius: 10px; padding: 3px 10px; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.fb-stats .bad { color: var(--bad); }
.card .feed-list { padding: 0; overflow: visible; }
.card .fb { padding: 8px 0; }
.unit-status { display: grid; gap: 6px; background: var(--soft); border-radius: 14px; padding: 10px; }
.unit-status .row { display: flex; gap: 6px; flex-wrap: wrap; }
.unit-status select, .unit-status input { height: 34px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--paper); padding: 0 8px; min-width: 0; }
.unit-status input { flex: 1; }
.qr { display: flex; gap: 12px; align-items: center; background: var(--soft); border-radius: 16px; padding: 10px; }
.qr img { width: 84px; height: 84px; background: #fff; border-radius: 10px; padding: 4px; flex: none; }
.qr div { display: grid; gap: 6px; min-width: 0; }
.qr code { font-size: 11.5px; overflow-wrap: anywhere; color: var(--muted); }
/* AI 核電廠 */
.power, .pw-forms, #power-live { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); min-width: 0; }
.pill.pw-none { color: var(--muted); } .pill.pw-low, .pill.pw-normal { color: var(--ok); } .pill.pw-high { color: var(--warn); } .pill.pw-full { color: var(--bad); }
.pill.pw-warn { background: color-mix(in srgb, var(--bad) 14%, transparent); }
.reactors { display: grid; gap: 6px; }
.reactor, .pw-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.reactor { background: var(--soft); border-radius: 14px; padding: 8px 11px; box-shadow: var(--puff); }
.reactor i, .pw-head i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; }
.reactor b { font-size: 14px; flex: 1; }
.pw-sec { display: grid; gap: 8px; }
.pw-head h3 { margin: 0; }
.seats { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.seat { background: var(--soft); border-radius: 14px; padding: 9px 11px; display: grid; gap: 7px; box-shadow: var(--puff); }
.seat-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13.5px; }
.src-chip { font-size: 11px; border-radius: 999px; padding: 0 7px; background: var(--paper); border: 1px dashed var(--stitch); }
.src-chip.statusline { color: var(--ok); }
.meters { display: grid; gap: 6px; }
.meter { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; grid-template-areas: "l bar v" ". sub sub"; align-items: center; column-gap: 8px; row-gap: 1px; font-size: 12.5px; }
.meter .m-label { grid-area: l; color: var(--muted); }
.meter .m-bar { grid-area: bar; height: 12px; border-radius: 999px; background: var(--paper); border: 1.5px dashed var(--stitch); overflow: hidden; }
.meter .m-bar i { display: block; height: 100%; border-radius: 999px; background: var(--ok); transition: width 0.6s ease; }
.meter[data-lv="warn"] .m-bar i { background: var(--warn); } .meter[data-lv="bad"] .m-bar i { background: var(--bad); }
.meter b { grid-area: v; font-size: 12.5px; }
.meter .m-sub { grid-area: sub; color: var(--muted); font-size: 11.5px; }
.meter.budget { grid-template-columns: 1fr; grid-template-areas: "bar"; }
.pw-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.pw-kpi:last-child { grid-column: 1 / -1; }
.pw-kpi { background: var(--soft); border-radius: 14px; padding: 8px 9px; display: grid; gap: 1px; box-shadow: var(--puff); min-width: 0; }
.pw-kpi span { font-size: 11.5px; color: var(--muted); }
.pw-kpi b { font-size: 18px; }
.pw-kpi small { font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.pw-sub { font-size: 12px; color: var(--muted); margin: 2px 0 -4px; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 56px; padding: 4px 6px; background: var(--soft); border-radius: 12px; }
.bars span { flex: 1; min-width: 0; border-radius: 4px 4px 2px 2px; background: #b7c3d1; }
.bars span.today { background: #7d8ea3; }
.pw-form { background: var(--soft); border-radius: 14px; padding: 8px 11px; box-shadow: var(--puff); min-width: 0; overflow: hidden; }
.pw-form summary { cursor: pointer; font-weight: 700; font-size: 13.5px; padding: 2px 0; }
.pw-form[open] { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); }
.pw-form[open] > :not(summary) { margin-top: 2px; }
.pw-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.pw-field { display: grid; gap: 3px; font-size: 12px; color: var(--muted); min-width: 0; }
.pw-form select, .pw-form input { height: 34px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--paper); padding: 0 8px; min-width: 0; width: 100%; color: var(--ink); }
.pw-form .row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pw-form .row input, .pw-form .row select { flex: 1 1 120px; width: auto; }
.pw-seatlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.pw-seatlist .row b { flex: 1 1 100%; font-size: 13.5px; min-width: 0; }
.pw-seatlist li, .pw-key { min-width: 0; }
.pw-key { display: grid; gap: 6px; margin-top: 6px; }
.rep-chip { font-size: 11px; border-radius: 999px; padding: 0 8px; border: 1px dashed currentColor; white-space: nowrap; }
.rep-ok { color: var(--ok); } .rep-nodata { color: var(--warn); white-space: normal; } .rep-none { color: var(--muted); }
.pw-kit { display: grid; gap: 4px; background: var(--paper); border: 1.5px dashed var(--stitch); border-radius: 12px; padding: 8px 10px; min-width: 0; }
.pw-kit b { font-size: 13px; }
.pw-kit code { font-size: 11.5px; overflow-wrap: anywhere; background: var(--soft); border-radius: 8px; padding: 4px 7px; }
.pw-phone { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.pw-phone > div { display: grid; gap: 6px; min-width: 0; }
.pw-qr { width: 104px; height: 104px; flex: none; background: #fff; border-radius: 10px; padding: 4px; }
.pw-link { color: var(--muted); }
.btn { border: 1.5px solid var(--line); background: var(--paper); border-radius: 999px; padding: 4px 12px; font-size: 13px; justify-self: start; box-shadow: var(--puff); }
.btn:hover { border-color: var(--accent); }
.primary, .primary-btn { background: var(--accent) !important; border: 1.5px solid var(--accent) !important; color: var(--on-accent) !important; border-radius: 999px; padding: 6px 16px; box-shadow: var(--puff); }
.primary-btn[disabled] { opacity: 0.6; }

/* ── 底部控制區 ── */
.dock {
  position: absolute; bottom: 16px; left: var(--gutter-l); right: calc(var(--feed-w) + 32px); margin-inline: auto; max-width: 760px; z-index: 12;
  background: var(--panel); border: 1.5px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); outline: 1.5px dashed var(--stitch); outline-offset: -7px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "tabs toggles" "panel panel"; gap: 6px 10px; padding: 12px 16px 13px; container-type: inline-size;
}
body.feed-closed .dock { right: var(--gutter-r); }
body.news-open .dock { left: calc(var(--gutter-l) + var(--news-w) + 16px); }
.dock-tabs { grid-area: tabs; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.dock-tabs::-webkit-scrollbar { display: none; }
.dock-tabs button { border: 0; background: none; font-size: 14px; padding: 4px 12px; border-radius: 999px; color: var(--muted); white-space: nowrap; flex: none; }
.dock-tabs button[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.dock-panel { grid-area: panel; min-width: 0; }
.dock-toggles { grid-area: toggles; display: flex; gap: 2px; }
.tg { display: inline-flex; align-items: center; gap: 4px; border: 1.5px solid transparent; background: none; border-radius: 999px; padding: 3px 9px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.tg svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tg[aria-pressed="true"] { color: var(--ink); border-color: var(--line); background: var(--paper); box-shadow: var(--puff); }
@container (max-width: 700px) { .tg span { display: none; } .tg { padding: 4px 7px; } }
.day-row { display: grid; grid-template-columns: auto auto 1fr; gap: 12px; align-items: center; }
.play { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--accent); color: var(--on-accent); font-size: 13px; box-shadow: var(--puff), 0 4px 10px rgb(238 154 77 / 0.35); }
#clock { font-size: 24px; line-height: 1; font-variant-numeric: tabular-nums; min-width: 66px; }
.range-wrap { min-width: 0; }
input[type="range"] { width: 100%; accent-color: var(--accent); margin: 0; height: 22px; }
.ticks { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); padding: 0 2px; }
.day-note { margin: 6px 0 0; font-size: 13.5px; min-height: 2.6em; }
.flow-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.flow-chips .chip { padding: 4px 12px; }
.flow-chips .chip[aria-pressed="false"] { opacity: 0.45; }
.flow-chips .chip i { width: 14px; height: 4px; border-radius: 2px; }
.flow-chips .chip span { color: var(--muted); }
.flow-chips + p { margin: 6px 0 0; }
.table-wrap { overflow-x: auto; }
.stats { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.stats th, .stats td { padding: 4px 8px; text-align: right; border-bottom: 1.5px dashed var(--line); white-space: nowrap; font-weight: 400; }
.stats th:first-child, .stats td:first-child { text-align: left; }
.stats th { font-size: 12px; color: var(--muted); }
.stats td i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); margin-right: 6px; }
.stats td.bad { color: var(--bad); }
.stats tr:last-child td { border-bottom: 0; }

/* ── 導覽 ── */
.tour {
  position: absolute; left: var(--gutter-l); bottom: 160px; width: min(380px, calc(100% - 32px)); z-index: 25;
  background: var(--ink); color: var(--paper); border-radius: var(--radius); padding: 16px 18px 14px; box-shadow: var(--shadow); display: grid; gap: 6px;
  outline: 1.5px dashed rgb(255 255 255 / 0.25); outline-offset: -7px;
}
body.news-open .tour { left: calc(var(--gutter-l) + var(--news-w) + 16px); }
.tour .eyebrow { color: var(--butter); }
.tour h3 { font-size: 23px; }
.tour p { margin: 0; font-size: 14.5px; }
.tour-bar { height: 4px; background: rgb(255 255 255 / 0.15); border-radius: 2px; overflow: hidden; }
.tour-bar i { display: block; height: 100%; width: 0; background: var(--accent); }
.tour-ctrl { display: flex; gap: 6px; margin-top: 6px; }
.tour-ctrl button { height: 34px; min-width: 34px; border-radius: 999px; border: 1.5px solid rgb(255 255 255 / 0.25); background: transparent; color: inherit; padding: 0 12px; }
.tour-ctrl .primary { margin-left: auto; }

/* ── 提示、對話框、圖鑑 ── */
.toast {
  position: absolute; top: 64px; left: 50%; transform: translateX(-50%); z-index: 30; max-width: calc(100% - 32px);
  background: var(--ink); color: var(--paper); padding: 7px 16px; border-radius: 999px; font-size: 13.5px; box-shadow: var(--shadow);
  display: flex; gap: 8px; align-items: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.toast i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; }

/* 走近地點時的操作提示與對話框：在時間軸正上方置中（--dock-cx、--dock-h 由 social.js 依時間軸的位置設定） */
.act, .talk {
  position: absolute; left: var(--dock-cx, 50%); translate: -50% 0; width: max-content;
  bottom: calc(var(--dock-h, 140px) + 28px); z-index: 14;
}
.act {
  display: flex; align-items: center; gap: 9px; padding: 6px 16px 6px 7px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--ink); color: var(--paper); font: inherit; font-size: 14.5px; box-shadow: var(--shadow); animation: pop-in 0.22s ease-out;
}
.act:hover, .act:focus-visible { background: var(--accent-strong); }
.act kbd, .talk kbd {
  font: inherit; font-size: 12px; line-height: 1; padding: 5px 9px 6px; border-radius: 9px; letter-spacing: 0.04em;
  background: var(--paper); color: var(--ink); box-shadow: inset 0 -2px 0 rgb(150 105 70 / 0.28);
}
.talk {
  display: flex; gap: 14px; align-items: flex-start; max-width: min(580px, calc(100% - 32px)); padding: 14px 18px 14px 14px;
  background: var(--panel); border: 1.5px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  outline: 1.5px dashed var(--stitch); outline-offset: -7px; animation: pop-in 0.22s ease-out;
}
.talk-pic { flex: none; width: 76px; height: 76px; border-radius: 18px; background: var(--soft); object-fit: contain; }
.talk-body { min-width: 0; display: grid; gap: 6px; }
.talk h2 { margin: 0; font-size: 17px; text-wrap: balance; }
.talk p { margin: 0; font-size: 14px; line-height: 1.6; max-height: 6.4em; overflow-y: auto; }
.talk-offers { display: flex; flex-wrap: wrap; gap: 5px; margin: 0; padding: 0; list-style: none; }
.talk-offers li { font-size: 12.5px; padding: 2px 9px; border-radius: 999px; background: var(--butter); color: var(--on-accent); }
.talk-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 2px; }
.talk-btns .btn { display: inline-flex; align-items: center; gap: 6px; }
.talk-btns kbd { font-size: 11px; padding: 3px 6px 4px; }
.no3d .act, .no3d .talk { display: none !important; }
@keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(0.97); } }
@media (prefers-reduced-motion: reduce) { .act, .talk { animation: none; } }
.modal { position: absolute; inset: 0; background: rgb(60 40 25 / 0.42); z-index: 40; display: grid; place-items: center; padding: 16px var(--gutter-r) 16px var(--gutter-l); }
.modal-box { position: relative; background: var(--paper); border-radius: 26px; padding: 24px; width: min(480px, 100%); max-height: 100%; overflow: auto; display: grid; gap: 10px; box-shadow: var(--shadow); outline: 1.5px dashed var(--stitch); outline-offset: -9px; }
.modal-box img { width: 56px; height: auto; }
.modal-box h2 { font-size: 22px; }
.modal-box ol { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.modal-box p { margin: 0; }
.modal-box > .primary { justify-self: end; }
.modal-box input { height: 40px; border: 1.5px solid var(--line); border-radius: 999px; padding: 0 14px; background: var(--paper); }
.modal-box label { font-size: 14px; }
.modal-box .row { display: flex; gap: 8px; justify-content: flex-end; }
.modal-box .row button:not(.primary) { border: 1.5px solid var(--line); background: var(--paper); border-radius: 999px; padding: 6px 16px; }
.gallery-box { width: min(900px, 100%); }
.gallery-grid { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 10px; }
.gal-item { display: grid; justify-items: center; gap: 4px; width: 100%; border: 1.5px solid var(--line); background: var(--panel); border-radius: 22px; padding: 10px 6px 10px; text-align: center; box-shadow: var(--puff); }
.gal-item:hover { border-color: var(--accent); transform: translateY(-2px); }
.gal-item .thumb img { display: block; }
.gal-item .thumb.big img:not([src]) { visibility: hidden; }
.gal-item .thumb img[src] { image-rendering: auto; }
.gal-item b { font-weight: 400; font-size: 14px; line-height: 1.3; }
.gal-item span { font-size: 11.5px; color: var(--muted); }

/* ── 同事：布偶名牌與對話泡泡 ── */
.ptag {
  position: absolute; left: 0; top: 0; pointer-events: none; display: grid; justify-items: center; gap: 3px; border: 0; background: none; padding: 0;
  font-size: 11.5px; line-height: 1.25; color: var(--ink); white-space: nowrap;
}
.ptag span { pointer-events: auto; cursor: pointer; background: var(--paper); border: 1.5px solid var(--line); border-radius: 999px; padding: 1px 8px; box-shadow: 0 3px 8px rgb(150 105 70 / 0.18); }
.ptag.me span { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.ptag:hover span { border-color: var(--accent); }
.ptag q { order: -1; quotes: none; max-width: 190px; white-space: normal; text-align: left; font-size: 12.5px; background: var(--paper); border-radius: 14px; padding: 5px 10px; box-shadow: var(--shadow); position: relative; overflow-wrap: anywhere; }
.ptag q::after { content: ""; position: absolute; left: 50%; bottom: -6px; margin-left: -6px; border: 6px solid transparent; border-bottom: 0; border-top-color: var(--paper); }
.labels.off .ptag:not(.me):not(.saying) { display: none; }

/* ── 聊天（桌機在左欄，和「訊息」二選一）── */
.chat { top: 64px; left: var(--gutter-l); bottom: 16px; width: var(--news-w); z-index: 18; }
.chat-head { padding: 16px 16px 8px; display: grid; gap: 8px; border-bottom: 1.5px dashed var(--stitch); margin: 0 6px; }
.chat-me { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding-right: 26px; }
.chat-me h2 { font-size: 19px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-me p { margin: 0; }
#chat-status[data-status="unauthorized"], #chat-status[data-status="offline"] { color: var(--bad); }
.av { display: grid; place-items: center; flex: none; }
.av svg { display: block; }
.chat-tabs { justify-self: start; }
.chat-tabs button { display: inline-flex; align-items: center; gap: 4px; }
.chat-where { margin: 0; color: var(--muted); }
.dm-pick { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.dm-pick select { flex: 1; min-width: 0; height: 32px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--paper); padding: 0 8px; }
.chat-list { list-style: none; margin: 0; padding: 8px 10px; overflow-y: auto; flex: 1; min-height: 0; display: grid; align-content: start; gap: 8px; }
.chat-empty { color: var(--muted); text-align: center; padding: 22px 8px; font-size: 13.5px; }
.msg { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 8px; align-items: start; }
.msg > div { background: var(--soft); border-radius: 4px 16px 16px 16px; padding: 6px 10px; min-width: 0; justify-self: start; max-width: 100%; }
.msg.mine { grid-template-columns: minmax(0, 1fr) 30px; }
.msg.mine .av { order: 2; }
.msg.mine > div { justify-self: end; background: var(--butter); color: #3b2414; border-radius: 16px 4px 16px 16px; }
.msg .meta { display: flex; gap: 8px; align-items: baseline; margin: 0; font-size: 11.5px; color: var(--muted); }
.msg.mine .meta { color: #7a5a3f; }
.msg .meta b { font-weight: 400; font-size: 12.5px; color: inherit; }
.msg .meta time { font-variant-numeric: tabular-nums; }
.msg .text { margin: 0; font-size: 14px; overflow-wrap: anywhere; white-space: pre-wrap; }
.msg .fail { display: block; font-style: normal; font-size: 11.5px; color: var(--bad); }
.msg.sys { display: block; text-align: center; font-size: 12.5px; color: var(--muted); }
.chat-people { margin: 0 6px; border-top: 1.5px dashed var(--stitch); padding: 6px 10px; font-size: 13px; }
.chat-people summary { cursor: pointer; color: var(--muted); }
.chat-people summary b { font-weight: 400; color: var(--ink); }
#people-list { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; max-height: 170px; overflow-y: auto; }
#people-list li { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto auto; gap: 6px; align-items: center; }
#people-list li > div { display: grid; min-width: 0; line-height: 1.3; }
#people-list b { font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-form { margin: 0 6px; border-top: 1.5px dashed var(--stitch); padding: 8px 10px 10px; display: grid; gap: 6px; }
.chat-form > .row { display: flex; gap: 6px; align-items: flex-end; }
.chat-form textarea { flex: 1; min-width: 0; resize: none; border: 1.5px solid var(--line); border-radius: 18px; padding: 8px 12px; background: var(--paper); min-height: 40px; max-height: 110px; line-height: 1.4; }
.chat-form .primary { height: 40px; flex: none; }
.chat-note { margin: 0; }
.chat-warn { background: rgb(242 193 78 / 0.18); border: 1.5px solid var(--warn); border-radius: 14px; padding: 8px 10px; display: grid; gap: 6px; font-size: 13px; }
.chat-warn p { margin: 0; }
.chat-warn .row { display: flex; gap: 6px; flex-wrap: wrap; }
.btn.warn { border-color: var(--warn); color: var(--warn); }
#chat-login { justify-self: start; }
body.chat-open .dock { left: calc(var(--gutter-l) + var(--news-w) + 16px); }
body.chat-open .tour { left: calc(var(--gutter-l) + var(--news-w) + 16px); }

/* ── 捏布偶 ── */
.avatar-box { width: min(560px, 100%); gap: 8px; }
.av-top { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: center; }
.av-preview { width: 112px; height: 112px; border-radius: 30px; background: radial-gradient(circle at 50% 45%, var(--paper) 0 35%, var(--soft) 100%); display: grid; place-items: center; box-shadow: inset 0 0 0 1.5px var(--line); }
.avatar-box fieldset { border: 0; padding: 0; margin: 4px 0 0; min-width: 0; }
.avatar-box legend { font-size: 14px; padding: 0; margin-bottom: 4px; }
.av-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.av-opt { position: relative; display: inline-flex; align-items: center; gap: 4px; border: 1.5px solid var(--line); background: var(--panel); border-radius: 999px; padding: 2px 10px 2px 3px; font-size: 13px; cursor: pointer; box-shadow: var(--puff); }
.av-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.av-opt:has(input:checked) { border-color: var(--accent); background: var(--paper); box-shadow: 0 0 0 3px rgb(238 154 77 / 0.3); }
.av-opt:has(input:focus-visible) { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.av-ico { display: grid; place-items: center; width: 34px; height: 34px; }
.av-swatch { width: 22px; height: 22px; margin: 4px 2px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1.5px rgb(0 0 0 / 0.12); }

/* ── 手機捷徑列（桌機不顯示）── */
.shortcuts { display: none; }

/* ── 開不了 3D 島時的入口頁（html.no3d）── */
.portal { display: none; }
.no3d .portal { display: grid; position: absolute; inset: 64px 0 0; overflow-y: auto; place-items: start center; padding: 24px var(--gutter-r) calc(24px + var(--sc-h, 0px)) var(--gutter-l); z-index: 10; }
.no3d #stage, .no3d .labels, .no3d .hero, .no3d .dock, .no3d .panel, .no3d .tour, .no3d .toast, .no3d .modal, .no3d #conn, .no3d .toolbar > :not(#btn-lang):not(.jc-theme-switch) { display: none !important; }
.portal-box { width: min(760px, 100%); background: var(--panel); border: 1.5px solid var(--line); border-radius: 26px; padding: 24px; display: grid; gap: 12px; box-shadow: var(--shadow); outline: 1.5px dashed var(--stitch); outline-offset: -9px; }
.portal-box img { width: 56px; height: auto; }
.portal-box h2 { font-size: 24px; }
.portal-box p { margin: 0; }
.portal-grid { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.portal-grid a { display: grid; gap: 2px; height: 100%; padding: 12px 16px; border: 1.5px solid var(--line); border-radius: 18px; background: var(--paper); color: var(--ink); text-decoration: none; box-shadow: var(--puff); }
.portal-grid a:hover { border-color: var(--accent); transform: translateY(-1px); }
.portal-grid b { font-weight: 400; font-size: 17px; }
.portal-grid span { font-size: 12.5px; color: var(--muted); }
.portal-quick { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 14px; color: var(--muted); }
.portal-quick a { color: var(--accent-strong); border: 1.5px solid var(--line); border-radius: 999px; padding: 3px 12px; text-decoration: none; background: var(--paper); }

/* ── 中型螢幕：左欄改成按需開啟 ── */
@media (max-width: 1179px) {
  body.news-open .dock, body.news-open .tour, body.chat-open .dock, body.chat-open .tour { left: var(--gutter-l); }
  .news, .chat { z-index: 22; }
  .dock { right: var(--gutter-r); }
}

/* ── 手機：所有面板改成底部抽屜 ── */
@media (max-width: 760px) {
  .brand { top: 10px; padding: 5px 10px 5px 6px; }
  .brand img { width: 26px; }
  .brand h1 { font-size: 15px; }
  .brand p, #conn-text { display: none; }
  .conn { padding: 4px; margin-left: 0; }
  .toolbar { top: 10px; gap: 3px; max-width: calc(100% - 158px); flex-wrap: nowrap; }
  .toolbar button:not(.jc-theme-switch) { height: 34px; padding: 0 8px; min-width: 34px; justify-content: center; }
  .toolbar button:not(.jc-theme-switch) span:not(.badge):not(#lang-text) { display: none; }
  #btn-overview, #btn-help { display: none; }
  .hero { top: 58px; }
  .hero-num, .hero p, .zone-key { display: none; }
  .hero h2 { font-size: 17px; }
  .panel { background: var(--paper); left: 0 !important; right: 0 !important; width: auto !important; bottom: 0 !important; top: auto !important; max-height: 74%; border-radius: 24px 24px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); z-index: 30; }
  .feed, .news { height: 74%; }
  .card { height: 66%; }
  .dock { left: 8px !important; right: 8px; bottom: 8px; grid-template-columns: 1fr; grid-template-areas: "tabs" "panel" "toggles"; padding: 9px 11px; }
  .dock-toggles { justify-content: space-between; border-top: 1.5px dashed var(--line); padding-top: 6px; }
  .tg span { display: none; }
  .tg { padding: 4px 10px; }
  .day-note { font-size: 12.5px; min-height: 0; }
  #clock { font-size: 19px; min-width: 52px; }
  .tour { bottom: auto; top: 58px; left: var(--gutter-l) !important; }
  .toast { top: auto; bottom: 210px; }
  .labels .tag { font-size: 10.5px; padding: 2px 7px 2px 5px; gap: 3px; }
  .labels .tag i { width: 6px; height: 6px; }
  .labels .tag[data-zone="gov"] span, .labels .tag[data-zone="partner"] span, .labels .tag[data-zone="back"] span { display: none; }
  .labels .tag[data-zone="gov"], .labels .tag[data-zone="partner"], .labels .tag[data-zone="back"] { padding: 3px; }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .thumb.big { width: 80px; height: 80px; }
}
/* 手機：捷徑列固定在最下面，打開就能按；比對話框還上層，第一次進島也只要一次點擊 */
@media (max-width: 760px) {
  :root { --sc-h: calc(62px + env(safe-area-inset-bottom, 0px)); }
  .shortcuts {
    display: grid; grid-template-columns: repeat(4, 1fr); position: absolute; left: 0; right: 0; bottom: 0; z-index: 45; height: var(--sc-h);
    padding: 4px max(6px, env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) max(6px, env(safe-area-inset-left, 0px));
    background: var(--paper); border-top: 1.5px solid var(--line); box-shadow: 0 -6px 18px rgb(150 105 70 / 0.14);
  }
  .shortcuts a { display: grid; justify-items: center; align-content: center; gap: 2px; color: var(--ink); text-decoration: none; font-size: 12px; border-radius: 16px; min-height: 52px; }
  .shortcuts a:active { background: var(--soft); }
  .shortcuts svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  #sc-clock { background: var(--accent); color: var(--on-accent); margin: 2px 3px; }
  .dock { bottom: calc(var(--sc-h) + 8px); }
  .panel { bottom: var(--sc-h) !important; padding-bottom: 0; max-height: calc(100% - var(--sc-h) - 40px); }
  .feed, .news, .chat { height: 70%; }
  .modal { bottom: var(--sc-h); }
  .toast { bottom: calc(var(--sc-h) + 210px); }
  .act, .talk { left: 50%; bottom: calc(var(--sc-h) + var(--dock-h, 120px) + 18px); }
  .talk { width: calc(100% - var(--gutter-l) - var(--gutter-r)); }
  .act kbd, .talk kbd { display: none; }
  .talk-pic { width: 56px; height: 56px; }
  .chat-me h2 { font-size: 16px; }
  .ptag { font-size: 10.5px; }
  .ptag q { max-width: 150px; font-size: 12px; }
  .av-preview { width: 84px; height: 84px; border-radius: 24px; }
  .av-preview svg { width: 84px; height: 84px; }
  .avatar-box { padding: 18px; }
  .no3d .portal { inset: 56px 0 0; }
  .portal-quick { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ══ Jellycat 樣板（css/jellycat.css）：模組視窗、鎖住的房子、島上介面對齊 ══ */
/* 模組視窗：桌機上下 36px、左右 56px 留邊，手機全螢幕不留圓角 */
.mod { position: absolute; inset: 0; z-index: 60; }
.mod-scrim { position: absolute; inset: 0; }
.mod-win { position: absolute; inset: 36px 56px; }
.jc-window__title { font-family: var(--jc-font); color: var(--jc-ink); }
.mod-badge { width: 36px; height: 36px; }
.mod-badge svg { width: 19px; height: 19px; }
.mod-frame { display: block; width: 100%; height: 100%; border: 0; background: var(--jc-bg); }
.no3d .mod { display: none !important; }

/* 有系統的房子：名牌的小圓點用模組代表色；沒開通的變灰、前面一個小鎖 */
.tag[style*="--mod"] i { background: var(--mod); }
.tag.backstage i { background: var(--jc-m-logging); }
.tag.locked { filter: grayscale(0.7); opacity: 0.82; }
.tag .lock { display: inline-grid; place-items: center; font-style: normal; color: var(--jc-muted); }
.tag .lock svg { width: 13px; height: 13px; }

/* 對話框、捏布偶、入口頁：Jellycat 的縫線布面板、按鈕與標籤 */
.talk { background: var(--jc-paper); border-color: var(--jc-line); outline-color: var(--jc-stitch); border-radius: var(--jc-radius); }
.talk-offers { display: flex; flex-wrap: wrap; gap: 6px; }
.talk-offers .jc-chip { --c: var(--jc-soft); }
.talk-btns { flex-wrap: wrap; }
.talk-btns .jc-btn { min-height: 40px; padding: 0 16px; }
#talk-open.is-locked { filter: grayscale(0.6); }
.modal.jc-scrim { background: var(--jc-scrim); }
.avatar-box.jc-felt { border-radius: var(--jc-radius-l); outline-offset: -9px; }
.avatar-box .jc-input { border-radius: 999px; }
.portal-grid a { grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; align-items: center; }
.portal-grid a .jc-dot { grid-row: span 2; width: 12px; height: 12px; }
.portal-quick .jc-btn { min-height: 40px; }

@media (max-width: 760px) {
  .mod-win { inset: 0; border: 0; border-radius: 0; }
  .shortcuts { background: var(--jc-paper); border-top: 1.5px dashed var(--jc-stitch); }
  .shortcuts a { color: var(--jc-ink); }
}

/* ══ 窗口：表單、我的申請、待我簽核、通知、主管看板（js/desk.js） ══ */
.desk-win { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(760px, calc(100% - 32px)); height: min(680px, calc(100% - 48px)); }
.desk-tabs { margin: 12px 16px 0; align-self: flex-start; max-width: calc(100% - 32px); flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.desk-tabs button { display: inline-flex; align-items: center; gap: 6px; flex: none; white-space: nowrap; }
.desk-body { padding: 16px; }
.desk-forms { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.desk-form-btn { display: grid; justify-items: center; gap: 10px; width: 100%; padding: 20px 10px; border: 0; border-radius: var(--jc-radius); background: var(--jc-paper); color: var(--jc-ink); font: inherit; font-size: 16px; cursor: pointer; }
.desk-form-btn:hover { background: var(--jc-soft); }
.desk-form-ic { width: 46px; height: 46px; background: var(--c); }
.desk-form-ic svg { width: 24px; height: 24px; }
.desk-form-title { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 18px; }
.desk-form-title .jc-dot, .desk-list .jc-dot { background: var(--c); }
.desk-form-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.desk-msg { flex: 1; min-width: 160px; margin: 0; color: var(--jc-bad); font-size: 14px; }
.desk-list .jc-row { cursor: default; }
.desk-list b { overflow-wrap: anywhere; font-weight: 600; }
.desk-note { font: inherit; color: inherit; cursor: pointer; }
.desk-note:not(.is-unread) b { font-weight: 400; color: var(--jc-muted); }
.desk-acts { display: flex; gap: 8px; flex: none; }
.desk-board { display: grid; gap: 12px; }
.desk-board-mods { justify-self: start; flex-wrap: wrap; }
.desk-table th[scope="row"] { white-space: nowrap; font-weight: 600; }
.desk-table td { font-variant-numeric: tabular-nums; white-space: nowrap; }
.talk-forms { display: contents; }
.no3d .desk { display: none !important; }
@media (max-width: 760px) {
  .desk-win { left: 0; top: 0; transform: none; width: 100%; height: 100%; border: 0; border-radius: 0; }
  .desk-approve { flex-wrap: wrap; }
  .desk-acts { width: 100%; justify-content: flex-end; }
}
.desk-stack { display: grid; gap: 12px; }
.desk-step { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.desk-why { white-space: normal; }
.desk-note-aal { margin: 0; }

/* ── 圖書館（js/library-ui.js）：和窗口同一個 jc-window ── */
.no3d .lib { display: none !important; }
.lib-badge-ic { --c: #c9bce6; }
.lib-stack { display: grid; gap: 14px; align-content: start; }
.lib-ask { display: flex; gap: 8px; }
.lib-ask .lib-q { flex: 1; min-width: 0; }
.lib-msg { margin: 0; font-size: 14px; }
.lib-msg.is-bad { color: var(--jc-bad); }
.lib-msg.is-warn { color: var(--jc-warn); }
.lib-try { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lib-try-label { color: var(--jc-muted); font-size: 14px; }
.lib-chip { font: inherit; cursor: pointer; border: 0; }
.lib-answer { display: grid; gap: 10px; }
.lib-text { padding: 14px 16px; border-radius: var(--jc-radius); background: var(--jc-paper); }
.lib-text p { margin: 0 0 8px; line-height: 1.7; }
.lib-cite { border: 0; background: none; padding: 0 2px; color: var(--jc-accent-strong, #9a4f15); font: inherit; font-weight: 600; cursor: pointer; }
.lib-via, .lib-demo, .lib-count, .lib-note { margin: 0; color: var(--jc-muted); font-size: 13px; }
.lib-h { margin: 4px 0 0; font-size: 15px; }
.lib-sources, .lib-docs { margin: 0; padding: 0; }
.lib-src { align-items: flex-start; cursor: default; }
.lib-n { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--jc-soft); font-size: 13px; font-weight: 600; }
.lib-quote { margin: 8px 0 0; padding: 8px 12px; border-left: 3px solid var(--jc-line); white-space: normal; line-height: 1.6; }
.lib-show { flex: none; }
.lib-cats { flex-wrap: wrap; }
.lib-doc { width: 100%; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.lib-vis { flex: none; font-size: 12px; }
.lib-read { padding: 4px 16px 12px; }
.lib-read h4 { margin: 10px 0 4px; font-size: 15px; }
.lib-read p { margin: 0; line-height: 1.7; }
.lib-up .jc-field--wide { grid-column: 1 / -1; }
@media (max-width: 760px) {
  .lib-src { flex-wrap: wrap; }
  .lib-show { margin-left: 32px; }
}

.card-acts { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; }
/* 時間軸：時鐘旁的「現在」（離開現在時間時才出現） */
.day-clock { display: inline-flex; align-items: center; gap: 6px; }
.day-now { padding: 3px 9px; border: 1.5px solid var(--jc-line); border-radius: 999px; background: var(--jc-paper); color: var(--jc-ink); font: inherit; font-size: 12px; line-height: 1.3; cursor: pointer; }
.day-now:hover { background: var(--jc-soft); }

/* ── 島嶼正常化（2026-11-02 稽核）── */
/* 提示要在窗口、圖書館、模組視窗之上，而且不擋點擊 */
.toast { z-index: 70; pointer-events: none; }
/* 捏布偶：小視窗時按鈕列固定在框底，不用往下捲 */
.avatar-box .row { position: sticky; bottom: -24px; margin: 0 -24px -24px; padding: 10px 24px 14px; background: var(--paper); border-top: 1.5px dashed var(--stitch); }
/* 中型螢幕（761–1179px）：工具列只留圖示（名稱在提示裡）、不換行；開場只留標題，不擋島上的名牌；
   右欄（回饋、詳情卡）開著時時間列讓位，關著才佔滿 */
@media (min-width: 761px) and (max-width: 1179px) {
  .toolbar { flex-wrap: nowrap; }
  .toolbar button:not(.jc-theme-switch) { padding: 0 11px; }
  .toolbar button:not(.jc-theme-switch) span:not(.badge):not(#lang-text) { display: none; }
  .hero-num, .hero p, .zone-key { display: none; }
  .dock { right: calc(var(--feed-w) + 32px); }
  body.feed-closed:not(.card-open) .dock { right: var(--gutter-r); }
}
/* 手機：工具列放不下時藏起圖鑑、導覽（說明與全景本來就藏），不要蓋住品牌 */
@media (max-width: 760px) {
  #btn-gallery, #btn-tour { display: none; }
}
@media (max-width: 400px) {
  .brand h1 { display: none; }
}
/* 「現在」按鈕先佔好位置：拖時間軸時它出現，滑桿不會被擠動 */
.day-now[hidden] { display: inline-block; visibility: hidden; }
.lib-declare { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.lib-declare input { margin-top: 3px; }
.desk-msg.is-ok { color: var(--jc-ok, #437534); }
/* 全景（遠）時行政島與圖書館的名牌擠在一起，會蓋住後面的房子：名牌照樣顯示，但不接點擊，
   點擊交給 3D 島（點到哪一棟就是哪一棟）；滑過房子時它自己的名牌會亮起來（亮起來的名牌也不接點擊，免得滑鼠剛移開時誤點） */
.labels.far .tag:is([data-zone="hub"], [data-zone="back"], [data-zone="library"], .backstage):not(.on) { pointer-events: none; }
/* 開不了 3D 的入口頁：還沒上線的系統不給連結 */
.portal-grid a.is-off { opacity: .5; cursor: default; }
