/* Homeground on the web. The look follows the iOS app: system type, grouped
   backgrounds, rounded cards and frosted panels over a full-bleed map. */

:root {
  color-scheme: light dark;
  --accent: #1c6b8f;
  --accent-soft: rgba(28, 107, 143, 0.12);
  --on-accent: #fff;
  --label: #000;
  --secondary: rgba(60, 60, 67, 0.62);
  --tertiary: rgba(60, 60, 67, 0.3);
  --grouped: #f2f2f7;
  --card: #fff;
  --tile: #f2f2f7;
  --elevated: #fff;
  --separator: rgba(60, 60, 67, 0.2);
  --fill: rgba(118, 118, 128, 0.12);
  --fill-strong: rgba(120, 120, 128, 0.2);
  --seg-thumb: #fff;
  --material: rgba(250, 250, 250, 0.8);
  --red: #ff3b30;
  --orange: #c96a00;
  --green: #1f8a3e;
  --best: rgba(52, 199, 89, 0.18);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #5cb8db;
    --accent-soft: rgba(92, 184, 219, 0.18);
    --on-accent: #04222e;
    --label: #fff;
    --secondary: rgba(235, 235, 245, 0.62);
    --tertiary: rgba(235, 235, 245, 0.3);
    --grouped: #000;
    --card: #1c1c1e;
    --tile: #2c2c2e;
    --elevated: #2c2c2e;
    --separator: rgba(84, 84, 88, 0.65);
    --fill: rgba(118, 118, 128, 0.24);
    --fill-strong: rgba(120, 120, 128, 0.36);
    --seg-thumb: #636366;
    --material: rgba(34, 34, 36, 0.8);
    --red: #ff453a;
    --orange: #ff9f0a;
    --green: #30d158;
    --best: rgba(48, 209, 88, 0.22);
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  }
  /* Sheets sit a level above the page, as they do on iOS. */
  .sheet { --grouped: #1c1c1e; --card: #2c2c2e; --tile: #3a3a3c; }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 17px/1.3 var(--font);
  color: var(--label);
  background: var(--grouped);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}
h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; text-align: inherit; }
button:disabled { cursor: default; opacity: 0.35; }
a { color: var(--accent); text-decoration: none; }
input, select { font: inherit; color: inherit; }
small { font-size: 12px; }
hr { border: 0; height: 1px; background: var(--separator); margin: 0; width: 100%; transform: scaleY(0.6); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon { flex: none; display: block; }
.accent { color: var(--accent); }
.secondary { color: var(--secondary); }
.placeholder { color: var(--secondary); }
.material {
  background: var(--material);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
}

/* ---------- Splash ---------- */

#splash {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 10px; background: var(--grouped); z-index: 10;
}
#splash img { border-radius: 19px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18); margin-bottom: 6px; }
#splash strong { font-size: 22px; font-weight: 700; }
#splash p { color: var(--secondary); font-size: 15px; max-width: 280px; text-align: center; }
#splash.failed p { color: var(--label); }

/* ---------- Layout ---------- */

.app { position: fixed; inset: 0; display: flex; background: var(--grouped); }
.app.compact { flex-direction: column; }
.stage { position: relative; flex: 1; min-width: 0; min-height: 0; overflow: hidden; }
.sidebar {
  position: relative; flex: none; width: 340px; background: var(--grouped);
  border-right: 1px solid var(--separator); z-index: 3;
}
.inspector {
  flex: none; width: 380px; display: flex; flex-direction: column; background: var(--grouped);
  border-left: 1px solid var(--separator); z-index: 3;
}
.inspector-bar { display: flex; justify-content: flex-end; padding: 6px 8px 0; flex: none; }
.close-button { display: grid; place-items: center; width: 44px; height: 36px; color: var(--secondary); }
.detail-scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.tab-page { position: relative; flex: 1; min-height: 0; }
.stack-root { position: absolute; inset: 0; }

