* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --ink: #152033;
  --muted: rgba(21, 32, 51, .62);
  --faint: rgba(21, 32, 51, .34);
  --paper: #f7f8f5;
  --water: #76b7db;
  --line: rgba(93, 139, 181, .58);
}
html, body { width: 100%; height: 100%; overflow: hidden; }
body {
  color: var(--ink);
  background: var(--paper);
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "Times New Roman", serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::before {
  position: fixed;
  z-index: 620;
  inset: 0;
  pointer-events: none;
  content: "";
  background:
    radial-gradient(circle at 18% 14%, rgba(68, 124, 187, .13), transparent 0 19%, transparent 27%),
    linear-gradient(90deg, rgba(247, 248, 245, .82), rgba(247, 248, 245, .22) 27%, rgba(247, 248, 245, .08) 70%, rgba(247, 248, 245, .54)),
    repeating-linear-gradient(135deg, rgba(25, 42, 68, .018) 0 1px, transparent 1px 7px);
  mix-blend-mode: normal;
}
#map { width: 100vw; height: 100dvh; background: #eef6f9; }
.leaflet-tile-pane { filter: grayscale(.28) saturate(.45) contrast(.86) brightness(1.12) hue-rotate(176deg); opacity: .62; }
.leaflet-overlay-pane { filter: saturate(.86) brightness(1.05); }

.panel {
  background: rgba(250, 251, 248, .50);
  border: 1px solid rgba(52, 82, 117, .10);
  box-shadow: 0 24px 60px rgba(77, 112, 145, .08), 0 0 0 1px rgba(255,255,255,.55) inset;
  backdrop-filter: blur(22px) saturate(120%);
  -webkit-backdrop-filter: blur(22px) saturate(120%);
}

#header {
  position: absolute;
  z-index: 700;
  top: 0;
  left: 0;
  width: min(360px, 33vw);
  min-width: 286px;
  height: 100dvh;
  padding: max(46px, env(safe-area-inset-top)) 38px 40px;
  pointer-events: none;
}
#header::before {
  position: absolute;
  z-index: -1;
  top: -20vh;
  right: -38px;
  width: 520px;
  height: 140vh;
  content: "";
  border-right: 1px solid rgba(96, 147, 201, .34);
  border-radius: 0 50% 50% 0;
  background: linear-gradient(90deg, rgba(250, 251, 248, .94), rgba(250, 251, 248, .70) 66%, rgba(250, 251, 248, .10));
}
#header::after {
  position: absolute;
  top: 108px;
  right: 42px;
  width: 96px;
  height: 96px;
  content: "";
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle, rgba(91, 139, 186, .30) 0 1px, transparent 1px 9px),
    radial-gradient(circle, rgba(91, 139, 186, .18), transparent 60%);
  opacity: .42;
}
.eyebrow {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  letter-spacing: .18em;
}
#header h1 {
  font-size: clamp(20px, 1.75vw, 27px);
  font-weight: 600;
  letter-spacing: .12em;
  line-height: 1.5;
}
#header > p:not(.eyebrow) {
  max-width: 260px;
  margin-top: 42px;
  color: var(--ink);
  font-size: 13px;
  line-height: 2.25;
  letter-spacing: .08em;
}
#header p span { display: block; }
#controls {
  position: absolute;
  z-index: 710;
  left: max(34px, env(safe-area-inset-left));
  bottom: max(76px, calc(env(safe-area-inset-bottom) + 76px));
  width: 260px;
  padding: 13px 14px 12px;
  border-radius: 0;
}
.opacity-control {
  position: relative;
  display: grid;
  gap: 8px;
}
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.label-row label, output, .opacity-footer {
  color: var(--ink);
  font: 600 11px/1.2 -apple-system, BlinkMacSystemFont, "Hiragino Sans", sans-serif;
  letter-spacing: .12em;
}
output { color: #416d9e; font-variant-numeric: tabular-nums; }
input[type="range"] {
  width: 100%;
  height: 18px;
  accent-color: #7aa3dc;
}
.opacity-footer { display: flex; justify-content: space-between; color: var(--muted); font-weight: 500; }

#about {
  position: absolute;
  z-index: 710;
  left: max(34px, env(safe-area-inset-left));
  bottom: max(28px, env(safe-area-inset-bottom));
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
#about-mobile { display: none; }
.about-body {
  display: flex;
  gap: 30px;
  align-items: center;
  color: var(--ink);
  font: 500 12px/1.5 -apple-system, BlinkMacSystemFont, "Hiragino Sans", sans-serif;
  letter-spacing: .12em;
}
.about-body p::before {
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-right: 16px;
  content: "";
  border-radius: 50%;
  background: #83a5df;
  vertical-align: -1px;
}
.about-body small {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .12em;
}

.leaflet-control-zoom {
  overflow: hidden;
  border: 1px solid rgba(52, 82, 117, .08) !important;
  border-radius: 999px !important;
  box-shadow: 0 18px 42px rgba(77, 112, 145, .10) !important;
}
.leaflet-control-zoom a {
  width: 42px !important;
  height: 42px !important;
  line-height: 42px !important;
  color: var(--ink) !important;
  background: rgba(250, 251, 248, .66) !important;
  border-color: rgba(52, 82, 117, .08) !important;
  backdrop-filter: blur(18px);
}
.leaflet-control-attribution {
  padding: 3px 8px !important;
  color: rgba(21,32,51,.48) !important;
  background: rgba(250,251,248,.58) !important;
  font: 10px/1.4 -apple-system, BlinkMacSystemFont, sans-serif !important;
}
.leaflet-popup-content-wrapper {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.leaflet-popup-content { min-width: 210px; margin: 0; }
.leaflet-popup-tip { display: none; }
.leaflet-popup-close-button { display: none; }
.popup-card {
  position: relative;
  padding-left: 42px;
  color: var(--ink);
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  letter-spacing: .08em;
}
.popup-card::before {
  top: 49px;
  left: 0;
  width: 29px;
  height: 1px;
  content: "";
  background: rgba(21,32,51,.22);
}
.popup-card h2 {
  display: flex;
  gap: 14px;
  align-items: center;
  font-size: 23px;
  font-weight: 500;
  line-height: 1.35;
}
.popup-card h2::after {
  width: 12px;
  height: 12px;
  content: "";
  border-radius: 50%;
  background: #e7c45f;
}
.popup-card dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 9px 26px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(21,32,51,.16);
  font-size: 14px;
  line-height: 1.25;
}
.popup-card dt { color: var(--muted); }
.popup-card dd {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", sans-serif;
  font-weight: 600;
  letter-spacing: .04em;
}

#loading {
  position: absolute;
  z-index: 1000;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--paper);
  transition: opacity .35s ease-out;
}
#loading.done { opacity: 0; pointer-events: none; }
#loading p {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .12em;
}
.spinner {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(21,32,51,.12);
  border-top-color: #6d9bca;
  border-radius: 50%;
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 820px) {
  body::before {
    background:
      linear-gradient(180deg, rgba(247,248,245,.86), rgba(247,248,245,.08) 35%, rgba(247,248,245,.60)),
      repeating-linear-gradient(135deg, rgba(25,42,68,.018) 0 1px, transparent 1px 7px);
  }
  #header {
    width: 100vw;
    min-width: 0;
    height: auto;
    padding: max(20px, env(safe-area-inset-top)) 20px 28px;
  }
  #header::before {
    top: 0;
    right: 0;
    width: 100vw;
    height: 230px;
    border-right: 0;
    border-bottom: 1px solid rgba(96,147,201,.18);
    border-radius: 0 0 50% 50%;
    background: linear-gradient(180deg, rgba(250,251,248,.94), rgba(250,251,248,.22));
  }
  #header::after { display: none; }
  #header h1 { font-size: 19px; }
  #header > p:not(.eyebrow) {
    max-width: min(420px, calc(100vw - 40px));
    margin-top: 18px;
    font-size: 11px;
    line-height: 1.9;
  }
  #controls {
    left: 14px;
    bottom: max(54px, calc(env(safe-area-inset-bottom) + 54px));
    width: min(260px, calc(100vw - 28px));
    height: auto;
  }
  .about-body { display: none; }
  .leaflet-control-zoom { display: none; }
}
