:root {
  color-scheme: light;
  --bg: #f3efe6;
  --panel: #faf7f2;
  --ink: #241e18;
  --muted: #6f655c;
  --line: #e3d9cc;
  --accent: #c24b24;
  --circle: #e06a32;
  --circle-edge: #8f3414;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background: var(--bg);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", "WenQuanYi Micro Hei", "Droid Sans Fallback", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 20px 13px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  box-shadow: inset 0 3px 0 var(--accent);
}

.brand { min-width: 0; }

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  margin: 1px 0 0;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.sub {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.stats {
  display: flex;
  flex: none;
  gap: 28px;
}

.stat { text-align: right; }

.stat b {
  display: block;
  color: var(--accent);
  font-size: 26px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.stat span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

main {
  display: flex;
  flex: 1;
  min-height: 0;
}

aside {
  width: 312px;
  flex: none;
  overflow: auto;
  padding: 14px 16px 20px;
  background: var(--panel);
  border-right: 1px solid var(--line);
}

fieldset {
  margin: 0 0 14px;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 6px;
  padding: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 2px 0;
  cursor: pointer;
}

.check input {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.stack {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.stack span {
  width: 2.5em;
  flex: none;
  color: var(--muted);
  font-size: 12px;
}

.range {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tilde {
  flex: none;
  color: var(--muted);
}

input[type="number"],
select {
  width: 100%;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

input::placeholder { color: #b3aa9f; }

input:focus,
select:focus {
  outline: 2px solid #f0c2ae;
  border-color: var(--accent);
}

.hint {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.error {
  margin: 0 0 12px;
  color: #8d1d1d;
  font-size: 13px;
}

.legend {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.dot {
  display: inline-block;
  flex: none;
  border: 1px solid var(--circle-edge);
  border-radius: 50%;
  background: var(--circle);
}

.dot.sm { width: 8px; height: 8px; }
.dot.md { width: 14px; height: 14px; }
.dot.lg { width: 22px; height: 22px; }

#map-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  background: #e5e0d6;
}

#map { height: 100%; }

#empty {
  position: absolute;
  z-index: 500;
  top: 16px;
  left: 50%;
  margin: 0;
  padding: 8px 14px;
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(48, 28, 12, 0.08);
  font-size: 13px;
}

.tx-popup .leaflet-popup-content-wrapper {
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(48, 28, 12, 0.18);
}

.tx-popup .leaflet-popup-content { margin: 12px 14px; }

.popup-name {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.popup-city {
  margin: 1px 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.popup-rows {
  display: grid;
  grid-template-columns: auto auto;
  gap: 3px 16px;
  margin: 0;
  font-size: 13px;
}

.popup-rows dt { color: var(--muted); }

.popup-rows dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

@media (max-width: 860px) {
  header { align-items: flex-start; }
  main { flex-direction: column; }
  aside {
    width: auto;
    max-height: 46vh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}