.tab-bar {
  flex: none; display: grid; grid-template-columns: repeat(3, 1fr);
  height: calc(50px + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  border-top: 1px solid var(--separator); z-index: 6;
}
.tab-bar button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--secondary); font-size: 10px; font-weight: 500;
}
.tab-bar button.on { color: var(--accent); }

/* ---------- Pages (lists) ---------- */

.page { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--grouped); }
.compact .page { padding-top: var(--safe-top); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 10px 4px 20px; flex: none; }
.page-head h1 { font-size: 30px; font-weight: 700; letter-spacing: -0.4px; line-height: 1.15; }
.page-actions { display: flex; align-items: center; gap: 2px; color: var(--accent); min-height: 40px; }
.icon-button, .options-menu .menu-button { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--accent); }
.icon-button:hover, .options-menu .menu-button:hover { background: var(--fill); }
.options-menu { --ko: var(--grouped); }
.page-search { padding: 6px 16px 10px; flex: none; }
.page-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 0 28px; -webkit-overflow-scrolling: touch; }
.nav-bar { display: flex; align-items: center; height: 44px; padding: 0 6px; flex: none; }
.load-more { height: 1px; }

.search {
  display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 8px;
  background: var(--fill); border-radius: 10px; color: var(--secondary);
}
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--label); padding: 0; -webkit-appearance: none; appearance: none; }
.search input::placeholder { color: var(--secondary); }
.search input::-webkit-search-cancel-button { display: none; }
.search-clear { display: grid; place-items: center; color: var(--secondary); }

/* ---------- Grouped sections and rows ---------- */

.section { margin: 0 16px 22px; }
.section-head { font-size: 13px; color: var(--secondary); text-transform: uppercase; padding: 0 16px 7px; letter-spacing: 0.1px; }
.section-foot { font-size: 13px; color: var(--secondary); padding: 7px 16px 0; line-height: 1.35; }
.group { background: var(--card); border-radius: 12px; overflow: hidden; }
.tier-head { display: inline-flex; align-items: center; gap: 6px; }
.result-head { font-size: 22px; font-weight: 700; color: var(--accent); text-transform: none; }

