:root {
  --bg: #f4f6f5;
  --panel: #ffffff;
  --ink: #17221d;
  --muted: #64716b;
  --line: #e1e7e4;
  --accent: #1f6f54;
  --accent-ink: #ffffff;
  --accent-soft: #e4f1eb;
  --warn: #b45309;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 24px rgba(20,40,30,.08);
  --header-h: 60px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; display: flex; flex-direction: column; }
a { color: var(--accent); }
h1 { font-size: 22px; margin: 0 0 8px; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0 0 6px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; display: flex; align-items: center; gap: 8px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
button { font: inherit; }
.btn { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 9px; padding: 8px 14px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #c5d0ca; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { background: #185c45; }
.btn.primary:disabled { opacity: .6; cursor: progress; }
.btn.ghost { background: transparent; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; text-transform: none; letter-spacing: 0; font-size: 12px; text-decoration: underline; }

/* header */
.top { height: var(--header-h); display: flex; align-items: center; gap: 14px; padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--line); position: relative; z-index: 20; }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.search { flex: 1; display: flex; gap: 8px; position: relative; max-width: 760px; }
.search input { flex: 1; font-size: 15px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fbfcfb; min-width: 0; }
.search input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.suggest { position: absolute; top: calc(100% + 6px); left: 0; right: 0; margin: 0; padding: 6px; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); max-height: 60vh; overflow: auto; z-index: 30; }
.suggest li { padding: 8px 10px; border-radius: 7px; cursor: pointer; display: flex; flex-direction: column; }
.suggest li:hover, .suggest li.active { background: var(--accent-soft); }
.suggest li .d { font-size: 12px; color: var(--muted); }

