:root {
  --cream: #fffaf2;
  --ink: #4a3b35;
  --muted: #8d7b72;
  --peach: #ff8fab;
  --peach-soft: #ffe1e8;
  --mint: #63c7b2;
  --butter: #ffe08a;
  --paper: rgba(255, 250, 242, 0.92);
  --line: rgba(74, 59, 53, 0.1);
  --shadow: 0 10px 28px rgba(110, 72, 60, 0.16), 0 2px 6px rgba(110, 72, 60, 0.08);
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;
  --font: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}
:root[data-theme="dark"] {
  --paper: rgba(52, 46, 72, 0.9);
  --ink: #fff3ea;
  --muted: #cbbfd6;
  --line: rgba(255, 255, 255, 0.14);
  --peach-soft: rgba(255, 143, 171, 0.22);
  --shadow: 0 10px 28px rgba(10, 8, 30, 0.35), 0 2px 6px rgba(10, 8, 30, 0.2);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #cfe9ee; color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
#app { position: fixed; inset: 0; }
#stage { position: absolute; inset: 0; z-index: 0; isolation: isolate; }
#stage canvas { display: block; outline: none; touch-action: none; }
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

.brand, .tools, .hud .seg, .hud .clock, .foot {
  background: var(--paper);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  border: 1.5px solid rgba(255, 255, 255, 0.75);
  box-shadow: var(--shadow);
  transition: background 0.4s, color 0.4s;
}
:root[data-theme="dark"] .brand, :root[data-theme="dark"] .tools, :root[data-theme="dark"] .hud .seg, :root[data-theme="dark"] .hud .clock, :root[data-theme="dark"] .foot { border-color: rgba(255, 255, 255, 0.16); }

/* 品牌卡 */
.brand { position: absolute; top: 16px; left: 16px; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 12px 20px 12px 12px; border-radius: var(--r-lg); }
.brand-mark { width: 44px; height: 44px; flex: none; }
.brand-mark svg { display: block; width: 100%; height: 100%; filter: drop-shadow(0 3px 6px rgba(255, 110, 140, 0.3)); }
.brand h1 { margin: 0; font-size: 21px; font-weight: 900; letter-spacing: 0.06em; line-height: 1.2; }
.brand-sub { margin: 3px 0 0; font-size: 11px; font-weight: 700; letter-spacing: 0.16em; color: var(--peach); }

/* 右上工具 */
.tools { position: absolute; top: 16px; right: 16px; z-index: 5; display: flex; gap: 4px; padding: 6px; border-radius: var(--r-md); }
.tools button { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--r-sm); font-size: 14px; font-weight: 700; transition: background 0.2s, transform 0.15s; }
.tools button:hover { background: var(--peach-soft); }
.tools button:active { transform: scale(0.96); }
.tools svg { width: 18px; height: 18px; flex: none; }
#btn-home svg { color: var(--peach); }
#btn-compass { padding: 8px 10px; }
#btn-compass svg { width: 22px; height: 22px; }
#btn-compass .needle { transform-origin: 12px 12px; transform-box: view-box; }
#btn-theme svg { color: #8f7fe0; }
:root[data-theme="dark"] #btn-theme svg { color: var(--butter); }

/* 底部 HUD */
.hud { position: absolute; left: 50%; bottom: 40px; transform: translateX(-50%); z-index: 5; display: flex; align-items: stretch; gap: 8px; max-width: calc(100vw - 32px); }
.hud .seg { display: flex; gap: 4px; padding: 6px; border-radius: var(--r-lg); }
.hud .seg button { padding: 9px 15px; border-radius: 16px; font-size: 14px; font-weight: 700; white-space: nowrap; transition: background 0.2s, color 0.2s, transform 0.15s; }
.hud .seg button:hover { background: var(--peach-soft); }
.hud .seg button:active { transform: scale(0.96); }
.hud .seg button.on { background: var(--peach); color: #fff; box-shadow: 0 4px 10px rgba(255, 110, 140, 0.35); }
.hud .seg button[data-time="live"]::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--mint); vertical-align: 1px; }
.time-toggle { display: none; }
.hud .clock { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 4px 16px; border-radius: var(--r-lg); min-width: 92px; }
.hud .clock small { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; color: var(--muted); }
.hud .clock b { font-size: 20px; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }
.hud .clock .transit-note { margin-top: 1px; font-size: 9px; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap; }

