/* 首頁（index.html）改版樣式：開場首頁、殺球動畫、選場地地圖。
   原本頁內的深色樣式已整段移到這裡，全部改用 vh.css 的 --vh-* token。
   深藍只用在殺球動畫（沉浸畫面）；首頁、地圖側欄、卡片都是紙色。 */

/* 紙色底上的 12–14px 小字：--vh-muted 在紙色上只有約 4.2:1，往墨色調一點到 4.5:1 以上 */
:root { --vh-index-label: color-mix(in srgb, var(--vh-muted) 70%, var(--vh-ink)); }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--vh-paper); color: var(--vh-ink); font-family: var(--vh-font); font-size: 16px; line-height: 1.75; }
button { font: inherit; color: inherit; }
a { color: var(--vh-ink); }
[hidden] { display: none !important; }

/* ───── 頂列：和其他頁的 .sitebar 同一套（vh.css），這裡只改成固定在畫面上 ───── */
#topbar.sitebar { position: fixed; top: 0; left: 0; right: 0; z-index: 35; }
body[data-view="intro"] #gohome { display: none !important; }

/* ───── 首頁 ───── */
#intro { position: fixed; inset: 0; z-index: 30; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding-top: 56px; background: var(--vh-paper); color: var(--vh-ink); transition: opacity .4s; }
.eyebrow { margin: 0; font: 500 13px/1 var(--vh-num); letter-spacing: .14em; text-transform: uppercase; color: var(--vh-index-label); }

.hero { position: relative; max-width: 1120px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; align-items: center;
  min-height: min(560px, calc(100svh - 56px - 150px)); padding: 48px max(16px, env(safe-area-inset-right, 0px)) 56px max(16px, env(safe-area-inset-left, 0px)); }
.hero h1 { margin: 16px 0 0; font-size: clamp(40px, 5.2vw, 56px); font-weight: 900; line-height: 1.15; letter-spacing: .02em; text-wrap: balance; }
.hero .lead { margin: 20px 0 0; max-width: 26em; font-size: 18px; line-height: 1.75; color: var(--vh-ink-2); text-wrap: pretty; }
.hero .lead .nb { display: inline-block; }   /* 依句讀換行，不要從詞中間斷開 */
.cta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; margin-top: 32px; }
.btn-primary { min-height: 52px; padding: 0 36px; border: 0; border-radius: 999px; background: var(--vh-ball); color: var(--vh-ball-ink); font-size: 18px; font-weight: 900; letter-spacing: .08em;
  cursor: pointer; box-shadow: var(--vh-shadow); transition: transform .15s, filter .15s; }
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.04); }
.btn-primary:disabled { cursor: progress; transform: none; filter: saturate(.7); }
.btn-text { min-height: 44px; padding: 0 2px; border: 0; background: none; color: var(--vh-ink); font-size: 16px; cursor: pointer;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px; }
.btn-text:hover { text-decoration-thickness: 2px; }
.stats { display: flex; gap: 40px; margin: 40px 0 0; padding-top: 20px; border-top: 1px solid var(--vh-line); max-width: 30em; }
.stats div { display: flex; flex-direction: column-reverse; gap: 8px; }
.stats dt { font-size: 14px; line-height: 1.4; color: var(--vh-index-label); }
.stats dd { margin: 0; font-size: 16px; line-height: 1; color: var(--vh-ink-2); white-space: nowrap; }
.stats dd b { font: 600 34px/1 var(--vh-num); color: var(--vh-ink); font-variant-numeric: tabular-nums; margin-right: 4px; }

