* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  height: 100dvh;
  padding-bottom: calc(56px + env(safe-area-inset-bottom));
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f8fafc;
}

#toilet-page {
  height: calc(100dvh - 112px - env(safe-area-inset-bottom));
  display: grid;
  grid-template-rows: minmax(260px, 1fr) minmax(240px, 0.9fr);
  min-height: 0;
}

#toilet-map-panel {
  position: relative;
  min-height: 0;
  background: #e8eef2;
}

#toilet-map {
  width: 100%;
  height: 100%;
}

#map-status {
  position: absolute;
  top: 12px;
  left: 12px;
  max-width: calc(100% - 24px);
  padding: 8px 11px;
  border-radius: 8px;
  background: rgba(255,255,255,0.94);
  color: #475569;
  font-size: 12px;
  box-shadow: 0 1px 5px rgba(15,23,42,0.14);
}

#map-status[hidden] { display: none; }

#toilet-locate-btn {
  position: absolute;
  z-index: 1000;
  right: 12px;
  bottom: 12px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

#toilet-locate-btn:hover { background: #f0f0f0; }
#toilet-locate-btn svg { width: 22px; height: 22px; }
#toilet-locate-btn:disabled { opacity: 0.65; cursor: wait; }
#toilet-locate-btn:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }

.map-note {
  position: absolute;
  left: 12px;
  bottom: 12px;
  margin: 0;
  color: #475569;
  font-size: 11px;
  text-shadow: 0 1px #fff, 1px 0 #fff, 0 -1px #fff, -1px 0 #fff;
}

#toilet-results {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #fff;
  border-top: 1px solid #e2e8f0;
}

.results-heading {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
  background: rgba(255,255,255,0.97);
  border-bottom: 1px solid #f1f5f9;
}

.results-heading h1 {
  font-size: 17px;
  line-height: 1.3;
  color: #0f172a;
}

#toilet-center-label {
  margin-top: 3px;
  color: #64748b;
  font-size: 12px;
}

#toilet-count {
  flex-shrink: 0;
  color: #15803d;
  font-size: 13px;
  font-weight: 700;
}

#toilet-status {
  margin: 0;
  padding: 10px 16px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.5;
}

#toilet-list { padding: 0 12px 12px; }

.toilet-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 4px;
  border-bottom: 1px solid #f1f5f9;
}

.toilet-card-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 2px 4px;
  border: 0;
  background: transparent;
  color: #0f172a;
  text-align: left;
  cursor: pointer;
}

.toilet-card-main strong {
  width: 100%;
  overflow: hidden;
  font-size: 14px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toilet-distance { color: #64748b; font-size: 12px; }

.toilet-directions {
  flex-shrink: 0;
  padding: 8px 10px;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  color: #15803d;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.toilet-directions:focus-visible,
.toilet-card-main:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }

.toilet-info-window {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15,23,42,0.2);
  white-space: nowrap;
}

.toilet-info-name { max-width: 190px; overflow: hidden; text-overflow: ellipsis; font-size: 13px; font-weight: 700; }
.toilet-info-link { color: #15803d; font-size: 12px; font-weight: 700; text-decoration: none; }

@media (min-width: 760px) {
  #toilet-page { grid-template-rows: minmax(300px, 1.15fr) minmax(240px, 0.85fr); }
  #toilet-results { max-width: 900px; width: 100%; margin: 0 auto; border-right: 1px solid #e2e8f0; border-left: 1px solid #e2e8f0; }
}
