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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  height: 100dvh;
  height: 100vh; /* fallback */
  width: 100vw;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
@supports (height: 100dvh) {
  body { height: 100dvh; }
}

/* ===== TOP NAV — one compact block ===== */
#topnav {
  background: #1a1a2e;
  padding: 8px 10px 6px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Row 1: brand + tagline + auth */
#brand-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
#tagline { flex: 1; }
.nav-icon-btn {
  padding: 4px 10px;
  background: #0f3460;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.nav-icon-btn:active { opacity: 0.8; }
#admin-btn { background: #e74c3c; }
.nav-icon-btn.hidden { display: none; }
#brand-row h1 {
  color: #fff;
  font-size: 17px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.brand-dot { color: #e74c3c; font-size: 13px; }
#tagline {
  color: #8899aa;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Row 2: search input + go */
#search-row {
  display: flex;
  gap: 6px;
}
#search-wrapper {
  flex: 1;
  position: relative;
}
#goto-input {
  width: 100%;
  padding: 10px 32px 10px 14px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  background: #fff;
  outline: none;
}
#goto-input:focus {
  box-shadow: 0 0 0 2px #4285f4;
}
#search-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 18px;
  color: #999;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}
#search-clear.hidden { display: none; }

/* Search dropdown */
#search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  max-height: 300px;
  overflow-y: auto;
  z-index: 2000;
}
#search-dropdown.hidden { display: none; }
.search-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.search-item:last-child { border-bottom: none; }
.search-item:active { background: #f5f5f5; }
.search-item-name { font-weight: 600; font-size: 14px; color: #222; }
.search-item-detail { font-size: 12px; color: #888; }
.search-item-score { font-size: 16px; }
.search-no-results {
  padding: 14px;
  text-align: center;
  color: #999;
  font-size: 13px;
}

/* Add place search results */
#add-search-row {
  margin-bottom: 8px;
}
#add-search {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 15px;
}
#add-search-results {
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 4px;
}
.add-result {
  padding: 10px;
  border: 1px solid #eee;
  border-radius: 6px;
  margin-bottom: 4px;
  cursor: pointer;
}
.add-result:active { background: #f5f5f5; }
.add-result-name { font-weight: 600; font-size: 14px; }
.add-result-addr { font-size: 12px; color: #888; }
#goto-btn {
  padding: 10px 18px;
  background: #0f3460;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
#goto-btn:active { background: #0a2040; }

/* Row 3: big action buttons */
#action-row {
  display: flex;
  gap: 6px;
}
.action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 0;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: opacity 0.15s;
}
.action-btn:active { opacity: 0.8; }
.action-icon { font-size: 16px; }

.nearby-btn { background: #27ae60; }
.add-btn    { background: #e67e22; }

/* ===== MAP ===== */
#map {
  flex: 1;
  z-index: 1;
}

/* ===== SEARCH THIS AREA ===== */
#search-area-btn {
  position: fixed;
  top: 140px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  background: #27ae60;
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  z-index: 999;
  box-shadow: 0 2px 10px rgba(39,174,96,0.35);
}
#search-area-btn:active { background: #1e8449; }
#search-area-btn.hidden { display: none; }

/* ===== LOADING ===== */
#loading {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 16px 24px;
  border-radius: 10px;
  z-index: 3000;
  font-size: 15px;
}
#loading.hidden { display: none; }

/* ===== PANELS (bottom sheets) ===== */
.panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 85vh;
  background: #fff;
  z-index: 2000;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.25);
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
}
.panel.hidden {
  transform: translateY(100%);
  pointer-events: none;
}
/* Drag handle bar */
.panel::before {
  content: '';
  display: block;
  width: 40px;
  height: 4px;
  background: #ccc;
  border-radius: 2px;
  margin: 10px auto 0;
  flex-shrink: 0;
}
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}
.panel-header h2 {
  font-size: 18px;
  color: #1a1a2e;
}
.panel-body {
  overflow-y: auto;
  padding: 12px 16px 16px;
  flex: 1;
}
.close-btn {
  background: #f0f0f0;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #666;
  line-height: 1;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.panel input[type="text"],
.panel textarea,
.panel input[type="file"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 15px;
  margin-bottom: 8px;
}
.panel textarea { resize: vertical; }

.btn-primary {
  width: 100%;
  padding: 12px;
  background: #0f3460;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
}
.btn-primary:active { background: #1a1a2e; }

.hint {
  font-size: 13px;
  color: #888;
  margin-bottom: 8px;
}

/* ===== DETAIL STATUS CARD ===== */
#detail-status-card {
  text-align: center;
  padding: 16px;
  background: #f8f9fa;
  border-radius: 12px;
  margin-bottom: 16px;
}
#detail-aggregate {
  margin-bottom: 4px;
}
#detail-info {
  font-size: 13px;
  color: #777;
}

