/* レー探 取締スポット一覧 — アプリと同じ暗い配色 */
:root {
  --bg: #15191d;
  --panel: #1f252b;
  --panel2: #232a31;
  --line: #2f3841;
  --text: #eef1f4;
  --muted: #9aa4ae;
  --accent: #e3262f;
  --osm: #e3262f;
  --preset: #c77dff;
  --rule: #2457c5;
  --radius: 14px;
  font-family: "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", Meiryo, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { font-size: 15px; line-height: 1.6; }
a { color: #8ec5ff; }
.muted { color: var(--muted); }

/* ---------------------------------------------------------------- 上のバー */
.topbar {
  display: flex; align-items: center; gap: 16px; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 18px 10px; background: #101316; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 1000;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none;
         font-weight: 800; font-size: 19px; white-space: nowrap; }
.brand img { border-radius: 8px; }
.brand small { font-weight: 600; font-size: 14px; color: var(--muted); margin-left: 4px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.nav a, .nav .linklike {
  color: var(--text); text-decoration: none; padding: 8px 12px; border-radius: 10px;
  font: inherit; font-weight: 600; background: none; border: none; cursor: pointer;
}
.nav a:hover, .nav .linklike:hover { background: var(--panel2); }
.nav a[aria-current="page"] { background: var(--panel); box-shadow: inset 0 -3px 0 var(--accent); }

/* ---------------------------------------------------------------- 地図ページ */
.map-page { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
.layout { flex: 1; display: flex; min-height: 0; overflow: clip; }
.side { width: 380px; display: flex; flex-direction: column; border-right: 1px solid var(--line);
        background: var(--bg); min-height: 0; }
.side-head { padding: 14px 14px 8px; border-bottom: 1px solid var(--line); }
.side-head input[type=search] {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel2); color: var(--text); font: inherit;
}
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.filters .group { width: 100%; font-size: 12px; color: var(--muted); margin-top: 4px; }
.chip {
  border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  border-radius: 999px; padding: 4px 11px; font: inherit; font-size: 13px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip[aria-pressed="true"] { color: var(--text); border-color: #56616c; background: var(--panel2); }
.chip .n { color: var(--muted); font-size: 12px; }
.chip .mk { width: 10px; height: 10px; border-radius: 50%; background: var(--osm); }
.chip .mk.sq { border-radius: 3px; background: var(--rule); }
.count { font-size: 13px; color: var(--muted); padding: 4px 2px 0; }
.spot-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; }
.spot-list li {
  display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border-radius: 10px; cursor: pointer;
}
.spot-list li:hover, .spot-list li:focus-visible { background: var(--panel); outline: none; }
.spot-list li.active { background: #3a1d1f; }
.spot-list .t { font-weight: 700; }
.spot-list .s { font-size: 13px; color: var(--muted); }
.empty { color: var(--muted); padding: 16px; }

.map-wrap { position: relative; flex: 1; min-width: 0; }
#map { position: absolute; inset: 0; background: #20262c; }
.leaflet-tile-pane { filter: brightness(.9) saturate(.9); }
.list-toggle { display: none; }

/* マーカー（アプリの地図と同じ見た目） */
.mk-wrap { position: relative; }
.mk {
  position: absolute; left: 0; top: 0; width: 28px; height: 28px; transform: translate(-50%, -50%);
  border: 2px solid #fff; border-radius: 50%; background: var(--osm); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font: 800 12px/1 "Noto Sans JP", sans-serif; box-shadow: 0 1px 4px rgba(0,0,0,.5);
}
.mk.preset { background: var(--preset); }
.mk.rule { border-radius: 7px; }
.mk.off { background: #7b848c; }
.mk.small { width: 14px; height: 14px; font-size: 0; }
.mk-arrow {
  position: absolute; left: 0; top: 0; width: 0; height: 0; transform-origin: 0 0;
}
.mk-arrow::before {
  content: ""; position: absolute; left: -8px; top: -34px;
  border-left: 8px solid transparent; border-right: 8px solid transparent;
  border-bottom: 14px solid #fff;
}
.mk-arrow::after {
  content: ""; position: absolute; left: -6px; top: -31px;
  border-left: 6px solid transparent; border-right: 6px solid transparent;
  border-bottom: 10px solid var(--c, var(--osm));
}
.mk-img {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -50%);
  width: 42px; height: 42px; border-radius: 11px; background: #fff; border: 3px solid var(--osm);
  display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 5px rgba(0,0,0,.55);
}
.mk-img.preset { border-color: var(--preset); }
.mk-img.off { filter: grayscale(1) brightness(.7); }
.mk-img img { display: block; }
.lead { flex: none; margin-top: 2px; width: 30px; display: flex; justify-content: center; }
.badge-img { display: block; border-radius: 6px; }
.badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px;
  padding: 0 4px; border-radius: 50%; border: 2px solid #fff; color: #fff; font-weight: 800; font-size: 11px;
  background: var(--osm);
}
.badge.preset { background: var(--preset); }
.badge.rule { border-radius: 7px; }

/* ポップアップ */
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel); color: var(--text); }
.leaflet-popup-content { margin: 12px 16px; font-size: 14px; line-height: 1.6; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.pop h3 { margin: 0 0 4px; font-size: 16px; }
.pop .kind { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 12px; font-weight: 700;
             background: #3a1d1f; color: #ffb3b6; }
.pop .kind.rule { background: #1d2b4a; color: #a9c4ff; }
.pop table { border-collapse: collapse; margin: 6px 0; }
.pop th { text-align: left; color: var(--muted); font-weight: 600; padding: 1px 12px 1px 0; white-space: nowrap; }
.pop .links a { margin-right: 12px; }
.leaflet-control-attribution { background: rgba(255,255,255,.85) !important; }
.leaflet-bar a { background: var(--panel); color: var(--text); border-color: var(--line); }
.leaflet-bar a:hover { background: var(--panel2); }
.locate-btn { font-size: 18px; }

.nav .install { color: #fff; background: var(--accent); }
.nav .install:hover { background: #b81d25; }
.nav [hidden] { display: none; }
/* オフラインのとき */
body.offline .topbar::after {
  content: "オフライン：保存したデータで表示しています"; position: absolute; left: 50%; top: 100%;
  transform: translateX(-50%); background: #3a1d1f; color: #ffb3b6; border: 1px solid var(--accent);
  border-radius: 0 0 10px 10px; padding: 2px 12px; font-size: 12px; white-space: nowrap;
}

/* ---------------------------------------------------------------- 説明ページ */
.doc { max-width: 860px; margin: 0 auto; padding: 24px 20px 60px; }
.doc h1 { font-size: 28px; margin: 8px 0 4px; }
.doc h2 { font-size: 20px; margin: 34px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.card { background: var(--panel); border-radius: var(--radius); padding: 16px 20px; margin: 12px 0; }
.card.warn { background: #3a1d1f; border: 1px solid var(--accent); }
.legend { display: grid; grid-template-columns: auto 1fr; gap: 10px 14px; align-items: center; }
.kinds { width: 100%; border-collapse: collapse; }
.kinds th, .kinds td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.kinds th { color: var(--muted); font-weight: 600; font-size: 13px; }
.stats { display: flex; gap: 12px; flex-wrap: wrap; }
.stat { background: var(--panel2); border-radius: 12px; padding: 10px 16px; min-width: 140px; }
.stat b { display: block; font-size: 26px; }

/* ---------------------------------------------------------------- 製作者ダイアログ */
.dialog { border: none; border-radius: 18px; padding: 0; background: var(--panel); color: var(--text);
          width: min(520px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.dialog::backdrop { background: rgba(0,0,0,.55); }
.dialog-body { padding: 22px 24px 18px; }
.maker-head { display: flex; gap: 14px; align-items: center; }
.maker-head img { border-radius: 12px; }
.maker-head h2 { margin: 0; font-size: 21px; }
.maker-head p { margin: 2px 0 0; font-size: 13px; }
.maker-list { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 18px 0; }
.maker-list dt { color: var(--muted); font-size: 13px; padding-top: 2px; }
.maker-list dd { margin: 0; }
.dialog-actions { display: flex; justify-content: flex-end; }
.btn { border: none; border-radius: 10px; padding: 9px 18px; font: inherit; font-weight: 700; cursor: pointer;
       background: var(--panel2); color: var(--text); }
.btn.primary { background: var(--accent); color: #fff; }

/* ---------------------------------------------------------------- スマホ */
@media (max-width: 760px) {
  .brand small { display: none; }
  .nav a, .nav .linklike { padding: 6px 8px; font-size: 14px; }
  .side { position: absolute; z-index: 1100; left: 0; right: 0; bottom: 0; top: auto; width: auto; height: 55%;
          border-right: none; border-top: 1px solid var(--line); border-radius: 16px 16px 0 0;
          transform: translateY(100%); transition: transform .25s; box-shadow: 0 -10px 30px rgba(0,0,0,.5); }
  .side.open { transform: none; }
  .layout { position: relative; }
  .list-toggle { display: block; position: absolute; z-index: 800; left: 50%; bottom: 22px;
                 transform: translateX(-50%); padding: 10px 26px; border-radius: 999px; border: none;
                 background: var(--accent); color: #fff; font: inherit; font-weight: 800;
                 box-shadow: 0 4px 14px rgba(0,0,0,.5); }
  body.list-open .list-toggle { bottom: calc(55% + 14px); }
}
