/* 左栏列表 + 右侧地图 + 浮动详情；手机端上地图下列表，详情全屏 */
:root {
  --ink: #1d1b16; --muted: #6e695e; --bg: #f4f1ea; --panel: #fcfbf7; --line: #e0dbcf; --soft: #efeadf;
  --accent: #b5651d; --red: #d32f2f; --green: #2e7d32; --nav: 0px;
  --shadow: 0 1px 3px rgba(30, 25, 15, .08), 0 10px 30px rgba(30, 25, 15, .12);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #ece8df; --muted: #a39d90; --bg: #11141a; --panel: #181c23; --line: #2a303a; --soft: #222833;
    --accent: #e39a52; --red: #ff6b6b; --green: #7bd389; --shadow: 0 1px 3px rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] {
  --ink: #ece8df; --muted: #a39d90; --bg: #11141a; --panel: #181c23; --line: #2a303a; --soft: #222833;
  --accent: #e39a52; --red: #ff6b6b; --green: #7bd389; --shadow: 0 1px 3px rgba(0, 0, 0, .5);
}
body:has(jic-nav-top) { --nav: 48px; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink); overflow: hidden;
  font: 15px/1.55 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Noto Sans SC", "Noto Sans TC", sans-serif;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
.app { position: fixed; top: var(--nav); left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: 400px 1fr; }

aside { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--panel); z-index: 2; }
header { padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.hrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
h1 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 19px; line-height: 1.3; white-space: nowrap; min-width: 0; }
h1 span { overflow: hidden; text-overflow: ellipsis; }
aside, header { min-width: 0; }
.brand { display: inline-flex; color: var(--accent); }
.hnav { display: flex; gap: 6px; flex: none; }
.chip {
  border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 3px 10px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.chip:hover { border-color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--panel); border-color: var(--ink); }
