:root {
  --green: #0b5d47; --green-2: #0f7a5c; --ink: #14201c; --muted: #5d6b66; --line: #e2e8e5;
  --bg: #ffffff; --soft: #f3f7f5; --amber: #e8930c; --red: #c8372d; --radius: 14px;
  --shadow: 0 6px 24px rgba(10, 30, 24, .16);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); overflow: hidden; }
#map { position: fixed; inset: 0; }
button, input, select, textarea { font: inherit; color: inherit; }

#top { position: fixed; top: 12px; left: 12px; width: min(400px, calc(100vw - 24px)); z-index: 5; display: grid; gap: 8px; }
.brand { background: var(--green); color: #fff; font-weight: 700; padding: 8px 14px; border-radius: 999px; width: max-content; max-width: 100%; box-shadow: var(--shadow); display: flex; align-items: center; gap: 8px; }
.brand em { font-style: normal; font-weight: 500; opacity: .8; font-size: 13px; }
.brand .pin { width: 10px; height: 10px; border-radius: 50% 50% 50% 0; background: #ffd27a; transform: rotate(-45deg); }
.search { position: relative; }
#q { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); box-shadow: var(--shadow); outline: none; }
#q:focus { border-color: var(--green-2); }
#results { list-style: none; margin: 6px 0 0; padding: 4px; background: var(--bg); border-radius: var(--radius); box-shadow: var(--shadow); max-height: 50vh; overflow: auto; }
#results li { padding: 9px 10px; border-radius: 10px; cursor: pointer; display: grid; gap: 1px; }
#results li:hover, #results li:focus { background: var(--soft); }
#results small, .muted { color: var(--muted); }
#results .none { cursor: default; color: var(--muted); }

#panel { position: fixed; z-index: 4; left: 12px; bottom: 12px; width: min(400px, calc(100vw - 24px)); max-height: calc(100vh - 150px); overflow: auto; background: var(--bg); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
#panel:empty { display: none; }
#panel h2 { margin: 0 0 2px; font-size: 18px; line-height: 1.25; }
#panel h3 { margin: 16px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
#panel p { margin: 6px 0; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.btn { border: 1px solid var(--line); background: var(--bg); padding: 9px 13px; border-radius: 10px; cursor: pointer; font-weight: 600; }
.btn:hover { background: var(--soft); }
a.btn { text-decoration: none; color: var(--ink); display: inline-block; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-2); }
.btn.small { padding: 6px 10px; font-size: 13px; font-weight: 500; }
.btn.warn { color: var(--red); }
.btn[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #fff; }
.close { position: absolute; top: 10px; right: 10px; border: 0; background: var(--soft); width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 16px; line-height: 1; }
#panel { position: fixed; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.stat { background: var(--soft); border-radius: 10px; padding: 9px 10px; }
.stat b { display: block; font-size: 18px; }
.stat span { font-size: 12px; color: var(--muted); }
.note { background: #fff7e8; border-left: 3px solid var(--amber); padding: 8px 10px; border-radius: 6px; margin: 10px 0; font-size: 14px; }
.fresh { background: #e9f5f0; border-left: 3px solid var(--green-2); padding: 8px 10px; border-radius: 6px; margin: 10px 0; font-size: 14px; }
.fresh.none { background: var(--soft); border-color: #a9b6b1; }
.big { font-size: 24px; font-weight: 700; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: var(--bg); padding: 7px 11px; cursor: pointer; font-size: 13px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--green); color: #fff; }
ol.steps { list-style: none; margin: 8px 0 0; padding: 0; counter-reset: s; }
ol.steps li { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); cursor: pointer; align-items: start; }
ol.steps li::before { counter-increment: s; content: counter(s); width: 22px; height: 22px; border-radius: 50%; background: var(--soft); font-size: 12px; display: grid; place-items: center; font-weight: 600; }
ol.steps li.final::before { content: "★"; background: var(--green); color: #fff; }
ol.steps small { color: var(--muted); white-space: nowrap; }
label { display: grid; gap: 4px; margin-top: 10px; font-size: 13px; color: var(--muted); }
label input, label select, label textarea { padding: 10px 11px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--bg); width: 100%; }
textarea { resize: vertical; min-height: 64px; }
.photo { width: 100%; border-radius: 10px; margin-top: 10px; max-height: 220px; object-fit: cover; display: block; }
.linkbox { display: flex; gap: 6px; margin-top: 10px; }
.linkbox input { flex: 1; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); min-width: 0; }
.legend { display: grid; gap: 4px; font-size: 13px; margin-top: 8px; }
.legend i { display: inline-block; width: 22px; height: 4px; border-radius: 2px; vertical-align: middle; margin-right: 8px; }
table.kv { width: 100%; border-collapse: collapse; font-size: 14px; }
table.kv td { padding: 4px 0; border-top: 1px solid var(--line); }
table.kv td:last-child { text-align: right; font-variant-numeric: tabular-nums; }

#banner { position: fixed; z-index: 6; top: 12px; left: 50%; transform: translateX(-50%); width: min(560px, calc(100vw - 24px)); background: var(--green); color: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
#banner .next { font-size: 20px; font-weight: 700; line-height: 1.25; }
#banner .sub { opacity: .85; margin-top: 4px; display: flex; justify-content: space-between; gap: 12px; }
#banner button { margin-top: 10px; background: rgba(255, 255, 255, .16); border: 0; color: #fff; padding: 7px 12px; border-radius: 8px; cursor: pointer; }
body.driving #top { display: none; }

#toast { position: fixed; z-index: 9; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }

.mk { width: 18px; height: 18px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 1px 6px rgba(0, 0, 0, .4); }
.mk.origin { background: #2b6fdb; }
.mk.me { background: #2b6fdb; box-shadow: 0 0 0 8px rgba(43, 111, 219, .22), 0 1px 6px rgba(0, 0, 0, .4); }
.mk.dest { background: var(--red); width: 22px; height: 22px; }
.mk.entrance { background: var(--amber); }
.mk.car { background: var(--green); width: 24px; height: 24px; border-width: 4px; }
.mk.sel { background: var(--ink); }

@media (max-width: 640px) {
  #panel { left: 0; right: 0; bottom: 0; width: 100%; border-radius: 18px 18px 0 0; max-height: 58vh; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .brand em { display: none; }
}

/* ---- street view ---- */
#viewer { position: fixed; z-index: 7; top: 12px; right: 12px; width: min(740px, calc(100vw - 448px)); height: min(70vh, 560px); background: #0c1210; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
#viewer[hidden] { display: none; }
.sv-stage, .sv-stage img, #sv-pano { width: 100%; height: 100%; }
.sv-stage img { object-fit: contain; display: block; }
.sv-close { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .55); color: #fff; font-size: 18px; cursor: pointer; z-index: 3; }
.sv-cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 28px 14px 12px; color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, .72)); display: grid; gap: 2px; pointer-events: none; z-index: 2; }
.sv-cap span { font-size: 13px; opacity: .85; }
.sv-pad { position: absolute; right: 14px; bottom: 64px; width: 132px; height: 132px; z-index: 3; }
.sv-pad button { position: absolute; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .92); color: var(--ink); font-size: 20px; font-weight: 700; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, .4); }
.sv-pad button:hover { background: #fff; }
.sv-forward { left: 44px; top: 0; } .sv-back { left: 44px; bottom: 0; } .sv-left { left: 0; top: 44px; } .sv-right { right: 0; top: 44px; }
.mk.street { background: #2b6fdb; width: 20px; height: 20px; position: relative; }
.mk.street::after { content: ""; position: absolute; left: 50%; top: 50%; width: 0; height: 0; border: 9px solid transparent; border-bottom: 22px solid rgba(43, 111, 219, .45); transform: translate(-50%, -100%) rotate(var(--h, 0deg)); transform-origin: 50% 100%; margin-top: -1px; }
#sv-video { width: 100%; border-radius: 10px; background: #000; margin-top: 8px; max-height: 240px; object-fit: cover; }
@media (max-width: 640px) {
  #viewer { top: 0; left: 0; right: 0; width: 100%; height: 50vh; border-radius: 0; }
  body.street #top { display: none; }
  body.street #panel { max-height: 48vh; }
}
