:root {
  --bg: #0f172a;
  --panel: #1f2937;
  --text: #f9fafb;
  --muted: #9ca3af;
  --accent: #2563eb;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Segoe UI", Roboto, sans-serif; }
#map { position: absolute; top: 52px; bottom: 44px; left: 0; right: 0; z-index: 1; }
.hidden { display: none !important; }

/* ヘッダー */
#appbar {
  position: fixed; top: 0; left: 0; right: 0; height: 52px; z-index: 600;
  display: flex; align-items: center; justify-content: space-between; padding: 0 16px;
  background: #111827; border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brand { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.brand .logo { font-size: 18px; }
.brand .app { font-weight: 700; }
.brand .sep { color: var(--muted); }
.brand .view { color: #93c5fd; font-weight: 600; }
.brand .muni { color: var(--muted); font-size: 12px; margin-left: 6px; }
.nav { display: flex; gap: 8px; }
.nav a { color: var(--text); text-decoration: none; font-size: 12px; border: 1px solid #374151; padding: 6px 10px; border-radius: 8px; }
.nav a:hover { background: #1f2937; }

/* 左フィルタ */
#filters {
  position: fixed; top: 64px; left: 12px; z-index: 500; width: 240px;
  background: rgba(31,41,55,0.96); backdrop-filter: blur(8px); border-radius: 14px; padding: 14px 16px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
#filters h2 { margin: 0 0 12px; font-size: 14px; }
.f-group { margin-bottom: 16px; }
.f-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.f-label strong { color: var(--text); }
.layers { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.lyr { border: 1px solid #374151; background: transparent; color: var(--text);
  padding: 8px 6px; border-radius: 9px; font-size: 12px; cursor: pointer; }
.lyr.active { background: var(--accent); border-color: var(--accent); }
input[type="range"] { width: 100%; }
.ticks { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); margin-top: 2px; }
.f-check { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: var(--text); line-height: 1.4; }
.f-hint { margin: 6px 0 0; font-size: 10px; color: var(--muted); line-height: 1.45; }
.f-hint strong { color: #93c5fd; font-weight: 600; }
.legend { font-size: 11px; color: var(--muted); }
.legend .bar { display: block; width: 100%; height: 10px; border-radius: 5px; margin: 6px 0; }
.legend .ends { display: flex; justify-content: space-between; }

/* 手薄一覧 */
#thinPanel {
  position: fixed; top: 64px; right: 12px; z-index: 500; width: 220px; max-height: 50vh; overflow-y: auto;
  background: rgba(31,41,55,0.95); backdrop-filter: blur(8px); border-radius: 14px; padding: 12px 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
#thinPanel h3 { margin: 0 0 8px; font-size: 13px; }
#thinList { margin: 0; padding-left: 0; list-style: none; counter-reset: r; }
#thinList li { display: flex; gap: 8px; padding: 6px 4px; border-bottom: 1px solid rgba(255,255,255,0.06); cursor: pointer; font-size: 12px; }
#thinList li::before { counter-increment: r; content: counter(r); width: 18px; height: 18px; flex: 0 0 auto;
  border-radius: 50%; background: #374151; display: grid; place-items: center; font-size: 10px; font-weight: 700; }
#thinList li:nth-child(1)::before { background:#bd0026; }
#thinList li:nth-child(2)::before { background:#e31a1c; }
#thinList li:nth-child(3)::before { background:#fc4e2a; }

/* 下部ステータスバー */
#statusbar {
  position: fixed; left: 0; right: 0; bottom: 0; height: 44px; z-index: 600;
  display: flex; align-items: center; justify-content: space-between; padding: 0 16px;
  background: #111827; border-top: 1px solid rgba(255,255,255,0.08); font-size: 13px;
}
.stats { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stats strong { color: #93c5fd; }
.stats .div { color: #374151; }
.legend-chips { display: flex; gap: 12px; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); }
.chip .box { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.box.low { background: #fee08b; }
.box.mid { background: #66bd63; }
.box.high { background: #0c2c84; }

/* 看板ピン */
.sign-thumb { border: 2px solid #fff; border-radius: 6px; overflow: hidden; width: 40px; height: 40px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5); background: #1f2937; }
.sign-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sign-thumb.noimg { display: grid; place-items: center; font-size: 20px; }
.zone-label { background: rgba(189,0,38,0.9); color:#fff; font-size: 11px; font-weight: 700;
  padding: 3px 8px; border-radius: 6px; white-space: nowrap; border: none; box-shadow: 0 2px 6px rgba(0,0,0,0.4); }

@media (max-width: 760px) {
  #thinPanel { display: none; }
  #filters { width: 200px; }
}