/* 右邊：一張兩面場的平面圖（像球館規劃頁的圖紙），球當裝飾放在舉球弧線的頂端 */
.hero-art { position: relative; width: 100%; max-width: 520px; justify-self: end; aspect-ratio: 420 / 340; }
.plan { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.plan .axis path, .plan .axis circle { fill: none; stroke: var(--vh-muted); stroke-width: .8; opacity: .6; }
.plan .axis text { font: 500 8px var(--vh-num); fill: var(--vh-muted); text-anchor: middle; }
.plan .wall { fill: var(--vh-surface); stroke: var(--vh-ink); stroke-width: 2.5; }
.plan .zone rect { fill: none; stroke: var(--vh-court); stroke-width: .8; stroke-dasharray: 3 3; opacity: .7; }
.plan .court rect { fill: color-mix(in srgb, var(--vh-court) 20%, var(--vh-surface)); stroke: var(--vh-court); stroke-width: 1.2; }
.plan .court path { fill: none; stroke: var(--vh-court); stroke-width: .8; }
.plan .net path { stroke: var(--vh-ink); stroke-width: 1.4; }
.plan .net rect { fill: var(--vh-ink); }
.plan .rooms { fill: none; stroke: var(--vh-ink); stroke-width: 1.2; }
.plan .lbl { font: 700 11px var(--vh-font); fill: var(--vh-ink-2); text-anchor: middle; }
.plan .arc { fill: none; stroke: var(--vh-ink); stroke-width: 1.4; stroke-dasharray: 4 5; opacity: .75; }
.plan .shot { fill: none; stroke: var(--vh-ink); stroke-width: 2; stroke-dasharray: 2 4; }
.plan .hit circle { fill: none; stroke: var(--vh-ink); stroke-width: 1.2; }
.plan .hit circle + circle { opacity: .45; }
.plan .hit path { stroke: var(--vh-ink); stroke-width: 1.6; }
#ball { position: absolute; left: 62.7%; top: 3.4%; width: 17.4%; height: auto; aspect-ratio: 1; cursor: pointer; filter: drop-shadow(0 10px 14px rgba(19, 35, 58, .22)); }

/* 三張步驟卡 */
.how { max-width: 1120px; margin: 0 auto; padding: 0 max(16px, env(safe-area-inset-right, 0px)) 64px max(16px, env(safe-area-inset-left, 0px)); }
.how-head { display: grid; gap: 12px; margin-bottom: 24px; }
.how h2 { margin: 0; font-size: 28px; font-weight: 700; line-height: 1.3; text-wrap: balance; }
.steps-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.step a { display: flex; flex-direction: column; gap: 6px; height: 100%; padding-bottom: 22px; overflow: hidden; border-radius: var(--vh-r); background: var(--vh-surface);
  border: 1px solid var(--vh-line); color: var(--vh-ink); text-decoration: none; box-shadow: var(--vh-shadow); transition: transform .2s, border-color .2s; }
.step a:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--vh-ink) 45%, var(--vh-line)); }
.step img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; background: var(--vh-paper); border-bottom: 1px solid var(--vh-line); margin-bottom: 14px; }
.step .num, .step h3, .step p, .step .more { padding: 0 22px; }
.step .num { font: 500 12px/1 var(--vh-num); letter-spacing: .14em; text-transform: uppercase; color: var(--vh-index-label); }
.step h3 { margin: 4px 0 0; font-size: 20px; font-weight: 700; line-height: 1.4; }
.step p { margin: 0; font-size: 16px; line-height: 1.75; color: var(--vh-ink-2); }
.step .more { margin-top: auto; padding-top: 10px; font-weight: 700; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px; }

.foot { max-width: 1120px; margin: 0 auto; display: grid; gap: 4px; padding: 24px max(16px, env(safe-area-inset-right, 0px)) max(40px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  border-top: 1px solid var(--vh-line); color: var(--vh-index-label); font-size: 14px; line-height: 1.6; }
.foot p { margin: 0; }

/* ───── 殺球動畫（深藍、全螢幕）───── */
#anim3d, #anim { position: fixed; inset: 0; z-index: 41; width: 100%; height: 100%; display: block; pointer-events: none; background: var(--vh-navy); opacity: 0; transition: opacity .3s ease; }
#anim3d.on, #anim.on { opacity: 1; }
/* 球撞上鏡頭後：整個畫面往前衝、0.3 秒內淡掉，下面的地圖接著對焦 */
#anim3d.leave, #anim.leave { transition: transform .35s cubic-bezier(.3, .7, .2, 1), opacity .28s ease, filter .35s ease; transform: scale(1.25); opacity: 0; filter: blur(8px) brightness(1.3); }
#phase { position: fixed; z-index: 42; left: max(16px, env(safe-area-inset-left, 0px)); bottom: max(24px, env(safe-area-inset-bottom, 0px)); display: flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 0 18px; border-radius: 999px; background: color-mix(in srgb, var(--vh-navy) 72%, transparent); border: 1px solid color-mix(in srgb, var(--vh-paper) 16%, transparent);
  color: var(--vh-paper); font-size: 16px; letter-spacing: .08em; pointer-events: none; backdrop-filter: blur(6px); transition: opacity .3s; }