.row {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 44px; padding: 8px 16px; text-align: left;
}
.group > .row + .row::before, .group > .row + .area-row::before {
  content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 1px;
  background: var(--separator); transform: scaleY(0.6);
}
.row-title { flex: 1; min-width: 0; }
.row-title small { display: block; font-size: 12px; color: var(--secondary); margin-top: 2px; line-height: 1.3; }
.row-value { color: var(--secondary); text-align: right; font-variant-numeric: tabular-nums; }
.row.bold .row-title, .row.bold .row-value { font-weight: 700; color: var(--label); }
.row.link.tinted .row-title, .row.link.tinted .row-icon, .row.action { color: var(--accent); }
.row.link:hover, .row.action:hover, .area-main:hover, .row.choice:hover { background: var(--fill); }
.row-chevron { color: var(--tertiary); }
.row.link .row-title { flex: 0 0 auto; white-space: nowrap; }
.row.link .row-value { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .row.link { gap: 10px; }
.sidebar .row.link .row-value { font-size: 15px; }
.row.note { display: block; font-size: 15px; line-height: 1.38; padding: 11px 16px; }
.row.welcome { font-size: 15px; line-height: 1.35; padding: 12px 16px; }
.row.selected { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.form-note { font-size: 13px; color: var(--secondary); padding: 0 32px 8px; line-height: 1.35; }
.count-badge { display: inline-block; background: var(--accent); color: var(--on-accent); font-size: 15px; font-weight: 600; padding: 1px 8px; border-radius: 999px; }

.field { cursor: text; }
.field .row-title { flex: 0 1 auto; }
.field-box { display: flex; align-items: center; gap: 2px; flex: 1 1 124px; min-width: 124px; justify-content: flex-end; }
.field-unit { color: var(--secondary); }
.field input { flex: 0 1 auto; min-width: 0; max-width: 100%; border: 0; background: none; outline: none; text-align: right; padding: 4px 0; font-variant-numeric: tabular-nums; }
.row.picker .row-title { flex: 0 0 auto; }
.row.picker .picker-box { flex: 1; min-width: 0; justify-content: flex-end; }
.row.picker select { max-width: 100%; }
.field input::placeholder { color: var(--tertiary); }
.picker-box { position: relative; display: flex; align-items: center; color: var(--accent); }
.picker-box select { -webkit-appearance: none; appearance: none; border: 0; background: none; color: var(--accent); padding: 4px 22px 4px 4px; text-align: right; text-align-last: right; cursor: pointer; outline-offset: 2px; }
.picker-box .icon { position: absolute; right: 0; pointer-events: none; }
.picker-box option { color: initial; }

/* Area rows */
.area-row { padding: 0; gap: 0; }
.area-main, .row.choice { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; padding: 9px 16px; min-height: 58px; }
.area-name { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.area-name b { font-weight: 500; }
.area-name small { color: var(--secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.area-figure { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.area-figure b { font-weight: 600; font-variant-numeric: tabular-nums; }
.area-figure small { color: var(--secondary); font-variant-numeric: tabular-nums; }
.area-heart { color: var(--red); flex: none; }
.row-edit { display: flex; align-items: center; gap: 2px; padding-right: 10px; flex: none; }
.row-edit button { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: var(--accent); }
.row-edit button.remove { color: var(--red); }

.unavailable { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 44px 28px; color: var(--secondary); }
.unavailable h3 { font-size: 22px; font-weight: 700; color: var(--label); margin-top: 6px; overflow-wrap: anywhere; }
.unavailable p { font-size: 15px; line-height: 1.35; max-width: 300px; }
.unavailable .button { margin-top: 8px; }

/* ---------- Controls ---------- */

.seg {
  position: relative; display: grid; grid-template-columns: repeat(var(--n), 1fr); width: 100%;
  height: 32px; padding: 2px; background: var(--fill); border-radius: 9px; flex: none;
}
.seg-thumb {
  position: absolute; top: 2px; bottom: 2px; left: 2px; width: calc((100% - 4px) / var(--n));
  transform: translateX(calc(var(--i) * 100%)); background: var(--seg-thumb); border-radius: 7px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 3px 1px rgba(0, 0, 0, 0.04);
  transition: transform 0.22s cubic-bezier(0.3, 0.7, 0.3, 1);
}
.seg button { position: relative; z-index: 1; font-size: 13px; font-weight: 500; text-align: center; border-radius: 7px; white-space: nowrap; }
.seg button.on { font-weight: 600; }
.seg.inline { width: 190px; }

.switch { position: relative; flex: none; width: 51px; height: 31px; border-radius: 16px; background: var(--fill-strong); transition: background 0.2s; }
.switch.on { background: var(--accent); }
.switch span { position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(0, 0, 0, 0.16); transition: transform 0.2s; }
.switch.on span { transform: translateX(20px); }

.slider { display: flex; align-items: center; gap: 10px; width: 100%; }
.slider-cap { font-size: 12px; color: var(--label); flex: none; }
.slider input { -webkit-appearance: none; appearance: none; flex: 1; min-width: 0; height: 30px; margin: 0; background: none; cursor: pointer; }
.slider input::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--accent) var(--p), var(--fill-strong) var(--p)); }
.slider input::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -12px; border-radius: 50%; background: #fff; box-shadow: 0 0.5px 4px rgba(0, 0, 0, 0.14), 0 6px 13px rgba(0, 0, 0, 0.14); }
.slider input::-moz-range-track { height: 4px; border-radius: 2px; background: var(--fill-strong); }
.slider input::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
.slider input::-moz-range-thumb { width: 28px; height: 28px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 0.5px 4px rgba(0, 0, 0, 0.14), 0 6px 13px rgba(0, 0, 0, 0.14); }

.stepper { display: inline-flex; align-items: center; background: var(--fill); border-radius: 8px; flex: none; }
.stepper button { display: grid; place-items: center; width: 46px; height: 32px; }
.stepper-rule { width: 1px; height: 18px; background: var(--separator); }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px; font-size: 15px; font-weight: 500; white-space: nowrap;
}
.button.large { width: 100%; min-height: 50px; border-radius: 12px; font-size: 17px; }
.button.small { padding: 6px 14px; }
.button.prominent { background: var(--accent); color: var(--on-accent); }
.button.tinted { background: var(--accent-soft); color: var(--accent); }
.button.bordered { background: var(--fill); color: var(--accent); }
.button.plain { color: var(--accent); }
.button:hover { filter: brightness(1.06); }
.button:active { opacity: 0.75; }

.tier-badge { display: inline-flex; align-items: center; gap: 4px; padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.tier-badge.compact { font-size: 11px; padding: 3px 7px; gap: 3px; }
.tier-dot { display: inline-block; flex: none; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.9); }

/* ---------- Menus ---------- */

.menu-wrap { position: relative; display: inline-block; }
.menu {
  position: absolute; top: calc(100% + 6px); z-index: 60; min-width: 236px;
  max-height: min(62vh, 560px); overflow-y: auto; padding: 5px 0; border-radius: 13px;
  background: var(--elevated); box-shadow: 0 10px 44px rgba(0, 0, 0, 0.22), 0 0 0 0.5px var(--separator);
  animation: pop 0.14s ease-out;
}
.menu.end { right: 0; transform-origin: top right; }
.menu.start { left: 0; transform-origin: top left; }
.menu.up { top: auto; bottom: calc(100% + 6px); transform-origin: bottom left; }
.menu-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 14px 10px 10px; font-size: 16px; color: var(--label); text-align: left; }
.menu-item:hover { background: var(--fill); }
.menu-check { flex: none; width: 16px; color: var(--label); }
.menu-label { flex: 1; }
.menu-item > .icon { color: var(--secondary); }
.menu-title { font-size: 12px; color: var(--secondary); padding: 9px 14px 4px 34px; margin-top: 5px; border-top: 6px solid var(--fill); }
.inline-menu .menu-button { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-size: 15px; padding: 2px 0; }

/* ---------- Sheets ---------- */

.sheet-layer { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 24px; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.32); animation: fade 0.2s ease-out; }
.sheet {
  position: relative; display: flex; flex-direction: column; width: min(540px, 100%);
  height: min(740px, 100%); background: var(--grouped); border-radius: 14px; overflow: hidden;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.3); animation: rise 0.3s cubic-bezier(0.2, 0.85, 0.25, 1); outline: none;
}
.sheet.compare-sheet { width: min(600px, 100%); }
.sheet-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; flex: none; height: 54px; padding: 0 8px; }
.sheet-bar h2 { font-size: 17px; font-weight: 600; text-align: center; }
.bar-side { display: flex; align-items: center; }
.bar-side.end { justify-content: flex-end; }
.bar-button { display: inline-flex; align-items: center; gap: 2px; color: var(--accent); padding: 8px; border-radius: 8px; white-space: nowrap; }
.bar-button.strong { font-weight: 600; }
.bar-button.back { padding-left: 2px; }
.sheet-body { position: relative; flex: 1; min-height: 0; }
.sheet-page { position: absolute; inset: 0; overflow-y: auto; padding: 14px 0 28px; -webkit-overflow-scrolling: touch; }
.sheet-page.under { visibility: hidden; }
.sheet-page .section-plain { padding: 0; }
.chooser .page-search { padding-top: 0; }

