:root {
  --bg: #f4f7fb;
  --panel: #fff;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #0f766e;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  --radius: 14px;
  --detail-h: 220px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); }
body.cartoon {
  --bg: #dff3ff; --panel: #fff9e8; --accent: #0284c7; --line: #7dd3fc;
  --shadow: 0 8px 0 #93c5fd; --ink: #0c4a6e;
}
.app { display: grid; grid-template-rows: auto auto auto minmax(0,1fr); height: 100%; min-height: 100vh; }
.banner { background:#111827; color:#f9fafb; padding:10px 16px; font-size:13px; line-height:1.4; }
.banner strong { color:#fbbf24; }
.topbar {
  display:flex; flex-wrap:wrap; gap:12px; align-items:center; justify-content:space-between;
  padding:14px 16px; background:var(--panel); border-bottom:1px solid var(--line);
}
.topbar h1 { margin:0; font-size:18px; }
.topbar .sub { margin:2px 0 0; color:var(--muted); font-size:12px; }
.toggles label {
  display:inline-flex; gap:6px; align-items:center; font-size:13px;
  background:var(--bg); border:1px solid var(--line); border-radius:999px; padding:6px 10px; cursor:pointer;
}
body.cartoon .toggles label { border-width:3px; border-radius:14px; background:#fef08a; font-weight:700; }
.filters {
  display:flex; flex-wrap:wrap; gap:8px; padding:10px 16px 14px;
  background:var(--panel); border-bottom:1px solid var(--line); align-items:center;
}
.chip, .select-wrap select {
  border:1px solid var(--line); background:#fff; border-radius:999px;
  padding:7px 12px; font:inherit; font-size:13px; cursor:pointer;
}
.chip.active { background:var(--accent); border-color:var(--accent); color:#fff; }
.select-wrap { display:inline-flex; align-items:center; gap:6px; font-size:12px; color:var(--muted); }
body.cartoon .chip, body.cartoon .select-wrap select { border-width:3px; border-radius:16px; }
.main { display:grid; grid-template-columns:minmax(280px,360px) 1fr; min-height:0; }
@media (max-width:860px){ .main { grid-template-columns:1fr; grid-template-rows:42vh 1fr; } }
.list-pane { background:var(--panel); border-right:1px solid var(--line); overflow:auto; padding:12px; }
.list-meta, .muted { font-size:12px; color:var(--muted); }
.list-meta { margin:0 0 10px; }
.empty-list { font-size:13px; color:var(--muted); padding:16px; border:1px dashed var(--line); border-radius:var(--radius); }
.card {
  border:1px solid var(--line); border-radius:var(--radius); padding:12px; margin-bottom:10px;
  background:#fff; box-shadow:var(--shadow); cursor:pointer;
}
.card:hover, .card.active { border-color:var(--accent); }
body.cartoon .card { border-width:3px; border-radius:20px; background:#fffef5; transform:rotate(-0.4deg); }
body.cartoon .card:nth-child(even){ transform:rotate(0.4deg); }
.card h2 { margin:0 0 4px; font-size:15px; }
.card .meta { display:flex; flex-wrap:wrap; gap:6px; margin:8px 0; }
.pill { font-size:11px; padding:3px 8px; border-radius:999px; background:#ecfeff; color:#0f766e; border:1px solid #99f6e4; }
.pill.warn { background:#fff7ed; color:#9a3412; border-color:#fed7aa; }
.pill.muted { background:#f3f4f6; color:#4b5563; border-color:#e5e7eb; }
.card p { margin:0; font-size:12px; color:var(--muted); line-height:1.45; }
.map-pane {
  position:relative; min-height:320px;
  display:grid; grid-template-rows:minmax(0,1fr) var(--detail-h);
}
#map { height:100%; width:100%; min-height:240px; }
body.cartoon #map { filter:saturate(1.35) contrast(1.05); border-top:4px solid #38bdf8; }
.hover-card {
  position:relative; z-index:500; width:100%; height:var(--detail-h); overflow:auto;
  background:var(--panel); border-top:1px solid var(--line); padding:12px 16px; display:block;
}
.hover-card.has-place { background:#f8fffe; }
body.cartoon .hover-card { border-top:4px solid #f472b6; background:#fff7ed; }
body.cartoon .hover-card.has-place { background:#fef9c3; }
.hover-card h3 { margin:0 0 6px; font-size:16px; }
.hover-card .close { float:right; border:0; background:transparent; font-size:18px; cursor:pointer; color:var(--muted); }
.attr-grid { display:grid; grid-template-columns:1fr 1fr; gap:6px; margin:10px 0; font-size:12px; }
.attr-grid div { background:#f3f4f6; border-radius:10px; padding:6px 8px; }
body.cartoon .attr-grid div { background:#e0f2fe; border:2px solid #7dd3fc; border-radius:14px; }
.attr-grid span { display:block; color:var(--muted); font-size:10px; text-transform:uppercase; letter-spacing:.03em; }
.people { font-size:12px; margin-top:8px; }
.people strong { display:block; margin-bottom:4px; }
.pin-wrap { background:transparent; border:0; }
.pin-label {
  background:#fff; border:2px solid var(--accent); border-radius:999px; padding:2px 8px;
  font-size:11px; font-weight:700; box-shadow:0 2px 8px rgba(0,0,0,.15);
  white-space:nowrap; display:inline-flex; align-items:center; gap:4px;
}
.cartoon-pin {
  border-width:3px !important; border-radius:16px !important; padding:4px 10px; font-size:12px;
  box-shadow:3px 3px 0 rgba(14,116,144,.35); transform:rotate(-3deg); background:#fffef5;
}
.pin-face { font-size:14px; line-height:1; }
.is-selected .pin-label { outline:3px solid #f59e0b; outline-offset:2px; }

.chip-row { display:flex; flex-wrap:wrap; gap:8px; width:100%; }
.chip-row.subchips { margin-top:6px; padding-top:6px; border-top:1px dashed var(--line); }
.chip-group { font-weight:600; }
.chip-row.subchips .chip { background:#ecfdf5; border-color:#6ee7b7; }
.chip-row.subchips .chip.active { background:#059669; border-color:#059669; color:#fff; }
