*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #fff;
  color: #1a1a1a;
  overflow: hidden;
}

header {
  padding: 12px 16px 6px;
  border-bottom: 1px solid #e5e5e5;
  line-height: 1.1;
}

header h1 {
  font-size: 1.2rem;
  font-weight: 700;
}

header .subtitle {
  font-size: 0.8rem;
  color: #666;
}

#tabs {
  display: flex;
  border-bottom: 1px solid #e5e5e5;
}

.tab {
  flex: 1;
  padding: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  color: #555;
  transition: color 0.15s, border-color 0.15s;
}

.tab.active {
  color: #0066cc;
  border-bottom-color: #0066cc;
}

#status-bar {
  font-size: 0.78rem;
  color: #555;
  padding: 5px 16px;
  background: #f7f7f7;
  border-bottom: 1px solid #e5e5e5;
  min-height: 26px;
}

.tab-panel { display: none; }
.tab-panel.active { display: flex; flex-direction: column; }

/* Map panel fills remaining height */
#tab-map {
  height: calc(100vh - 115px);
}

#map {
  flex: 1;
  width: 100%;
  height: 100%;
}

/* List panel */
#tab-list {
  height: calc(100vh - 115px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#fountain-list {
  list-style: none;
  padding: 8px 0;
}

#fountain-list li {
  padding: 14px 16px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: background 0.1s;
}

#fountain-list li:active { background: #f5f5f5; }

.fountain-icon-list {
  font-size: 1.4rem;
  flex-shrink: 0;
}

.fountain-info .name {
  font-weight: 600;
  font-size: 0.95rem;
}

.fountain-info .dist {
  font-size: 0.8rem;
  color: #888;
  margin-top: 2px;
}

/* Search-here button */
#tab-map { position: relative; }

#search-here-btn {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: #fff;
  color: #0066cc;
  border: 2px solid #0066cc;
  border-radius: 24px;
  padding: 10px 20px;
  font-size: 0.95rem;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, opacity 0.2s;
}

#search-here-btn:active { background: #e8f0fe; }

#search-here-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

#search-here-btn.hidden { display: none; }

/* Address line in list */
.fountain-info .addr {
  font-size: 0.78rem;
  color: #999;
  margin-top: 1px;
}

/* Popup overlay */
#popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

#popup-overlay.hidden { display: none; }

#popup-card {
  background: #fff;
  width: 100%;
  max-width: 540px;
  border-radius: 18px 18px 0 0;
  padding: 20px 20px 36px;
  position: relative;
  max-height: 70vh;
  overflow-y: auto;
}

#popup-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: #eee;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

#popup-img {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 14px;
}

#popup-img.hidden { display: none; }

#popup-name {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 6px;
  padding-right: 36px;
}

#popup-meta {
  font-size: 0.85rem;
  color: #666;
}