.compare-columns { display: flex; align-items: flex-start; gap: 12px; overflow-x: auto; padding: 2px 16px 12px; }
.compare-card { flex: none; width: 170px; }
.compare-head { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.compare-head small { color: var(--secondary); }
.compare-metric { display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; border-radius: 8px; margin: 0 -8px; }
.compare-metric small { color: var(--secondary); }
.compare-metric b { font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; }
.compare-metric.best { background: var(--best); }
.compare-metric.best b { font-weight: 700; }
.compare-note { font-size: 12px; color: var(--secondary); padding: 0 16px; line-height: 1.35; }

/* ---------- Suburb detail ---------- */

.detail { display: flex; flex-direction: column; gap: 16px; padding: 16px; }
.inspector .detail, .detail-sheet .detail { padding-top: 4px; }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.detail-head h2 { font-size: 22px; font-weight: 700; line-height: 1.2; }
.detail-head p { font-size: 15px; color: var(--secondary); margin: 6px 0; }
.heart { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 50%; color: var(--secondary); }
.heart.on { color: var(--red); }
.heart:hover { background: var(--fill); }

.card { display: flex; flex-direction: column; gap: 12px; padding: 16px; background: var(--card); border-radius: 16px; }
.card h3 { font-size: 17px; font-weight: 600; }
.card p { font-size: 15px; line-height: 1.36; }
.card .footnote { font-size: 13px; color: var(--secondary); }
.card.no-data { align-items: center; text-align: center; gap: 8px; color: var(--secondary); }
.card.no-data h3 { color: var(--label); }
.figure { display: flex; flex-direction: column; gap: 2px; }
.figure small { color: var(--secondary); }
.large-title { font-size: 34px; font-weight: 700; letter-spacing: -0.5px; line-height: 1.12; font-variant-numeric: tabular-nums; }
.title { font-size: 28px; font-weight: 700; letter-spacing: -0.3px; line-height: 1.15; }
.title3 { font-size: 20px; font-weight: 600; line-height: 1.2; }
.title3.spaced { margin-top: 4px; }
.notice { display: flex; align-items: flex-start; gap: 6px; }
.notice .icon { margin-top: 1px; }
.notice.red { color: var(--red); }
.notice.orange { color: var(--orange); }

.detail-rows { display: flex; flex-direction: column; gap: 8px; }
.detail-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 15px; }
.detail-row span { color: var(--secondary); }
.detail-row b { font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; }
.detail-row.bold b { font-weight: 700; }
.detail-row.total span { color: var(--label); font-weight: 600; }
.detail-row.total b { font-size: 20px; font-weight: 700; }

