:root {
  --bg: #f7f1e8;
  --panel: #fffaf2;
  --ink: #2d2a26;
  --muted: #756f66;
  --line: #eadfce;
  --accent: #5aa9a6;
  --accent-dark: #387b79;
  --sun: #f7c86a;
  --peach: #f5a97f;
  --leaf: #88c57f;
  --shadow: 0 16px 40px rgba(65, 46, 25, 0.12);
  --radius: 24px;
}

* { box-sizing: border-box; }

html, body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(247, 200, 106, 0.25), transparent 32rem),
    radial-gradient(circle at bottom right, rgba(90, 169, 166, 0.22), transparent 34rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

button, input, select { font: inherit; }

.app-shell {
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 18px 0;
}

.panel {
  background: rgba(255, 250, 242, 0.95);
  border: 2px solid rgba(234, 223, 206, 0.95);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.hero {
  padding: 18px;
  margin-bottom: 14px;
}

.hero-copy {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.logo-badge {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: var(--sun);
  border: 2px solid rgba(45, 42, 38, 0.08);
  font-size: 32px;
  transform: rotate(-3deg);
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 0.95;
  margin-bottom: 8px;
  letter-spacing: -0.05em;
}

.hero p, .summary-card p, .empty-state p {
  color: var(--muted);
  margin-bottom: 0;
}

.search-grid {
  display: grid;
  grid-template-columns: 1fr 180px 170px;
  gap: 12px;
  align-items: end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field span {
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--muted);
}

input, select {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 14px 15px;
  background: white;
  color: var(--ink);
  outline: none;
}

.select-wrap {
  position: relative;
  display: block;
}

.native-radius-select {
  display: none;
}

.radius-trigger {
  width: 100%;
  min-height: 52px;
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 14px 42px 14px 15px;
  background: white;
  color: var(--ink);
  outline: none;
  cursor: pointer;
  text-align: left;
  position: relative;
}

.radius-trigger::after {
  content: "⌄";
  position: absolute;
  right: 15px;
  top: 50%;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  transform: translateY(-50%);
}

.radius-trigger[aria-expanded="true"]::after {
  transform: translateY(-50%) rotate(180deg);
}

.radius-trigger:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(90, 169, 166, 0.14);
}

.radius-options {
  position: absolute;
  z-index: 1000;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  display: none;
  max-height: 240px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: white;
  border: 2px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 18px 36px rgba(65, 46, 25, 0.18);
  overflow-y: auto;
}

.select-wrap.is-open .radius-options {
  display: block;
}

.radius-options li {
  border-radius: 11px;
  cursor: pointer;
  padding: 9px 10px;
}

.radius-options li:hover,
.radius-options li[aria-selected="true"] {
  background: #e8f4f3;
  color: var(--accent-dark);
  font-weight: 800;
}

input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(90, 169, 166, 0.14);
}


.primary-button {
  min-height: 52px;
  border: 0;
  border-radius: 17px;
  background: var(--accent);
  color: white;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 7px 0 var(--accent-dark);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.primary-button:hover { transform: translateY(-1px); }
.primary-button:active { transform: translateY(5px); box-shadow: 0 2px 0 var(--accent-dark); }
.primary-button:disabled { opacity: 0.7; cursor: wait; }

.hint-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

.hint-row span {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
}

.layout {
  display: grid;
  grid-template-columns: 420px minmax(0, 1fr);
  gap: 14px;
  height: clamp(560px, calc(100vh - 215px), 760px);
  min-height: 0;
}

.sidebar {
  padding: 16px;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.summary-card {
  display: flex;
  gap: 12px;
  padding: 14px;
  border-radius: 20px;
  background: white;
  border: 1px solid var(--line);
  margin-bottom: 14px;
}

.summary-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: #e8f4f3;
  font-size: 24px;
}

.summary-card h2 {
  font-size: 1.05rem;
  margin-bottom: 3px;
}

.status {
  padding: 11px 13px;
  border-radius: 16px;
  background: #fff3d7;
  border: 1px solid #f1d89c;
  color: #745418;
  margin-bottom: 12px;
  font-weight: 700;
}

.hidden { display: none !important; }

.category-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.category-tab {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 11px;
  cursor: pointer;
  font-weight: 800;
  font-size: 0.88rem;
}

.category-tab.active {
  background: var(--ink);
  color: white;
}

.results {
  display: grid;
  gap: 10px;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.empty-state {
  min-height: 0;
  place-content: center;
  text-align: center;
  color: var(--muted);
  padding: 20px;
}

.empty-illustration {
  font-size: 58px;
  margin-bottom: 10px;
}

.category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding: 8px 2px;
  border-bottom: 1px dashed var(--line);
}

.category-header h3 {
  margin: 0;
  font-size: 1rem;
}

.category-header span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.place-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.place-main {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  border: 0;
  background: transparent;
  cursor: pointer;
  flex: 1;
  color: inherit;
}

.place-main:hover .place-name { text-decoration: underline; }

.place-emoji {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #f1f7ee;
  font-size: 20px;
  flex: 0 0 auto;
}

.place-info { display: grid; gap: 3px; }
.place-name { line-height: 1.15; }
.place-meta { color: var(--muted); }

.map-link {
  white-space: nowrap;
  color: var(--accent-dark);
  font-weight: 900;
  text-decoration: none;
  font-size: 0.85rem;
}

.map-link:hover { text-decoration: underline; }

.map-panel {
  position: relative;
  overflow: hidden;
  min-height: 0;
  height: 100%;
}

#map {
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: calc(var(--radius) - 2px);
}

.route-card {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 500;
  background: white;
  border: 2px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 13px 42px 13px 14px;
  display: grid;
  gap: 4px;
  max-width: min(420px, calc(100% - 36px));
}

.route-card button {
  position: absolute;
  right: 9px;
  top: 6px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
}

.route-card span { color: var(--muted); font-weight: 700; }

.leaflet-popup-content-wrapper {
  border-radius: 18px;
}

.popup-title { font-weight: 900; margin-bottom: 4px; }
.popup-meta { color: #666; margin-bottom: 8px; }
.popup-actions { display: flex; gap: 8px; }
.popup-actions a, .popup-actions button {
  border: 0;
  border-radius: 999px;
  padding: 7px 10px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  background: #e8f4f3;
  color: #286966;
}

@media (max-width: 980px) {
  .search-grid { grid-template-columns: 1fr; }
  .layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  .sidebar { min-height: 420px; }
  .map-panel, #map { min-height: 520px; }
  .results { max-height: none; }
}

@media (max-width: 560px) {
  .app-shell { width: min(100vw - 18px, 1440px); padding: 9px 0; }
  .hero, .sidebar { padding: 12px; }
  .hero-copy { align-items: flex-start; }
  .logo-badge { width: 48px; height: 48px; font-size: 27px; }
}