#phase b { color: var(--vh-ball); font-family: var(--vh-num); font-weight: 600; }
#phase span { font-weight: 700; }
#phase.leave { opacity: 0; }
#skipanim { position: fixed; z-index: 43; right: max(16px, env(safe-area-inset-right, 0px)); bottom: max(24px, env(safe-area-inset-bottom, 0px)); min-height: 44px; padding: 0 20px;
  border-radius: 999px; border: 1px solid color-mix(in srgb, var(--vh-paper) 40%, transparent); background: color-mix(in srgb, var(--vh-navy) 64%, transparent); color: var(--vh-paper);
  font-size: 16px; font-weight: 700; letter-spacing: .04em; cursor: pointer; backdrop-filter: blur(6px); }
#skipanim:hover { background: var(--vh-navy); border-color: var(--vh-paper); }
.fadeout { position: fixed; inset: 0; z-index: 50; pointer-events: none; opacity: 0; transition: opacity .5s;
  background: radial-gradient(circle at 50% 50%, var(--vh-surface) 0, color-mix(in srgb, var(--vh-paper) 80%, transparent) 35%, transparent 75%); }

/* ───── 地圖 ───── */
#map { position: fixed; inset: 0; z-index: 1; background: var(--vh-paper); }
.leaflet-container { font-family: var(--vh-font); background: var(--vh-paper); }
/* 衛星底圖淡化：顏色不搶，圓點與文字才看得清楚 */
#map .leaflet-tile-pane { filter: grayscale(1) sepia(.2) brightness(1.5) contrast(.6); }
.leaflet-pane .mask-out { fill: var(--vh-paper); fill-opacity: .72; }
.leaflet-pane .region-line { stroke: var(--vh-ink); stroke-opacity: .5; }
.leaflet-pane .ring { stroke: var(--vh-ink); stroke-opacity: .5; }
.ring-label { background: transparent; border: 0; box-shadow: none; padding: 0; color: var(--vh-ink); font: 500 12px/1 var(--vh-num); letter-spacing: .04em;
  text-shadow: 0 0 2px var(--vh-paper), 0 0 4px var(--vh-paper), 0 0 6px var(--vh-paper); }
.ring-label::before { display: none; }

/* 候選場地：16–20px 圓點寫等級（A 綠、B 黃、C 灰）；外圍 28px 是點擊範圍 */
.pin-wrap { background: none; border: 0; }
.pin { width: 28px; height: 28px; display: grid; place-items: center; animation: pinIn .35s cubic-bezier(.2, 1.4, .4, 1) both; }
.pin b { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font: 600 11px/1 var(--vh-num); color: var(--vh-surface);
  box-shadow: 0 0 0 2px var(--vh-surface), 0 1px 4px rgba(19, 35, 58, .45); transition: transform .2s, opacity .2s; }
.pin.A b { background: var(--vh-ok); }
.pin.B b { background: var(--vh-warn); }
.pin.C b { background: var(--vh-muted); }
.pin.off b { transform: scale(.62); opacity: .55; color: transparent; }
.pin:hover b { transform: scale(1.18); }
.pin.sel b { transform: scale(1.45); box-shadow: 0 0 0 2px var(--vh-surface), 0 0 0 3.5px var(--vh-ink), 0 2px 8px rgba(19, 35, 58, .45); }
@keyframes pinIn { from { transform: scale(0); opacity: 0; } to { transform: none; opacity: 1; } }
/* 現有球館：小的深藍方塊（數字＝面數）；公立運動中心是白底方塊 */
.vpin { width: 18px; height: 18px; margin: 3px; border-radius: 3px; display: grid; place-items: center; background: var(--vh-navy); color: var(--vh-surface);
  font: 600 11px/1 var(--vh-num); box-shadow: 0 0 0 1.5px var(--vh-surface), 0 1px 4px rgba(19, 35, 58, .45); }
