* { margin: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #10141a;
  color: #1c2430;
  overflow: hidden;
}

/* Explicit viewport dimensions, not just inset: the classic Google Maps
   constructor sets position:relative inline on the container, which
   collapses an inset-sized fixed div to 0 height (found 2026-08-07). */
#map { position: fixed; inset: 0; width: 100vw; height: 100dvh; }

#brand {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 10;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(16, 20, 26, .82);
  color: #e8ecf1;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .08em;
  user-select: none;
}
#brand .red { color: #e53935; }

/* --- circular buttons, app-FAB style (white surface, dark icon) --- */
.chip-btn {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 10;
  padding: 0;
}
.chip-btn svg { width: 22px; height: 22px; fill: #3c4043; }
.chip-btn:active { background: #f1f3f4; }

#menu-btn { position: fixed; top: 10px; right: 12px; }
#layers-btn { position: fixed; bottom: 28px; left: 12px; }

#action-stack {
  position: fixed;
  right: 12px;
  bottom: 28px;
  display: flex;
  flex-direction: column-reverse; /* first markup child = bottom of stack */
  gap: 10px;
  z-index: 10;
}
#action-stack .chip-btn { position: static; }
/* markup order: recenter, planner, search — column-reverse puts search
   at the bottom and lets recenter pop in on top without moving them */

/* --- panels --- */
.panel {
  position: fixed;
  z-index: 20;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .3);
  overflow: hidden;
  min-width: 180px;
}
#menu-panel { top: 62px; right: 12px; }
#layers-panel { bottom: 80px; left: 12px; }

.panel .row {
  display: block;
  width: 100%;
  border: none;
  background: none;
  text-align: left;
  font-size: 15px;
  color: #1c2430;
  padding: 12px 16px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.panel .row:hover:not(:disabled) { background: #f1f3f4; }
.panel .row:disabled { color: #9aa0a6; cursor: default; }
.panel .row.active { font-weight: 700; }
.panel .row.active::after { content: " ✓"; color: #e53935; }
.panel .sep { height: 1px; background: #e8eaed; margin: 4px 0; }
.panel .row.muted { color: #9aa0a6; cursor: default; }

/* --- search overlay (app parity: rounded card, top of map) --- */
.top-panel {
  top: 10px;
  left: 64px;              /* clear of the brand chip */
  right: 64px;             /* clear of the menu button */
  max-width: 560px;
  margin: 0 auto;
}
.search-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
}
.search-line svg { width: 20px; height: 20px; fill: #9aa0a6; flex: none; }
#search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px;         /* ≥16px prevents iOS zoom-on-focus */
  padding: 8px 0;
  background: none;
  color: #1c2430;
}
#search-close {
  border: none;
  background: none;
  font-size: 16px;
  color: #9aa0a6;
  cursor: pointer;
  padding: 6px;
}
.busy {
  height: 2px;
  background: linear-gradient(90deg, #e53935, #ffb4b0, #e53935);
  background-size: 200% 100%;
  animation: busy 1s linear infinite;
}
@keyframes busy { from { background-position: 0 0; } to { background-position: 200% 0; } }
#search-results .result { border-top: 1px solid #f1f3f4; }

/* --- notice (errors) --- */
#notice {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 2rem;
  background: #10141a;
  font-size: 1.05rem;
  line-height: 1.6;
  color: #aeb8c4;
}
#notice code { color: #e8ecf1; }
/* An id selector beats the UA's [hidden] rule — restate it explicitly. */
#notice[hidden] { display: none; }
.panel[hidden], .chip-btn[hidden] { display: none; }

@media (max-width: 480px) {
  .top-panel { left: 10px; right: 10px; top: 60px; } /* below brand+menu on phones */
}
:root { color-scheme: light dark; }
