html, body { margin: 0; padding: 0; height: 100%; font: 14px/1.35 system-ui, -apple-system, sans-serif; }
#map { position: absolute; inset: 0; }

#legend {
  position: absolute; top: 12px; left: 12px; z-index: 1;
  background: rgba(255,255,255,0.95); padding: 8px 12px; border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15); min-width: 110px;
}
.legend-title { font-weight: 600; margin-bottom: 4px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: #555; }
.legend-row { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
#sign-in { margin-top: 6px; padding-top: 6px; border-top: 1px solid #eee; font-size: 12px; }
#sign-in a { color: #555; }
.sw { width: 18px; height: 4px; border-radius: 2px; display: inline-block; }
.sw-C { background: #dc2626; }
.sw-B { background: #facc15; }
.sw-A { background: #22c55e; }
.sw-S { background: #06b6d4; }
.sw-0 { background: #888; opacity: 0.4; }

#nta-label {
  position: absolute; top: 12px; right: 12px; z-index: 1;
  background: rgba(255,255,255,0.95); padding: 6px 12px; border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  font-size: 12px; font-weight: 600; color: #333; max-width: 240px;
}

#panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: 300px;
  background: #fff; box-shadow: -2px 0 8px rgba(0,0,0,0.15);
  z-index: 2; padding: 16px 18px; overflow-y: auto; box-sizing: border-box;
  transform: translateX(100%); transition: transform 0.2s ease;
}
#panel:not([hidden]) { transform: translateX(0); }

/* On phones, dock the panel to the bottom as a half-height sheet so the
   selected street's halo stays visible above it. */
@media (max-width: 599px) {
  #panel {
    top: auto; right: 0; bottom: 0; left: 0;
    width: 100%; max-height: 55vh;
    transform: translateY(100%);
    border-top-left-radius: 14px; border-top-right-radius: 14px;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.18);
    padding: 14px 16px 20px;
  }
  #panel:not([hidden]) { transform: translateY(0); }
  #panel h2 { font-size: 16px; }
  .cur-rating { font-size: 26px; padding: 2px 12px; }
}
#panel .close {
  position: absolute; top: 8px; right: 12px;
  background: none; border: none; font-size: 24px; cursor: pointer; color: #888;
}
#panel h2 { margin: 0 24px 4px 0; font-size: 18px; }
#panel h3 { margin: 20px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; color: #555; }
.cur-rating {
  display: inline-block; font-size: 32px; font-weight: 700;
  min-width: 56px; text-align: center; padding: 4px 14px; border-radius: 8px;
  color: #fff; margin: 6px 0 14px;
}
.cur-rating.unrated { color: #888; background: none; font-size: 16px; font-weight: 400; padding: 0; }
.cur-rating.tier-C { background: #dc2626; }
.cur-rating.tier-B { background: #facc15; color: #2a2a2a; }
.cur-rating.tier-A { background: #22c55e; }
.cur-rating.tier-S { background: #06b6d4; }

.rating-buttons { display: flex; gap: 6px; margin-bottom: 10px; }
.rating-buttons button {
  flex: 1; padding: 10px 0; font-size: 18px; font-weight: 700;
  border: 1px solid #ccc; background: #f8f8f8; border-radius: 6px; cursor: pointer;
  color: #333;
}
.rating-buttons button:hover { background: #eee; }
.rating-buttons button.selected { color: #fff; border-color: transparent; }
.rating-buttons button.selected.tier-C { background: #dc2626; }
.rating-buttons button.selected.tier-B { background: #facc15; color: #2a2a2a; }
.rating-buttons button.selected.tier-A { background: #22c55e; }
.rating-buttons button.selected.tier-S { background: #06b6d4; }

#panel textarea {
  width: 100%; box-sizing: border-box; min-height: 60px;
  padding: 8px; border: 1px solid #ccc; border-radius: 6px;
  font: inherit; resize: vertical; margin-bottom: 8px;
}
#panel .submit {
  width: 100%; padding: 10px; background: #06b6d4; color: #fff;
  border: none; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer;
}
#panel .submit:disabled { background: #ccc; cursor: not-allowed; }

#panel .history { list-style: none; padding: 0; margin: 0; }
#panel .history li {
  padding: 8px 0; border-bottom: 1px solid #eee; font-size: 13px;
}
#panel .history .tier {
  display: inline-block; min-width: 16px; text-align: center;
  font-weight: 700; color: #fff; background: #888;
  padding: 1px 6px; border-radius: 3px; margin-right: 6px; font-size: 12px;
}
#panel .history .tier-C { background: #dc2626; }
#panel .history .tier-B { background: #facc15; color: #2a2a2a; }
#panel .history .tier-A { background: #22c55e; }
#panel .history .tier-S { background: #06b6d4; }
#panel .history .date { color: #888; font-size: 12px; }
#panel .history .empty { color: #888; font-style: italic; padding: 8px 0; }

#tooltip {
  position: absolute; z-index: 3; pointer-events: none;
  background: rgba(0,0,0,0.85); color: #fff; padding: 6px 10px;
  border-radius: 4px; font-size: 12px; max-width: 320px;
}

#api-error {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  z-index: 1; background: rgba(255,220,220,0.95); color: #8a0000;
  padding: 6px 14px; border-radius: 4px; font-size: 12px;
}
#api-error code { background: rgba(0,0,0,0.08); padding: 1px 4px; border-radius: 2px; }

.submit-error {
  background: #fee; color: #8a0000; padding: 6px 10px; border-radius: 4px;
  margin-top: 8px; font-size: 12px;
}

.geo-distance { color: #666; font-size: 12px; margin: 2px 0 6px; }
.geo-distance.far { color: #8a4f00; background: #fff4d6; padding: 4px 8px; border-radius: 4px; }

.photos-grid {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 4px;
}
.add-photo {
  width: 80px; height: 80px; flex: 0 0 80px;
  border: 2px dashed #ccc; background: #f8f8f8; border-radius: 8px;
  font-size: 28px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.add-photo:hover { background: #eee; border-color: #999; }
.photo-thumb {
  width: 80px; height: 80px; flex: 0 0 80px; border-radius: 8px;
  overflow: hidden; background: #eee; display: block; text-decoration: none;
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-uploading {
  width: 80px; height: 80px; flex: 0 0 80px; border-radius: 8px;
  background: #eee; color: #888; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
}
.photo-error {
  background: #fee; color: #8a0000; padding: 6px 10px; border-radius: 4px;
  margin-top: 6px; font-size: 12px;
}

.selection-meta { color: #444; font-size: 13px; margin-top: -2px; }
.selection-breakdown { color: #888; font-size: 12px; margin: 4px 0 14px; }
.multi-hint { color: #888; font-size: 11px; margin: 10px 0 0; text-align: center; }

/* === Penthouse screen overlay (penthouses.js) === */
#ph-legend {
  position: absolute; top: 176px; left: 12px; z-index: 1;
  background: rgba(255,255,255,0.95); padding: 8px 12px; border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15); width: 190px; box-sizing: border-box;
}
#ph-legend.off .ph-rows, #ph-legend.off .ph-features, #ph-legend.off .ph-note { opacity: 0.4; }
.ph-features { border-top: 1px solid #eee; margin-top: 6px; padding-top: 4px; }
.ph-subtitle { color: #777; font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 2px; }
.ph-title { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.ph-title input { margin: 0; }
.ph-row { cursor: pointer; }
.ph-row input { margin: 0 2px 0 0; }
.ph-sw { width: 12px; height: 12px; border-radius: 50%; display: inline-block; border: 1px solid #1e1b4b; }
.ph-name { flex: 1; }
.ph-count { color: #888; font-size: 11px; font-variant-numeric: tabular-nums; }
.ph-note { color: #777; font-size: 11px; line-height: 1.3; margin-top: 6px; }
@media (max-width: 599px) {
  #ph-legend { top: auto; bottom: 12px; left: 12px; width: 170px; }
  .ph-note { display: none; }
}

#ph-tooltip {
  position: absolute; z-index: 3; pointer-events: none;
  background: rgba(30,27,75,0.92); color: #fff; padding: 6px 10px;
  border-radius: 4px; font-size: 12px; max-width: 280px; line-height: 1.35;
}

.ph-kicker { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: #7c3aed; font-weight: 600; margin-bottom: 2px; }
.ph-sub { color: #888; font-size: 12px; margin: 0 0 8px; }
.ph-badge { display: inline-block; font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 6px; margin: 6px 0 12px; }
.ph-facts { display: grid; grid-template-columns: 82px 1fr; gap: 4px 10px; margin: 0; font-size: 13px; }
.ph-facts dt { color: #777; }
.ph-facts dd { margin: 0; }
.ph-dim { color: #888; }
.ph-text { font-size: 12px; color: #444; line-height: 1.4; margin: 0 0 6px; word-break: break-word; }
.ph-text a { color: #7c3aed; }
