:root {
  --card: rgba(255,255,255,0.97); --ink: #0f172a; --muted: #64748b; --line: #e8edf3;
  --accent: #7c3aed; --green: #15803d;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: var(--ink); }
#map { position: absolute; inset: 0; z-index: 0; background: #aadaff; }

#panel {
  position: absolute; top: 14px; right: 14px; bottom: 14px; width: 380px; max-width: calc(100vw - 28px);
  z-index: 1000; background: var(--card); border-radius: 18px; box-shadow: 0 18px 50px rgba(15,23,42,.28);
  display: flex; flex-direction: column; overflow: hidden; backdrop-filter: blur(8px);
}
.panel-head { padding: 16px 18px 10px; border-bottom: 1px solid var(--line); }
.panel-head h1 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.panel-head .sub { margin: 3px 0 0; color: var(--muted); font-size: 12px; }

.ctrl { padding: 12px 18px; border-bottom: 1px solid var(--line); }
.ctrl-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 8px 0; }
.lbl { font-size: 12px; color: var(--muted); }
.seg { display: inline-flex; background: #f1f5f9; border-radius: 9px; padding: 2px; }
.seg button { border: 0; background: transparent; font-size: 12px; padding: 4px 9px; border-radius: 7px; cursor: pointer; color: var(--muted); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); font-weight: 600; }
.slider-label { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: var(--muted); margin-top: 4px; }
.slider-label strong { font-size: 15px; color: var(--ink); }
#bw { width: 100%; margin: 8px 0 2px; accent-color: var(--accent); }
.hint { margin: 4px 0 0; font-size: 11px; color: var(--muted); line-height: 1.4; }
.chk { font-size: 12px; color: var(--ink); display: flex; align-items: center; gap: 6px; }
.export { border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 6px 12px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--accent); }
.export:hover { background: #faf5ff; }

#selected { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 18px; }
#selected.empty .placeholder { color: var(--muted); font-size: 13px; line-height: 1.55; }
.shop-head .name { font-size: 17px; font-weight: 800; margin: 0; }
.shop-head .brand { font-size: 12px; color: var(--muted); margin: 2px 0 4px; }
.sec { margin-top: 14px; }
.sec h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); margin: 0 0 6px; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 3px 0; }
.kv > span:first-child { color: var(--muted); }
.kv > span:last-child { text-align: right; }
.kv a { color: var(--accent); text-decoration: none; }
.ci { color: #dc2626; font-size: 15px; }
.rt { color: #d97706; }
.y { color: var(--green); }
.n { color: #94a3b8; }
.na { color: #cbd5e1; }
.summary { font-size: 12px; color: var(--muted); margin: 6px 0 0; font-style: italic; }
.rivals { list-style: none; margin: 4px 0 0; padding: 0; }
.rivals li { display: flex; justify-content: space-between; font-size: 12.5px; padding: 3px 0; border-bottom: 1px solid var(--line); }

.panel-foot { padding: 10px 18px; border-top: 1px solid var(--line); background: #f8fafc; }
.legend { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); }
.rampbar { flex: 1; height: 9px; border-radius: 5px; background: linear-gradient(90deg, hsl(140,72%,46%), hsl(70,72%,46%), hsl(0,72%,46%)); }
.usage { margin: 8px 0 0; font-size: 11px; color: var(--muted); }

.export-menu { position: absolute; top: 150px; right: 30px; z-index: 1200; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(0,0,0,.18); overflow: hidden; }
.export-menu.hidden { display: none; }
.export-menu a { display: block; padding: 10px 16px; font-size: 13px; color: var(--ink); text-decoration: none; }
.export-menu a:hover { background: #f1f5f9; }

.toast { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1300; background: var(--ink); color: #fff; padding: 9px 16px; border-radius: 999px; font-size: 13px; }
.toast.hidden { display: none; }
.toast.err { background: #b91c1c; }

@media (max-width: 720px) { #panel { top: auto; right: 8px; left: 8px; bottom: 8px; width: auto; max-height: 62vh; } }
