body {
  margin: 0 auto;
  max-width: 960px;
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  font-family: -apple-system, "PingFang SC", system-ui, sans-serif;
  background: white;
}
header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  height: auto;
  gap: 4px 12px;
  padding: calc(env(safe-area-inset-top) + 6px) max(14px, env(safe-area-inset-right)) 8px max(14px, env(safe-area-inset-left));
}
.brand { gap: 8px; }
.brand .brandmark { display: block; width: 32px; font: 26px/32px Georgia; border-radius: 9px; }
h1 { font-size: 18px; }
.edition, .area-switch span { display: none; }
#openFavorites { grid-area: 1/2; min-height: 44px; padding: 4px 10px; border-color: transparent; font-size: 14px; }
.area-switch { grid-area: 2/1/3/-1; padding: 2px; }
.area-switch button { flex: 1; padding: 0; min-height: 44px; font-size: 14px; }
main { display: grid; grid-template: minmax(0,1fr) / minmax(0,1fr); height: auto; min-height: 0; }
.atlas, #listPanel { grid-area: 1/1; min-height: 0; min-width: 0; height: auto; }
body[data-panel="map"] #listPanel, body[data-panel="list"] .atlas { visibility: hidden; pointer-events: none; }
.map-title { left: max(12px,env(safe-area-inset-left)); top: 12px; padding: 7px 12px; }
.map-title h2 { font-size: 22px; line-height: 1.2; }
.map-title p, .map-title small { font-size: 11px; }
.mapKey { display: none; }
.recenter { left: max(12px,env(safe-area-inset-left)); bottom: 16px; min-height: 44px; font-size: 13px; }
.leaflet-control-zoom { margin: 12px max(12px,env(safe-area-inset-right)) 0 0 !important; }
.leaflet-touch .leaflet-control-zoom a { width: 44px; height: 44px; line-height: 44px; }
.price-pin { font-size: 13px; line-height: 26px; }
.price-pin.compact { width: 13px; height: 13px; border-radius: 50%; padding: 0; font-size: 0; transform: translate(-50%, -50%); }
.price-pin.compact em { display: none; }
.price-pin.compact::after { width: 28px; height: 28px; top: -9px; left: -9px; border: 0; transform: none; background: transparent; }
.phone-nav {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  border-top: 1px solid var(--line); background: white;
  padding: 6px max(12px,env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));
}
.phone-nav button { min-height: 44px; border: 0; border-radius: 9px; background: #f1f4ef; font-weight: 700; }
.phone-nav button[aria-pressed="true"] { color: white; background: var(--green); }
#phoneCount { margin-left: 3px; font-size: 12px; font-variant-numeric: tabular-nums; }
#listPanel { border: 0; padding-inline: env(safe-area-inset-left) env(safe-area-inset-right); }
.list-toolbar { display: flex; align-items: center; gap: 2px; padding: 2px 12px; }
#summary { min-width: 0; margin: 0; font-size: 14px; font-weight: 650; color: var(--ink); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.list-toolbar #clearGroup { flex: none; width: 44px; height: 44px; margin: 0; padding: 0; font-size: 20px; color: var(--muted); background: transparent; }
#openFilters { flex: none; min-height: 44px; margin-left: auto; border: 0; padding: 0 5px; background: transparent; color: var(--green); font-weight: 700; }
#filterCount { margin-left: 4px; padding: 1px 5px; border-radius: 6px; background: #e5f0e6; }
#phoneFilters { padding: 16px max(16px,env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left)); }
#filterTitle { font-size: 20px; margin: 0 48px 12px 0; }
#phoneFilters .fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin: 0 0 12px; }
#phoneFilters .fields label:first-child { grid-column: 1/-1; }
#phoneFilters .fields select { min-height: 44px; font-size: 16px; }
#phoneFilters .tabs { gap: 6px; }
#phoneFilters .tabs button { min-height: 44px; }
#viewFiltered { width: 100%; min-height: 44px; margin-top: 14px; border: 0; border-radius: 8px; background: var(--green); color: white; font-weight: 700; }
.results { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 12px; }
.card { gap: 9px; padding: 11px 0; }
.card img { width: 72px; height: 64px; }
.save-button { min-width: 44px; min-height: 44px; font-size: 13px; }
.about { margin: 0; padding: 0 12px; }
.about a,.about button { display: inline-flex; align-items: center; min-height: 44px; }
dialog,#favorites {
  width: min(100%, 560px); max-width: 100%; max-height: calc(100dvh - env(safe-area-inset-top) - 12px);
  margin: auto auto 0; border-radius: 18px 18px 0 0; overscroll-behavior: contain;
  padding-bottom: env(safe-area-inset-bottom);
}
#detail, #favorites { overflow: hidden; }
#detail[open], #favorites[open] { display: flex; flex-direction: column; }
#detailBody, #favoriteList { overflow-y: auto; min-height: 0; }
.close { width: 44px; height: 44px; top: 8px; right: 8px; }
.cover { height: clamp(160px,32dvh,360px); touch-action: pan-y pinch-zoom; }
.gallery-nav button { border: 1px solid var(--line); border-radius: 8px; background: white; min-height: 44px; }
.detailText,.infoBody { padding: 16px max(16px,env(safe-area-inset-right)) 16px max(16px,env(safe-area-inset-left)); }
.infoBody h2 { padding-right: 35px; }
dd { overflow-wrap: anywhere; }
.actions button,.actions a { min-height: 44px; display: inline-flex; align-items: center; }
#favorites { padding: 0 max(14px,env(safe-area-inset-right)) env(safe-area-inset-bottom) max(14px,env(safe-area-inset-left)); }
.favorites-heading { min-height: 64px; align-items: center; padding-right: 44px; }
@media (orientation: landscape) and (max-height: 500px) {
  header { grid-template-columns: auto minmax(180px,1fr) auto; align-items: center; }
  .area-switch { grid-area: 1/2; }
  #openFavorites { grid-area: 1/3; }
  .map-title p,.map-title small { display: none; }
}
