:root {
  --bg: #f1f5f9;
  --panel: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}

body { display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: #0f172a;
  color: #fff;
}

.brand { font-weight: 700; font-size: 17px; letter-spacing: .3px; }

.badge {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 600;
}
.badge-google { background: #10b981; color: #052e1f; }
.badge-osm { background: #fbbf24; color: #422006; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.loc-form { display: flex; gap: 6px; flex: 1 1 260px; }
.loc-form input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}

button, select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  font-size: 14px;
  cursor: pointer;
}
button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}
button.primary:hover { background: var(--primary-dark); }
button:disabled { opacity: .6; cursor: wait; }

.seg { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: var(--panel); }
.seg button.active { background: var(--primary); color: #fff; font-weight: 600; }

.layout { flex: 1; display: flex; min-height: 0; }

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

.result-info { padding: 10px 14px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--border); }

.results { overflow-y: auto; flex: 1; }

.item {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s;
}
.item:hover, .item.active { background: #eff6ff; }
.item-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.item-name { font-weight: 600; font-size: 14.5px; }
.dist { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.item-rating { margin-top: 3px; font-size: 13px; }
.item-addr { margin-top: 2px; color: var(--muted); font-size: 12.5px; }
.item-extra { margin-top: 2px; color: var(--muted); font-size: 12.5px; font-style: italic; }

.stars { color: #f59e0b; letter-spacing: 1px; }
.stars .off { color: #d1d5db; }
.muted { color: var(--muted); }
.empty { padding: 24px 16px; color: var(--muted); text-align: center; font-size: 14px; }
.empty.error { color: var(--danger); }

#map { flex: 1; min-height: 0; }

.pin {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50% 50% 50% 4px;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.35);
  font-size: 15px;
}
.pin-stay { background: #2563eb; }
.pin-food { background: #ea580c; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(440px, 100vw);
  background: var(--panel);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 24px rgba(0,0,0,.12);
  z-index: 1200;
  display: flex;
  flex-direction: column;
}
.drawer.hidden { display: none; }

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.drawer-head h2 { margin: 0; font-size: 18px; }

.icon-btn {
  border: 0;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  color: var(--muted);
}

.drawer-body { padding: 16px; overflow-y: auto; }

.rating-box {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
  margin-bottom: 14px;
}
.rating-box .big { font-size: 30px; font-weight: 800; color: #b45309; }

.row {
  display: flex;
  gap: 10px;
  padding: 6px 0;
  font-size: 14px;
  border-bottom: 1px dashed var(--border);
}
.row .k { width: 110px; flex-shrink: 0; color: var(--muted); font-size: 13px; }
.row .v { word-break: break-word; }
.row a { color: var(--primary); text-decoration: none; }
.row a:hover { text-decoration: underline; }

.btn {
  display: inline-block;
  margin: 10px 0;
  padding: 9px 14px;
  background: var(--primary);
  color: #fff !important;
  border-radius: 8px;
  text-decoration: none !important;
  font-size: 14px;
  font-weight: 600;
}
.btn:hover { background: var(--primary-dark); }

.gbox { margin-top: 14px; padding: 12px 14px; background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; font-size: 13.5px; }
.gframe { margin-top: 12px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.gframe iframe { width: 100%; height: 260px; border: 0; display: block; }

h3 { font-size: 15px; margin: 18px 0 8px; }

.review { padding: 12px 0; border-bottom: 1px solid var(--border); }
.review-head { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; }
.review-head b { font-size: 14px; }
.review-stars { margin: 3px 0 5px; font-size: 13px; }
.review p { margin: 0; font-size: 13.5px; line-height: 1.55; }

@media (max-width: 760px) {
  .layout { flex-direction: column-reverse; }
  .sidebar { width: 100%; height: 45vh; border-right: 0; border-top: 1px solid var(--border); }
  #map { height: 55vh; }
  .drawer { width: 100vw; }
}
