:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --ink: #17222e;
  --ink-soft: #5a6a78;
  --line: #e2e8ef;
  --brand: #1a73e8;
  --brand-dark: #0f5bd0;
  --brand-tint: #e8f0fe;
  --accent: #0a7c5a;
  --shadow: 0 10px 30px rgba(20, 40, 70, 0.10);
  --radius: 16px;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-dark); }

.app-header {
  padding: 28px 20px 8px;
  max-width: 920px;
  margin: 0 auto;
}
.brand { display: flex; gap: 14px; align-items: flex-start; }
.brand-mark {
  font-size: 30px;
  line-height: 1;
  color: var(--brand);
  background: var(--brand-tint);
  border-radius: 12px;
  width: 52px; height: 52px;
  display: grid; place-items: center;
  flex: 0 0 auto;
}
.app-header h1 { margin: 2px 0 2px; font-size: 1.5rem; letter-spacing: -0.01em; }
.app-header p { margin: 0; color: var(--ink-soft); font-size: 0.95rem; }

main {
  max-width: 920px;
  margin: 0 auto;
  padding: 12px 20px 40px;
}

/* ---- Search ---- */
.search-panel { position: relative; z-index: 1000; }
.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 6px 12px;
  box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
}
.search-box:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-tint), var(--shadow);
}
.search-icon { width: 22px; height: 22px; fill: var(--ink-soft); flex: 0 0 auto; }
#address-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1.1rem;
  padding: 12px 0;
  background: transparent;
  color: var(--ink);
}
.clear-btn {
  border: none; background: transparent; cursor: pointer;
  font-size: 1.5rem; line-height: 1; color: var(--ink-soft);
  width: 32px; height: 32px; border-radius: 8px;
}
.clear-btn:hover { background: var(--bg); color: var(--ink); }
.input-spinner {
  width: 20px; height: 20px; flex: 0 0 auto;
  border: 2.5px solid var(--brand-tint);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.suggestions {
  list-style: none;
  margin: 8px 0 0;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  position: absolute;
  left: 0; right: 0;
  max-height: 340px;
  overflow-y: auto;
}
.suggestions li {
  padding: 11px 12px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  gap: 12px;
  align-items: center;
}
.suggestions li:hover,
.suggestions li.active { background: var(--brand-tint); }
.sugg-pin { color: var(--brand); flex: 0 0 auto; width: 18px; height: 18px; }
.sugg-text { min-width: 0; }
.sugg-line1 { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sugg-line2 { color: var(--ink-soft); font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggestions .sugg-empty { color: var(--ink-soft); cursor: default; padding: 14px 12px; }
.suggestions .sugg-empty:hover { background: transparent; }

/* ---- Result banner ---- */
.result-card {
  margin-top: 18px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 22px 26px;
  box-shadow: var(--shadow);
}
.result-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.72rem;
  font-weight: 700;
  opacity: 0.85;
}
.result-name {
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin-top: 4px;
}
.result-formal { margin-top: 6px; font-size: 1.02rem; opacity: 0.95; }
.result-meta { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.result-meta .chip {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.28);
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
}
.result-address {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.22);
  font-size: 0.9rem;
  opacity: 0.92;
}

.result-meta .chip.chip-nbhd {
  background: rgba(255, 255, 255, 0.92);
  color: var(--brand-dark);
  border-color: rgba(255, 255, 255, 0.92);
}

/* ---- Status / errors ---- */
.status-card {
  margin-top: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 12px;
  padding: 16px 18px;
  color: var(--ink-soft);
  box-shadow: var(--shadow);
}
.status-card.warn { border-left-color: #e0a10b; }
.status-card.error { border-left-color: #d64545; }
.status-card strong { color: var(--ink); }
.status-card code {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 0.85em;
}

/* ---- Map ---- */
.map-wrap { position: relative; margin-top: 18px; }
#map {
  height: 460px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: #dfe6ec;
}
.map-legend[hidden] { display: none; }
.map-legend {
  position: absolute;
  left: 12px; bottom: 12px;
  z-index: 500;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.8rem;
  display: flex;
  gap: 16px;
  box-shadow: 0 4px 14px rgba(20, 40, 70, 0.12);
}
.legend-item { display: flex; align-items: center; gap: 7px; color: var(--ink); }
.legend-dot {
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--brand); border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--brand);
}
.legend-item[hidden] { display: none; }
.legend-swatch {
  width: 15px; height: 12px; border-radius: 3px;
  background: rgba(10, 124, 90, 0.22);
  border: 2px solid var(--accent);
}
.legend-swatch.nbhd {
  background: rgba(124, 58, 237, 0.16);
  border-color: #7c3aed;
}

/* Blue dot marker */
.address-dot {
  width: 18px; height: 18px;
  background: var(--brand);
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--brand), 0 2px 6px rgba(0,0,0,0.35);
}

.app-footer {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 20px 40px;
  color: var(--ink-soft);
  font-size: 0.8rem;
  line-height: 1.6;
}

@media (max-width: 560px) {
  #map { height: 380px; }
  .result-card { padding: 18px 18px; }
  .map-legend { flex-direction: column; gap: 6px; }
}