.vpin.pub { background: var(--vh-surface); color: var(--vh-navy); font: 700 10px/1 var(--vh-font); box-shadow: inset 0 0 0 1.5px var(--vh-navy), 0 1px 4px rgba(19, 35, 58, .45); }
.vlabel { background: var(--vh-surface); color: var(--vh-ink); border: 1px solid var(--vh-line); border-radius: 6px; padding: 2px 8px; font-size: 12px; font-weight: 700; box-shadow: var(--vh-shadow); }
.vlabel::before { display: none; }

/* 候選場地側欄（電腦）／底部抽屜（手機） */
.panel { position: fixed; z-index: 15; top: 68px; left: max(16px, env(safe-area-inset-left, 0px)); bottom: 16px; width: 360px; display: flex; flex-direction: column;
  background: var(--vh-surface); color: var(--vh-ink); border: 1px solid var(--vh-line); border-radius: 14px; box-shadow: var(--vh-shadow); overflow: hidden; transition: transform .4s, opacity .4s; }
.panel.away { transform: translateX(-110%); opacity: 0; }
.p-handle { display: none; }
.p-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.p-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--vh-line); }
.p-head h2 { margin: 0 0 4px; font-size: 20px; font-weight: 700; line-height: 1.4; }
.p-head .meta { font-size: 14px; line-height: 1.6; color: var(--vh-muted); }
.p-head .meta b { color: var(--vh-ink); font-family: var(--vh-num); font-weight: 600; font-variant-numeric: tabular-nums; }
.filters { display: flex; flex-direction: column; gap: 12px; padding: 10px 20px 12px; border-bottom: 1px solid var(--vh-line); }
.ftoggle { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 36px; padding: 0; border: 0; background: none; color: var(--vh-ink);
  font-size: 16px; font-weight: 700; text-align: left; white-space: nowrap; cursor: pointer; }