/* layout */
.layout { flex: 1; display: grid; grid-template-columns: 400px 1fr; min-height: 0; }
.panel { overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; border-right: 1px solid var(--line); background: #f8faf9; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.right { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.map-wrap { position: relative; flex: 1; min-height: 300px; }
#map { position: absolute; inset: 0; }
.pano-wrap { position: relative; height: 240px; background: #0e1a24; border-top: 1px solid var(--line); flex: none; }
#pano { width: 100%; height: 100%; display: block; cursor: crosshair; }
.pano-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #9fb4c3; font-size: 14px; text-align: center; padding: 20px; pointer-events: none; }
.pano-tip { position: absolute; top: 10px; background: rgba(12,20,28,.88); color: #fff; font-size: 12px; padding: 6px 9px; border-radius: 7px; pointer-events: none; white-space: nowrap; transform: translateX(-50%); z-index: 5; }
.status { position: absolute; top: 0; left: 0; right: 0; z-index: 6; background: rgba(12,20,28,.85); color: #e6eef3; font-size: 12px; padding: 6px 12px; display: flex; align-items: center; gap: 10px; }
.status-bar { flex: 1; height: 6px; background: rgba(255,255,255,.15); border-radius: 3px; overflow: hidden; }
#status-fill { height: 100%; width: 0; background: #4ade80; transition: width .15s; }

/* map toolbar */
.map-toolbar { position: absolute; top: 10px; left: 10px; display: flex; align-items: center; gap: 10px; z-index: 5; flex-wrap: wrap; }
.seg { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; box-shadow: var(--shadow); }
.seg-btn { border: 0; background: transparent; padding: 7px 13px; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg-btn.active { background: var(--accent); color: #fff; }
.seg-btn:disabled { cursor: not-allowed; opacity: .5; }
.toggle, .bearing { background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 6px 10px; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; box-shadow: var(--shadow); cursor: pointer; }
.bearing input { width: 160px; }
.map-hint { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); background: rgba(255,255,255,.92); border: 1px solid var(--line); padding: 6px 12px; border-radius: 20px; font-size: 13px; z-index: 5; pointer-events: none; box-shadow: var(--shadow); }

/* intro */
.feature-list { padding-left: 18px; margin: 0 0 12px; }
.feature-list li { margin-bottom: 5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 20px; padding: 5px 11px; font-size: 13px; cursor: pointer; }
.chip:hover { background: var(--accent-soft); border-color: var(--accent); }

/* result */
.score-row { display: flex; gap: 14px; align-items: center; }
.score-badge { width: 84px; height: 84px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 32px; line-height: 1; flex: none; box-shadow: inset 0 0 0 4px rgba(255,255,255,.35); }
.score-badge small { font-size: 11px; font-weight: 600; opacity: .9; }
.score-label { font-weight: 700; font-size: 18px; }
.addr { font-size: 14px; margin-top: 2px; }
.summary { margin: 12px 0 0; padding-left: 18px; font-size: 14px; }
.summary li { margin-bottom: 3px; }
.controls { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; align-items: flex-end; }
.controls label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 4px; flex: 1; min-width: 140px; }
.controls select { font: inherit; font-size: 14px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.metric { background: #f6f8f7; border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; }
.metric .k { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.metric .v { font-weight: 700; font-size: 16px; margin-top: 2px; }
.metric .s { font-size: 12px; color: var(--muted); }
.sectors { margin: 0; padding-left: 18px; font-size: 14px; }
.sectors li { margin-bottom: 4px; }
.bars { display: flex; flex-direction: column; gap: 7px; }
.bar { display: grid; grid-template-columns: 78px 1fr 48px; gap: 8px; align-items: center; font-size: 13px; }
.bar .track { height: 9px; background: #edf1ef; border-radius: 5px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--accent); border-radius: 5px; }
.bar .n { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar[title] { cursor: help; }
.links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.links a, .links button { font-size: 13px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; cursor: pointer; }
.links a:hover, .links button:hover { border-color: var(--accent); color: var(--accent); }
.explain { margin: -2px 0 10px; }

/* scan */
.legend { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-top: 12px; }
.legend-bar { flex: 1; height: 10px; border-radius: 5px; background: linear-gradient(90deg, rgb(180,60,50), rgb(230,150,50) 35%, rgb(240,210,70) 60%, rgb(90,180,90) 80%, rgb(20,120,70)); }
.spots { margin: 8px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.spot { display: grid; grid-template-columns: 28px 46px 1fr auto; gap: 8px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer; }
.spot:hover, .spot.hl { border-color: var(--accent); background: var(--accent-soft); }
.spot .rank { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.spot .sc { font-weight: 800; font-size: 17px; color: #fff; border-radius: 7px; text-align: center; padding: 3px 0; }
.spot .a { font-size: 13px; line-height: 1.3; min-width: 0; }
.spot .a small { display: block; color: var(--muted); }
.spot .act { display: flex; gap: 4px; }
.spot .act a, .spot .act button { font-size: 12px; padding: 4px 7px; border-radius: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; cursor: pointer; }
.credits { padding: 4px 6px 20px; }
.credits p { margin-bottom: 8px; }

/* map markers */
.obs-marker { width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--accent); border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.35); cursor: grab; }
.obs-marker::after { content: ""; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: #fff; }
.spot-marker { width: 26px; height: 26px; border-radius: 50%; color: #fff; font-weight: 800; font-size: 12px; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; box-shadow: 0 1px 5px rgba(0,0,0,.4); cursor: pointer; }
.spot-marker.hl { transform: scale(1.25); z-index: 2; }

@media (max-width: 900px) {
  :root { --header-h: auto; }
  .top { flex-wrap: wrap; padding: 10px 12px; gap: 8px; }
  .brand { order: 0; }
  #locate { order: 1; margin-left: auto; }
  .search { order: 2; flex-basis: 100%; }
  .layout { grid-template-columns: 1fr; grid-template-rows: auto auto; overflow: visible; }
  .right { order: 0; height: 78vh; }
  .panel { order: 1; border-right: 0; border-top: 1px solid var(--line); }
  .pano-wrap { height: 190px; }
  .bearing input { width: 110px; }
  .map-hint { display: none; }
}