/* ===== VOTE SECTION ===== */
#vote-section {
  margin-bottom: 12px;
}
#vote-label {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
  text-align: center;
}
#rate-buttons {
  display: flex;
  gap: 8px;
}
.rate-btn {
  flex: 1;
  padding: 14px 8px;
  border: 2px solid #eee;
  border-radius: 12px;
  background: #fff;
  font-size: 20px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.rate-btn span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.vote-no { color: #e74c3c; }
.vote-no span { color: #e74c3c; }
.vote-idk { color: #888; }
.vote-idk span { color: #888; }
.vote-yes { color: #27ae60; }
.vote-yes span { color: #27ae60; }
.rate-btn.selected.vote-no { border-color: #e74c3c; background: #fde8e8; }
.rate-btn.selected.vote-idk { border-color: #888; background: #f0f0f0; }
.rate-btn.selected.vote-yes { border-color: #27ae60; background: #e8f8e8; }

/* Expandable details */
#rate-details {
  margin-bottom: 10px;
}
#rate-details summary {
  font-size: 13px;
  color: #666;
  cursor: pointer;
  padding: 8px 0;
  user-select: none;
}
#rate-details-inner {
  padding-top: 8px;
}
#rate-details-inner input[type="text"],
#rate-details-inner textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 8px;
}
.photo-label {
  display: block;
  font-size: 13px;
  color: #666;
  margin-bottom: 8px;
}
.photo-label span {
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
}

/* Ratings list */
#ratings-section {
  margin-top: 20px;
  border-top: 1px solid #eee;
  padding-top: 12px;
}
#ratings-header {
  font-size: 14px;
  font-weight: 700;
  color: #333;
  margin-bottom: 10px;
}
#ratings-header span {
  color: #999;
  font-weight: 400;
}

/* ===== MISC ===== */
.signin-divider {
  text-align: center;
  margin: 12px 0;
  color: #ccc;
  font-size: 12px;
  position: relative;
}
.signin-divider::before,
.signin-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 30%;
  height: 1px;
  background: #eee;
}
.signin-divider::before { left: 0; }
.signin-divider::after { right: 0; }
.signin-divider span {
  background: #fff;
  padding: 0 10px;
}

/* ===== RATING CARDS ===== */
.rating-card {
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
}
.rating-card .rc-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}
.rating-card .rc-user { font-weight: 600; font-size: 14px; }
.rating-card .rc-date { font-size: 12px; color: #999; }
.rating-card .rc-score { font-size: 18px; margin: 4px 0; }
.rating-card .rc-note { font-size: 14px; color: #444; margin-top: 4px; }
.rating-card .rc-photo {
  margin-top: 8px;
  max-width: 100%;
  border-radius: 6px;
}
.admin-delete-rating {
  margin-top: 6px;
  padding: 4px 10px;
  background: none;
  border: 1px solid #e74c3c;
  color: #e74c3c;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.admin-delete-rating:active { background: #fde8e8; }

/* (aggregate + info styled in detail-status-card above) */

/* ===== LEGEND ===== */
#legend {
  position: fixed;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255,255,255,0.95);
  padding: 6px 14px;
  border-radius: 20px;
  display: flex;
  gap: 12px;
  font-size: 12px;
  z-index: 999;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid #fff;
  box-shadow: 0 0 2px rgba(0,0,0,0.2);
}
.legend-dot.green { background: #27ae60; }
.legend-dot.red { background: #e74c3c; }
.legend-dot.gray { background: #bbb; }
.legend-divider { color: #ccc; }
.disclaimer-link { color: #999; text-decoration: none; font-size: 11px; }
.disclaimer-link:hover { text-decoration: underline; }

/* ===== MAP MARKERS ===== */
.custom-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  pointer-events: auto;
}
.place-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2.5px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.place-dot.green { background: #27ae60; }
.place-dot.red { background: #e74c3c; }
.place-dot.gray { background: #bbb; }
.marker-label {
  font-size: 10px;
  font-weight: 700;
  background: rgba(255,255,255,0.92);
  padding: 1px 5px;
  border-radius: 4px;
  white-space: nowrap;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  margin-top: 1px;
}
/* Detail panel large dot */
.detail-dot {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin: 0 auto;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.detail-dot.green { background: #27ae60; }
.detail-dot.red { background: #e74c3c; }
.detail-dot.gray { background: #bbb; }
/* Keep marker-icon class for admin dashboard + rating cards */
.marker-icon { font-size: 20px; line-height: 1; }
.marker-icon.green { color: #27ae60; }
.marker-icon.red { color: #e74c3c; }
.marker-icon.gray { color: #999; }
.marker-icon.orange { color: #e67e22; }

.tap-marker-icon {
  font-size: 28px;
}

/* ===== FLAG / REPORT BUTTON ===== */
.flag-btn {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 10px;
  background: none;
  border: 1px solid #ccc;
  border-radius: 8px;
  color: #999;
  font-size: 13px;
  cursor: pointer;
  text-align: center;
}
.flag-btn:active { background: #f5f5f5; }

/* ===== SIGN IN PANEL ===== */
#signin-card {
  max-width: 340px;
  margin: 0 auto;
  padding: 8px 0 0;
}
#signin-logo {
  text-align: center;
  font-size: 20px;
  font-weight: 800;
  color: #1a1a2e;
  letter-spacing: -0.3px;
}
#signin-subtitle {
  text-align: center;
  font-size: 13px;
  color: #999;
  margin: 2px 0 18px;
}
.si-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 6px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.si-option:hover { background: #f8f8f8; border-color: #ccc; }
.si-option:active { background: #f0f0f0; }
.si-expand {
  padding: 12px 0 4px;
}
.si-expand.hidden { display: none; }
.si-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  margin-bottom: 8px;
}
.si-input:focus { border-color: #1a1a2e; }
.si-submit {
  width: 100%;
  padding: 10px;
  background: #1a1a2e;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.si-submit:active { background: #0f0f1a; }
#signin-phone-code-row.hidden { display: none; }
#signin-footer {
  text-align: center;
  font-size: 11px;
  color: #c0c0c0;
  margin-top: 20px;
}

/* ===== ADMIN DASHBOARD ===== */
#admin-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  overflow-x: auto;
}
.admin-tab {
  padding: 8px 14px;
  background: #eee;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.admin-tab.active {
  background: #1a1a2e;
  color: #fff;
}
.admin-card {
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
}
.admin-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.admin-date { font-size: 11px; color: #999; }
.admin-meta { font-size: 12px; color: #777; margin-top: 4px; word-break: break-all; }
.admin-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.admin-action-btn {
  padding: 6px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background: #fafafa;
}
.admin-action-btn.view-btn { color: #2980b9; border-color: #2980b9; }
.admin-action-btn.danger { color: #e74c3c; border-color: #e74c3c; }
.admin-action-btn:active { opacity: 0.7; }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.stat-card {
  background: #f8f8f8;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}
.stat-num {
  font-size: 24px;
  font-weight: 700;
  color: #1a1a2e;
}
.stat-label {
  font-size: 11px;
  color: #888;
  margin-top: 2px;
}

/* ===== BANNED STATES ===== */
.banned-tooltip {
  background: #e74c3c;
  color: #fff;
  border: none;
  font-weight: 700;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 4px;
}
.banned-tooltip::before { border-top-color: #e74c3c; }
.banned-hash-fill { fill: url(#hash-pattern) !important; }
.permit-tooltip {
  background: #f1c40f;
  color: #333;
  border: none;
  font-weight: 700;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 4px;
}
.permit-tooltip::before { border-top-color: #f1c40f; }
.legal-tooltip {
  background: #27ae60;
  color: #fff;
  border: none;
  font-weight: 700;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 4px;
}
.legal-tooltip::before { border-top-color: #27ae60; }

/* ===== ACTIVE USERS ===== */
.active-user-dot {
  width: 10px;
  height: 10px;
  background: #4285f4;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(66,133,244,0.5);
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 6px rgba(66,133,244,0.5); }
  50% { box-shadow: 0 0 12px rgba(66,133,244,0.8); }
}

/* ===== DISCLAIMER MODAL ===== */
#disclaimer {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
#disclaimer.hidden { display: none; }
#disclaimer-box {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 500px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#disclaimer-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 8px;
  -webkit-overflow-scrolling: touch;
  font-size: 12px;
  line-height: 1.5;
  color: #333;
}
#disclaimer-scroll h3 {
  font-size: 17px;
  color: #1a1a2e;
  margin-bottom: 10px;
  text-align: center;
}
#disclaimer-scroll p {
  margin-bottom: 8px;
}
#disclaimer-scroll .warn {
  background: #fff3cd;
  border-left: 4px solid #e67e22;
  padding: 8px 10px;
  border-radius: 4px;
  font-weight: 600;
  margin: 10px 0;
  font-size: 12px;
}
#disclaimer-box .btn-primary {
  margin: 0;
  border-radius: 0 0 12px 12px;
  flex-shrink: 0;
}

/* ===== MARKER CLUSTERS ===== */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
  background: rgba(26, 26, 46, 0.25);
}
.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
  background: #1a1a2e;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
}

/* ===== ADD PLACE: address lookup ===== */
#add-locate-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
#add-locate-row input {
  flex: 1;
  margin-bottom: 0;
}
#add-locate-btn {
  padding: 10px 14px;
  background: #2980b9;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
#add-locate-btn:active { background: #1a6da0; }

/* ===== MOBILE RESPONSIVE ===== */
#map { touch-action: none; }

@media (max-width: 480px) {
  #brand-row h1 { font-size: 14px; }
  #tagline { font-size: 10px; }
  .nav-icon-btn { padding: 6px 10px; font-size: 12px; }
  #goto-input { font-size: 14px; padding: 9px 28px 9px 10px; }
  .action-btn { font-size: 13px; padding: 9px 0; }
  .panel { max-height: 85vh; }
  #legend { gap: 8px; font-size: 11px; padding: 5px 10px; flex-wrap: wrap; justify-content: center; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  #search-dropdown { max-height: 250px; }
  #add-locate-row { flex-direction: column; }
  #add-locate-row input { width: 100%; }
}

@media (max-width: 360px) {
  #brand-row h1 { font-size: 13px; }
  #tagline { display: none; }
  .action-btn { font-size: 12px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