.ftoggle i { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-style: normal; font-size: 14px; font-weight: 400; color: var(--vh-muted); text-align: right; }
.ftoggle i { margin-left: auto; }
.ftoggle::after { content: "▾"; flex: none; margin-left: -4px; font-size: 14px; color: var(--vh-ink-2); }
.ftoggle[aria-expanded="true"]::after { content: "▴"; }
.fbody { display: flex; flex-direction: column; gap: 14px; }
.frow { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--vh-ink-2); }
.frow .lab { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.frow .lab b { color: var(--vh-ink); font-weight: 700; }
.frow input[type=range] { width: 100%; accent-color: var(--vh-ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { min-height: 32px; padding: 2px 12px; border: 1px solid var(--vh-line); border-radius: 999px; background: var(--vh-surface); color: var(--vh-ink-2); font-size: 14px; cursor: pointer; }
.chips button:hover { border-color: var(--vh-ink-2); }
.chips button[aria-pressed="true"] { background: var(--vh-ink); border-color: var(--vh-ink); color: var(--vh-surface); font-weight: 700; }
.chips button i { margin-left: 4px; font-style: normal; font-size: 12px; opacity: .75; }
.chips button.zero:not([aria-pressed="true"]) { opacity: .55; }
.chips button .x { margin-left: 6px; font-weight: 900; opacity: .8; }
.chips button.custom { border-style: dashed; }
.hint { margin-left: 6px; font-size: 12px; font-weight: 400; color: var(--vh-muted); }
.addtown { display: flex; gap: 6px; margin-top: 8px; }
.addtown input { flex: 1; min-width: 0; min-height: 36px; padding: 4px 10px; font: inherit; font-size: 16px; color: var(--vh-ink); background: var(--vh-paper); border: 1px solid var(--vh-line); border-radius: 8px; }
.addtown button { min-height: 36px; padding: 0 16px; border: 1.5px solid var(--vh-ink); border-radius: 999px; background: transparent; color: var(--vh-ink); font-size: 14px; font-weight: 700; cursor: pointer; }
.addtown button:hover { background: var(--vh-ink); color: var(--vh-surface); }
.tq { display: flex; gap: 8px; margin-top: 4px; }
.tq button, .tlink { padding: 2px 2px; border: 0; background: none; color: var(--vh-ink-2); font-size: 14px; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
#f-reset { align-self: flex-start; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--vh-ink-2); cursor: pointer; }
.chk input { width: 16px; height: 16px; margin: 0; accent-color: var(--vh-ink); }
.list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; padding: 4px 8px 12px; }
.item { all: unset; box-sizing: border-box; cursor: pointer; display: grid; grid-template-columns: 28px 1fr; gap: 2px 12px; padding: 12px; border-radius: 10px; }
.item + .item { box-shadow: inset 0 1px 0 var(--vh-line); }
.item:hover { background: var(--vh-paper); }
.item.on { background: var(--vh-paper); box-shadow: inset 0 0 0 1.5px var(--vh-ink); }
.item.off { opacity: .45; }
.item:focus-visible { outline: 2px solid var(--vh-ball); outline-offset: -2px; }
.g { grid-row: span 2; width: 28px; height: 28px; margin-top: 2px; border-radius: 50%; display: grid; place-items: center; font: 600 14px/1 var(--vh-num); color: var(--vh-surface); }
.g.A { background: var(--vh-ok); } .g.B { background: var(--vh-warn); } .g.C { background: var(--vh-muted); }
.item .nm { font-size: 16px; font-weight: 700; line-height: 1.45; }
.item .sp { font-size: 14px; line-height: 1.6; color: var(--vh-ink-2); }
.item .sp em { font-style: normal; font-weight: 700; color: var(--vh-ink); }
.memtag { margin-left: 4px; font-style: normal; font-size: 12px; font-weight: 700; color: var(--vh-ok); white-space: nowrap; }
.memline { margin: 8px 0 10px; font-size: 14px; color: var(--vh-ok); }
.p-foot { padding: 10px 20px 14px; border-top: 1px solid var(--vh-line); font-size: 14px; line-height: 1.6; color: var(--vh-muted); }

.legend { position: fixed; z-index: 15; right: max(16px, env(safe-area-inset-right, 0px)); bottom: 32px; display: grid; gap: 8px; padding: 12px 14px;
  background: color-mix(in srgb, var(--vh-surface) 94%, transparent); border: 1px solid var(--vh-line); border-radius: var(--vh-r); box-shadow: var(--vh-shadow);
  font-size: 12px; line-height: 1.5; color: var(--vh-ink-2); transition: opacity .4s; }
.legend div { display: flex; align-items: center; gap: 6px; }
.legend i { flex: none; width: 16px; height: 16px; display: grid; place-items: center; font-style: normal; font: 600 10px/1 var(--vh-num); color: var(--vh-surface); }
.lg-dot { border-radius: 50%; }
.lg-dot.A { background: var(--vh-ok); } .lg-dot.B { background: var(--vh-warn); } .lg-dot.C { background: var(--vh-muted); margin-right: 4px; }
.lg-sq { border-radius: 3px; background: var(--vh-navy); }
.lg-sq.pub { background: var(--vh-surface); color: var(--vh-navy) !important; box-shadow: inset 0 0 0 1.5px var(--vh-navy); font-family: var(--vh-font) !important; font-size: 9px !important; }
.lg-ring { border-radius: 50%; border: 1px dashed var(--vh-ink); }
.toast { position: fixed; z-index: 25; left: 50%; top: 72px; transform: translateX(-50%); max-width: calc(100vw - 32px); padding: 10px 20px; border-radius: 999px;
  background: var(--vh-ink); color: var(--vh-paper); font-size: 14px; line-height: 1.5; text-align: center; box-shadow: var(--vh-shadow); transition: opacity .4s; pointer-events: none; }

/* 場地小卡（Leaflet popup） */
.leaflet-popup.card .leaflet-popup-content-wrapper { background: var(--vh-surface); color: var(--vh-ink); border: 1px solid var(--vh-line); border-radius: 14px;
  box-shadow: 0 2px 4px rgba(19, 35, 58, .08), 0 18px 40px -12px rgba(19, 35, 58, .35); }
.leaflet-popup.card .leaflet-popup-tip { background: var(--vh-surface); box-shadow: none; }
.leaflet-popup.card .leaflet-popup-content { width: 300px !important; margin: 18px 18px 16px; font-size: 14px; line-height: 1.6; }
.leaflet-container .leaflet-popup.card a.leaflet-popup-close-button { width: 36px; height: 36px; font: 22px/36px var(--vh-font); color: var(--vh-muted); }
.leaflet-popup.card a:not(.enter):not(.leaflet-popup-close-button) { color: var(--vh-ink); text-decoration: underline; text-underline-offset: 3px; }
.pc-top { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; padding-right: 18px; }
.pc-top h3 { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.4; }
.pc-top .loc { font-size: 13px; line-height: 1.5; color: var(--vh-muted); }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px; }
.fact { padding: 8px 10px; border-radius: 8px; background: var(--vh-paper); }
.fact b { display: block; font: 600 20px/1.25 var(--vh-num); color: var(--vh-ink); font-variant-numeric: tabular-nums; }
.fact span { font-size: 12px; line-height: 1.5; color: var(--vh-index-label); }
.fact.wide { grid-column: span 2; }
.fact.wide b { font: 700 14px/1.5 var(--vh-font); }
.pc-note { margin: 0 0 8px; font-size: 14px; color: var(--vh-ink-2); }
.pc-links { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 14px; font-size: 14px; }
.vcard { padding-right: 16px; }
.vcard h3 { margin: 0 0 2px; font-size: 16px; font-weight: 700; line-height: 1.4; }
.vcard p { margin: 0 0 6px; }
.vcard .pc-addr { font-size: 13px; color: var(--vh-muted); }
.enter { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 48px; padding: 10px 16px; border: 0; border-radius: 999px; background: var(--vh-ball);
  color: var(--vh-ball-ink) !important; font-size: 16px; font-weight: 900; text-align: center; text-decoration: none; cursor: pointer; }
.enter:hover { filter: brightness(1.05); }
.enter.sm { min-height: 40px; margin-top: 10px; font-size: 14px; }

.leaflet-container .leaflet-control-attribution { background: color-mix(in srgb, var(--vh-surface) 85%, transparent); color: var(--vh-muted); font-size: 11px; }
.leaflet-control-attribution a { color: var(--vh-ink-2) !important; }
.leaflet-top.leaflet-right { top: 60px; }
.leaflet-touch .leaflet-bar, .leaflet-bar { border: 1px solid var(--vh-line); border-radius: 8px; box-shadow: var(--vh-shadow); overflow: hidden; }
.leaflet-bar a, .leaflet-touch .leaflet-bar a { background: var(--vh-surface); color: var(--vh-ink); border-bottom-color: var(--vh-line); }
.leaflet-bar a:hover { background: var(--vh-paper); }

/* 從殺球動畫接到地圖：飛行時先藏起圈線、遮罩、圓點（Leaflet 會用 CSS 放大舊的 SVG，看起來很糊） */
#map .leaflet-overlay-pane, #map .leaflet-marker-pane, #map .leaflet-tooltip-pane, #map .leaflet-mask-pane { transition: opacity .6s ease; }
#map.flying .leaflet-overlay-pane, #map.flying .leaflet-marker-pane, #map.flying .leaflet-tooltip-pane, #map.flying .leaflet-mask-pane, #map.flying .leaflet-shadow-pane { opacity: 0; visibility: hidden; transition: none; }
#map.focusing { filter: blur(4px) brightness(1.05); transform: scale(1.04); }
#map.focused { transition: filter .9s ease, transform 1s cubic-bezier(.2, .7, .2, 1); filter: none; transform: none; }
body[data-view="map"] .panel:not(.away), body[data-view="map"] #legend:not([hidden]) { animation: vhIn .7s cubic-bezier(.2, .7, .2, 1) .1s both; }
@keyframes vhIn { from { opacity: 0; } to { opacity: 1; } }

/* ───── 手機 ───── */
@media (max-width: 960px) {
  .hero { grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: 32px; }
}
@media (max-width: 760px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 0; min-height: 0; padding-top: 32px; padding-bottom: 40px; }
  .hero h1 { margin-top: 14px; font-size: 36px; }
  .hero .lead { margin-top: 14px; }
  .hero-art { position: absolute; top: 16px; right: max(12px, env(safe-area-inset-right, 0px)); width: 92px; max-width: none; aspect-ratio: 1; }
  .plan { display: none; }
  #ball { position: static; width: 100%; }
  .cta { flex-direction: column; align-items: stretch; gap: 4px; margin-top: 28px; }
  .btn-primary { width: 100%; }
  .btn-text { align-self: center; }
  .stats { justify-content: space-between; gap: 16px; margin-top: 28px; }
  .stats dd b { font-size: 28px; }
  .how { padding-bottom: 48px; }
  .how h2 { font-size: 24px; }
  .steps-list { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .step img { aspect-ratio: 16 / 9; }

  #phase { font-size: 14px; padding: 0 14px; }
  #skipanim { padding: 0 16px; }

  /* 候選清單 → 底部抽屜，預設只有一行「N 間候選場地 ▲」 */
  .panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 78svh; border-radius: 16px 16px 0 0; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -8px 24px -12px rgba(19, 35, 58, .3); }
  .panel.away { transform: translateY(110%); }
  .p-handle { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 60px; padding: 8px 20px 0;
    border: 0; background: none; color: var(--vh-ink); font-size: 16px; font-weight: 700; text-align: left; cursor: pointer; }
  .p-handle::before { content: ""; position: absolute; top: 7px; left: 50%; width: 36px; height: 4px; border-radius: 2px; background: var(--vh-line); transform: translateX(-50%); }
  .p-handle b { margin-right: 2px; font: 600 22px/1 var(--vh-num); font-variant-numeric: tabular-nums; }
  .p-handle i { font-style: normal; font-size: 12px; color: var(--vh-ink-2); }
  .p-body { display: none; }
  .panel.open .p-body { display: flex; height: calc(78svh - 60px); }
  .p-head { padding: 4px 20px 10px; }
  .p-head h2 { display: none; }
  .legend { display: none; }
  .toast { top: 68px; }
  .leaflet-popup.card .leaflet-popup-content { width: 264px !important; max-height: calc(100svh - 56px - 84px - 72px); overflow-y: auto; margin: 16px 14px 14px 16px; }
  .pc-note { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .fact b { font-size: 18px; }
  .fact.wide { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 6px 10px; }
  .fact.wide span { flex: none; }
}
@media (max-width: 380px) {
  .hero h1 { font-size: 32px; }
  .hero-art { width: 76px; }
}
/* 手機橫拿（矮螢幕） */
@media (orientation: landscape) and (max-height: 520px) {
  .hero { min-height: 0; padding-top: 24px; padding-bottom: 32px; }
  .hero h1 { font-size: 36px; }
  .stats { margin-top: 24px; }
  .panel { top: 64px; bottom: 8px; width: 270px; left: max(8px, env(safe-area-inset-left, 0px)); }
  .p-head { padding: 10px 16px 8px; }
  .p-head h2 { font-size: 16px; }
  .filters { padding: 6px 16px 8px; }
  .p-foot { display: none; }
  .legend { display: none; }
  .leaflet-popup.card .leaflet-popup-content { max-height: calc(100vh - 110px); overflow: auto; }
  #phase { bottom: 10px; font-size: 14px; min-height: 36px; }
  #skipanim { bottom: 10px; min-height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  #anim3d.leave, #anim.leave, #map.focused, .panel, #legend { transition: none !important; animation: none !important; }
  .pin { animation: none; }
}
