:root {
  --park: #2e8b57;
  --px: #b5793a;        /* 紙箱色 */
  --down: #12a150;      /* 台股跌是綠色 */
  --ink: #1f2328;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #ffffff;
  --head: #111827;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: system-ui, "Noto Sans TC", "Microsoft JhengHei", sans-serif; color: var(--ink); background: #e5e7eb; }
#map { position: absolute; inset: 0; }
.tiles-light { filter: grayscale(.85) brightness(1.08) contrast(.9); }

/* ---------- 面板 ---------- */
#panel {
  position: absolute; top: 12px; left: 56px; z-index: 1000;
  width: 330px; max-height: calc(100% - 24px);
  display: flex; flex-direction: column;
  background: var(--bg); border-radius: 12px; overflow: hidden;
  box-shadow: 0 4px 18px rgba(0,0,0,.22);
}
#panel header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; background: var(--head); color: #fff; }
#panel h1 { font-size: 17px; margin: 0; }
#panel .sub { margin: 2px 0 0; font-size: 12px; color: #cbd5e1; }
#collapse { background: transparent; border: 1px solid #475569; color: #fff; border-radius: 6px; width: 30px; height: 30px; cursor: pointer; font-size: 16px; transition: transform .2s; }
#panel.collapsed #collapse { transform: rotate(-90deg); }
#panel.collapsed .body { display: none; }

.ticker { background: #052e16; color: #4ade80; font-size: 12px; white-space: nowrap; overflow: hidden; padding: 3px 0; }
.ticker span { display: inline-block; padding-left: 100%; animation: tick 18s linear infinite; }
@keyframes tick { to { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) { .ticker span { animation: none; padding-left: 8px; } }

.body { padding: 12px; overflow: auto; }
.primary, #locate { width: 100%; padding: 10px; border: 0; border-radius: 8px; font-size: 15px; cursor: pointer; }
.primary { background: var(--down); color: #fff; font-weight: 600; }
.primary:hover { filter: brightness(1.08); }
#locate { background: #2563eb; color: #fff; font-size: 14px; padding: 8px; }
.hint { font-size: 12px; color: var(--muted); margin: 6px 0; }

#combos:empty { display: none; }
#combos { margin: 8px 0 4px; }
.combo { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; cursor: pointer; font-size: 13px; line-height: 1.6; }
.combo:hover { background: #f0fdf4; border-color: var(--down); }
.combo .rank { font-weight: 700; color: var(--down); margin-right: 4px; }
.combo small { color: var(--muted); }

.search { position: relative; margin: 10px 0; }
#q { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; }
#results { position: absolute; left: 0; right: 0; top: 100%; z-index: 2; list-style: none; margin: 0; padding: 0; background: var(--bg); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 6px 6px; max-height: 280px; overflow: auto; box-shadow: 0 6px 12px rgba(0,0,0,.08); }
#results:empty { display: none; }

details { border-top: 1px solid var(--line); padding: 8px 0 4px; }
summary { cursor: pointer; font-weight: 600; font-size: 14px; padding: 2px 0 6px; }
.toggle { display: flex; align-items: center; gap: 6px; font-size: 14px; margin: 6px 0; cursor: pointer; }
.field { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; margin: 8px 0; }
.field select { flex: 0 0 60%; padding: 5px 6px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; background: #fff; }
.count { color: var(--muted); font-size: 12px; margin-left: auto; font-weight: 400; }
.dot { font-size: 14px; }

.list { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow: auto; }
.list li, #results li { padding: 6px 8px; cursor: pointer; font-size: 13px; border-bottom: 1px solid var(--line); }
.list li:hover, #results li:hover { background: #f3f4f6; }
li small { color: var(--muted); display: block; }
.list .empty, #results .empty { cursor: default; color: var(--muted); }

.about { font-size: 12px; color: #374151; line-height: 1.6; }
.about p { margin: 4px 0 8px; }
.about ul { margin: 0 0 8px; padding-left: 18px; }
.about a { color: #2563eb; }

/* ---------- 地圖標記 ---------- */
.pin { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 15px; background: #fff; border: 2px solid; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.pin.park { border-color: var(--park); }
.pin.px { border-color: var(--px); }
.pin.fav { box-shadow: 0 0 0 3px #facc15, 0 1px 4px rgba(0,0,0,.35); }
.cluster { color: #fff; font-weight: 700; font-size: 12px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 3px solid rgba(255,255,255,.85); box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.cluster.park { background: rgba(46,139,87,.9); }
.cluster.px { background: rgba(181,121,58,.92); }
.me { width: 18px; height: 18px; border-radius: 50%; background: #2563eb; border: 3px solid #fff; box-shadow: 0 0 0 2px #2563eb, 0 0 10px rgba(37,99,235,.6); }

.popup { font-size: 13px; min-width: 190px; }
.popup .kind { font-size: 12px; font-weight: 600; }
.popup .kind.park { color: var(--park); }
.popup .kind.px { color: var(--px); }
.popup b { display: block; font-size: 15px; margin: 2px 0; }
.popup .meta { color: var(--muted); margin: 2px 0; }
.popup .joke { color: var(--down); margin: 4px 0; }
.popup .actions { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.popup .fav-btn { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 3px 8px; cursor: pointer; font-size: 12px; }
.popup .fav-btn.on { background: #fef9c3; border-color: #facc15; }

@media (max-width: 600px) {
  #panel { left: 8px; right: 8px; top: auto; bottom: 8px; width: auto; max-height: 55%; }
  #panel h1 { font-size: 16px; }
}
