@font-face {
  font-family: "ArimoSubset";
  src: url("../fonts/Arimo-Regular-subset.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}

:root {
  --fg: #1d2733;
  --muted: #5b6672;
  --panel: rgba(255, 255, 255, 0.92);
  --border: #c9d2dc;
  --accent: #2467b0;
  --ok: #1e7b34;
  --ng: #c0261c;
  --bg: #f4f6f8;
  --panel-solid: #ffffff;
  --on-accent: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fg: #e4e9ef; --muted: #9aa6b2; --panel: rgba(28, 34, 42, 0.92); --border: #3a4552; --accent: #7fb2ea; --ok: #5fcf7b; --ng: #ff7a6e; --bg: #151a20; --panel-solid: #1c222a; --on-accent: #0d1620;
  }
}
:root[data-theme="dark"] {
  --fg: #e4e9ef; --muted: #9aa6b2; --panel: rgba(28, 34, 42, 0.92); --border: #3a4552; --accent: #7fb2ea; --ok: #5fcf7b; --ng: #ff7a6e; --bg: #151a20; --panel-solid: #1c222a; --on-accent: #0d1620;
}

html, body { margin: 0; padding: 0; background: var(--bg); color: var(--fg); font-family: -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif; }

/* 地図の画面 */
body.map-page { height: 100%; overflow: hidden; display: flex; flex-direction: column; }
html:has(body.map-page) { height: 100%; }
#stage { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; }
#map { position: absolute; inset: 0; background: #dfe7ee; }

/* 上の帯（独立したページのときだけ） */
#bar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 4px 12px; padding: 6px 12px; padding-top: max(6px, env(safe-area-inset-top));
  background: var(--panel-solid); border-bottom: 1px solid var(--border); font-size: 13px; line-height: 1.35; z-index: 1100;
}
body.embed #bar { display: none; }
#bar a { color: var(--accent); text-decoration: none; }
#bar .brand { display: inline-flex; align-items: center; gap: 6px; color: var(--fg); white-space: nowrap; flex: 0 0 auto; }
#bar .brand img { border-radius: 6px; display: block; }
#bar .pitch { color: var(--muted); flex: 1 1 auto; min-width: 0; order: 2; }
#bar .links { display: inline-flex; gap: 10px; align-items: center; white-space: nowrap; flex: 0 0 auto; order: 3; }
#bar .store { background: var(--accent); color: var(--on-accent); border-radius: 999px; padding: 3px 10px; font-weight: 600; }
@media (max-width: 640px) {
  /* 2 行に収める: 案内を 1 行目の右に浮かせ、名前の後ろから一文を流し込む */
  #bar { display: block; padding: 4px 16px 5px; font-size: 12px; line-height: 22px; }
  #bar .brand { display: inline-flex; vertical-align: top; height: 22px; margin-right: 6px; }
  #bar .brand img { width: 20px; height: 20px; border-radius: 5px; }
  #bar .links { float: right; display: inline-flex; gap: 8px; height: 22px; margin-left: 6px; }
  #bar .store { padding: 0 9px; line-height: 20px; }
  #bar .pitch { font-size: 11px; }
}

/* 出典（隅に小さく） */
#credit {
  position: absolute; right: 0; bottom: 0; z-index: 1070; max-width: calc(100% - 8px); box-sizing: border-box;
  padding: 1px 6px; font-size: 10px; line-height: 1.4; color: #333; background: rgba(255, 255, 255, 0.8); border-top-left-radius: 4px;
}
#credit a { color: #333; }
#credit button { font: inherit; border: 0; background: none; padding: 0 0 0 2px; cursor: pointer; color: #2467b0; }
#creditFull {
  position: absolute; right: 6px; bottom: 22px; z-index: 1071; max-width: min(420px, calc(100% - 28px)); padding: 8px 10px;
  font-size: 11px; line-height: 1.5; color: var(--fg); background: var(--panel); border: 1px solid var(--border); border-radius: 6px;
}
body.overzoom #credit { bottom: 40px; }
body.overzoom #creditFull { bottom: 62px; }

/* 埋め込み: 押す前の静止画 */
#cover { position: absolute; inset: 0; z-index: 1050; background: #dfe7ee; overflow: hidden; cursor: pointer; }
#cover img { position: absolute; left: 50%; top: 50%; width: 1280px; height: 800px; max-width: none; transform: translate(-50%, -50%); }
#coverBtn {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font: 600 15px/1 -apple-system, "Hiragino Sans", sans-serif;
  color: #fff; background: rgba(20, 30, 45, 0.78); border: 0; border-radius: 999px; padding: 12px 20px; cursor: pointer; white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}
#cover.loading { cursor: progress; }
#openLarge {
  position: absolute; top: 8px; right: 8px; z-index: 1060; font-size: 12px; line-height: 1; padding: 7px 10px; border-radius: 999px;
  color: var(--accent); background: var(--panel); border: 1px solid var(--border); text-decoration: none; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.panel {
  position: absolute; z-index: 1000; background: var(--panel); color: var(--fg); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; font-size: 12px; line-height: 1.5; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}
#info { top: 10px; right: 10px; min-width: 190px; font-variant-numeric: tabular-nums; }
#info .row { display: flex; justify-content: space-between; gap: 12px; }
#info .row span:first-child { color: var(--muted); }
#info label { display: block; margin-top: 6px; cursor: pointer; }
#info a { color: var(--accent); }
#info .err { color: var(--ng); white-space: pre-wrap; }
#banner {
  position: absolute; left: 0; right: 0; bottom: 0; height: 40px; z-index: 999; display: none;
  background: rgba(20, 30, 45, 0.745); color: #fff; font-size: 14.7px; line-height: 40px; text-align: center; pointer-events: none;
}
body.overzoom #banner { display: block; }
body.overzoom .leaflet-bottom { bottom: 40px; }
.region-label {
  font: 600 11px/1 -apple-system, sans-serif; color: #7a2c8c; white-space: nowrap; text-shadow: 0 0 2px #fff, 0 0 2px #fff;
  transform: translate(-50%, -50%); width: auto !important; height: auto !important; pointer-events: none;
}
.region-label small { display: block; font-weight: 400; text-align: center; margin-top: 2px; }

/* 比べる画面 */
body.compare { padding: 0 16px 40px; }
.cmp-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg); z-index: 1; }
.cmp-head h1 { font-size: 18px; margin: 0; }
.cmp-head a { color: var(--accent); }
#summary { font-weight: 600; }
.cmp-note { color: var(--muted); font-size: 13px; }
.cmp-row h2 { font-size: 14px; font-weight: 600; margin: 18px 0 6px; overflow-wrap: anywhere; }
.cmp-row.ok .res { color: var(--ok); }
.cmp-row.ng .res { color: var(--ng); }
.cmp-imgs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; max-width: 1200px; }
.cmp-imgs canvas { width: 100%; height: auto; border: 1px solid var(--border); background: rgb(190, 210, 255); }
@media (max-width: 600px) { .cmp-imgs { grid-template-columns: 1fr; } }
