:root {
  --ink: #171b18;
  --sub: #62675f;
  --paper: #f7f0df;
  --panel: #fffaf0;
  --panel2: #eee4ce;
  --green: #234b37;
  --green2: #dbe9df;
  --orange: #b1642d;
  --red: #a33e35;
  --blue: #315c72;
  --line: rgba(70, 58, 38, .18);
  --shadow: 0 24px 70px rgba(37, 29, 17, .18);
  --sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  --serif: ui-serif, "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, rgba(255,255,255,.85), transparent 28rem),
    linear-gradient(135deg, #efe5d0, #ded2ba);
  font-family: var(--serif);
}
button, input, select { font: inherit; }
button { color: inherit; }

.app {
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 14px;
  gap: 12px;
}

.masthead {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 250, 240, .78);
  backdrop-filter: blur(18px);
  box-shadow: 0 10px 32px rgba(37, 29, 17, .09);
}
.identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.symbol {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: #fffaf0;
  background: var(--green);
  font-size: 28px;
  font-weight: 900;
  box-shadow: inset 0 -10px 20px rgba(0,0,0,.14);
}
.kicker {
  margin: 0 0 5px;
  color: var(--orange);
  font: 800 11px/1 var(--sans);
  letter-spacing: .18em;
  text-transform: uppercase;
}
h1, h2, h3 { margin: 0; }
.masthead h1 {
  font-size: clamp(22px, 4vw, 34px);
  line-height: 1;
  letter-spacing: -.06em;
  white-space: nowrap;
}
.summary {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--sub);
  font: 700 13px/1.2 var(--sans);
}
.summary strong { color: var(--ink); font-size: 20px; padding: 0 3px; }
.summary button, .reset {
  border: 1px solid rgba(35,75,55,.25);
  background: var(--green);
  color: #fffaf0;
  border-radius: 999px;
  padding: 9px 13px;
  cursor: pointer;
  font-weight: 800;
}

.layout {
  min-height: 0;
  display: grid;
  grid-template-columns: 340px minmax(420px, 1fr) 420px;
  gap: 12px;
}
.drawer, .inspector, .map-stage {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 250, 240, .9);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.drawer, .inspector {
  overflow-y: auto;
}
.drawer {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.intro-card {
  padding: 18px;
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(35,75,55,.94), rgba(49,92,114,.84)),
    var(--green);
  color: #fffaf0;
}
.intro-card h2 {
  font-size: 28px;
  line-height: 1.08;
  letter-spacing: -.06em;
}
.intro-card p:last-child {
  margin-bottom: 0;
  color: rgba(255,250,240,.8);
  font-size: 14px;
}
.tool-section {
  padding: 12px;
  border: 1px solid rgba(70,58,38,.12);
  border-radius: 20px;
  background: rgba(247,240,223,.72);
}
.two-col { display: grid; gap: 12px; }
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 9px;
}
.section-title h3 { font-size: 16px; }
.section-title span {
  color: var(--sub);
  font: 800 10px/1 var(--sans);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.search-label, .select-label {
  display: grid;
  gap: 7px;
  color: var(--sub);
  font: 800 12px/1.2 var(--sans);
}
input[type="search"], select {
  width: 100%;
  border: 1px solid rgba(70,58,38,.2);
  border-radius: 14px;
  background: #fffaf0;
  color: var(--ink);
  padding: 12px 13px;
}
input:focus, select:focus {
  outline: 3px solid rgba(35,75,55,.18);
  border-color: rgba(35,75,55,.5);
}
.chips {
  display: grid;
  gap: 7px;
}
.chips.compact {
  display: flex;
  flex-wrap: wrap;
}
.chip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(35,75,55,.18);
  border-radius: 999px;
  background: #fffaf0;
  padding: 8px 10px;
  cursor: pointer;
  font: 800 13px/1.2 var(--sans);
}
.compact .chip { width: auto; }
.chip-count {
  min-width: 22px;
  padding: 2px 6px;
  color: var(--sub);
  border-radius: 999px;
  background: rgba(35,75,55,.08);
  font-size: 11px;
  text-align: center;
}
.chip.is-active {
  color: #fffaf0;
  background: var(--green);
}
.chip.is-active .chip-count {
  color: var(--green);
  background: #fffaf0;
}
.checks {
  display: grid;
  gap: 8px;
  font: 700 13px/1.3 var(--sans);
}
.checks label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.checks input { accent-color: var(--green); }
.reset {
  width: 100%;
  margin-top: auto;
  padding: 12px 14px;
}

.map-stage {
  position: relative;
  background: #d6d0bd;
}
.map { width: 100%; height: 100%; min-height: 560px; z-index: 1; }
.map-credit-note {
  position: absolute;
  z-index: 3;
  left: 12px;
  bottom: 28px;
  padding: 7px 10px;
  border-radius: 999px;
  color: rgba(23,27,24,.72);
  background: rgba(255,250,240,.82);
  backdrop-filter: blur(10px);
  font: 800 11px/1 var(--sans);
}
.leaflet-container { font-family: var(--sans); }
.leaflet-control-attribution { font-family: var(--sans); }

