/* =========================
   換電站地圖.css（整檔覆蓋版）
   乾淨玻璃感｜一致按鈕｜美化 Popup
   ========================= */
* { box-sizing: border-box; }
html, body { height: 100%; }
:root{
  --nav-h: 56px;
  --bg: #0b0e12;
  --glass: rgba(16,18,27,.55);
  --chip: rgba(255,255,255,.92);
  --text: #111827;
  --muted: #6b7280;
  --primary: #1c7ed6;
  --shadow-1: 0 10px 30px rgba(0,0,0,.25);
  --shadow-2: 0 6px 18px rgba(0,0,0,.18);
}
@media (max-width: 480px){ :root{ --nav-h: 54px; } }

body{
  margin:0;
  font-family: "Noto Sans TC", system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial;
  background: var(--bg);
  color:#fff;
}

/* --- 導覽列 --- */
.main-navbar{
  position: fixed; inset: 0 0 auto 0; height: var(--nav-h);
  z-index: 9999;
  background: rgba(10,109,202,.75);
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  padding: .2rem 1.2rem;
}
.nav-container{ max-width: 1200px; margin:0 auto; height:100%;
  display:flex; align-items:center; justify-content:space-between; }
.nav-left .logo{ height: 46px; display:block; }
.nav-right{ display:flex; gap:1.1rem; }
.nav-right a{ color:#fff; font-weight:800; text-decoration:none; }
.nav-right a:hover{ color:#63e6be; }
@media (max-width:580px){ .nav-left .logo{ height:40px; } }

/* --- 地圖滿版 --- */
#mapRoot{ position: fixed; inset: var(--nav-h) 0 0 0; z-index:0; }
#swapMap{ position:absolute; inset:0; }

/* --- 浮動 UI --- */
.map-overlay{ position:absolute; z-index:10; display:flex; gap:.5rem; align-items:center; }

/* --- 強制底部藥丸上下排列（放在檔案最後，帶 !important 提升權重） --- */
.map-overlay.bottom-center{
  left:50% !important;
  transform:translateX(-50%) !important;
  bottom:.9rem !important;
  display:flex !important;
  flex-direction: column !important;
  align-items: center !important;  /* 想靠左就改成 flex-start */
  gap:.6rem !important;
}

/* 兩顆藥丸的寬度行為：最近站可換行、訪問數單行 */
.nearest-pill{
  max-width: 92vw;              /* 讓長站名能換行但不超出螢幕 */
  white-space: normal !important;
}
.visit-pill{
  white-space: nowrap !important; /* 訪問數保持一行 */
}

.pill-btn{
  border:0; padding:.48rem .86rem; border-radius:999px;
  background: var(--glass); color:#fff; font-weight:900; letter-spacing:.3px;
  backdrop-filter: blur(8px); box-shadow: var(--shadow-2);
  transition: transform .06s ease, filter .15s ease;
}
.pill-btn:hover{ filter:brightness(1.05); }
.pill-btn:active{ transform: translateY(1px) scale(.98); }

.pill-chip{
  padding:.46rem .86rem; border-radius:999px; font-weight:900; color:#222;
  background: var(--chip); box-shadow: var(--shadow-2);
}

.visit-pill{
  padding:.42rem .86rem; border-radius:999px; font-weight:800;
  background: var(--glass); color:#fff; backdrop-filter: blur(8px);
  box-shadow: var(--shadow-2);
}

/* --- MapLibre 控制輕量美化（+/-、羅盤） --- */
.maplibregl-ctrl-group{ border-radius:12px; box-shadow: var(--shadow-2); overflow:hidden; }
.maplibregl-ctrl button{
  background:#fff; border:0; width:32px; height:32px;
}
.maplibregl-ctrl button:hover{ background:#f2f4f7; }

/* =======================
   Popup 卡片樣式
   ======================= */
.maplibregl-popup{ max-width: 320px; }
.maplibregl-popup-content{
  padding: 14px 14px 12px;
  border-radius: 16px;
  background:#fff; color: var(--text);
  box-shadow: var(--shadow-1);
}
.popup-title{
  font-weight:900; font-size:1rem; line-height:1.2;
  color: var(--text); margin:0 0 .4rem 0;
  display:flex; gap:.5rem; align-items:center; flex-wrap:wrap;
}
.badge{ font-size:.72rem; font-weight:800; padding:.2rem .5rem; border-radius:999px; letter-spacing:.5px; }
.badge-ionex{ background:#e6f4ff; color:#0b6bcb; }
.badge-gogoro{ background:#e6fff8; color:#0a8f6d; }
.badge-other{ background:#eef2f6; color:#334155; }

.popup-addr{ font-size:.9rem; color:#374151; margin:.1rem 0 .45rem; }
.popup-meta{ font-size:.85rem; color: var(--muted); margin:0 0 .6rem; }

.popup-actions{ display:flex; gap:.5rem; }
.popup-actions .btn{
  border:0; border-radius:12px; padding:.5rem .85rem;
  background: var(--primary); color:#fff; font-weight:900; cursor:pointer;
  box-shadow: var(--shadow-2);
}
.popup-actions .btn:hover{ filter:brightness(.95); }

/* =======================
   站內導航資訊卡
   ======================= */
.dir-card{
  position:absolute; left:50%; transform:translateX(-50%);
  bottom:4.6rem; z-index:12;
  background:#fff; color:var(--text);
  border-radius:16px; box-shadow: var(--shadow-1);
  padding:.75rem .95rem; min-width:240px; max-width:92vw;
  font-family:"Noto Sans TC", system-ui, -apple-system, Segoe UI, Roboto;
}
.dir-title{ font-weight:900; margin-bottom:.25rem; }
#dirMeta.dir-meta{ font-size:.92rem; color:#374151; margin-bottom:.5rem; }
.dir-actions{ display:flex; gap:.5rem; }
.dir-btn{
  border:0; border-radius:12px; padding:.5rem .85rem;
  background:#e9ecef; color:#111; font-weight:900; cursor:pointer;
}
.dir-btn:hover{ filter:brightness(.97); }

@media (max-width: 480px){
  .pill-btn, .visit-pill{ font-size:.92rem; }
  .pill-chip{ font-size:.92rem; }
  .dir-card{ bottom:4.2rem; }
}
/* 自訂圓形 Marker（品牌顏色＋陰影） */
.marker {
  width: 22px; height: 22px;
  border-radius: 999px;
  box-shadow: 0 6px 14px rgba(0,0,0,.25);
  display: grid; place-items: center;
  transform: translateY(-2px);
}
.marker.ionex  { background: radial-gradient(circle at 30% 30%, #2ea8ff, #1c7ed6); }
.marker.gogoro { background: radial-gradient(circle at 30% 30%, #27d2b2, #11a085); }
.marker.other  { background: radial-gradient(circle at 30% 30%, #9aa4af, #6b7280); }
.marker::after{
  content:"";
  width: 6px; height: 6px; border-radius: 50%;
  background: #fff; opacity: .95;
}

/* 最近站藥丸 */
.nearest-pill{
  display:none; /* 未定位前不顯示 */
  margin-bottom: .4rem;
  padding:.46rem .86rem; border-radius:999px;
  background: rgba(255,255,255,.95); color:#111; font-weight:900;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
  cursor:pointer;
}
.nearest-pill small{ font-weight:700; color:#6b7280; margin-left:.35rem; }
.nearest-pill:hover{ filter:brightness(.98); }
.popup-actions .btn.alt{ background:#e9ecef; color:#111; }
.popup-actions .btn.alt:hover{ filter:brightness(.97); }

/* 隱藏右下角 MapLibre 版權與 logo */
.maplibregl-ctrl-bottom-right {
  display: none !important;
}

/* 自訂版權：左下角 */
.custom-attribution {
  position: absolute;
  bottom: 5px;
  left: 5px;
  font-size: 10px;
  color: white;
  background: rgba(0, 0, 0, 0.5);
  padding: 3px 6px;
  border-radius: 4px;
  user-select: none;
  pointer-events: none; /* 不會擋到滑鼠操作 */
}

/* ============ 宮廟標籤（marker 名稱） ============ */
.marker-label {
  position: absolute;
  top: -28px;              /* 標籤往上，不會蓋住圓點 */
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255,255,255,0.95);
  color: #111;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  white-space: nowrap;     /* 名稱單行顯示 */
  pointer-events: none;    /* 不影響滑鼠事件，仍可點 Marker */
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}

.marker {
  position: relative;      /* 為了讓 label 定位在 Marker 上 */
}

/* ============ Marker 容器（名稱在上、圓點在下） ============ */
.marker-wrap{
  display: flex;
  flex-direction: column;     /* 直排：上面是 label、下面是 dot */
  align-items: center;
  transform: translateY(-2px);
  pointer-events: auto;       /* 仍可點擊打開 popup */
}

/* 名稱標籤 */
.marker-label{
  background: rgba(255,255,255,.95);
  color: #111;
  font-size: 12px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 8px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
  margin-bottom: 6px;         /* 與圓點的間距 */
  pointer-events: none;       /* 不擋滑鼠事件 */
}

/* 圓點本體（沿用你原本的樣式） */
.marker{
  width: 22px; height: 22px;
  border-radius: 999px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.055);
  display: grid; place-items: center;
}
.marker.ionex  { background: radial-gradient(circle at 30% 30%, #2ea8ff, #1c7ed6); }
.marker.gogoro { background: radial-gradient(circle at 30% 30%, #27d2b2, #11a085); }
.marker.other  { background: radial-gradient(circle at 30% 30%, #9aa4af, #6b7280); }
.marker::after{
  content:""; width:6px; height:6px; border-radius:50%; background:#fff; opacity:.95;
}

/* 手機螢幕或縮很遠時可以自動隱藏名稱（選用） */
@media (max-width: 480px){
  .marker-label{ display: none; }
}
/* 強制在所有裝置顯示宮廟名稱 */
.marker-label{ display:inline-block !important; }

/* ===== Pitch 設定按鈕樣式 ===== */
.pitch-settings { position: relative; display: inline-block; margin-top: 6px; }

/* 小齒輪按鈕（使用既有 pill-btn 基本樣式，再客製化） */
.settings-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  box-shadow: 0 6px 18px rgba(10,10,10,0.12);
  background: #1d1d1d9d;
  color: #222;
  border: 1px solid rgba(0,0,0,0.06);
  cursor: pointer;
}

/* 選單容器（預設隱藏） */
.pitch-menu {
  position: absolute;
  left: 0;
  top: 48px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  min-width: 92px;
  background: #0000004f;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(10,10,10,0.12);
  transform-origin: top left;
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 9999;
}

/* 選單開啟 */
.pitch-settings.open .pitch-menu {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

/* 選單按鈕微調（可共用 .pill-btn） */
.pitch-menu .pill-btn {
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 8px;
  background: #181818cb;
  border: 1px solid rgba(0,0,0,0.06);
  text-align: center;
  cursor: pointer;
}

/* hover 樣式 */
.pitch-menu .pill-btn:hover { background: #0000004f; box-shadow: 0 6px 14px rgba(10,10,10,0.06); }

/* 手機或窄寬畫面時微調位置 */
@media (max-width: 720px) {
  .pitch-menu { left: 0; top: 46px; min-width: 86px; }
  .settings-btn { width: 36px; height: 36px; font-size: 16px; }
}
/* --- 美食標記樣式 --- */
.marker.food {
  background: radial-gradient(circle at 30% 30%, #ffb84d, #ff6b6b);
  box-shadow: 0 6px 14px rgba(255, 107, 107, .35);
}
.marker.food::after {
  content: "🍴";
  font-size: 11px;
  color: #fff;
}
.badge-food {
  background: #fff1e6;
  color: #c2410c;
}
.sidebar {
  position: absolute;
  top: var(--nav-h);
  left: 15px;
  width: 320px;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(12px);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  z-index: 9999 !important;
  display: flex;
  flex-direction: column;
}

/* === 🍜 Sidebar 標題外觀（最終版） === */
.sidebar h2 {
  margin-top: 20px !important;       /* 🔥 上面與導覽列保持距離 */
  margin-bottom: 20px !important;    /* 🔥 底部留出呼吸感 */
  padding: 14px 20px !important;
  border-radius: 40px !important;    /* 藥丸外觀 */
  background: linear-gradient(135deg, #ff6b6b, #ffb84d);
  color: white !important;
  text-align: center;
  font-weight: 900;
  font-size: 1.1rem;
}


/* === Sidebar 整體的位置調整 === */
.sidebar {
  position: absolute;
  top: var(--nav-h);
  left: 15px;
  width: 320px;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(12px);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  z-index: 9999 !important;
  display: flex;
  flex-direction: column;
}



.sidebar h2 {
  font-size: 1.1rem;
  margin-bottom: 10px;
  color: #444;
}

.sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar li {
  margin-bottom: 12px;
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  transition: background 0.25s;
}

.sidebar li:hover {
  background: #ffe9e3;
}
.sidebar li.active {
  background: linear-gradient(135deg, #ffb84d, #ff6b6b);
  color: #fff;
}



.sub-list {
  list-style: none;
  padding: 8px 12px;
  margin: 0;
  background: #fff;
}

.sub-list li {
  padding: 6px 4px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
}
.sub-list li:hover {
  background: #ffe9e3;
}
/* === 地圖控制列修正 === */
.map-overlay {
  position: absolute;
  z-index: 9999; /* 🔥 讓控制列永遠在最上層 */
  font-family: "Noto Sans TC", sans-serif;
  backdrop-filter: none !important; /* 🚫 取消模糊 */
}

/* --- 左上角控制列：改放在清單右邊 --- */
.map-overlay.top-left {
  position: absolute;
  top: 0px; /* 與導航列對齊 */
  left: 320px; /* 根據 sidebar 寬度 + 一點間距 */
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  z-index: 3000;
  background: rgba(255, 255, 255, 0.85); /* ✅ 半透明乾淨底 */
  border-radius: 16px;
  padding: 6px 10px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

/* --- 按鈕與標籤 --- */
.pill-chip {
  background: linear-gradient(135deg, #ffb84d, #ff6b6b);
  color: white;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 25px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  backdrop-filter: none !important; /* 🚫 移除模糊 */
}

.pill-btn {
  border: none;
  font-weight: 600;
  border-radius: 25px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.3s;
  backdrop-filter: none !important; /* 🚫 移除模糊 */
}
.pill-btn:hover {
  background: #f0f0f0;
}



.pill-chip {
  background: linear-gradient(135deg, #ffb84d, #ff6b6b);
  color: white;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 25px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

.pill-btn {
  border: none;
  background: rgba(255,255,255,0.95);
  color: #333;
  font-weight: 600;
  border-radius: 25px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.3s;
}
.pill-btn:hover {
  background: #f0f0f0;
}
/* === 📱 手機版美食地圖（App 模式） === */
@media (max-width: 768px) {

  /* 導覽列略縮 */
  .main-navbar {
    height: 52px;
    padding: 0.3rem 1rem;
  }
  .nav-left .logo {
    height: 34px;
  }

  /* 地圖滿版在導覽列下方 */
  #mapRoot {
    position: fixed;
    top: var(--nav-h);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
  }

  /* 📂 側邊清單改成底部抽屜模式 */
  

  /* 底部清單標題樣式 */
  .sidebar h2 {
    font-size: 1rem;
    font-weight: 900;
    margin-bottom: 8px;
    color: #333;
    text-align: center;
  }

  /* 清單內容捲動效果 */
  .sidebar ul {
    padding: 0;
    margin: 0;
    list-style: none;
  }

  .sidebar li {
    font-size: 0.9rem;
    border-radius: 10px;
    padding: 8px 10px;
    margin-bottom: 8px;
    background: #fff;
    box-shadow: 0 1px 6px rgba(0,0,0,0.08);
  }

  /* 🍜 左上控制列改為浮動在右上角（不重疊） */
  .map-overlay.top-left {
    position: fixed;
    top: calc(var(--nav-h) + 8px);
    right: 12px;
    left: auto;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 6px;
  }

  .pill-chip, .pill-btn {
    font-size: 0.9rem;
  }

  /* 📍 底部資訊 pill 改小一點 */
  .map-overlay.bottom-center {
    bottom: 10vh;
  }

  /* Popup 適合手機螢幕 */
  .maplibregl-popup {
    max-width: 90vw !important;
  }

}
/* =========================
   小琉球美食地圖 - 外送平台風格
   ========================= */
* { box-sizing: border-box; }
html, body { height: 100%; }
:root{
  --nav-h: 56px;
  --bg: #0b0e12;
  --glass: rgba(16,18,27,.55);
  --chip: rgba(255,255,255,.92);
  --text: #111827;
  --muted: #6b7280;
  --primary: #1c7ed6;
  --shadow-1: 0 10px 30px rgba(0,0,0,.25);
  --shadow-2: 0 6px 18px rgba(0,0,0,.18);
}
@media (max-width: 480px){ :root{ --nav-h: 54px; } }

body{
  margin:0;
  font-family: "Noto Sans TC", system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial;
  background: var(--bg);
  color:#fff;
  overflow:hidden;
}

/* --- 導覽列 --- */
.main-navbar{
  position: fixed; inset: 0 0 auto 0; height: var(--nav-h);
  z-index: 9999;
  background: rgba(10,109,202,.75);
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  padding: .2rem 1.2rem;
}
.nav-container{ max-width: 1200px; margin:0 auto; height:100%;
  display:flex; align-items:center; justify-content:space-between; }
.nav-left .logo{ height: 46px; display:block; }
.nav-right{ display:flex; gap:1.1rem; }
.nav-right a{ color:#fff; font-weight:800; text-decoration:none; }
.nav-right a:hover{ color:#63e6be; }
@media (max-width:580px){ .nav-left .logo{ height:40px; } }

/* --- 地圖滿版 --- */
#mapRoot{ position: fixed; inset: var(--nav-h) 0 0 0; z-index:0; }
#swapMap{ position:absolute; inset:0; }

/* =========================
   Sidebar 清單區 (外送平台風格)
   ========================= */

/* === 桌面版：左側清單 === */
.sidebar {
  position: absolute;
  top: var(--nav-h);
  left: 15px;
  width: 320px;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(12px);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  z-index: 9999 !important;
  display: flex;
  flex-direction: column;
}

/* === 手機版：底部抽屜 === */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 50vh;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.15);
    padding: 0;
  }
  
  /* 拖拽把手 */
  .sidebar::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: #ddd;
    border-radius: 999px;
    z-index: 10;
  }
}

/* === Sidebar 標題區 === */
.sidebar h2 {
  position: sticky;
  top: 0;
  z-index: 10;
  color: white;
  font-size: 1.1rem;
  font-weight: 900;
  margin: 0;
  padding: 20px 16px 12px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

@media (max-width: 768px) {
  .sidebar h2 {
    padding: 28px 16px 12px;
  }
}

/* === 搜尋框 (手機版新增) === */
@media (max-width: 768px) {
  .search-box {
    padding: 8px 16px 12px;
    background: white;
    position: sticky;
    top: 60px;
    z-index: 9;
  }
  
  .search-input {
    width: 100%;
    padding: 10px 16px;
    border: 2px solid #f0f0f0;
    border-radius: 12px;
    font-size: 15px;
    background: #f8f9fa;
  }
  
  .search-input:focus {
    outline: none;
    border-color: #ff6b6b;
    background: white;
  }
}

/* === 清單容器 === */
#restaurant-list {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow-y: auto;
  flex: 1;
}

/* === 資料夾樣式 (外送平台風格) === */
.folder {
  margin: 0;
  border-radius: 0;
  overflow: visible;
  background: transparent;
  box-shadow: none;
}

.folder-header {
  padding: 14px 16px;
  font-weight: 800;
  font-size: 16px;
  color: #222;
  background: white;
  border-bottom: 2px solid #f0f0f0;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.folder-header::after {
  content: '▼';
  font-size: 12px;
  color: #999;
  transition: transform 0.3s;
}

.folder.open .folder-header::after {
  transform: rotate(180deg);
}

.folder-header:hover {
  background: #f8f9fa;
}

/* === 子清單容器 === */
.sub-list {
  max-height: 0;
  overflow: hidden;
  transition: max-height .35s ease;
}

/* 展開時，不要固定 height，只給 max-height 大一點 */
.folder.open .sub-list {
  max-height: 9999px !important; /* 足夠大就不會被切 */
}
#sidebar, .list-panel, #restaurant-list {
  overflow-y: auto;
  height: 100%;
}
#restaurant-list {
  overflow-y: auto !important;
  max-height: calc(100vh - var(--nav-h) - 40px) !important;
}


/* === 美食項目卡片 === */
.sub-list li {
  padding: 12px 16px;
  margin: 8px 12px;
  background: white;
  border-radius: 12px;
  cursor: pointer;
  border: 1px solid #e9ecef;
  transition: all 0.25s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.sub-list li:hover {
  background: #fff5f0;
  border-color: #ff6b6b;
  box-shadow: 0 4px 12px rgba(255,107,107,0.15);
  transform: translateY(-2px);
}

.sub-list li strong {
  display: block;
  font-size: 15px;
  color: #222;
  margin-bottom: 4px;
}

.sub-list li span {
  font-size: 13px;
  color: #999;
}

/* === 滾動條美化 === */
.sidebar::-webkit-scrollbar,
.sub-list::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track,
.sub-list::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb,
.sub-list::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.sub-list::-webkit-scrollbar-thumb:hover {
  background: #bbb;
}

/* --- 浮動 UI --- */
.map-overlay{ position:absolute; z-index:10; display:flex; gap:.5rem; align-items:center; }

/* 左上角工具列 */
.map-overlay.top-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin: 15px 0 0 15px;
}

/* === 手機版：隱藏左上角控制列中的篩選器 === */
@media (max-width: 768px) {
  #foodFilter {
    display: none;
  }
  
  .map-overlay.top-left {
    top: calc(var(--nav-h) + 12px);
    left: 12px;
    right: 12px;
    flex-direction: row;
    gap: 8px;
    margin: 0;
  }
  
  .pill-chip {
    font-size: 14px;
    padding: 8px 12px;
  }
  
  .pill-btn {
    font-size: 13px;
    padding: 8px 12px;
  }
}

/* --- 底部按鈕列 --- */
.map-overlay.bottom-center{
  left:50% !important;
  transform:translateX(-50%) !important;
  bottom:.9rem !important;
  display:flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap:.6rem !important;
}

.nearest-pill{
  max-width: 92vw;
  white-space: normal !important;
}
.visit-pill{
  white-space: nowrap !important;
}

.pill-btn{
  border:0; padding:.48rem .86rem; border-radius:999px;
  background: var(--glass); color:#fff; font-weight:900; letter-spacing:.3px;
  backdrop-filter: blur(8px); box-shadow: var(--shadow-2);
  transition: transform .06s ease, filter .15s ease;
}
.pill-btn:hover{ filter:brightness(1.05); }
.pill-btn:active{ transform: translateY(1px) scale(.98); }

.pill-chip{
  padding:.46rem .86rem; border-radius:999px; font-weight:900; color:#222;
  background: var(--chip); box-shadow: var(--shadow-2);
}

.visit-pill{
  padding:.42rem .86rem; border-radius:999px; font-weight:800;
  background: var(--glass); color:#fff; backdrop-filter: blur(8px);
  box-shadow: var(--shadow-2);
}

/* --- MapLibre 控制輕量美化 --- */
.maplibregl-ctrl-group{ border-radius:12px; box-shadow: var(--shadow-2); overflow:hidden; }
.maplibregl-ctrl button{
  background:#fff; border:0; width:32px; height:32px;
}
.maplibregl-ctrl button:hover{ background:#f2f4f7; }

/* =======================
   Popup 卡片樣式
   ======================= */
.maplibregl-popup{ max-width: 320px; }
.maplibregl-popup-content{
  padding: 14px 14px 12px;
  border-radius: 16px;
  background:#fff; color: var(--text);
  box-shadow: var(--shadow-1);
}
.popup-title{
  font-weight:900; font-size:1rem; line-height:1.2;
  color: var(--text); margin:0 0 .4rem 0;
  display:flex; gap:.5rem; align-items:center; flex-wrap:wrap;
}
.badge{ font-size:.72rem; font-weight:800; padding:.2rem .5rem; border-radius:999px; letter-spacing:.5px; }
.badge-food{ background:#fff1e6; color:#c2410c; }

.popup-addr{ font-size:.9rem; color:#374151; margin:.1rem 0 .45rem; }
.popup-meta{ font-size:.85rem; color: var(--muted); margin:0 0 .6rem; }

.popup-actions{ display:flex; gap:.5rem; }
.popup-actions .btn{
  border:0; border-radius:12px; padding:.5rem .85rem;
  background: var(--primary); color:#fff; font-weight:900; cursor:pointer;
  box-shadow: var(--shadow-2);
}
.popup-actions .btn:hover{ filter:brightness(.95); }

/* =======================
   站內導航資訊卡
   ======================= */
.dir-card{
  position:absolute; left:50%; transform:translateX(-50%);
  bottom:4.6rem; z-index:12;
  background:#fff; color:var(--text);
  border-radius:16px; box-shadow: var(--shadow-1);
  padding:.75rem .95rem; min-width:240px; max-width:92vw;
  font-family:"Noto Sans TC", system-ui, -apple-system, Segoe UI, Roboto;
}
.dir-title{ font-weight:900; margin-bottom:.25rem; }
#dirMeta.dir-meta{ font-size:.92rem; color:#374151; margin-bottom:.5rem; }
.dir-actions{ display:flex; gap:.5rem; }
.dir-btn{
  border:0; border-radius:12px; padding:.5rem .85rem;
  background:#e9ecef; color:#111; font-weight:900; cursor:pointer;
}
.dir-btn:hover{ filter:brightness(.97); }

@media (max-width: 480px){
  .dir-card{ bottom:4.2rem; }
}

/* === Marker 樣式 === */
.marker-wrap{
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateY(-2px);
  pointer-events: auto;
}

.marker-label{
  background: rgba(255,255,255,.95);
  color: #111;
  font-size: 12px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 8px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
  margin-bottom: 6px;
  pointer-events: none;
}

.marker{
  width: 22px; height: 22px;
  border-radius: 999px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.055);
  display: grid; place-items: center;
}

.marker.food {
  background: radial-gradient(circle at 30% 30%, #ffb84d, #ff6b6b);
  box-shadow: 0 6px 14px rgba(255, 107, 107, .35);
}
.marker.food::after {
  content: "🍴";
  font-size: 11px;
  color: #fff;
}

@media (max-width: 480px){
  .marker-label{ display: none; }
}

/* ===== Pitch 設定按鈕樣式 ===== */
.pitch-settings { position: relative; display: inline-block; margin-top: 6px; }

.settings-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  box-shadow: 0 6px 18px rgba(10,10,10,0.12);
  background: #1d1d1d9d;
  color: #222;
  border: 1px solid rgba(0,0,0,0.06);
  cursor: pointer;
}

.pitch-menu {
  position: absolute;
  left: 0;
  top: 48px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  min-width: 92px;
  background: #0000004f;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(10,10,10,0.12);
  transform-origin: top left;
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 9999;
}

.pitch-settings.open .pitch-menu {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.pitch-menu .pill-btn {
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 8px;
  background: #181818cb;
  border: 1px solid rgba(0,0,0,0.06);
  text-align: center;
  cursor: pointer;
}

.pitch-menu .pill-btn:hover { background: #0000004f; box-shadow: 0 6px 14px rgba(10,10,10,0.06); }

@media (max-width: 720px) {
  .pitch-menu { left: 0; top: 46px; min-width: 86px; }
  .settings-btn { width: 36px; height: 36px; font-size: 16px; }
}

/* 隱藏右下角 MapLibre 版權與 logo */
.maplibregl-ctrl-bottom-right {
  display: none !important;
}

/* 自訂版權：左下角 */
.custom-attribution {
  position: absolute;
  bottom: 5px;
  left: 5px;
  font-size: 10px;
  color: white;
  background: rgba(0, 0, 0, 0.5);
  padding: 3px 6px;
  border-radius: 4px;
  user-select: none;
  pointer-events: none;
}

.nearest-pill{
  display:none;
  margin-bottom: .4rem;
  padding:.46rem .86rem; border-radius:999px;
  background: rgba(255,255,255,.95); color:#111; font-weight:900;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
  cursor:pointer;
}
.nearest-pill small{ font-weight:700; color:#6b7280; margin-left:.35rem; }
.nearest-pill:hover{ filter:brightness(.98); }
.popup-actions .btn.alt{ background:#e9ecef; color:#111; }
.popup-actions .btn.alt:hover{ filter:brightness(.97); }

.shop-open {
  color: #fff;
}

.shop-closed {
  color: #999;
  opacity: 0.6;
}
/* === 店家營業狀態 === */
.custom-marker {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid white;
}

/* 營業中（橘色） */
.marker-open {
  background-color: #ff7a00;
}

/* 已打烊（灰色） */
.marker-closed {
  background-color: #999;
}

/* 沒提供營業時間（更淡灰） */
.marker-unknown {
  background-color: #cccccc;
}
/* === iOS Apple Maps 氣泡式標籤 === */

.marker-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translateY(-10px);
}

.marker-label {
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    padding: 4px 10px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    margin-bottom: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
    pointer-events: none;
}

.marker-dot {
    width: 10px;
    height: 10px;
    background: #ff7f00;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
/* === 動態縮放字體（Apple Maps Style）=== */
.dynamic-label {
  transition: font-size 0.15s ease;
  font-weight: 2000;
}

/* === 📂 子清單展開動畫（Apple Maps Style）=== */
.sub-list {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-10px);
  transition: max-height 0.55s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.35s ease-out,
              transform 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.folder.open .sub-list {
  max-height: 2400px;
  opacity: 1;
  transform: translateY(0);
}

.folder:not(.open) .sub-list {
  transition: max-height 0.45s cubic-bezier(0.33, 1, 0.68, 1),
              opacity 0.25s ease-out,
              transform 0.45s cubic-bezier(0.33, 1, 0.68, 1);
}

/* === 資料夾 pill 開啟時的彈跳動畫 === */
@keyframes folderBounce {
  0% { transform: scale(1); }
  35% { transform: scale(0.96); }
  70% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

/* 套用在資料夾標題（folder-header） */
.folder-header.bounce {
  animation: folderBounce 0.35s ease;
}

/* === 修正：限制分類標題中的分類圖示大小 (folder-header) === */
.folder-header img {
  width: 18px !important;
  height: 18px !important;
  object-fit: contain;
  margin-right: 6px;
  vertical-align: middle;
  display: inline-block;
}
/* 限制分類 icon 的大小，不讓它撐開整個大格 */
.folder-header img.folder-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  margin-right: 6px;
  vertical-align: middle;
}

/* Emoji 也對齊一下 */
.folder-header .folder-emoji {
  font-size: 18px;
  margin-right: 6px;
  vertical-align: middle;
}
.folder-header {
  display: flex;
  align-items: center;
  justify-content: flex-start !important;  /* ← 改成靠左 */
  gap: 8px;                                 /* 讓 icon 跟文字保持小間距 */
}
/* === Sidebar 不能超過上方導覽列與下方 bottom pills === */
.sidebar {
  position: absolute;
  top: calc(var(--nav-h) + 11px);   /* 避開上面 Navbar */
  bottom: 30px;                     /* 避開下面訪問人數 / 最近美食 pill */
  left: 15px;
  width: 300px;

  display: flex;
  flex-direction: column;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(12px);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  overflow: hidden; /* 不要露出內容 */
  z-index: 9999 !important;
}

/* 清單部分要能捲動 */
#restaurant-list {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 20px;
}

/* 美化滾動條 */
#restaurant-list::-webkit-scrollbar {
  width: 6px;
}
#restaurant-list::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 10px;
}
/* 讓 JS 的 display:none 完全生效，不留背景空間 */
.marker-label {
  transition: opacity 0.25s ease;
}

/* 當 JS 設 display:none 時 → 強制乾淨消失 */
.marker-label[style*="display: none"] {
  display: none !important;
  opacity: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* === 店名浮出動畫 === */
.marker-label {
  opacity: 0;
  transform: translateY(4px) scale(0.95);
  transition:
    opacity 0.28s ease,
    transform 0.28s cubic-bezier(0.16, 0.82, 0.44, 1);
}

/* 開啟店名時 */
.marker-label.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* 關閉時的消失動畫 */
.marker-label.hide {
  opacity: 0;
  transform: translateY(4px) scale(0.95);
}
@keyframes markerPop {
  0% { transform: translateY(-20px) scale(0.6); opacity: 0; }
  70% { transform: translateY(4px) scale(1.05); opacity: 1; }
  100% { transform: translateY(0) scale(1); }
}
.marker-wrap.pop {
  animation: markerPop .45s cubic-bezier(.34,1.56,.64,1) forwards;
}
.marker::before {
  content: "";
  position: absolute;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  animation: pulse 1.6s infinite ease-out;
}
@keyframes pulse {
  0% { transform: scale(0.8); opacity: 0.8; }
  100% { transform: scale(2.2); opacity: 0; }
}


/* =============================== */
/* 手機版 (Mobile Layout) - 覆蓋 */
/* ------------------------------- */
@media (max-width: 768px) {
  /* 1. 將地圖和清單垂直排列 */
  body {
    display: flex;
    flex-direction: column; /* 垂直排列 */
    height: 100vh; /* 佔滿視窗高度 */
  }

  /* 2. 讓地圖佔用上半部空間 */
  #mapRoot {
    flex-grow: 1; /* 佔用所有剩餘的垂直空間 */
    min-height: 0; /* 修正 flex 佈局下的溢出問題 */
    height: auto; /* 讓 flex-grow 生效 */
    /* 移除 PC 上的邊距 */
    margin-left: 0; 
  }

  /* 3. 將 Sidebar (清單) 移到地圖下方，並從底部滑入 */
  .sidebar {
    /* 移除 PC 上的 fixed 定位，讓它成為 normal flow 的一部分 */
    position: relative; 
    inset: auto;
    width: 100%; /* 全寬 */
    height: 70vh; /* 預設佔視窗高度 45% */
    min-height: 150px;
    
    /* 調整滑動動畫：從下往上 */
    transform: translateY(100%); 
    transition: transform 0.4s cubic-bezier(0.16, 0.82, 0.44, 1);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .sidebar.open {
    transform: translateY(0);
  }

  /* 4. 調整地圖工具列 (Overlay) */
  .map-overlay.top-left {
    /* 調整定位到左上角，並向下移一點以避開導覽列 */
    top: calc(var(--nav-h) + 12px);
    right: auto;
    left: 12px;
    
    /* 工具列改成垂直排列 */
    flex-direction: column; /* 垂直排列 */
    align-items: flex-start;
  }
}