.measure { display: flex; flex-direction: column; gap: 6px; }
.measure-head { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.measure-head span { color: var(--secondary); }
.measure-head b { font-weight: 600; }
.bar { position: relative; height: 34px; }
.bar-track, .bar-fill { position: absolute; left: 0; top: 3px; height: 8px; border-radius: 4px; }
.bar-track { width: 100%; background: var(--fill); }
.bar-fill { max-width: 100%; }
.bar-mark { position: absolute; top: 0; width: 1.5px; height: 14px; margin-left: -0.75px; background: var(--label); opacity: 0.55; }
.bar-label { position: absolute; top: 19px; transform: translateX(-50%); font-size: 11px; color: var(--secondary); white-space: nowrap; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-tile { display: flex; flex-direction: column; gap: 4px; padding: 10px; background: var(--tile); border-radius: 12px; min-width: 0; }
.stat-tile small { color: var(--secondary); }
.stat-tile b { display: flex; align-items: center; gap: 4px; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-tile b.green { color: var(--green); }
.stat-tile b.red { color: var(--red); }

.chart { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; }
.chart-axis { position: relative; width: 42px; height: 150px; }
.chart-axis span { position: absolute; right: 0; transform: translateY(-50%); font-size: 11px; color: var(--secondary); font-variant-numeric: tabular-nums; }
.chart-plot { position: relative; height: 150px; }
.chart-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.chart-grid { position: absolute; left: 0; right: 0; height: 1px; background: var(--separator); opacity: 0.7; }
.chart-point { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--accent); }
.chart-labels { grid-column: 2; display: grid; margin-top: 7px; font-size: 11px; color: var(--secondary); text-align: center; }

.link-buttons { display: flex; flex-direction: column; gap: 10px; }
.detail-foot { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 0 4px 8px; font-size: 12px; color: var(--secondary); line-height: 1.35; }
.detail-foot button { color: var(--accent); font-weight: 600; margin-top: 2px; }

/* The phone's suburb sheet over the map */
.detail-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; height: 50%; z-index: 5;
  display: flex; flex-direction: column; background: var(--grouped); border-radius: 14px 14px 0 0;
  box-shadow: 0 -6px 30px rgba(0, 0, 0, 0.2); transition: height 0.34s cubic-bezier(0.2, 0.85, 0.25, 1);
  animation: slide-up 0.32s cubic-bezier(0.2, 0.85, 0.25, 1);
}
.detail-sheet.large { height: calc(100% - 8px - var(--safe-top)); }
.detail-sheet.dragging { transition: none; }
.detail-sheet-bar { position: relative; flex: none; height: 32px; touch-action: none; cursor: grab; }
.grabber { position: absolute; top: 6px; left: 50%; width: 36px; height: 5px; margin-left: -18px; border-radius: 3px; background: var(--tertiary); }
.detail-sheet-bar .close-button { position: absolute; top: 2px; right: 4px; }

/* ---------- Map ---------- */

.map-screen { position: absolute; inset: 0; }
.map-canvas { position: absolute; inset: 0; z-index: 0; isolation: isolate; background: #e9e7e2; font-family: var(--font); }
.leaflet-container { font: 11px var(--font); }
.leaflet-control-attribution { font-size: 10px; background: color-mix(in srgb, var(--card) 72%, transparent) !important; color: var(--secondary) !important; border-radius: 6px 0 0 0; }
.leaflet-control-attribution a { color: inherit !important; }
.leaflet-interactive:focus { outline: none; }
.hg-zone { cursor: grab; transition: fill-opacity 0.25s; }
.zone-level .hg-zone { cursor: pointer; }
.hg-marker { background: none; border: 0; }
.hg-marker:focus-visible { outline: none; }
.hg-marker:focus-visible > * { outline: 2px solid var(--accent); outline-offset: 2px; }

.pin { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); cursor: pointer; -webkit-user-select: none; user-select: none; }
.pin.pill {
  padding: 4px 8px; border-radius: 999px; border: 1px solid #fff; white-space: nowrap;
  font: 700 12.5px/1.2 var(--font); box-shadow: 0 1px 2.5px rgba(0, 0, 0, 0.26);
}
.pin.pill.selected { padding: 7px 13px; border-width: 3px; font-size: 15px; box-shadow: 0 1px 5px rgba(0, 0, 0, 0.4); }
.pin.dot { display: grid; place-items: center; width: 30px; height: 30px; }
.pin.dot i { display: block; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.9), 0 1px 2px rgba(0, 0, 0, 0.22); }
.zone-tag {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); display: flex; flex-direction: column;
  align-items: center; gap: 2px; padding: 5px 9px; border-radius: 10px; white-space: nowrap; cursor: pointer;
  background: var(--elevated); color: var(--label); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22), 0 0 0 0.5px rgba(0, 0, 0, 0.08);
  -webkit-user-select: none; user-select: none;
}
.zone-tag b { font: 700 12.5px/1.2 var(--font); }
.zone-tag span { display: flex; align-items: center; gap: 4px; font: 500 11px/1.2 var(--font); color: var(--secondary); }
.zone-tag i { display: block; width: 14px; height: 7px; border-radius: 4px; }

