:root {
  --ink: #2b2b2b; --muted: #6b6b6b; --line: #e8e2d9;
  --acc: #2f7d5b; --acc-dark: #23604a; --acc-soft: #eaf5ee; --acc-line: #9fcdb3; --cream: #fffdf9;
  --radius: 16px; --shadow: 0 8px 28px rgba(60,40,20,.14);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: #dfe8f5; color: var(--ink); font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif; line-height: 1.5; }
#map { position: fixed; inset: 0; z-index: 1; }
button { font: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* ---------- 左上カード ---------- */
.panel { position: fixed; top: 12px; left: 12px; z-index: 1000; width: 340px; background: var(--cream); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px 14px; }
.panel-head { display: flex; align-items: center; gap: 10px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: inherit; }
.brand-logo { width: 40px; height: 40px; }
.brand-name { font-size: 22px; font-weight: 900; letter-spacing: .02em; white-space: nowrap; }
.brand-sep { width: 2px; height: 32px; background: var(--acc); }
.brand-edition { font-size: 26px; font-weight: 900; color: var(--acc); }
.tagline { margin-top: 6px; font-size: 13px; font-weight: 700; color: var(--acc); }
.sub { font-size: 12px; color: var(--muted); }
.live-count { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 14px; font-weight: 700; color: #b91c1c; }
.live-count .dot { width: 10px; height: 10px; border-radius: 50%; background: #e11d48; box-shadow: 0 0 0 3px rgba(225,29,72,.15); }
.panel-links { font-size: 12px; margin: 4px 0 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.panel-links a { color: var(--muted); }
.editions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.ed { text-align: center; padding: 8px 0; border: 1.5px solid var(--line); border-radius: 10px; font-weight: 700; font-size: 14px; text-decoration: none; background: #fff; color: var(--ink); }
.ed.active { background: var(--acc); color: #fff; border-color: var(--acc); }
.search { display: flex; align-items: center; gap: 8px; margin-top: 12px; border: 1.5px solid var(--line); border-radius: 12px; padding: 9px 12px; background: #fff; color: var(--muted); }
.search input { flex: 1; border: 0; outline: 0; font-size: 15px; background: transparent; color: var(--ink); }
.random { width: 100%; margin-top: 12px; padding: 12px; border-radius: 12px; border: 1.5px dashed var(--acc-line); background: var(--acc-soft); color: var(--acc-dark); font-weight: 900; font-size: 16px; }
.panel-collapse { display: none; }

/* ---------- 下段カテゴリ ---------- */
.catbar { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 1000; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: min(900px, calc(100vw - 24px)); padding: 10px 12px; background: rgba(255,253,249,.96); border-radius: 18px; box-shadow: var(--shadow); }
.cat-pill { padding: 7px 14px; border-radius: 999px; border: 2px solid #9a948b; background: #fff; color: #4b4b4b; font-weight: 700; font-size: 14px; white-space: nowrap; }
.cat-pill .cnt { font-weight: 900; }
.cat-pill.c-mountain { border-color: #3c9a5f; color: #2f7a4b; } .cat-pill.c-city { border-color: #8b4fc2; color: #6b3aa0; }
.cat-pill.c-sea { border-color: #2f7fbf; color: #23649a; } .cat-pill.c-traffic { border-color: #2f7d5b; color: #23604a; }
.cat-pill.c-river { border-color: #2f8f8a; color: #23706c; } .cat-pill.c-world { border-color: #d6336c; color: #b0275a; } .cat-pill.c-fav { border-color: #d4a017; color: #a77c0d; }
.cat-pill.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.cat-pill.hidden-cat { display: none; }

/* ---------- マーカー ---------- */
.custom-cluster-wrapper, .custom-pin-wrapper { background: none; border: none; }
.cluster-icon { display: flex; align-items: center; justify-content: center; border-radius: 50%; background: #7fbf9b; color: #2b2b2b; font-weight: 900; font-size: 15px; border: 4px solid rgba(255,255,255,.95); box-shadow: 0 3px 10px rgba(0,0,0,.25); }
.cluster-icon.large { background: var(--acc); color: #fff; font-size: 17px; }
.custom-pin { width: 18px; height: 18px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--acc); border: 2.5px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); cursor: pointer; }
.custom-pin.world-pin { background: #d6336c; } .custom-pin.river-pin { background: #2f8f8a; }
.custom-pin.offline { background: #b7aea2; }
.custom-pin:hover { transform: rotate(-45deg) scale(1.2); }
.leaflet-control-zoom a { width: 38px; height: 38px; line-height: 38px; font-size: 22px; }
.leaflet-control-layers { border-radius: 10px !important; box-shadow: var(--shadow) !important; }

/* ---------- 再生パネル ---------- */
.sheet { position: fixed; z-index: 1100; background: #fff; box-shadow: var(--shadow); border-radius: var(--radius); top: 12px; right: 12px; bottom: 12px; width: 480px; display: flex; flex-direction: column; overflow: hidden; }
.sheet-bar { display: flex; gap: 8px; align-items: center; padding: 12px 14px 0; }
.camera-status-tag { margin-right: auto; font-size: 11px; font-weight: 900; letter-spacing: .1em; padding: 4px 10px; border-radius: 999px; background: #e11d48; color: #fff; }
.camera-status-tag.offline { background: #9a948b; }
.chip { padding: 7px 14px; border-radius: 999px; border: 1.5px solid var(--acc-line); background: var(--acc-soft); color: var(--acc-dark); font-weight: 700; font-size: 13px; }
.chip.active { background: var(--acc); color: #fff; }
.close { width: 36px; height: 36px; border-radius: 50%; border: 0; background: #f1ece5; font-size: 22px; line-height: 1; color: var(--muted); }
.sheet-body { overflow-y: auto; padding: 8px 16px 24px; }
.camera-title { font-size: 18px; font-weight: 900; margin: 6px 0 10px; line-height: 1.4; }
.player-container { position: relative; width: 100%; aspect-ratio: 16/9; background: #111; border-radius: 12px; overflow: hidden; }
.player-container iframe, .player-container video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player-placeholder { display: flex; height: 100%; align-items: center; justify-content: center; color: #9a948b; font-size: 13px; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 16px; }
.btn { padding: 10px 16px; border-radius: 999px; border: 1.5px solid var(--acc); color: var(--acc-dark); font-weight: 700; text-decoration: none; font-size: 14px; background: #fff; }
.btn.fill { background: var(--acc); color: #fff; }
.info div { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.info dt { flex: none; width: 88px; color: var(--muted); }
.info dd { flex: 1; word-break: break-all; }
.info a { color: var(--acc-dark); }

/* ---------- about ---------- */
.about { position: fixed; z-index: 1200; top: 50%; left: 50%; transform: translate(-50%,-50%); width: min(560px, 92vw); background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; line-height: 1.8; font-size: 14px; }
.about .close { position: absolute; top: 12px; right: 12px; }
.about h2 { font-size: 20px; font-weight: 900; margin-bottom: 10px; }
.about a { color: var(--acc-dark); }

/* ---------- モバイル ---------- */
@media (max-width: 720px) {
  .panel { width: calc(100vw - 24px); padding: 14px 14px 12px; }
  .panel.collapsed > :not(.panel-head):not(.panel-collapse) { display: none; }
  .panel-collapse { display: block; position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: #f1ece5; color: var(--muted); font-size: 18px; }
  .panel.collapsed .panel-collapse { transform: rotate(180deg); }
  .brand-name { font-size: 18px; } .brand-edition { font-size: 22px; }
  .catbar { bottom: 10px; padding: 8px; gap: 6px; }
  .cat-pill { padding: 6px 10px; font-size: 12px; }
  .sheet { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 82vh; border-radius: 20px 20px 0 0; }
  .sheet-bar::before { content: ''; position: absolute; top: 6px; left: 50%; transform: translateX(-50%); width: 40px; height: 4px; border-radius: 2px; background: #d8d3cb; }
}

.panel-links .req { color: var(--acc-dark); font-weight: 700; margin-right: 10px; text-decoration: none; }

/* ---------- ランキング ---------- */
.rank { position: fixed; top: 372px; left: 12px; z-index: 999; width: 340px; background: var(--cream); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; }
.rank-tabs { display: flex; background: #f1ece5; border-radius: 10px; padding: 3px; margin-bottom: 8px; }
.rank-tabs button { flex: 1; border: 0; background: transparent; padding: 7px; border-radius: 8px; font-weight: 700; color: var(--muted); }
.rank-tabs button.active { background: #fff; color: var(--acc-dark); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
#rankList { list-style: none; max-height: calc(100vh - 560px); overflow-y: auto; }
#rankList li { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
#rankList li:hover { background: var(--acc-soft); }
#rankList .n { flex: none; width: 26px; height: 26px; border-radius: 50%; background: #7fbf9b; color: #fff; font-weight: 900; font-size: 13px; display: flex; align-items: center; justify-content: center; }
#rankList .t { flex: 1; font-size: 13px; font-weight: 700; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
#rankList .v { flex: none; font-size: 13px; font-weight: 900; color: var(--acc-dark); }
@media (max-width: 720px) { .rank { display: none; } }

.editions.ed5 { grid-template-columns: repeat(5, 1fr); gap: 4px; } .editions.ed5 .ed { font-size: 12.5px; padding: 8px 0; }

.cat-pill.c-craft { border-color: #b07d1c; color: #8a5f10; } .custom-pin.craft-pin { background: #b07d1c; }