#tabs { display: flex; gap: 4px; overflow-x: auto; margin: 10px -16px 8px; padding: 0 16px; scrollbar-width: none; }
#tabs::-webkit-scrollbar { display: none; }
#tabs button {
  flex: none; border: 0; background: transparent; padding: 6px 9px 7px; border-radius: 8px; cursor: pointer; font-size: 13.5px; color: var(--muted);
  display: flex; flex-direction: column; align-items: flex-start; line-height: 1.25; border-bottom: 2px solid transparent;
}
#tabs button small { font-size: 11px; opacity: .8; font-variant-numeric: tabular-nums; }
#tabs button[aria-selected="true"] { color: var(--ink); background: var(--soft); border-bottom-color: var(--c); font-weight: 600; }
input, select { width: 100%; font-size: 14px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.filters { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 6px; margin-top: 6px; }
.filters select { padding: 6px 6px; font-size: 13px; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
#count { padding: 6px 16px; font-size: 12.5px; color: var(--muted); border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
#count .hint { display: block; }
#list { overflow-y: auto; flex: 1; min-height: 0; }
.empty { padding: 24px 16px; color: var(--muted); }

.card { display: flex; gap: 10px; padding: 9px 16px; text-decoration: none; border-bottom: 1px solid var(--line); }
.card:hover { background: var(--soft); }
.card.on { background: var(--soft); box-shadow: inset 3px 0 0 var(--accent); }
.th { flex: none; width: 56px; height: 56px; border-radius: 8px; overflow: hidden; background: var(--soft); display: grid; place-items: center; }
.th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.th i { width: 12px; height: 12px; border-radius: 50%; opacity: .85; }
.tx { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.nm { font-weight: 600; font-size: 14.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.n2 { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 12px; color: var(--muted); align-items: center; }
.dot::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--c); margin-right: 4px; vertical-align: 1px; }
.tag { font-weight: 500; font-size: 11.5px; padding: 0 6px; border-radius: 4px; border: 1px solid var(--c, var(--line)); color: var(--c, var(--muted)); white-space: nowrap; }
.tag.red { --c: var(--red); } .tag.green { --c: var(--green); } .tag.gray { --c: var(--muted); }

main { position: relative; min-width: 0; }
#map { position: absolute; inset: 0; background: var(--soft); }
.leaflet-container { font: inherit; }
:root[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9); } }
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large { background: rgba(181, 101, 29, .25); }
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div { background: rgba(181, 101, 29, .85); color: #fff; font-weight: 600; }

#detail {
  position: absolute; top: 12px; right: 12px; bottom: 12px; width: min(440px, calc(100% - 24px)); overflow-y: auto; z-index: 1000;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
}
#detail[hidden] { display: none; }
.dh { position: sticky; top: 0; height: 0; z-index: 2; }
.x {
  position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 20px; line-height: 1;
}
#detail figure { margin: 0; background: var(--soft); }
#detail figure img { width: 100%; max-height: 260px; object-fit: cover; display: block; border-radius: 14px 14px 0 0; }
#detail figcaption { font-size: 11px; color: var(--muted); padding: 3px 12px; text-align: right; }
#detail figcaption a { text-decoration: none; }
.db { padding: 14px 18px 18px; }
.badges { display: flex; flex-wrap: wrap; gap: 5px; padding-right: 36px; }
#detail h2 { font-size: 20px; line-height: 1.35; margin: 8px 0 2px; }
.sub2 { margin: 0 0 6px; color: var(--muted); font-size: 13.5px; }
.note { font-size: 12px; color: var(--muted); margin: 4px 0; }
.facts { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 13.5px; }
.facts th { text-align: left; font-weight: 500; color: var(--muted); padding: 5px 10px 5px 0; vertical-align: top; white-space: nowrap; width: 1%; }
.facts td { padding: 5px 0; border-top: 1px solid var(--line); }
.facts tr:first-child td { border-top: 0; }
.facts td.r { text-align: right; font-variant-numeric: tabular-nums; padding-right: 10px; }
.facts abbr { text-decoration: none; font-weight: 600; cursor: help; }
.facts a { color: var(--accent); }
.names td { font-size: 13px; }
.mini { font-size: 11.5px; border: 1px solid var(--line); background: var(--bg); border-radius: 5px; padding: 0 6px; cursor: pointer; margin-left: 6px; }
code { font: 12.5px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--soft); padding: 1px 5px; border-radius: 4px; }
.desc p { margin: 0 0 8px; font-size: 14px; }
details { border-top: 1px solid var(--line); padding: 8px 0; }
summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.parts { margin: 8px 0 0; padding-left: 22px; font-size: 13px; max-height: 320px; overflow-y: auto; }
.parts a { text-decoration: none; }
.parts small { color: var(--muted); }
h3 { font-size: 14px; margin: 14px 0 6px; }
.rel { list-style: none; padding: 0; margin: 0; font-size: 13.5px; }
.rel li { margin: 4px 0; }
.rel a { text-decoration: none; }
.links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.links a { font-size: 13px; text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }
.links a:hover { border-color: var(--accent); color: var(--accent); }

dialog { max-width: 640px; width: calc(100% - 32px); border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--ink); padding: 20px 22px; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0, 0, 0, .35); }
dialog h2 { margin: 0 0 8px; font-size: 20px; }
dialog p, dialog li { font-size: 14px; }
dialog a { color: var(--accent); }
dialog .x { top: 12px; right: 12px; }

@media (max-width: 760px) {
  body { overflow: auto; }
  .app { position: static; display: flex; flex-direction: column-reverse; padding-top: var(--nav); }
  main { height: 42vh; position: sticky; top: 0; z-index: 1; }
  aside { border-right: 0; }
  #list { overflow: visible; }
  header { padding: 12px 16px 8px; }
  #detail { position: fixed; inset: var(--nav) 0 0 0; width: auto; border-radius: 0; border: 0; }
  body.has-detail main { z-index: 5; }
  h1 { font-size: 17px; }
  #detail figure img { border-radius: 0; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters #country { grid-column: 1 / -1; }
}
