:root {
  --bg: #efe6d4;
  --paper: #fffaf1;
  --ink: #221c16;
  --muted: #5e564c;
  --line: #ddd2bf;
  --warn: #7f1d1d;
  --warn-ink: #fff7ed;
  --station: #1a1a1a;
  --shadow: 0 10px 28px rgba(48, 32, 16, 0.12);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", Meiryo, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

body {
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

button, a, label, summary {
  -webkit-tap-highlight-color: transparent;
}

button, .osm-link, .flood a, .row-osm {
  min-height: 44px;
}

.warn {
  background: var(--warn);
  color: var(--warn-ink);
  padding: calc(10px + env(safe-area-inset-top)) 16px 12px;
}

.warn-main {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.warn-sub {
  margin: 4px 0 0;
  font-size: 0.92rem;
}

.shell {
  display: block;
}

.map-wrap {
  height: 58vh;
  height: 58dvh;
  min-height: 280px;
  background: #d7d0c3;
}

#map {
  height: 100%;
  width: 100%;
  background: #d7d0c3;
}

.side {
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
}

.intro h1 {
  margin: 0 0 6px;
  font-family: "Iowan Old Style", "Palatino Linotype", "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: 1.55rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.02em;
}

.lede {
  margin: 0 0 14px;
  color: var(--muted);
}

.filters {
  border: 1px solid var(--line);
  background: var(--paper);
  margin: 0 0 12px;
  padding: 8px 10px 10px;
}

.filters legend {
  padding: 0 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-row label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 4px 10px;
  background: #f6f0e4;
  border: 1px solid var(--line);
}

.filter-row input {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: #7f1d1d;
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.sorts {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.sort {
  flex: 1;
  min-height: 44px;
  border: 1px solid #8a8174;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  padding: 8px 10px;
}

.sort.is-on {
  background: #221c16;
  color: #fffaf1;
  border-color: #221c16;
}

.status {
  min-height: 1.5em;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.row {
  display: flex;
  align-items: stretch;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.row.is-on {
  border-color: #221c16;
}

.row-btn {
  flex: 1;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  text-align: left;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  padding: 10px 8px 10px 12px;
  min-height: 44px;
}

.row-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.row-title {
  font-weight: 700;
  line-height: 1.35;
}

.row-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.row-osm, .osm-link, .flood a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 8px 12px;
  color: #7f1d1d;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.row-osm {
  border-left: 1px solid var(--line);
  align-self: stretch;
}

.flood {
  margin-top: 18px;
  padding: 14px;
  background: #fff4e8;
  border: 1px solid #e2c2a4;
}

.flood h2 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.flood p {
  margin: 0 0 8px;
}

.flood ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.flood li {
  padding: 8px 0;
  border-top: 1px solid #ead7c4;
}

.flood a {
  justify-content: flex-start;
  padding: 8px 0;
  min-height: 44px;
}

.colophon {
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.85rem;
}

.colophon p {
  margin: 0;
}

.sheet {
  position: fixed;
  z-index: 2000;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 12px calc(10px + env(safe-area-inset-bottom));
  pointer-events: none;
}

.sheet[hidden] {
  display: none;
}

.sheet-card {
  pointer-events: auto;
  max-width: 640px;
  margin: 0 auto;
  max-height: min(48vh, 420px);
  overflow: auto;
  background: var(--paper);
  border: 1px solid #221c16;
  box-shadow: var(--shadow);
  padding: 12px 14px 16px;
}

.sheet-close {
  float: right;
  min-width: 72px;
  border: 1px solid #221c16;
  background: #221c16;
  color: #fffaf1;
  font: inherit;
  padding: 8px 12px;
}

.sheet-cat {
  margin: 0 48px 4px 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.sheet-card h2 {
  margin: 0 0 8px;
  font-size: 1.25rem;
  line-height: 1.35;
  clear: both;
}

.facts {
  margin: 0;
  display: grid;
  grid-template-columns: 7.5em 1fr;
  gap: 4px 8px;
}

.facts dt {
  margin: 0;
  color: var(--muted);
}

.facts dd {
  margin: 0;
}

.station-pin, .pin {
  background: transparent;
  border: 0;
}

.pin-hit {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #fffaf1;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45);
}

.station-mark {
  display: flex;
  align-items: center;
  gap: 4px;
  width: max-content;
  transform: translate(-6px, -10px);
}

.station-dot {
  width: 14px;
  height: 14px;
  background: var(--station);
  border: 2px solid #fffaf1;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4);
}

.station-label {
  background: var(--station);
  color: #fffaf1;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 5px 6px;
}

.leaflet-control-attribution {
  font-size: 11px;
  max-width: 70%;
  background: rgba(255, 250, 241, 0.9);
}

button:focus-visible, a:focus-visible, label:focus-within {
  outline: 3px solid #9a3412;
  outline-offset: 2px;
}

.empty {
  padding: 12px;
  background: var(--paper);
  border: 1px dashed var(--line);
}

@media (min-width: 960px) {
  .shell {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(340px, 0.7fr);
    height: calc(100vh - 72px);
    height: calc(100dvh - 72px);
    min-height: 480px;
  }

  .map-wrap {
    height: auto;
    min-height: 0;
  }

  .side {
    overflow: auto;
    border-left: 1px solid var(--line);
  }
}

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