:root {
  --bg: #f6f2ee; --card: #ffffff; --text: #2a1f22; --sub: #6e6063; --line: #e6dcd6;
  --wine: #6d1a36; --wine2: #9b2c4f; --gold: #b88a2e; --ok: #2f7d4f; --ng: #b3322f;
  --sea: #dce9f2; --land: #efe8dc; --land2: #fbf7f0; --river: #4b8bbe; --adm: #b9ab9a;
  --chip: #f1e7e2;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17121a; --card: #221b25; --text: #f0e8ea; --sub: #b3a5aa; --line: #3a2f3c;
    --wine: #d9708f; --wine2: #e58fa8; --gold: #d8b25e; --ok: #5cc28a; --ng: #ee7a72;
    --sea: #1b2a36; --land: #2c2729; --land2: #4a423c; --river: #6fb0e0; --adm: #7a6d62; --chip: #33283a;
  }
}
:root[data-theme="dark"] {
  --bg: #17121a; --card: #221b25; --text: #f0e8ea; --sub: #b3a5aa; --line: #3a2f3c;
  --wine: #d9708f; --wine2: #e58fa8; --gold: #d8b25e; --ok: #5cc28a; --ng: #ee7a72;
  --sea: #1b2a36; --land: #2c2729; --land2: #4a423c; --river: #6fb0e0; --adm: #7a6d62; --chip: #33283a;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  font-size: 15px; line-height: 1.65; -webkit-text-size-adjust: 100%;
  padding-bottom: calc(68px + env(safe-area-inset-bottom));
}
.top { background: var(--wine); color: #fff; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; position: sticky; top: 0; z-index: 10; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .top { background: #3b1426; } }
.brand { display: flex; gap: 10px; align-items: center; max-width: 860px; margin: 0 auto; }
.brand .logo { font-size: 26px; }
.brand h1 { font-size: 17px; margin: 0; }
.brand p { font-size: 11px; margin: 0; opacity: .8; }
main { max-width: 860px; margin: 0 auto; padding: 14px 16px 24px; }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 20; }
.tabs button { flex: 1; border: 0; background: none; color: var(--sub); font-size: 11px; padding: 7px 0 8px; display: flex; flex-direction: column; align-items: center; gap: 1px; cursor: pointer; }
.tabs button span { font-size: 19px; }
.tabs button.on { color: var(--wine); font-weight: 700; }
h2 { font-size: 18px; margin: 18px 0 10px; }
h3 { font-size: 15px; margin: 14px 0 6px; color: var(--wine); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.muted { color: var(--sub); font-size: 13px; }
.note { font-size: 12px; color: var(--sub); background: var(--chip); border-radius: 8px; padding: 8px 10px; margin: 8px 0; }
table.kv { width: 100%; border-collapse: collapse; font-size: 14px; }
table.kv td { border-top: 1px solid var(--line); padding: 7px 6px; vertical-align: top; }
table.kv td:first-child { width: 34%; font-weight: 600; color: var(--wine); }
.bars .row { display: grid; grid-template-columns: minmax(0, 1fr) 46px; gap: 8px; align-items: center; margin: 6px 0; cursor: pointer; }
.bars .lbl { font-size: 13px; }
.bars .track { height: 8px; background: var(--chip); border-radius: 4px; overflow: hidden; margin-top: 2px; }
.bars .fill { height: 100%; background: var(--wine2); border-radius: 4px; }
.bars .val { font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; color: var(--sub); }
.trend h4 { margin: 0 0 4px; font-size: 14px; }
.trend p { margin: 0; font-size: 14px; }
.stars { color: var(--gold); letter-spacing: 1px; font-size: 13px; }
.tlist .t { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 11px 12px; border-top: 1px solid var(--line); cursor: pointer; }
.tlist .t:first-child { border-top: 0; }
.tlist .t .nm { font-weight: 600; }
.tlist .t .meta { font-size: 12px; color: var(--sub); text-align: right; white-space: nowrap; }
.pill { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 99px; background: var(--chip); color: var(--sub); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 10px; background: var(--wine); color: #fff; padding: 10px 16px; font-size: 15px; font-weight: 600; cursor: pointer; }
.btn.sub { background: var(--chip); color: var(--text); }
.btn.block { width: 100%; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.back { background: none; border: 0; color: var(--wine); font-size: 14px; padding: 4px 0; cursor: pointer; }
.trendbox { border-left: 4px solid var(--gold); }
ul.pts { margin: 0; padding-left: 20px; }
ul.pts li { margin: 4px 0; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
.chips button { flex: none; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 99px; padding: 5px 12px; font-size: 13px; cursor: pointer; }
.chips button.on { background: var(--wine); color: #fff; border-color: var(--wine); }
.mapwrap { background: var(--sea); border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.mapwrap svg { display: block; width: 100%; height: auto; max-height: 78vh; }
.map-land { fill: var(--land); stroke: #fff; stroke-width: .8; }
.map-land.focus { fill: var(--land2); stroke: var(--adm); stroke-width: 1.2; }
.map-adm { fill: none; stroke: var(--adm); stroke-width: .7; stroke-dasharray: 3 2; }
.map-river { fill: none; stroke: var(--river); stroke-width: 1.3; stroke-linejoin: round; stroke-linecap: round; }
.map-lake { fill: var(--sea); stroke: var(--river); stroke-width: .5; }
.map-label { fill: var(--river); font-style: italic; font-weight: 600; paint-order: stroke; stroke: var(--sea); stroke-width: 3px; }
.mk circle { fill: var(--wine); stroke: #fff; stroke-width: 1.5; }
.mk text { fill: #fff; font-weight: 700; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.mk { cursor: pointer; }
.mk.hl circle { fill: var(--gold); }
.mk.dim circle { fill: var(--sub); opacity: .45; }
.mk-line { stroke: var(--wine); stroke-width: 1; opacity: .7; }
.mk-name { font-weight: 600; fill: var(--text); paint-order: stroke; stroke: var(--land2); stroke-width: 3px; pointer-events: none; }
.legend { counter-reset: none; margin: 10px 0 0; padding: 0; list-style: none; columns: 2 260px; column-gap: 16px; }
.legend li { break-inside: avoid; display: flex; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 13px; cursor: pointer; }
.legend li.hl { background: var(--chip); }
.legend .n { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--wine); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.legend .o { color: var(--sub); font-size: 11px; }
.legend .hide { filter: blur(5px); }
.q { font-size: 16px; font-weight: 600; margin: 4px 0 12px; }
.choices button { display: block; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 10px; padding: 12px 14px; margin: 8px 0; font-size: 15px; cursor: pointer; }
.choices button.ok { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, var(--card)); }
.choices button.ng { border-color: var(--ng); background: color-mix(in srgb, var(--ng) 14%, var(--card)); }
.choices button:disabled { cursor: default; color: var(--text); }
.fb { margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: var(--chip); font-size: 14px; }
.fb b.ok { color: var(--ok); } .fb b.ng { color: var(--ng); }
.prog { height: 6px; background: var(--chip); border-radius: 3px; overflow: hidden; margin-bottom: 10px; }
.prog div { height: 100%; background: var(--gold); }
.big { font-size: 34px; font-weight: 800; color: var(--wine); font-variant-numeric: tabular-nums; }
select { font-size: 15px; padding: 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--text); width: 100%; }
label.opt { display: flex; gap: 8px; align-items: center; font-size: 14px; margin: 8px 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 420px) { table.kv td:first-child { width: 38%; } }