.map-top {
  position: absolute; top: calc(8px + var(--safe-top)); left: 50%; transform: translateX(-50%); z-index: 2;
  width: min(520px, calc(100% - 24px)); display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
  pointer-events: none;
}
.map-top > * { pointer-events: auto; }
.map-panel { align-self: stretch; display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 18px; box-shadow: var(--shadow); }
.map-panel-row { display: flex; align-items: center; gap: 10px; }
.type-picker { width: 150px; flex: 0 1 150px; min-width: 112px; }
.budget-button {
  flex: 1 0 auto; max-width: calc(100% - 178px); min-width: 0; display: flex; align-items: center; gap: 6px; padding: 7px 12px;
  border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 15px; font-weight: 600;
}
.budget-button span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compact .budget-button { padding: 7px 10px; }
.compact .budget-button.long { font-size: 13px; gap: 5px; }
.filter-button { position: relative; flex: none; display: grid; place-items: center; width: 36px; height: 34px; color: var(--accent); --ko: var(--card); }
.filter-button b {
  position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; line-height: 16px; text-align: center;
}

.home-banner { align-self: stretch; display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 18px; box-shadow: var(--shadow); }
.home-banner div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.home-banner strong { font-size: 15px; font-weight: 600; }
.home-banner span { font-size: 12px; color: var(--secondary); }