.marker-dot {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 2px solid #fffaf0;
  border-radius: 50% 50% 50% 8px;
  transform: rotate(-45deg);
  box-shadow: 0 12px 28px rgba(0,0,0,.25);
}
.marker-dot span {
  transform: rotate(45deg);
  color: #fffaf0;
  font: 900 11px/1 var(--sans);
}
.marker-food { background: #b1642d; }
.marker-nature { background: #234b37; }
.marker-culture { background: #315c72; }
.marker-stay { background: #6f4b7d; }
.marker-shop { background: #8d6330; }
.marker-info { background: #555d57; }

.inspector {
  display: grid;
  grid-template-rows: auto 1fr;
}
.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 8px;
  gap: 6px;
  border-bottom: 1px solid rgba(70,58,38,.12);
  background: rgba(247,240,223,.84);
}
.tab {
  border: 0;
  border-radius: 999px;
  background: transparent;
  padding: 10px 6px;
  cursor: pointer;
  font: 900 13px/1 var(--sans);
  color: var(--sub);
}
.tab.is-active {
  color: #fffaf0;
  background: var(--green);
}
.panel {
  display: none;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
}
.panel.is-active { display: block; }
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.panel-head h2 { font-size: 28px; line-height: 1.1; letter-spacing: -.05em; }
.result-meta {
  padding: 7px 9px;
  border-radius: 999px;
  color: var(--green);
  background: var(--green2);
  font: 900 11px/1 var(--sans);
  white-space: nowrap;
}
.spot-list { display: grid; gap: 10px; }
.spot-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 13px;
  border: 1px solid rgba(70,58,38,.13);
  border-radius: 20px;
  background: rgba(255,250,240,.84);
  cursor: pointer;
}
.spot-card:hover, .spot-card.is-selected {
  border-color: rgba(35,75,55,.42);
  background: #fffaf0;
  transform: translateY(-1px);
}
.spot-card h3 {
  margin: 5px 0 4px;
  font-size: 19px;
  line-height: 1.25;
  letter-spacing: -.03em;
}
.spot-card p {
  margin: 0;
  color: var(--sub);
  font-size: 13px;
  line-height: 1.55;
}
.badges { display: flex; flex-wrap: wrap; gap: 5px; }
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  border-radius: 999px;
  color: var(--green);
  background: var(--green2);
  font: 900 11px/1 var(--sans);
}
.badge.food { color: var(--orange); background: #ffe7d5; }
.badge.culture { color: var(--blue); background: #dfeaf0; }
.badge.free { color: var(--red); background: #f7ddd9; }
.card-actions { display: grid; align-content: start; gap: 7px; }
.icon-button {
  border: 1px solid rgba(70,58,38,.16);
  border-radius: 999px;
  background: #fffaf0;
  padding: 8px 10px;
  cursor: pointer;
  font: 900 12px/1 var(--sans);
}
.icon-button.saved { color: var(--orange); background: #fff0df; }
.empty, .detail-empty {
  padding: 24px;
  border: 1px dashed rgba(70,58,38,.24);
  border-radius: 22px;
  color: var(--sub);
}
.detail-empty h2 { color: var(--ink); font-size: 30px; line-height: 1.1; }
.detail-hero {
  min-height: 140px;
  display: grid;
  align-content: end;
  gap: 8px;
  margin: -16px -16px 16px;
  padding: 18px;
  color: #fffaf0;
  background:
    linear-gradient(135deg, rgba(35,75,55,.94), rgba(49,92,114,.72)),
    var(--green);
}
.detail-hero h2 {
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: -.06em;
}
.detail-body { display: grid; gap: 12px; }
.detail-body p { margin: 0; color: #444a43; }
.data-grid { display: grid; gap: 8px; }
.data-item {
  padding: 11px;
  border: 1px solid rgba(70,58,38,.12);
  border-radius: 15px;
  background: rgba(247,240,223,.6);
}
.data-item span {
  display: block;
  margin-bottom: 3px;
  color: var(--sub);
  font: 900 11px/1 var(--sans);
  letter-spacing: .04em;
}
.links { display: grid; gap: 8px; margin-top: 4px; }
.links a, .detail-save {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 12px 14px;
  text-align: center;
  text-decoration: none;
  font: 900 13px/1 var(--sans);
  cursor: pointer;
}
.links a.primary { color: #fffaf0; background: var(--green); }
.links a.secondary { color: var(--green); background: var(--green2); }
.detail-save { color: var(--orange); background: #fff0df; }

@media (max-width: 1220px) {
  .layout { grid-template-columns: 310px 1fr; grid-template-rows: 1fr 420px; }
  .inspector { grid-column: 1 / -1; }
}
@media (max-width: 820px) {
  .app { height: auto; min-height: 100dvh; padding: 9px; }
  .masthead { align-items: flex-start; flex-direction: column; border-radius: 22px; }
  .summary { flex-wrap: wrap; }
  .layout { grid-template-columns: 1fr; grid-template-rows: auto 70dvh auto; }
  .map { min-height: 70dvh; }
  .drawer, .inspector, .map-stage { border-radius: 22px; }
}
