:root {
  --bg: #fff8e7;
  --card: #fff;
  --ink: #171717;
  --accent: #ed412f;
  --yellow: #ffd84d;
  --blue: #1479a8;
  --muted: #68635a;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); -webkit-text-size-adjust: 100%; }
body { min-height: 100%; margin: 0; color: var(--ink); background: var(--bg); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; overflow-x: hidden; }
button, input, a { font: inherit; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.map-page-topbar {
  position: relative;
  z-index: 1000;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: .78rem;
  align-items: center;
  width: min(1440px, calc(100% - 1.5rem));
  margin: 0 auto;
  padding: max(.72rem, env(safe-area-inset-top)) 0 .75rem;
}

.map-page-brand { display: grid; width: 50px; height: 50px; place-items: center; background: #fff; border: 3px solid var(--ink); border-radius: 14px; box-shadow: 3px 3px 0 var(--ink); }
.map-page-brand img { width: 42px; height: 42px; border-radius: 10px; }
.map-page-title { min-width: 0; }
.map-page-title p { margin: 0; color: var(--accent); font-size: .66rem; font-weight: 950; letter-spacing: .09em; text-transform: uppercase; }
.map-page-title h1 { margin: .06rem 0 0; font-size: clamp(1.35rem, 3.2vw, 2rem); line-height: 1; letter-spacing: -.045em; }

.locale-menu { position: relative; z-index: 10030; margin: 0; }
.locale-menu summary { min-height: 44px; padding: .55rem .8rem; list-style: none; background: #fff; border: 3px solid var(--ink); border-radius: 999px; box-shadow: 3px 3px 0 var(--ink); font-size: .78rem; font-weight: 950; cursor: pointer; }
.locale-menu summary::-webkit-details-marker { display: none; }
.locale-menu nav { position: absolute; top: calc(100% + .5rem); right: 0; display: grid; width: max-content; min-width: 180px; padding: .55rem; background: #fff; border: 3px solid var(--ink); border-radius: 15px; box-shadow: 5px 5px 0 var(--ink); }
.locale-menu a { min-height: 40px; padding: .55rem .65rem; color: var(--ink); border-radius: 9px; font-size: .78rem; font-weight: 850; text-decoration: none; }
.locale-menu a:hover, .locale-menu a[aria-current="page"] { background: var(--yellow); }

.map-page-main { width: min(1440px, 100%); margin: 0 auto; padding: 0 .75rem calc(6rem + env(safe-area-inset-bottom)); }
.map-intro { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; align-items: center; width: min(1040px, 100%); margin: .35rem auto .8rem; }
.map-intro-copy { max-width: 760px; }
.map-intro p { margin: 0; color: var(--muted); font-size: clamp(.8rem, 2vw, .96rem); font-weight: 720; line-height: 1.45; }
.map-find-now { display: inline-flex; min-height: 50px; align-items: center; justify-content: center; gap: .45rem; padding: .62rem 1rem; color: #fff; background: var(--accent); border: 3px solid var(--ink); border-radius: 999px; box-shadow: 4px 4px 0 var(--ink); font-size: .8rem; font-weight: 950; text-decoration: none; white-space: nowrap; transition: transform .18s cubic-bezier(.16, 1, .3, 1), box-shadow .18s cubic-bezier(.16, 1, .3, 1); }
.map-find-now:hover, .map-find-now:focus-visible { transform: translateY(-2px); box-shadow: 4px 6px 0 var(--ink); }
.map-find-now:focus-visible { outline: 3px solid #1c7ed6; outline-offset: 3px; }

.map-tools { position: relative; z-index: 850; display: grid; grid-template-columns: minmax(280px, 1fr) auto; gap: .75rem; align-items: end; width: min(1040px, 100%); margin: 0 auto .75rem; }
.map-search { position: relative; }
.map-search > label { display: block; margin: 0 0 .34rem .15rem; font-size: .72rem; font-weight: 900; }
.map-search-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; min-height: 52px; background: #fff; border: 3px solid var(--ink); border-radius: 16px; box-shadow: 4px 4px 0 var(--ink); overflow: hidden; }
.map-search-row > i { margin-left: .75rem; color: var(--accent); font-size: 1.2rem; }
.map-search-row input { min-width: 0; height: 48px; padding: 0 .7rem; color: var(--ink); background: transparent; border: 0; outline: 0; font-size: .88rem; font-weight: 760; }
#mapLocate { display: inline-flex; min-height: 42px; align-items: center; gap: .35rem; margin-right: .28rem; padding: .48rem .68rem; color: #fff; background: var(--blue); border: 2px solid var(--ink); border-radius: 12px; font-size: .75rem; font-weight: 920; cursor: pointer; }
#mapLocate:disabled { cursor: wait; opacity: .58; }
.map-place-choices { position: absolute; z-index: 1200; top: calc(100% + .45rem); right: 0; left: 0; display: grid; max-height: min(52vh, 410px); overflow: auto; padding: .45rem; background: #fff; border: 3px solid var(--ink); border-radius: 15px; box-shadow: 5px 5px 0 var(--ink); }
.map-place-choices[hidden] { display: none; }
.map-place-choice { display: flex; min-height: 44px; align-items: center; justify-content: space-between; gap: .6rem; padding: .55rem .65rem; color: var(--ink); background: transparent; border: 0; border-radius: 10px; font-size: .8rem; font-weight: 850; text-align: left; cursor: pointer; }
.map-place-choice:hover, .map-place-choice:focus-visible { background: var(--yellow); }
.map-place-choice small { color: var(--muted); font-size: .62rem; font-weight: 750; }
.map-search-status { min-height: 1.2em; margin: .35rem 0 0 .15rem; color: #9c1b29; font-size: .68rem; font-weight: 800; }

.map-candidate-toggle { display: inline-flex; min-height: 52px; align-items: center; gap: .55rem; padding: .55rem .75rem; background: #fff; border: 3px solid var(--ink); border-radius: 16px; box-shadow: 4px 4px 0 var(--ink); font-size: .75rem; font-weight: 900; cursor: pointer; }
.map-candidate-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.map-candidate-toggle span { position: relative; width: 42px; height: 24px; background: #d8d3c7; border: 2px solid var(--ink); border-radius: 999px; transition: background .18s ease; }
.map-candidate-toggle span::after { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; background: #fff; border: 2px solid var(--ink); border-radius: 50%; content: ""; transition: transform .18s ease; }
.map-candidate-toggle input:checked + span { background: var(--yellow); }
.map-candidate-toggle input:checked + span::after { transform: translateX(18px); }
.map-candidate-toggle input:focus-visible + span { outline: 3px solid #1c7ed6; outline-offset: 3px; }

.washroom-map-shell { position: relative; height: min(76vh, 820px); min-height: 520px; overflow: hidden; background: #dbe9d8; border: 3px solid var(--ink); border-radius: 24px; box-shadow: 8px 8px 0 var(--ink); }
#washroomMap { width: 100%; height: 100%; }
.leaflet-control-zoom a { color: var(--ink) !important; font-weight: 950; }
.leaflet-control-attribution { font-size: 9px !important; }
.map-marker-shell { display: grid; width: 34px; height: 38px; place-items: center; color: var(--accent); filter: drop-shadow(0 3px 0 var(--ink)); }
.map-marker-shell i { font-size: 33px; -webkit-text-stroke: 1.3px var(--ink); }
.map-marker-shell.is-candidate { color: var(--yellow); }
.map-cluster { position: relative; display: grid; width: 36px; height: 36px; place-items: center; background: #fff; border: 2px solid var(--ink); border-radius: 50%; box-shadow: 3px 3px 0 rgba(23,23,23,.88); color: var(--ink); font-size: .68rem; font-weight: 950; line-height: 1; }
.map-cluster.is-medium { width: 39px; height: 39px; }
.map-cluster.is-large { width: 42px; height: 42px; }
.map-cluster.is-public-only { color: #fff; background: var(--accent); }
.map-cluster.is-candidate-only { background: var(--yellow); }
.map-overview-cluster { position: relative; display: grid; width: 34px; height: 34px; place-items: center; background: #fff; border: 2px solid var(--ink); border-radius: 50%; box-shadow: 2px 2px 0 rgba(23,23,23,.88); color: var(--ink); font-size: .62rem; font-weight: 950; line-height: 1; }
.map-overview-cluster.is-medium { width: 38px; height: 38px; font-size: .66rem; }
.map-overview-cluster.is-large { width: 42px; height: 42px; font-size: .68rem; }
.map-overview-cluster.is-public-only { color: #fff; background: var(--accent); }
.map-overview-cluster.is-candidate-only { background: var(--yellow); }
.map-cluster.is-mixed::before, .map-overview-cluster.is-mixed::before { position: absolute; top: 3px; left: 50%; width: 17px; height: 4px; background: linear-gradient(90deg, var(--accent) 0 50%, var(--yellow) 50%); border: 1px solid var(--ink); border-radius: 999px; content: ""; transform: translateX(-50%); }

.map-zoom-prompt { position: absolute; z-index: 700; top: 50%; left: 50%; display: flex; width: min(88%, 470px); align-items: center; justify-content: center; gap: .55rem; padding: .75rem 1rem; background: rgba(255,255,255,.95); border: 3px solid var(--ink); border-radius: 999px; box-shadow: 5px 5px 0 var(--ink); font-size: .78rem; font-weight: 900; line-height: 1.35; text-align: center; transform: translate(-50%, -50%); }
.map-zoom-prompt[hidden] { display: none; }
.map-zoom-prompt i { color: var(--accent); font-size: 1.3rem; }
.map-view-count { position: absolute; z-index: 720; top: .75rem; left: 3.8rem; max-width: calc(100% - 8rem); margin: 0; padding: .46rem .68rem; background: rgba(255,255,255,.94); border: 2px solid var(--ink); border-radius: 999px; box-shadow: 3px 3px 0 var(--ink); font-size: .68rem; font-weight: 900; }
.map-legend { position: absolute; z-index: 720; right: .65rem; bottom: .65rem; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .4rem; max-width: calc(100% - 1.3rem); }
.map-legend span { display: inline-flex; min-height: 32px; align-items: center; gap: .34rem; padding: .3rem .5rem; background: rgba(255,255,255,.94); border: 2px solid var(--ink); border-radius: 999px; font-size: .6rem; font-weight: 850; }
.map-legend i { width: 11px; height: 11px; border: 2px solid var(--ink); border-radius: 50%; }
.map-legend-public { background: var(--accent); }
.map-legend-candidate { background: var(--yellow); }

.map-place-card { position: absolute; z-index: 760; right: .75rem; bottom: 3.6rem; width: min(390px, calc(100% - 1.5rem)); max-height: calc(100% - 7rem); overflow: auto; padding: .85rem; background: #fff; border: 3px solid var(--ink); border-radius: 18px; box-shadow: 6px 6px 0 var(--ink); }
.map-place-card[hidden] { display: none; }
.map-place-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .6rem; }
.map-place-card h2 { margin: 0; font-size: 1.08rem; line-height: 1.15; overflow-wrap: anywhere; }
.map-place-card-close { flex: 0 0 auto; width: 38px; height: 38px; background: var(--bg); border: 2px solid var(--ink); border-radius: 50%; font-size: 1rem; font-weight: 950; cursor: pointer; }
.map-place-card-badge { display: inline-flex; margin-top: .5rem; padding: .3rem .48rem; background: var(--yellow); border: 2px solid var(--ink); border-radius: 999px; font-size: .62rem; font-weight: 930; }
.map-place-card-badge.is-public { color: #fff; background: var(--accent); }
.map-place-address { margin: .55rem 0 0; color: var(--muted); font-size: .76rem; line-height: 1.4; }
.map-place-details { display: grid; gap: .4rem; margin-top: .65rem; }
.map-place-detail { padding: .5rem .58rem; background: var(--bg); border-left: 4px solid var(--accent); border-radius: 0 9px 9px 0; font-size: .7rem; line-height: 1.35; }
.map-place-detail strong { display: block; margin-bottom: .12rem; }
.map-place-actions { display: grid; grid-template-columns: 1fr; gap: .48rem; margin-top: .7rem; }
.map-place-actions a, .map-place-actions button { display: inline-flex; min-height: 46px; align-items: center; justify-content: center; gap: .38rem; padding: .58rem .72rem; color: #fff; background: var(--ink); border: 2px solid var(--ink); border-radius: 999px; font: inherit; font-size: .75rem; font-weight: 930; text-decoration: none; cursor: pointer; }
.map-place-actions button { color: var(--ink); background: var(--yellow); }
.map-place-status { min-height: 1.2em; margin: .45rem 0 0; color: #8e1a27; font-size: .66rem; font-weight: 820; line-height: 1.35; }

.map-source-note { max-width: 980px; margin: 1.15rem auto 0; color: var(--muted); font-size: .72rem; font-weight: 720; line-height: 1.55; text-align: center; }

@media (max-width: 760px) {
  .washroom-map-page .site-menu { top: max(.72rem, env(safe-area-inset-top)); right: .72rem; }
  .map-page-topbar { grid-template-columns: 48px minmax(0, 1fr) auto; width: calc(100% - 1rem); gap: .55rem; }
  .map-page-brand { width: 46px; height: 46px; }
  .map-page-brand img { width: 38px; height: 38px; }
  .locale-menu { display: none; }
  .map-tools { grid-template-columns: 1fr; }
  .map-search-row { grid-template-columns: auto minmax(0, 1fr) 46px; }
  #mapLocate { width: 40px; justify-content: center; padding: 0; }
  #mapLocate span { display: none; }
  .map-candidate-toggle { min-height: 46px; }
  .washroom-map-shell { height: 70svh; min-height: 500px; border-radius: 20px; box-shadow: 5px 5px 0 var(--ink); }
  .map-place-card { right: .5rem; bottom: 3.4rem; left: .5rem; width: auto; max-height: 52%; }
  .map-legend { right: .45rem; bottom: .45rem; left: .45rem; justify-content: center; }
  .map-view-count { left: 3.2rem; max-width: calc(100% - 6.8rem); }
}

@media (max-width: 819px) {
  .map-intro { display: block; max-width: 820px; text-align: center; }
  .map-find-now { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

@media print {
  .site-menu, .locale-menu, .map-tools, .community-mobile-find-dock { display: none !important; }
  .washroom-map-shell { height: 700px; box-shadow: none; }
}