.chip {
  display: inline-flex; align-items: center; gap: 9px; max-width: 100%; padding: 9px 14px; border-radius: 999px;
  color: var(--accent); font-size: 15px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12); white-space: nowrap;
}
.chip button { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.chip strong { font-weight: 600; }
.chip small { color: var(--secondary); font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; }
.chip-rule { width: 1px; height: 16px; background: var(--separator); flex: none; }
.chip-swatch { width: 22px; height: 10px; border-radius: 5px; flex: none; }
.chip-name { color: var(--label); overflow: hidden; text-overflow: ellipsis; }

.map-bottom {
  position: absolute; left: 12px; right: 12px; bottom: 34px; z-index: 2; display: flex; align-items: flex-end;
  justify-content: space-between; gap: 12px; pointer-events: none;
}
.map-bottom > * { pointer-events: auto; }
.legend { display: flex; flex-direction: column; gap: 5px; width: 172px; padding: 10px; border-radius: 12px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12); font-size: 12px; }
.legend-row { display: flex; align-items: center; gap: 6px; }
.legend-row b { margin-left: auto; font-weight: 400; color: var(--secondary); font-variant-numeric: tabular-nums; }
.legend-swatch { width: 18px; height: 10px; border-radius: 5px; flex: none; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.9); }
.legend-hint { font-size: 11px; color: var(--secondary); margin-top: 1px; }
.data-caption { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--secondary); margin-top: 1px; align-self: flex-start; }
.data-caption:hover { color: var(--accent); }
.map-buttons { display: flex; flex-direction: column; align-items: center; border-radius: 12px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12); }
.map-buttons i { width: 28px; height: 1px; background: var(--separator); }
.map-button { display: grid; place-items: center; width: 44px; height: 44px; color: var(--accent); }
.map-button:first-child { border-radius: 12px 12px 0 0; }
.map-button:last-child { border-radius: 0 0 12px 12px; }
.map-button:hover { background: var(--fill); }
@media (pointer: coarse) { .map-buttons .zoom { display: none; } }

/* ---------- Phones ---------- */

@media (max-width: 759px) {
  .sheet-layer { place-items: end center; padding: 0; }
  .sheet {
    width: 100%; height: calc(100% - 22px - var(--safe-top)); border-radius: 14px 14px 0 0;
    animation-name: slide-up; padding-bottom: var(--safe-bottom);
  }
  .seg.inline { width: 168px; }
}

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(24px) scale(0.98); } }
@keyframes slide-up { from { transform: translateY(100%); } }
@keyframes pop { from { opacity: 0; transform: scale(0.92); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