/* 目前所在區 */
/* 全景時中心可能是海，標籤沒有意義：拉近到全景 45% 以內（#app.near）才顯示 */
.here { position: absolute; top: 92px; left: 16px; z-index: 5; display: none; align-items: center; gap: 6px; padding: 5px 12px 5px 6px; border-radius: 999px; background: var(--paper); border: 1.5px solid rgba(255, 255, 255, 0.75); box-shadow: 0 4px 12px rgba(110, 72, 60, 0.14); font-size: 13px; pointer-events: none; transition: background 0.4s, color 0.4s; }
.here span { padding: 2px 8px; border-radius: 999px; background: var(--c, var(--butter)); color: #4a3b35; font-size: 11px; font-weight: 800; letter-spacing: 0.06em; }
.here b { font-weight: 900; letter-spacing: 0.06em; }
#app.near .here { display: inline-flex; }
#app.near .here:has(b:empty) { display: none; }
:root[data-theme="dark"] .here { border-color: rgba(255, 255, 255, 0.16); }
/* 島內換區：「目前」標籤下方一排區名按鈕（目前所在區以該區底色標示） */
.here-sub { position: absolute; top: 128px; left: 16px; z-index: 5; display: none; flex-wrap: wrap; gap: 5px; max-width: min(420px, calc(100% - 32px)); }
#app.near.has-sub .here-sub { display: flex; }
.here-sub button { padding: 3px 10px; border-radius: 999px; border: 1.5px solid rgba(255, 255, 255, 0.8); background: var(--paper); box-shadow: 0 2px 6px rgba(110, 72, 60, 0.12); color: var(--ink); font: inherit; font-size: 12px; font-weight: 800; letter-spacing: 0.04em; cursor: pointer; }
.here-sub button:hover { background: var(--peach-soft); }
.here-sub button[aria-pressed="true"] { background: var(--c); color: #4a3b35; border-color: rgba(74, 59, 53, 0.25); }
.here-sub button:focus-visible { outline: 3px solid var(--butter); outline-offset: 2px; }
:root[data-theme="dark"] .here-sub button { border-color: rgba(255, 255, 255, 0.16); }
:root[data-theme="dark"] .here-sub button[aria-pressed="true"] { color: #4a3b35; }

/* 上一區、下一區：拉近到全景 45% 以內才出現；垂直位置避開右下小地圖 */
.nav-arrow { --mm: 168px; position: absolute; top: min(40%, calc(100% - 96px - var(--mm) - 84px)); z-index: 6; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 0; opacity: 0; visibility: hidden; transform: translateY(-50%) scale(0.85); transition: opacity 0.25s, transform 0.25s, visibility 0.25s; }
.nav-prev { left: 14px; }
.nav-next { right: 14px; }
#app.near .nav-arrow { opacity: 1; visibility: visible; transform: translateY(-50%); }
.nav-arrow i { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--paper); border: 2px solid rgba(255, 255, 255, 0.85); box-shadow: var(--shadow); color: var(--peach); transition: background 0.2s, transform 0.15s; }
.nav-arrow i svg { width: 24px; height: 24px; }
.nav-arrow:hover i { background: var(--peach-soft); }
.nav-arrow:active i { transform: scale(0.94); }
.nav-arrow:focus-visible i { outline: 3px solid var(--butter); outline-offset: 2px; }
.nav-arrow b { max-width: 84px; padding: 2px 9px; border-radius: 999px; background: var(--paper); box-shadow: 0 2px 6px rgba(110, 72, 60, 0.14); font-size: 12px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 小地圖：右下、時段 HUD 上方 */
.minimap { --mm: 168px; position: absolute; right: 16px; bottom: 96px; z-index: 5; width: var(--mm); height: var(--mm); padding: 6px; border-radius: var(--r-md); background: var(--paper); border: 1.5px solid rgba(255, 255, 255, 0.75); box-shadow: var(--shadow); transition: width 0.25s, height 0.25s, background 0.4s; }
.minimap canvas { display: block; width: 100%; height: 100%; border-radius: 10px; background: rgba(127, 211, 236, 0.35); cursor: crosshair; touch-action: none; }
.mm-toggle { position: absolute; top: -10px; right: -10px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--paper); box-shadow: 0 2px 6px rgba(110, 72, 60, 0.2); color: var(--ink); }
.mm-toggle svg { width: 16px; height: 16px; transition: transform 0.25s; }
.minimap.closed { width: 40px; height: 40px; }
.minimap.closed canvas { visibility: hidden; }
.minimap.closed .mm-toggle { top: 7px; right: 7px; }
.minimap.closed .mm-toggle svg { transform: rotate(180deg); }
:root[data-theme="dark"] .minimap { border-color: rgba(255, 255, 255, 0.16); }
@media (max-height: 560px) { .minimap, .nav-arrow { --mm: 128px; } }

/* 頁尾 */
.foot { position: absolute; right: 12px; bottom: 8px; z-index: 5; display: flex; align-items: center; gap: 4px; padding: 3px 12px; border-radius: 999px; font-size: 11px; color: var(--muted); box-shadow: 0 2px 8px rgba(110, 72, 60, 0.1); }
.foot a { color: var(--ink); text-decoration: none; font-weight: 700; }
.foot a:hover { color: var(--peach); text-decoration: underline; }

/* 地圖標籤 */
.lb { pointer-events: none; white-space: nowrap; user-select: none; transition: opacity 0.35s ease, visibility 0.35s; font-family: var(--font); color: #4a3b35; }
.lb.off { opacity: 0; visibility: hidden; }
.lb-link { pointer-events: auto; cursor: pointer; }
.lb-link.off { pointer-events: none; }
.lb-link:hover { filter: brightness(1.04); scale: 1.06; }
/* 名牌：白底膠囊加柔和陰影，以左側色點表示島色（不加粗描邊與硬陰影） */
.lb-district, .lb-satellite { display: inline-flex; align-items: center; gap: 6px; padding: 4px 13px 4px 10px; border-radius: 999px; background: rgba(255, 252, 247, 0.95); box-shadow: 0 3px 10px rgba(110, 72, 60, 0.16); font-size: 14px; font-weight: 900; letter-spacing: 0.08em; }
.lb-district::before, .lb-satellite::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1.5px rgba(74, 59, 53, 0.12); flex: none; }
.lb-satellite { font-size: 12.5px; padding: 3px 11px 3px 9px; }
/* 核心島的島名牌（全景距離）：大字；區名牌（拉近）：小字並一直顯示該區景點數 */
.lb-district.isle { font-size: 19px; padding: 6px 16px 6px 13px; letter-spacing: 0.12em; }
.lb-district.isle::before { width: 11px; height: 11px; }
.lb-district.sub { font-size: 12.5px; padding: 3px 11px 3px 9px; }
.lb-district.isle.tight { font-size: 12.5px; padding: 3px 10px 3px 8px; letter-spacing: 0.06em; }
.lb-district.isle.tight::before { width: 9px; height: 9px; }
.lb-district.sub .cnt { display: inline-block; }
.lb-num { padding: 1px 8px; border-radius: 8px; background: rgba(255, 255, 255, 0.92); color: #cf6683; font-size: 11.5px; font-weight: 900; letter-spacing: 0.05em; box-shadow: 0 2px 6px rgba(110, 72, 60, 0.14); }
.lb-station { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px 2px 5px; border-radius: 999px; background: rgba(255, 255, 255, 0.92); font-size: 11px; font-weight: 700; box-shadow: 0 2px 6px rgba(74, 59, 53, 0.18); }
.lb-station i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.lb-district .cnt, .lb-satellite .cnt { display: none; margin-left: 1px; padding: 1px 8px; border-radius: 999px; background: var(--c); color: #4a3b35; font-size: 0.86em; font-weight: 900; letter-spacing: 0; font-variant-numeric: tabular-nums; }
#labels[data-lod="far"] .cnt { display: inline-block; }
.lb-landmark { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 7px; border-radius: 999px; background: rgba(255, 255, 255, 0.95); box-shadow: 0 3px 10px rgba(110, 72, 60, 0.16); font-size: 12px; font-weight: 900; letter-spacing: 0.04em; }
.lb-landmark::before { content: ""; width: 9px; height: 9px; border-radius: 3px; background: var(--peach); transform: rotate(45deg); }
.lb-poi { padding: 2px 8px 2px 6px; border-radius: 9px; background: rgba(255, 255, 255, 0.95); border-left: 4px solid var(--mint); font-size: 11px; font-weight: 800; box-shadow: 0 2px 6px rgba(74, 59, 53, 0.16); transition: none; }
.lb-poi.food { border-left-color: var(--peach); }

/* 詳情卡（階段 3）：桌機在左側寬 340、圓角 22、柔和多層陰影、內部可捲動；手機是 bottom sheet */
.card { position: absolute; left: 16px; top: 100px; z-index: 8; width: min(340px, calc(100vw - 32px)); max-height: calc(100% - 100px - 112px); display: flex; flex-direction: column; border-radius: 22px; background: #fffaf2; color: #4a3b35; box-shadow: 0 18px 40px rgba(110, 72, 60, 0.16), 0 6px 14px rgba(110, 72, 60, 0.08), 0 1px 3px rgba(110, 72, 60, 0.08); opacity: 0; visibility: hidden; transform: translateX(-16px); transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s; }
.card.open { opacity: 1; visibility: visible; transform: none; }
#app.near .card { top: 132px; max-height: calc(100% - 132px - 112px); }
#app.near.has-sub .card { top: 164px; max-height: calc(100% - 164px - 112px); }
.card-body { overflow-y: auto; padding: 16px 18px 16px; overscroll-behavior: contain; scrollbar-width: thin; }
.card-close { position: absolute; top: 10px; right: 10px; z-index: 2; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 250, 242, 0.9); color: #8d7b72; transition: background 0.2s; }
.card-close:hover { background: #ffe1e8; color: #4a3b35; }
.card-close svg { width: 18px; height: 18px; }
.card-head { display: grid; grid-template-columns: 160px 1fr; gap: 12px; align-items: start; padding-right: 26px; }
.card-thumb { width: 160px; height: 120px; border-radius: 16px; overflow: hidden; display: grid; place-items: center; background: radial-gradient(circle at 50% 70%, #fff 0, #ffe9ee 70%); box-shadow: inset 0 0 0 1.5px rgba(255, 143, 171, 0.18); }
.card-thumb.spot { background: radial-gradient(circle at 50% 70%, #fff 0, #dcf4ee 70%); box-shadow: inset 0 0 0 1.5px rgba(99, 199, 178, 0.2); }
.card-thumb img { display: block; width: 160px; height: 120px; }
.card-thumb .ic.big { width: 64px; height: 64px; }
.card-side { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; padding-top: 2px; }
.card-tag { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 12px; font-weight: 800; letter-spacing: 0.04em; color: #8d7b72; }
.card-tag i { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); flex: none; }
.card-tag.food i { background: var(--peach); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; background: #ffe08a; color: #6d4c12; font-size: 11px; font-weight: 900; letter-spacing: 0.06em; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: #ff8fab; transform: rotate(45deg); }
.card-district { margin: 0; font-size: 12px; font-weight: 700; color: #8d7b72; }
.card-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.card-act { display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px 6px 8px; border-radius: 999px; background: #fff; box-shadow: 0 2px 6px rgba(110, 72, 60, 0.12); font-size: 12px; font-weight: 800; color: #6d5a50; transition: transform 0.15s, background 0.2s; }
.card-act svg { width: 17px; height: 17px; }
.card-act:hover { background: #ffe1e8; }
.card-act:active { transform: scale(0.95); }
.card-act.fav.on { background: #ffe1e8; color: #e0517a; --heart-fill: #ff8fab; }
.card-title { margin: 12px 0 0; font-size: 21px; font-weight: 900; line-height: 1.35; letter-spacing: 0.03em; outline: none; }
.card-title:focus-visible { outline: 3px solid var(--butter); outline-offset: 2px; border-radius: 6px; }
.card-en { margin: 2px 0 0; font-size: 12.5px; font-weight: 700; color: #8d7b72; letter-spacing: 0.02em; }
.card-summary { margin: 8px 0 0; font-size: 14px; line-height: 1.7; }
/* 重點磚：大字、數字放大 */
.card-tiles { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.card-tile { padding: 10px 12px; border-radius: 14px; background: linear-gradient(135deg, #fff4d4, #ffeaf0); font-size: 14px; font-weight: 700; line-height: 1.5; color: #4a3b35; }
.card-tile:nth-child(2) { background: linear-gradient(135deg, #e3f6f0, #fff4d4); }
.card-tile:nth-child(3) { background: linear-gradient(135deg, #ffeaf0, #eef0ff); }
.card-tile .num { font-size: 1.32em; font-weight: 900; color: #e0517a; letter-spacing: 0.01em; font-variant-numeric: tabular-nums; }
.card-facts { margin: 12px 0 0; padding: 10px 12px; border-radius: 14px; background: rgba(255, 224, 138, 0.2); display: grid; gap: 7px; }
.card-row { display: grid; grid-template-columns: 64px 1fr; gap: 8px; font-size: 13px; line-height: 1.55; }
.card-row dt { font-weight: 800; color: #8d7b72; }
.card-row dd { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.addr-tools { display: inline-flex; align-items: center; gap: 6px; }
.mini { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: #fff; box-shadow: 0 1px 4px rgba(110, 72, 60, 0.14); color: #6d5a50; }
.mini svg { width: 16px; height: 16px; }
.mini:hover { background: #ffe1e8; }
.gmap { display: inline-flex; align-items: center; gap: 3px; padding: 4px 9px 4px 6px; border-radius: 9px; background: #fff; box-shadow: 0 1px 4px rgba(110, 72, 60, 0.14); color: #d4567a; font-size: 12px; font-weight: 800; text-decoration: none; }
.gmap svg { width: 15px; height: 15px; }
.gmap:hover { background: #ffe1e8; }
.warn { padding: 1px 8px; border-radius: 999px; background: #fff0c2; color: #8a6116; font-size: 11px; font-weight: 800; }
.card-h { margin: 14px 0 6px; font-size: 12px; font-weight: 900; letter-spacing: 0.08em; color: #8d7b72; }
.station-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0; font-size: 13px; }
.line-dot { width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 0 2.5px #fff, 0 1px 4px rgba(0, 0, 0, 0.18); flex: none; }
.station-go { padding: 3px 10px; border-radius: 999px; background: #fff; box-shadow: 0 1px 4px rgba(110, 72, 60, 0.16); font-weight: 900; color: #4a3b35; }
.station-go:hover { background: #ffe1e8; }
.st-ref { font-size: 11.5px; font-weight: 700; color: #8d7b72; }
.st-walk { font-weight: 800; color: #3f9e89; }
.muted { margin: 0; font-size: 12.5px; color: #8d7b72; }
.timeline { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: 0; padding: 0; list-style: none; }
.timeline li { padding: 7px 0; border-radius: 10px; background: #f3ece4; color: #a89488; font-size: 11.5px; font-weight: 800; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timeline li.on { background: #ffe08a; color: #5c4210; box-shadow: 0 2px 6px rgba(243, 198, 94, 0.45); }
.src-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.src-list a { color: #d4567a; font-size: 12.5px; font-weight: 700; text-decoration: none; overflow-wrap: anywhere; }
.src-list a:hover { text-decoration: underline; }
.trust { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0 0; font-size: 12px; color: #8d7b72; }
.trust-badge { padding: 2px 9px; border-radius: 999px; background: #f3ece4; color: #6d5a50; font-weight: 800; }
.trust.high .trust-badge { background: #dcf4ee; color: #2f7f6d; }
.card-note { margin: 10px 0 0; font-size: 11px; color: #8d7b72; }
.sheet-grip { display: none; }
@media (prefers-reduced-motion: reduce) { .card { transition: none; } }

/* 對話泡泡：島主的話、車站下一班、列車資訊 */
.speech-anchor { width: 0; height: 0; pointer-events: none; }
.speech { position: absolute; left: 0; bottom: 12px; display: flex; flex-direction: column; gap: 3px; width: max-content; min-width: 150px; max-width: 250px; padding: 9px 13px 9px; border-radius: 16px; background: #fffaf2; color: #4a3b35; box-shadow: 0 8px 22px rgba(110, 72, 60, 0.22), 0 2px 6px rgba(110, 72, 60, 0.1); font-family: var(--font); font-size: 12.5px; line-height: 1.55; white-space: normal; pointer-events: none; transform: translateX(-50%); transition: opacity 0.2s; }
.speech::after { content: ""; position: absolute; left: 50%; bottom: -7px; width: 14px; height: 14px; background: #fffaf2; transform: translateX(-50%) rotate(45deg); border-radius: 0 0 4px 0; }
.speech.off { opacity: 0; }
.sp-title { font-size: 13.5px; font-weight: 900; letter-spacing: 0.03em; color: #d4567a; }
.sp-line { display: flex; justify-content: space-between; gap: 10px; }
.sp-line i { font-style: normal; color: #6d5a50; }
.sp-line em { font-style: normal; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sp-note { margin-top: 2px; font-size: 10.5px; color: #8d7b72; }

.lb-road { font-size: 11px; font-weight: 700; color: #6d5a50; text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 6px #fff; }

/* 載入畫面 */
.loading { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 24px; text-align: center; background: radial-gradient(circle at 50% 40%, #fffdf8, #ffe9dc 70%, #ffd9cf); transition: opacity 0.6s ease; }
.loading.done { opacity: 0; pointer-events: none; }
.loading h2 { margin: 18px 0 0; font-size: 30px; font-weight: 900; letter-spacing: 0.08em; color: #4a3b35; }
.loading p { margin: 0; font-size: 14px; color: #8d7b72; max-width: 520px; line-height: 1.7; }
.loading-blob { display: flex; gap: 10px; }
.loading-blob i { width: 22px; height: 22px; border-radius: 50%; background: var(--peach); animation: squish 1.1s ease-in-out infinite; }
.loading-blob i:nth-child(2) { background: var(--butter); animation-delay: 0.15s; }
.loading-blob i:nth-child(3) { background: var(--mint); animation-delay: 0.3s; }
@keyframes squish { 0%, 100% { transform: translateY(0) scale(1, 1); } 40% { transform: translateY(-14px) scale(0.9, 1.1); } 70% { transform: translateY(0) scale(1.15, 0.85); } }
.loading.error .loading-blob i { animation: none; background: #d8c6bd; }
.loading.error h2 { color: #d4567a; }
.loading.error p { color: #4a3b35; }

/* 窄螢幕：工具列只留圖示（按鈕都有 aria-label），才不會和品牌卡重疊 */
@media (max-width: 440px) {
  .tools button span { display: none; }
}

/* 手機 */
@media (max-width: 800px) {
  .brand { top: 10px; left: 10px; gap: 8px; padding: 8px 14px 8px 8px; border-radius: var(--r-md); }
  .brand-mark { width: 32px; height: 32px; }
  .brand h1 { font-size: 15px; }
  .brand-sub { font-size: 8.5px; letter-spacing: 0.1em; }
  .tools { top: 10px; right: 10px; padding: 4px; }
  .tools button { padding: 7px 9px; font-size: 12px; gap: 4px; }
  .tools svg { width: 16px; height: 16px; }
  .hud { left: 10px; right: 10px; bottom: 36px; transform: none; max-width: none; gap: 6px; }
  .hud { justify-content: center; }
  .time-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px; border-radius: var(--r-lg); background: var(--peach); color: #fff; font-size: 14px; font-weight: 800; box-shadow: var(--shadow); }
  .time-toggle svg { width: 17px; height: 17px; }
  .hud .seg { display: none; position: absolute; left: 50%; translate: -50% 0; bottom: calc(100% + 8px); flex-direction: column; gap: 2px; padding: 6px; min-width: 140px; z-index: 7; }
  .hud .seg.open { display: flex; animation: pop 0.18s ease; }
  .hud .seg button { padding: 10px 14px; font-size: 14px; text-align: left; }
  @keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.97); } to { opacity: 1; transform: none; } }
  .hud .clock { min-width: 70px; padding: 4px 10px; }
  .hud .clock b { font-size: 17px; }
  .hud .clock .transit-note { font-size: 8px; letter-spacing: 0; }
  .foot { left: 50%; right: auto; transform: translateX(-50%); bottom: 6px; font-size: 10px; white-space: nowrap; }
  .lb-district { font-size: 13px; padding: 3px 11px 3px 9px; }
  #btn-compass { padding: 6px 7px; }
  #btn-compass svg { width: 20px; height: 20px; }
  .here { top: 68px; left: 10px; font-size: 12px; }
  .here-sub { top: 104px; left: 10px; max-width: calc(100% - 20px); }
  .here-sub button { padding: 2px 9px; font-size: 11.5px; }
  .lb-district.isle { font-size: 15px; padding: 4px 12px 4px 10px; }
  .minimap, .nav-arrow { --mm: 112px; }
  .minimap { right: 10px; bottom: 108px; padding: 4px; }
  .nav-arrow { top: 46%; }
  .nav-prev { left: 8px; }
  .nav-next { right: 8px; }
  .nav-arrow i { width: 42px; height: 42px; }
  .nav-arrow b { font-size: 11px; max-width: 72px; }
}

/* 介紹卡開啟時（桌機），上一區按鈕移到卡片右側 */
@media (min-width: 801px) {
  #app.card-open .nav-prev { left: 372px; }
}

/* ── 階段 3：右側清單側欄（預設收合成搜尋膠囊加「今天吃什麼？」） ── */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { display: block; width: 34px; height: 34px; flex: none; }
.ic.sm { width: 18px; height: 18px; }
.ic.big { width: 56px; height: 56px; }
.tools .lang { display: inline-flex; align-items: center; gap: 3px; padding: 8px 11px; border-radius: var(--r-sm); font-size: 13px; font-weight: 800; color: var(--muted); text-decoration: none; transition: background 0.2s; }
.tools .lang:hover { background: var(--peach-soft); }
.tools .lang i { font-style: normal; opacity: 0.45; }
.tools .lang .lang-on { color: var(--ink); }
#btn-help { padding: 8px 9px; }
#btn-help svg { width: 20px; height: 20px; color: var(--peach); }
:focus-visible { outline: 3px solid var(--butter); outline-offset: 2px; }

.panel { position: absolute; top: 76px; right: 16px; z-index: 7; width: 318px; max-height: calc(100% - 76px - 40px); display: flex; flex-direction: column; border-radius: var(--r-lg); background: var(--paper); backdrop-filter: blur(12px) saturate(1.2); -webkit-backdrop-filter: blur(12px) saturate(1.2); border: 1.5px solid rgba(255, 255, 255, 0.75); box-shadow: var(--shadow); color: var(--ink); transition: background 0.4s, color 0.4s; }
:root[data-theme="dark"] .panel { border-color: rgba(255, 255, 255, 0.16); }
.panel-head { display: flex; align-items: center; gap: 5px; padding: 6px; }
.search { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 6px 0 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.92); box-shadow: inset 0 0 0 1.5px rgba(74, 59, 53, 0.08); cursor: text; }
:root[data-theme="dark"] .search { background: rgba(255, 255, 255, 0.12); }
.search > svg { width: 18px; height: 18px; flex: none; color: var(--peach); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; font: inherit; font-size: 14px; font-weight: 700; color: inherit; }
.search input::placeholder { color: var(--muted); font-weight: 600; }
.search input::-webkit-search-cancel-button { display: none; }
.search:focus-within { box-shadow: inset 0 0 0 2px var(--peach); }
.search-clear { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: var(--muted); flex: none; }
.search-clear svg { width: 14px; height: 14px; }
.search-clear:hover { background: var(--peach-soft); }
.search-clear[hidden] { display: none; }
.draw-btn { display: inline-flex; align-items: center; gap: 5px; height: 40px; padding: 0 12px 0 10px; border-radius: 999px; background: linear-gradient(135deg, #ff9fb5, #ff8fab 60%, #ffb48f); color: #fff; font-size: 13px; font-weight: 900; letter-spacing: 0.02em; white-space: nowrap; box-shadow: 0 4px 12px rgba(255, 110, 140, 0.35); transition: transform 0.15s, filter 0.2s; }
.draw-btn svg { width: 18px; height: 18px; flex: none; }
.draw-btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.draw-btn:active { transform: scale(0.96); }
.panel-toggle { display: grid; place-items: center; width: 32px; height: 40px; border-radius: 12px; color: var(--muted); flex: none; }
.panel-toggle:hover { background: var(--peach-soft); color: var(--ink); }
.panel-toggle svg { width: 20px; height: 20px; transition: transform 0.25s; }
.panel.open .panel-toggle svg { transform: rotate(180deg); }
.panel-body { display: none; flex-direction: column; min-height: 0; flex: 1; border-top: 1.5px solid var(--line); }
.panel.open .panel-body { display: flex; }
.panel.open { height: calc(100% - 76px - 40px); }
.chips { padding: 8px 10px 4px; display: grid; gap: 6px; max-height: 38vh; overflow-y: auto; flex: none; scrollbar-width: thin; }
.chip-group { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.chip-title { width: 100%; font-size: 10.5px; font-weight: 900; letter-spacing: 0.1em; color: var(--muted); }
.chip-group:not(.cats) .chip-title { width: auto; margin-right: 2px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.85); box-shadow: inset 0 0 0 1.5px rgba(74, 59, 53, 0.09); font-size: 12.5px; font-weight: 800; color: var(--ink); white-space: nowrap; transition: background 0.15s, color 0.15s, transform 0.12s; }
:root[data-theme="dark"] .chip { background: rgba(255, 255, 255, 0.1); }
.chip:hover { background: var(--peach-soft); }
.chip:active { transform: scale(0.95); }
.chip.on { background: var(--peach); color: #fff; box-shadow: 0 3px 8px rgba(255, 110, 140, 0.3); }
.chip .ic.sm { margin-left: -4px; }
.chip-dot { width: 8px; height: 8px; border-radius: 50%; }
.chip-dot.rain { background: #7fb2e5; }
.chip-dot.heart { background: #ff6f93; border-radius: 50% 50% 2px 50%; transform: rotate(45deg); }
.chip-more { border-radius: 12px; }
.chip-more summary { display: inline-flex; align-items: center; gap: 6px; padding: 4px 2px; font-size: 12px; font-weight: 800; color: var(--muted); cursor: pointer; list-style: none; }
.chip-more summary::-webkit-details-marker { display: none; }
.chip-more summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform 0.2s; }
.chip-more[open] summary::before { transform: rotate(45deg); }
.chip-more summary[data-count]:not([data-count=""])::after { content: attr(data-count); padding: 0 7px; border-radius: 999px; background: var(--peach); color: #fff; font-size: 11px; }
.chip-more .chip-group { margin-top: 6px; }
.tabs { display: flex; gap: 4px; margin: 6px 10px 0; padding: 4px; border-radius: 14px; background: rgba(74, 59, 53, 0.06); flex: none; }
.tab { flex: 1; padding: 6px 0; border-radius: 10px; font-size: 13px; font-weight: 800; color: var(--muted); transition: background 0.15s, color 0.15s; }
.tab.on { background: #fff; color: var(--ink); box-shadow: 0 2px 6px rgba(110, 72, 60, 0.12); }
:root[data-theme="dark"] .tab.on { background: rgba(255, 255, 255, 0.18); }
.result-line { display: flex; align-items: center; justify-content: space-between; padding: 6px 14px 4px; font-size: 12px; font-weight: 800; color: var(--muted); flex: none; }
.result-reset { padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 800; color: #d4567a; }
.result-reset:hover { background: var(--peach-soft); }
.result-reset[hidden] { display: none; }
.list { flex: 1; min-height: 0; overflow-y: auto; padding: 2px 8px 10px; overscroll-behavior: contain; scrollbar-width: thin; }
.item { position: relative; width: 100%; display: flex; align-items: flex-start; gap: 10px; padding: 8px 8px; border-radius: 14px; text-align: left; transition: background 0.15s; }
.item:hover, .item:focus-visible { background: rgba(255, 143, 171, 0.14); }
.item:focus-visible { outline-offset: -2px; }
.it-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.it-name { font-size: 14px; font-weight: 900; line-height: 1.35; padding-right: 14px; }
.item.fav .it-name::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 6px; background: #ff6f93; border-radius: 50% 50% 2px 50%; transform: rotate(45deg); vertical-align: 2px; }
.it-meta { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.it-price { color: #d4567a; font-weight: 900; letter-spacing: 0.02em; }
.it-badge { padding: 0 6px; border-radius: 999px; background: #ffe08a; color: #6d4c12; font-size: 10.5px; font-weight: 900; }
.it-sum { font-size: 12px; line-height: 1.5; color: var(--ink); opacity: 0.82; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.now { position: absolute; top: 12px; right: 10px; width: 9px; height: 9px; border-radius: 50%; background: #3fbf8f; box-shadow: 0 0 0 3px rgba(63, 191, 143, 0.22); }
.district { border-radius: 12px; }
.district summary { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border-radius: 12px; font-size: 13.5px; font-weight: 900; cursor: pointer; list-style: none; }
.district summary::-webkit-details-marker { display: none; }
.district summary:hover { background: rgba(255, 143, 171, 0.12); }
.district[open] summary { background: rgba(255, 224, 138, 0.25); }
.dcount { min-width: 26px; padding: 1px 8px; border-radius: 999px; background: rgba(74, 59, 53, 0.08); font-size: 12px; text-align: center; }
.district.zero summary { opacity: 0.5; }
/* 分區分頁兩層：島 → 區 */
.district.island > summary { font-size: 14.5px; }
.district.sub { margin-left: 12px; }
.district.sub summary { padding: 6px 10px; font-size: 13px; font-weight: 800; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px 12px; text-align: center; }
.empty svg { width: 64px; height: 64px; }
.empty b { font-size: 15px; font-weight: 900; }
.empty p { margin: 0 0 6px; font-size: 12.5px; color: var(--muted); }
.panel.no-data .panel-body::before { content: "景點資料無法載入，請重新整理頁面"; padding: 14px; font-size: 13px; font-weight: 700; color: #d4567a; }
:root[lang="en"] .panel.no-data .panel-body::before { content: "Place data could not be loaded. Please reload."; }

/* 側欄展開時（桌機），右側的小地圖、下一區按鈕、時段 HUD 讓位 */
@media (min-width: 801px) {
  #app.panel-open .minimap { right: calc(16px + 318px + 14px); bottom: 156px; }
  #app.panel-open .nav-next { right: calc(14px + 318px + 18px); }
  #app.panel-open .hud { left: calc((100% - 334px) / 2); }
}

/* HUD：現在是午餐時間（點一下套用時段篩選） */
.meal-now { display: inline-flex; align-items: center; gap: 7px; padding: 4px 8px 4px 12px; border-radius: var(--r-lg); background: var(--paper); backdrop-filter: blur(12px) saturate(1.2); -webkit-backdrop-filter: blur(12px) saturate(1.2); border: 1.5px solid rgba(255, 255, 255, 0.75); box-shadow: var(--shadow); font-size: 12.5px; font-weight: 700; white-space: nowrap; transition: transform 0.15s, background 0.2s; }
:root[data-theme="dark"] .meal-now { border-color: rgba(255, 255, 255, 0.16); }
.meal-now[hidden] { display: none; }
.meal-now:hover { background: #fff6dc; color: #4a3b35; }
.meal-now:active { transform: scale(0.97); }
.meal-txt b { font-weight: 900; }
.meal-now em { min-width: 26px; padding: 2px 8px; border-radius: 999px; background: #ffe08a; color: #5c4210; font-style: normal; font-weight: 900; text-align: center; font-variant-numeric: tabular-nums; }
.meal-dot { width: 9px; height: 9px; border-radius: 50%; background: #ffd25e; box-shadow: 0 0 0 0 rgba(255, 210, 94, 0.6); animation: meal-pulse 2.4s ease-in-out infinite; }
@keyframes meal-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 210, 94, 0.55); } 50% { box-shadow: 0 0 0 6px rgba(255, 210, 94, 0); } }

/* 今天吃什麼：翻牌 */
.draw { position: absolute; top: 140px; right: 16px; z-index: 9; width: 300px; padding: 14px 16px 14px; border-radius: var(--r-lg); background: #fffaf2; color: #4a3b35; box-shadow: 0 18px 40px rgba(110, 72, 60, 0.2), 0 4px 10px rgba(110, 72, 60, 0.1); text-align: center; animation: draw-in 0.28s cubic-bezier(0.3, 1.5, 0.5, 1); }
.draw[hidden] { display: none; }
@keyframes draw-in { from { opacity: 0; transform: translateY(-10px) scale(0.94); } to { opacity: 1; transform: none; } }
.draw-close { position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: #8d7b72; }
.draw-close:hover { background: #ffe1e8; }
.draw-close svg { width: 16px; height: 16px; }
.draw-title { margin: 0; font-size: 17px; font-weight: 900; letter-spacing: 0.06em; color: #e0517a; outline: none; }
.draw-pool { margin: 2px 0 10px; min-height: 1.4em; font-size: 11.5px; font-weight: 700; color: #8d7b72; }
.flip { position: relative; height: 178px; perspective: 900px; }
.face { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 12px; border-radius: 18px; backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: transform 0.9s cubic-bezier(0.34, 1.36, 0.5, 1); }
.front { background: repeating-linear-gradient(45deg, #ff9fb5 0 14px, #ffb0c2 14px 28px); color: #fff; transform: rotateY(0deg); box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.6); }
.front b { font-size: 44px; font-weight: 900; line-height: 1; text-shadow: 0 3px 0 rgba(224, 81, 122, 0.4); }
.front .ic.big { filter: drop-shadow(0 3px 6px rgba(160, 60, 90, 0.25)); }
.back { background: linear-gradient(160deg, #fff6df, #ffeef3); transform: rotateY(180deg); box-shadow: inset 0 0 0 2px rgba(255, 143, 171, 0.25); }
.flip.flipped .front { transform: rotateY(-180deg); }
.flip.flipped .back { transform: rotateY(0deg); }
.flip.instant .face { transition: none; }
.draw.spinning .flip { animation: wobble 0.9s ease-in-out; }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-3deg) scale(1.03); } 45% { transform: rotate(3deg) scale(1.05); } 70% { transform: rotate(-1.5deg); } }
.draw-icon .ic.big { width: 48px; height: 48px; }
.draw-name { font-size: 18px; font-weight: 900; line-height: 1.35; }
.draw-meta { font-size: 12px; font-weight: 800; color: #8d7b72; }
.draw-sum { margin: 2px 0 0; font-size: 12.5px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.draw-again { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; padding: 8px 16px 8px 12px; border-radius: 999px; background: var(--mint); color: #fff; font-size: 13.5px; font-weight: 900; box-shadow: 0 4px 10px rgba(99, 199, 178, 0.4); transition: transform 0.15s, opacity 0.2s; }
.draw-again svg { width: 18px; height: 18px; }
.draw-again:disabled { opacity: 0.5; cursor: default; }
.draw-again:not(:disabled):active { transform: scale(0.96); }

/* 第一次進站的操作說明 */
.help { position: fixed; inset: 0; z-index: 15; display: grid; place-items: center; padding: 16px; background: rgba(74, 59, 53, 0.28); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.help[hidden] { display: none; }
.help-card { position: relative; width: min(360px, 100%); padding: 22px 22px 18px; border-radius: 26px; background: #fffaf2; color: #4a3b35; box-shadow: 0 24px 60px rgba(74, 40, 30, 0.28); text-align: center; animation: draw-in2 0.3s cubic-bezier(0.3, 1.4, 0.5, 1); }
@keyframes draw-in2 { from { opacity: 0; transform: translateY(12px) scale(0.95); } to { opacity: 1; transform: none; } }
.help-art svg { display: block; width: 100%; max-width: 220px; height: auto; margin: 0 auto; }
.help-step { margin: 10px 0 0; font-size: 12px; font-weight: 800; letter-spacing: 0.08em; color: var(--peach); }
.help-card h2 { margin: 4px 0 0; font-size: 20px; font-weight: 900; letter-spacing: 0.04em; outline: none; }
.help-desc { margin: 8px 0 0; font-size: 13.5px; line-height: 1.7; color: #6d5a50; }
.help-dots { display: flex; justify-content: center; gap: 6px; margin-top: 14px; }
.help-dots i { width: 8px; height: 8px; border-radius: 50%; background: #eadfd6; transition: width 0.2s, background 0.2s; }
.help-dots i.on { width: 22px; border-radius: 999px; background: var(--peach); }
.help-nav { display: flex; justify-content: center; gap: 8px; margin-top: 14px; }
.help-nav button { padding: 10px 20px; border-radius: 999px; font-size: 14px; font-weight: 900; }
.help-prev { background: #f3ece4; color: #6d5a50; }
.help-prev[hidden] { display: none; }
.help-next { background: var(--peach); color: #fff; box-shadow: 0 4px 12px rgba(255, 110, 140, 0.35); }
.help-skip { position: absolute; top: 12px; right: 14px; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 800; color: #8d7b72; }
.help-skip:hover { background: #ffe1e8; }

/* 複製成功等小提示 */
.toast { position: absolute; left: 50%; bottom: 158px; z-index: 16; padding: 8px 16px; border-radius: 999px; background: rgba(74, 59, 53, 0.9); color: #fffaf2; font-size: 13px; font-weight: 800; transform: translate(-50%, 8px); opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  .face, .draw, .help-card, .panel-toggle svg, .chip-more summary::before { transition: none; animation: none; }
  .draw.spinning .flip, .meal-dot { animation: none; }
}

/* 手機：側欄與詳情卡改成 bottom sheet（三段 18%、52%、92%），浮動元件依 sheet 高度避讓 */
@media (max-width: 800px) {
  .panel, .panel.open, .card { left: 0; right: 0; top: auto; bottom: 0; width: auto; max-height: none; height: var(--sh, 18%); border-radius: 22px 22px 0 0; transition: height 0.28s cubic-bezier(0.3, 1.1, 0.5, 1), opacity 0.25s, visibility 0.25s, transform 0.25s; }
  .panel { z-index: 8; box-shadow: 0 -8px 28px rgba(110, 72, 60, 0.18); }
  .card { z-index: 9; transform: translateY(24px); box-shadow: 0 -8px 28px rgba(110, 72, 60, 0.2); }
  #app.near .card, #app.near.has-sub .card { top: auto; max-height: none; }
  .card.open { transform: none; }
  .panel.dragging, .card.dragging { transition: none; }
  #app.card-open .panel { visibility: hidden; }
  .sheet-grip { display: block; flex: none; height: 18px; cursor: grab; touch-action: none; }
  .sheet-grip::before { content: ""; display: block; width: 42px; height: 5px; margin: 8px auto 0; border-radius: 999px; background: rgba(74, 59, 53, 0.22); }
  .panel-head { touch-action: none; padding: 2px 10px 6px; }
  .panel-body { display: flex; }
  .card-body { flex: 1; min-height: 0; padding: 4px 16px calc(16px + env(safe-area-inset-bottom)); }
  .list { padding-bottom: 10px; }
  /* 頁尾在 sheet 內最底部（panel.js 搬移），底部預留安全區；詳情卡開啟時隨 sheet 一起隱藏 */
  .panel > .foot { position: static; transform: none; flex: none; align-self: center; max-width: calc(100% - 20px); margin: 4px auto calc(6px + env(safe-area-inset-bottom)); box-shadow: none; z-index: auto; }
  .card-close { top: 14px; right: 12px; }
  .card-title { font-size: 19px; }
  .card-head { grid-template-columns: 140px 1fr; }
  .card-thumb, .card-thumb img { width: 140px; height: 105px; }
  .foot { z-index: 10; }
  .hud { bottom: calc(var(--sheet-h, 18vh) + 10px); transition: bottom 0.28s, opacity 0.2s, visibility 0.2s; }
  .minimap { bottom: calc(var(--sheet-h, 18vh) + 82px); transition: bottom 0.28s, opacity 0.2s, visibility 0.2s, width 0.25s, height 0.25s; }
  .nav-arrow { top: min(46%, calc(100% - var(--sheet-h, 18vh) - 230px)); }
  #app[data-sheet="1"] .hud, #app[data-sheet="2"] .hud, #app[data-sheet="1"] .minimap, #app[data-sheet="2"] .minimap, #app[data-sheet="1"] .nav-arrow, #app[data-sheet="2"] .nav-arrow, #app[data-sheet="2"] .here, #app[data-sheet="2"] .here-sub { opacity: 0; visibility: hidden; pointer-events: none; }
  .draw { top: 64px; left: 16px; right: 16px; width: auto; }
  .toast { bottom: calc(var(--sheet-h, 18vh) + 70px); }
  .meal-now { padding: 4px 6px 4px 10px; font-size: 11.5px; }
  .meal-now .meal-txt { max-width: 92px; overflow: hidden; text-overflow: ellipsis; }
  .tools .lang { padding: 7px 8px; font-size: 12px; }
  #btn-help { padding: 7px; }
  #btn-help svg { width: 18px; height: 18px; }
}

/* 窄手機（440 px 以下）：品牌卡只留標誌與站名，工具列縮小間距，兩者才不會重疊 */
@media (max-width: 440px) {
  .brand { padding: 6px 10px 6px 6px; gap: 6px; }
  .brand-mark { width: 28px; height: 28px; }
  .brand h1 { font-size: 14px; letter-spacing: 0.03em; }
  .brand-sub { display: none; }
  .tools { gap: 0; padding: 3px; }
  .tools button, .tools .lang { padding: 7px 5px; }
  #btn-compass { padding: 6px 5px; }
  #btn-help { padding: 7px 5px; }
}
/* 更窄的手機（372 px 以下，例如 360 寬）：站名縮小、工具列按鈕再收窄，品牌卡與工具列至少相距 4 px */
@media (max-width: 372px) {
  .brand { padding: 6px 8px 6px 6px; gap: 5px; }
  .brand h1 { font-size: 12px; letter-spacing: 0.01em; }
  .tools button, .tools .lang, #btn-help { padding: 7px 3px; }
  #btn-compass { padding: 6px 3px; }
}
@media (max-width: 800px) {
  .panel[data-level="0"] .panel-body { visibility: hidden; }
  .time-toggle, .meal-now { white-space: nowrap; }
}
@media (max-width: 440px) {
  .meal-pre { display: none; }
  .time-toggle { padding: 10px 12px; }
}

/* 桌機：用餐時段鈕疊在時鐘正上方（與 HUD 右緣對齊），HUD 維持原寬度，不和小地圖、側欄、詳情卡搶位置；
   抽籤卡開啟時右側的下一區按鈕讓位，畫面不夠高時小地圖暫時隱藏 */
@media (min-width: 801px) {
  .meal-now { position: absolute; right: 0; bottom: calc(100% + 8px); }
  #app.draw-open .nav-next { right: calc(16px + 300px + 18px); }
}
@media (min-width: 801px) and (max-height: 820px) {
  #app.draw-open .minimap { opacity: 0; visibility: hidden; pointer-events: none; }
}

/* ── 階段 4B：推薦路線（側欄「路線」分頁、路線卡、停靠點編號牌）、HUD 天氣小卡、下雨提示 ── */
.tools #btn-routes svg { color: var(--peach); }
.tools #btn-routes.on { background: var(--peach); color: #fff; }
.tools #btn-routes.on svg { color: #fff; }
.panel.tab-routes .chips, .panel.tab-routes .result-reset { display: none; }
.rt-item { position: relative; width: 100%; display: flex; gap: 10px; padding: 10px 10px 10px 8px; border-radius: 14px; text-align: left; transition: background 0.15s; }
.rt-item:hover, .rt-item:focus-visible { background: rgba(255, 143, 171, 0.12); }
.rt-bar { flex: none; width: 6px; border-radius: 999px; background: var(--rc); }
.rt-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.rt-name { font-size: 14.5px; font-weight: 900; line-height: 1.35; }
.rt-intro, .rt-desc { font-size: 12px; line-height: 1.55; opacity: 0.85; }
.rt-meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.rt-meta span { padding: 1px 8px; border-radius: 999px; background: rgba(74, 59, 53, 0.07); font-size: 11px; font-weight: 800; color: var(--muted); }
:root[data-theme="dark"] .rt-meta span { background: rgba(255, 255, 255, 0.1); }
.rt-card { padding: 4px 4px 8px; }
.rt-back { display: inline-flex; align-items: center; gap: 2px; padding: 4px 10px 4px 4px; border-radius: 999px; font-size: 12.5px; font-weight: 800; color: var(--muted); }
.rt-back svg { width: 18px; height: 18px; }
.rt-back:hover { background: var(--peach-soft); color: var(--ink); }
.rt-title { margin: 6px 4px 0; padding-left: 12px; border-left: 5px solid var(--rc); font-size: 17px; font-weight: 900; line-height: 1.35; outline: none; }
.rt-desc { margin: 6px 4px 4px; }
.rt-card > .rt-meta { margin: 0 4px 8px; }
.rt-stops { position: relative; margin: 0; padding: 0 0 0 2px; list-style: none; }
.rt-stops::before { content: ""; position: absolute; left: 17px; top: 14px; bottom: 14px; width: 3px; border-radius: 3px; background: repeating-linear-gradient(to bottom, var(--rc) 0 6px, transparent 6px 10px); opacity: 0.7; }
.rt-stops li { position: relative; }
.rt-stop { width: 100%; display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 4px; border-radius: 12px; text-align: left; transition: background 0.15s; }
.rt-stop:hover, .rt-stop:focus-visible { background: rgba(255, 143, 171, 0.12); }
.rt-no { position: relative; flex: none; display: grid; place-items: center; width: 26px; height: 26px; margin-left: 2px; border-radius: 50%; background: var(--rc); color: #fff; font-size: 12.5px; font-weight: 900; box-shadow: 0 0 0 3px var(--paper, #fffaf2); font-variant-numeric: tabular-nums; }
.rt-txt { display: flex; flex-direction: column; min-width: 0; }
.rt-txt b { font-size: 13.5px; font-weight: 900; line-height: 1.35; }
.rt-txt small { font-size: 11.5px; font-weight: 700; color: var(--muted); }
.rt-ferry, .rt-pass { display: flex; align-items: center; gap: 10px; margin: 2px 0; padding: 6px 8px 6px 6px; border-radius: 12px; background: rgba(127, 178, 229, 0.16); font-size: 12.5px; font-weight: 800; }
.rt-ferry svg { position: relative; flex: none; width: 24px; height: 24px; padding: 3px; border-radius: 50%; background: #7fb2e5; color: #fff; }
.rt-pass { background: rgba(74, 59, 53, 0.06); }
.rt-pass .rt-no { background: #c9b8ae; font-size: 11px; }
.rt-empty { padding: 14px; font-size: 13px; font-weight: 700; color: #d4567a; }
/* 地圖上的停靠點編號牌（CSS2D） */
.rt-pin { pointer-events: auto; display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border-radius: 50%; background: var(--rc); border: 2.5px solid #fff; box-shadow: 0 3px 8px rgba(74, 59, 53, 0.3); color: #fff; font: 900 12px/1 var(--font); font-variant-numeric: tabular-nums; cursor: pointer; }
.rt-pin::after { content: ""; position: absolute; left: 50%; bottom: -7px; width: 0; height: 0; margin-left: -5px; border: 5px solid transparent; border-top: 6px solid #fff; border-bottom: 0; }
.rt-pin:hover { filter: brightness(1.08); }
/* 下雨提示 */
.rain-tip { display: flex; align-items: center; gap: 8px; margin: 2px 2px 6px; padding: 8px 12px; border-radius: 12px; background: rgba(127, 178, 229, 0.2); font-size: 12.5px; font-weight: 800; }
.rain-tip i { flex: none; width: 10px; height: 13px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: #5fa8e6; clip-path: polygon(50% 0, 100% 62%, 92% 88%, 50% 100%, 8% 88%, 0 62%); }
/* HUD 天氣小卡：時鐘右側；點開切換示範天氣 */
.wx { position: relative; display: flex; }
.wx-btn { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 8px; border-radius: var(--r-lg); background: var(--paper); backdrop-filter: blur(12px) saturate(1.2); -webkit-backdrop-filter: blur(12px) saturate(1.2); border: 1.5px solid rgba(255, 255, 255, 0.75); box-shadow: var(--shadow); white-space: nowrap; transition: background 0.2s, transform 0.15s; }
:root[data-theme="dark"] .wx-btn { border-color: rgba(255, 255, 255, 0.16); }
.wx-btn:hover { background: #fff6dc; color: #4a3b35; }
.wx-btn:active { transform: scale(0.97); }
.wx-ic svg { display: block; width: 30px; height: 30px; }
.wx-main { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.wx-main b { font-size: 17px; font-weight: 900; font-variant-numeric: tabular-nums; }
.wx-pop { font-size: 10.5px; font-weight: 800; color: var(--muted); }
.wx-src { align-self: center; padding: 2px 7px; border-radius: 999px; background: rgba(99, 199, 178, 0.2); color: #2f7f6d; font-size: 10.5px; font-weight: 900; }
.wx-src.demo { background: #ffe08a; color: #6d4c12; }
.wx-menu { position: absolute; left: 0; bottom: calc(100% + 8px); z-index: 7; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; width: 300px; padding: 8px; border-radius: var(--r-md); background: #fffaf2; color: #4a3b35; box-shadow: 0 14px 34px rgba(110, 72, 60, 0.2), 0 3px 8px rgba(110, 72, 60, 0.1); }
.wx-menu[hidden] { display: none; }
.wx-menu button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 12px; font-size: 12px; font-weight: 800; }
.wx-menu button svg { width: 28px; height: 28px; }
.wx-menu button:hover { background: #ffe1e8; }
.wx-menu button.on { background: #ffe08a; box-shadow: 0 2px 6px rgba(243, 198, 94, 0.4); }
.wx-note { grid-column: 1 / -1; margin: 2px 4px 0; font-size: 11px; line-height: 1.5; color: #8d7b72; }
@media (max-width: 800px) {
  .wx-btn { gap: 4px; padding: 4px 8px 4px 5px; }
  .wx-ic svg { width: 24px; height: 24px; }
  .wx-main b { font-size: 14px; }
  .wx-pop { display: none; }
  .wx-src { display: none; }
  .wx-btn::after { content: ""; position: absolute; top: 3px; right: 3px; width: 8px; height: 8px; border-radius: 50%; background: #ffd25e; box-shadow: 0 0 0 2px var(--cream); }
  .wx-menu { width: min(300px, calc(100vw - 20px)); left: -4px; }
}
/* 群組標記：座標重疊、放不下的多家店合成一點，拉遠顯示家數，點一下或拉近展開（CSS2D） */
.gp-badge { pointer-events: auto; display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: #fffaf2; border: 2.5px solid #ff8fab; box-shadow: 0 3px 8px rgba(74, 59, 53, 0.28); color: #4a3b35; font: 900 12px/1 var(--font); font-variant-numeric: tabular-nums; cursor: pointer; }
.gp-badge:hover { background: #fff1d6; }
.gp-badge.lit { background: #ffe08a; border-color: #f3c65e; }
.gp-badge.dim { opacity: 0.45; }
.gp-badge[hidden] { display: none; }
