:root {
  --bg: #121410;
  --panel: #1c1f18;
  --ink: #f3efe4;
  --muted: #a8a392;
  --line: #2d3228;
  --accent: #d4a017;
  --soon: #3d6fd9;
  --now: #2f8f5b;
  --city: #c0392b;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  background: var(--bg);
  color: var(--ink);
}

#app {
  display: grid;
  grid-template-columns: minmax(320px, 400px) 1fr;
  height: 100%;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sidebar header {
  padding: 1.1rem 1.2rem 0.7rem;
}

.sidebar h1 {
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
}

.lede {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.controls {
  padding: 0.6rem 1.2rem 0.8rem;
  display: grid;
  gap: 0.45rem;
}

.controls label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: var(--ink);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.filters button,
.landomo-link,
.source-link {
  appearance: none;
  border: 1px solid var(--line);
  background: #262a20;
  color: var(--ink);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.filters button.active { background: #3a4030; border-color: var(--accent); }

.tabs { display: flex; gap: 0.35rem; }
.tabs button {
  flex: 1;
  appearance: none;
  border: 1px solid var(--line);
  background: #262a20;
  color: var(--ink);
  border-radius: 8px;
  padding: 0.4rem 0.5rem;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.tabs button.active { border-color: var(--accent); background: #3a4030; }

.listing-filters { display: grid; gap: 0.45rem; }
.stack { flex-direction: column; align-items: stretch !important; gap: 0.15rem !important; }
.stack input[type="range"] { width: 100%; }
.stamp { padding: 0 0 0.2rem; }
.card.listing .price { color: #f0d48a; font-variant-numeric: tabular-nums; }

.legend i.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  vertical-align: middle;
}

.legend i.train {
  width: 16px;
  height: 12px;
  background: #2f8f5b;
  border-radius: 2px 4px 2px 2px;
  position: relative;
  vertical-align: middle;
}
.legend i.train::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 4px;
  bottom: -3px;
  height: 3px;
  background:
    radial-gradient(circle at 3px 1.5px, #2a2a28 1.2px, transparent 1.3px),
    radial-gradient(circle at 10px 1.5px, #2a2a28 1.2px, transparent 1.3px);
}

.train-marker {
  background: none !important;
  border: none !important;
}
.train-marker svg {
  display: block;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.4));
}

.list {
  overflow: auto;
  padding: 0 0.6rem 1rem;
  min-height: 0;
}

.card {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #161910;
  color: inherit;
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  margin: 0 0.4rem 0.5rem;
  cursor: pointer;
  font: inherit;
}

.card.selected { border-color: var(--accent); }
.card h2 {
  margin: 0 0 0.2rem;
  font-size: 1rem;
}
.meta { color: var(--muted); font-size: 0.8rem; }
.scores {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.4rem;
  font-size: 0.8rem;
}
.scores span { font-variant-numeric: tabular-nums; }
.scores .now { color: #7dcea0; }
.scores .soon { color: #9bb7f0; }

#map { height: 100%; }

.detail {
  position: absolute;
  right: 1rem;
  top: 1rem;
  width: min(380px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow: auto;
  background: rgba(28, 31, 24, 0.94);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  z-index: 500;
  box-shadow: 0 16px 40px rgba(0,0,0,0.35);
}

.detail[hidden] { display: none; }
.detail h2 { margin: 0 0 0.3rem; font-size: 1.2rem; }
.detail p { margin: 0.45rem 0; line-height: 1.4; font-size: 0.92rem; }
.detail .links { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.7rem; }
.detail .close {
  float: right;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
}

.legend {
  position: absolute;
  left: calc(400px + 1rem);
  bottom: 1rem;
  z-index: 400;
  background: rgba(28, 31, 24, 0.92);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.legend i {
  display: inline-block;
  width: 18px;
  height: 3px;
  margin-right: 0.35rem;
  vertical-align: middle;
}

@media (max-width: 860px) {
  #app { grid-template-columns: 1fr; grid-template-rows: 46% 54%; }
  .legend { left: 1rem; }
  .detail { left: 1rem; right: 1rem; width: auto; top: auto; bottom: 1rem; max-height: 42vh; }
}
