html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f5f5;
}

/* 🔍 搜尋欄 */
#ui {
  position: fixed;
  top: env(safe-area-inset-top, 20px);
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 40px);
  max-width: 500px;
  background: rgba(255,255,255,0.92);
  padding: 12px;
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  display: flex;
  gap: 10px;
  z-index: 999;
  backdrop-filter: blur(6px);
}

#ui input {
  flex: 1;
  padding: 12px;
  font-size: 17px; /* ⭐ 避免 iPhone 自動放大 */
  border-radius: 10px;
  border: 1px solid #ccc;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation; /* ⭐ 減少誤觸 */
}

#ui button {
  padding: 12px 16px;
  font-size: 17px;
  border-radius: 10px;
  border: none;
  background: #007aff;
  color: white;
}

/* 🗺️ 地圖容器：自動填滿 UI 與廣告區之間的空間 */
#mapContainer {
  position: fixed;
  top: calc(var(--ui-height) + env(safe-area-inset-top));
  left: 0;
  right: 0;
  bottom: calc(var(--ad-height) + env(safe-area-inset-bottom));
  overflow: hidden;
}

/* 地圖本體永遠填滿容器 */
#map {
  width: 100%;
  height: 100%;
}

/* 📢 廣告區 */
#adArea {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 120px;
  background: white;
  border-top: 1px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  z-index: 998;
}

/* 📍 定位按鈕 */
#locateBtn {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: white;
  border: none;
  box-shadow: 0 4px 10px rgba(0,0,0,0.25);
  font-size: 28px;
  z-index: 999;
}

/* 📱 iPhone 14 Pro Max / 手機 RWD */
@media (max-width: 600px) {
  #ui {
    width: calc(100% - 20px);
    padding: 10px;
  }

  #adArea {
    height: 100px;
  }

  #locateBtn {
    bottom: calc(100px + 20px + env(safe-area-inset-bottom));
    width: 54px;
    height: 54px;
  }
}
