:root {
  --bg: #f7f8fa; --card: #fff; --ink: #1d2433; --muted: #5b6577; --line: #dfe3ea;
  --accent: #2a6fb0; --sea: #eef5fb; --na: #d9d9d9; --border: #ffffff;
  font-family: "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #12151b; --card: #1b2029; --ink: #e8ebf0; --muted: #a2abba; --line: #2e3542;
    --accent: #7db4ea; --sea: #18202b; --na: #4a4f58; --border: #1b2029; color-scheme: dark; }
}
:root[data-theme="dark"] { --bg: #12151b; --card: #1b2029; --ink: #e8ebf0; --muted: #a2abba; --line: #2e3542;
    --accent: #7db4ea; --sea: #18202b; --na: #4a4f58; --border: #1b2029; color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.6; }
a { color: var(--accent); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--card); }
.top h1 { font-size: 1.25rem; margin: 0; }
.sub { margin: 0; color: var(--muted); font-size: .85rem; }
.tools { display: flex; gap: 8px; flex: none; }
.lang { border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 6px; padding: 6px 12px; cursor: pointer; font-weight: 600; white-space: nowrap; }
.layout { display: grid; grid-template-columns: 300px 1fr; gap: 16px; padding: 16px 20px; max-width: 1280px; margin: 0 auto; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 14px; align-self: start; position: sticky; top: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; color: var(--muted); font-weight: 600; }
select, input { font: inherit; font-size: .95rem; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 7px 8px; font-weight: 400; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { flex: 1; border: 0; background: var(--bg); color: var(--ink); padding: 7px 6px; font: inherit; font-size: .9rem; font-weight: 400; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg-v { flex-direction: column; }
.seg-v button { text-align: left; padding: 8px 10px; }
.seg-v button + button { border-left: 0; border-top: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; font-weight: 600; }
.explain { margin: 0; font-size: .85rem; color: var(--muted); }
.nav { display: flex; gap: 8px; }
.nav button { flex: 1; border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 6px; padding: 7px; font: inherit; font-size: .85rem; cursor: pointer; }
.mapwrap { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px 16px; position: relative; min-width: 0; }
.mapwrap h2 { font-size: 1.05rem; margin: 0 0 6px; }
.map svg { width: 100%; height: auto; max-height: calc(100vh - 190px); min-height: 320px; display: block; background: var(--sea); border-radius: 6px; touch-action: none; }
.map .muni { stroke: none; }
.map .pref { fill: none; stroke: var(--border); stroke-width: .8; vector-effect: non-scaling-stroke; pointer-events: none; }
.map .hl { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; pointer-events: none; }
.map svg.has-hl path.muni:not(.is-hl) { fill-opacity: .3; }
.map svg.has-hl .pref { stroke-opacity: .6; }
.map .sep { stroke: var(--muted); stroke-width: 1; fill: none; vector-effect: non-scaling-stroke; }
.tip { position: absolute; pointer-events: none; background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px; font-size: .85rem; box-shadow: 0 2px 8px rgba(0,0,0,.15); max-width: 260px; }
.tip b { display: block; }
.legend { margin-top: 10px; font-size: .8rem; color: var(--muted); }
.legend .bar { display: flex; height: 14px; border-radius: 3px; overflow: hidden; }
.legend .bar span { flex: 1; }
.legend .ticks { position: relative; height: 1.4em; }
.legend .ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.legend .na { display: inline-flex; align-items: center; gap: 6px; margin-top: 2px; }
.legend .na i { width: 14px; height: 14px; background: var(--na); border-radius: 2px; display: inline-block; }
.foot { max-width: 1280px; margin: 0 auto; padding: 0 20px 28px; font-size: .8rem; color: var(--muted); }
@media (max-width: 760px) {
  .top { padding: 12px 16px; }
  .layout { grid-template-columns: 1fr; padding: 12px 16px; }
  .panel { position: static; }
  .mapwrap { padding: 10px; }
  .foot { padding: 0 16px 24px; }
}
