/* 皆で作る もしもの函館 — v3「地図が主役」デザイン
   霧の紙色 × 港の藍 × 市電の深緑 × 赤レンガ。地図を全面に、深掘りは右パネル（スマホは下から引き出すシート）。 */

@font-face {
  font-family: 'ZenKakuGothic';
  src: url('./assets/fonts/ZenKakuGothicNew-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'ZenKakuGothic';
  src: url('./assets/fonts/ZenKakuGothicNew-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'ShipporiMincho';
  src: url('./assets/fonts/ShipporiMincho-subset.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'BebasNeue';
  src: url('./assets/fonts/BebasNeue-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --navy: #1B3443;
  --navy-2: #24404F;
  --bg: #F2EFE8;
  --surface: #FBFAF6;
  --surface-soft: #F4F1EA;
  --ink: #14232E;
  --ink-muted: #5B6A72;
  --line: #E2DCCF;
  --line-strong: #CBC3B3;
  --accent: #A8553A;
  --accent-hover: #8E4430;
  --accent-soft: #F5E8E1;
  --teal: #2E6B5E;
  --teal-soft: #E5EEEA;
  --amber: #B07A1E;
  --amber-soft: #F8EFDC;
  --sea: #4E7A8C;
  --sea-soft: #E3ECEF;
  --gold: #C9A45C;
  --radius: 14px;
  --shadow-sm: 0 1px 3px rgba(20, 35, 46, 0.08);
  --shadow-md: 0 10px 30px rgba(20, 35, 46, 0.16);
  --glass: rgba(251, 250, 246, 0.9);
  --font-sans: 'ZenKakuGothic', "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Noto Sans CJK JP", "Meiryo", sans-serif;
  --font-serif: 'ShipporiMincho', "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif CJK JP", serif;
  --font-num: 'BebasNeue', 'ZenKakuGothic', sans-serif;
  --appbar-h: 56px;
  --panel-w: 412px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
body.mayor-app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---- アプリバー（細く・静かに。目安箱とその後は常に右上） ---- */
.appbar {
  flex: none;
  height: var(--appbar-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 14px 0 10px;
  background: var(--ink);
  color: #EFEBE2;
  position: relative;
  z-index: 30;
}
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: #B9C3C7; text-decoration: none; font-size: 12px; font-weight: 700;
  padding: 6px 8px; border-radius: 8px;
}
.back-link:hover { color: #FFFFFF; background: rgba(255,255,255,0.07); }
.brand { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.brand-title, .era-head-title, .detail-title, .change-q, .q-chip span, .detail-q, .briefing-title, .district-label, .tut-title { font-feature-settings: 'palt'; }
.brand-title {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.12em;
  color: #C9D2D4;
  white-space: nowrap;
}
.brand-moshimo { font-size: 20px; color: #FBF8F1; letter-spacing: 0.08em; margin-left: 6px; }
.tag-unofficial, .tag-dummy, .tag-beta {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; white-space: nowrap;
  padding: 2px 8px; border-radius: 999px;
}
.tag-unofficial { color: #9FB0B6; border: 1px solid rgba(255,255,255,0.18); }
.tag-dummy { color: #E8C98E; border: 1px solid rgba(201,164,92,0.45); }
.tag-dummy[hidden] { display: none; }
.tag-beta { flex: 0 0 auto; color: #ffe4ad; border: 1px solid #bc945e; }
.appbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
/* 市長室・市長選挙への入口（PC はヘッダー、スマホは地図の左下） */
.btn-office {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 9px;
  color: #EFEBE2; font-size: 12.5px; font-weight: 700; text-decoration: none; white-space: nowrap;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.14);
}
.btn-office:hover { background: rgba(255,255,255,0.12); }
.office-badge { font-size: 10.5px; font-weight: 700; color: #fff; background: #B4553A; border-radius: 999px; padding: 1px 7px; }
.office-badge[hidden] { display: none; }
.office-chip { display: none; }
.edition-pick {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 4px 0 10px; height: 36px; border-radius: 9px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.14);
}
.edition-ico { display: inline-flex; color: var(--gold); }
.edition-ico svg { width: 15px; height: 15px; }
.edition-pick select {
  background: transparent; color: #EFEBE2; border: none; font: inherit;
  font-size: 12.5px; font-weight: 700; padding: 6px 4px; max-width: 220px; cursor: pointer;
}
.edition-short { display: none; }
.edition-pick select option { color: var(--ink); background: #FFFFFF; }
.btn-followup {
  position: relative;
  display: inline-flex; align-items: center; gap: 7px;
  height: 36px; padding: 0 13px; border-radius: 9px;
  background: transparent; color: #EFEBE2;
  border: 1px solid rgba(255,255,255,0.22);
  font-size: 12.5px; font-weight: 700; white-space: nowrap;
}
.btn-followup:hover { background: rgba(255,255,255,0.08); }
.followup-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #E0896B;
  box-shadow: 0 0 0 3px rgba(224,137,107,0.25);
}
.followup-dot[hidden] { display: none; }
.btn-cta { height: 36px; padding: 0 16px; white-space: nowrap; }
.btn-cta .btn-ico svg { width: 16px; height: 16px; }

/* ---- ボタン ---- */
button { font-family: inherit; cursor: pointer; }
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--accent);
  color: #FFFFFF;
  border: none;
  border-radius: 9px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(217, 72, 38, 0.32);
  transition: background 0.15s, transform 0.1s;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: translateY(1px); }
.btn-ico { display: inline-flex; align-items: center; }

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 700;
}
.btn-secondary:hover { background: var(--surface-soft); border-color: var(--navy); }
.btn-ghost {
  background: var(--accent-soft);
  color: var(--accent-hover);
  border: 1px solid #F4C4B7;
  border-radius: 8px;
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 700;
}
.btn-ghost:hover { background: #FBE0D7; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-link {
  background: none; border: none; color: var(--teal); font-weight: 700;
  font-size: 13px; text-decoration: underline; padding: 0;
}
.btn-link-muted {
  background: none; border: none; color: var(--ink-muted); font-size: 12px;
  text-decoration: underline; padding: 0;
}
.btn-help {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #E5F1F6;
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}
.btn-help:hover { background: rgba(255, 255, 255, 0.2); color: #FFFFFF; }
.icon-close {
  background: transparent; border: none; color: var(--ink-muted);
  font-size: 22px; line-height: 1; width: 32px; height: 32px; border-radius: 8px;
}
.icon-close:hover { background: #EEEAE0; color: var(--ink); }


/* ボタンの上書き（落ち着いたトーンへ） */
.btn-primary { background: var(--accent); box-shadow: none; border-radius: 9px; font-size: 13px; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-help {
  width: 36px; height: 36px; padding: 0; border-radius: 50%;
  font-size: 14px; background: transparent; border: 1px solid rgba(255,255,255,0.22);
}
.btn-secondary { border-radius: 9px; }
.btn-ghost { background: var(--accent-soft); border-color: #E7C9BB; color: var(--accent-hover); }

/* ---- 本体：地図（主役）＋ 深掘りパネル ---- */
.app {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--panel-w);
  position: relative;
}
.map-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #C9D9E0;
}
.map-stage::after {
  content: '';
  position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 0 0 rgba(168,85,58,0);
  transition: box-shadow 0.6s ease;
}
body[data-horizon="m6"] .map-stage::after { box-shadow: inset 0 0 90px rgba(168,85,58,0.10); }
body[data-horizon="y5"] .map-stage::after { box-shadow: inset 0 0 110px rgba(168,85,58,0.14); }
body[data-horizon="y10"] .map-stage::after { box-shadow: inset 0 0 130px rgba(168,85,58,0.18); }
.map-canvas { position: absolute; inset: 0; touch-action: none; }

/* ---- 地図SVG ---- */
.hk-map-svg { width: 100%; height: 100%; display: block; user-select: none; -webkit-user-select: none; cursor: grab; touch-action: none; }
.hk-map-svg.is-dragging { cursor: grabbing; }
.layer-tiles { filter: saturate(0.45) sepia(0.1) brightness(1.05) contrast(0.86); opacity: 0.86; transition: filter 0.4s; }
.layer-routes path, .layer-zones circle { vector-effect: non-scaling-stroke; }
.hk-map-svg.is-photo .layer-tiles { filter: saturate(0.78) brightness(0.96); opacity: 1; }
.layer-coastline { opacity: 0.55; }
.hk-map-svg.is-photo .layer-coastline { opacity: 0; }
.map-hit { cursor: pointer; outline: none; transition: opacity 0.25s; }
.map-hit:focus-visible { filter: drop-shadow(0 0 5px var(--accent)); }
.hk-map-svg.has-selection .layer-routes .map-hit:not(.is-selected):not(.route-tram),
.hk-map-svg.has-selection .layer-zones .map-hit:not(.is-selected),
.hk-map-svg.has-selection .layer-labels .map-hit:not(.is-selected) { opacity: 0.45; }
.route-plan { animation: dash-flow 1.6s linear infinite; }
@keyframes dash-flow { to { stroke-dashoffset: -32; } }

.map-pill-txt {
  fill: #FFFFFF; font-family: var(--font-sans); font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.03em; pointer-events: none;
}
.pill-num { font-family: var(--font-num); font-size: 11.5px; letter-spacing: 0; pointer-events: none; }
.chg-num-bg { fill: var(--accent); stroke: #FFFFFF; stroke-width: 1.6; }
.chg-num { fill: #FFFFFF; }
.lm-label {
  fill: var(--ink); font-family: var(--font-sans); font-size: 10.5px; font-weight: 700;
  paint-order: stroke; stroke: rgba(251, 250, 246, 0.95); stroke-width: 3.4px; stroke-linejoin: round;
  pointer-events: none;
}
.lm-node.is-major .lm-label { font-size: 11.2px; }
.lm-node.is-sim .lm-label { fill: var(--accent-hover); }
.hk-map-svg.is-photo .lm-label { fill: #FFFFFF; stroke: rgba(20, 35, 46, 0.86); stroke-width: 4px; }
.stop-label {
  fill: #23574C; font-family: var(--font-sans); font-size: 9.2px; font-weight: 700;
  paint-order: stroke; stroke: rgba(251, 250, 246, 0.92); stroke-width: 3px; stroke-linejoin: round;
}
.hk-map-svg.is-photo .stop-label { fill: #FFF7E6; stroke: rgba(20, 35, 46, 0.85); }
.layer-stops, .layer-slopes { transition: opacity 0.25s; }
.district-label {
  font-family: var(--font-serif); font-weight: 600; font-size: 14px; letter-spacing: 0.32em;
  fill: rgba(27, 52, 67, 0.62); paint-order: stroke; stroke: rgba(245, 243, 236, 0.85);
  stroke-width: 3px; stroke-linejoin: round;
}
.sea-label {
  font-family: var(--font-serif); font-weight: 600; font-size: 13px; letter-spacing: 0.6em;
  fill: rgba(62, 104, 124, 0.62);
}
.hk-map-svg.is-photo .district-label { fill: rgba(255,255,255,0.9); stroke: rgba(20,35,46,0.6); }
.hk-map-svg.is-photo .sea-label { fill: rgba(225,238,244,0.75); }
.hk-map-svg.is-zoomed .area-district { opacity: 0.55; }
.slope-mark { fill: none; stroke: var(--accent); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.slope-label {
  font-family: var(--font-serif); font-weight: 600; font-size: 9.6px; letter-spacing: 0.1em; fill: #7A4A35;
  paint-order: stroke; stroke: rgba(251,250,246,0.92); stroke-width: 2.6px;
}
/* 変化地点の波紋 */
.chg-halo { pointer-events: none; }
.chg-halo circle { fill: none; stroke: var(--accent); stroke-width: 2; transform-box: fill-box; transform-origin: center; }
.chg-halo.is-changed circle { stroke: var(--amber); }
.chg-halo .halo-a { animation: halo 2.6s ease-out infinite; }
.chg-halo .halo-b { animation: halo 2.6s ease-out 1.3s infinite; }
@keyframes halo { 0% { transform: scale(0.5); opacity: 0.85; } 100% { transform: scale(2.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .chg-halo .halo-a, .chg-halo .halo-b, .route-plan { animation: none; }
}

/* ---- 地図の上に浮かぶ道具 ---- */
.district-nav {
  position: absolute; top: 14px; left: 14px; z-index: 6;
  display: flex; align-items: center; gap: 10px;
  max-width: calc(100% - 230px);
  padding: 6px 8px 6px 12px; border-radius: 12px;
  background: var(--glass); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: var(--shadow-sm); border: 1px solid rgba(203,195,179,0.6);
}
.district-nav-label { font-size: 11px; font-weight: 700; color: var(--ink-muted); letter-spacing: 0.08em; white-space: nowrap; }
.district-chips { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.district-chips::-webkit-scrollbar { display: none; }
.district-chip {
  flex: none; border: 1px solid transparent; background: transparent; color: var(--navy);
  font-size: 12.5px; font-weight: 700; padding: 5px 10px; border-radius: 8px; white-space: nowrap;
}
.district-chip:hover { background: var(--surface-soft); border-color: var(--line); }
.district-chip.is-active { background: var(--ink); color: #FBF8F1; }

.map-tools {
  position: absolute; top: 14px; right: 14px; z-index: 6;
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
}
.zoom-controls {
  display: flex; flex-direction: column; overflow: hidden; border-radius: 11px;
  background: var(--glass); backdrop-filter: blur(8px); box-shadow: var(--shadow-sm); border: 1px solid rgba(203,195,179,0.6);
}
.zoom-btn {
  width: 40px; height: 38px; border: none; background: transparent; color: var(--navy);
  font-size: 17px; font-weight: 700; border-bottom: 1px solid var(--line);
}
.zoom-btn:last-child { border-bottom: none; }
.zoom-btn:hover { background: #FFFFFF; }
.zoom-reset { font-size: 11px; }
.style-switch {
  display: flex; border-radius: 10px; overflow: hidden;
  background: var(--glass); backdrop-filter: blur(8px); box-shadow: var(--shadow-sm); border: 1px solid rgba(203,195,179,0.6);
}
.style-btn { border: none; background: transparent; color: var(--ink-muted); font-size: 11.5px; font-weight: 700; padding: 7px 10px; }
.style-btn.is-active { background: var(--ink); color: #FBF8F1; }
.toggle-chip {
  border: 1px solid rgba(203,195,179,0.6); background: var(--glass); backdrop-filter: blur(8px);
  color: var(--ink-muted); font-size: 11.5px; font-weight: 700; padding: 7px 10px; border-radius: 10px; box-shadow: var(--shadow-sm);
}
.toggle-chip:disabled { opacity: 0.45; cursor: not-allowed; }
.toggle-chip.is-diff-on { background: var(--amber-soft); border-color: var(--amber); color: #7A520E; }

.status-banner {
  position: absolute; top: 66px; left: 14px; z-index: 6;
  max-width: min(560px, calc(100% - 100px));
  padding: 9px 14px; border-radius: 11px;
  background: var(--amber-soft); border: 1px solid #E8D3A6; color: #6E4A0C;
  font-size: 12.5px; font-weight: 700; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow-sm);
}
.status-banner .btn-secondary { white-space: nowrap; flex: none; }
.status-banner[hidden] { display: none; }
.status-banner.is-error { background: #F8E7E4; border-color: #E8BDB4; color: #7E2A1C; }

/* ---- 時代の切替（地図下部の主役コントロール） ---- */
.era-dock {
  position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 7;
  width: min(640px, calc(100% - 40px));
}
.era-rail {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 5px;
  border-radius: 16px; background: rgba(20, 35, 46, 0.9); backdrop-filter: blur(10px);
  box-shadow: 0 12px 34px rgba(20,35,46,0.3);
  position: relative;
}
.era-btn {
  position: relative;
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: baseline;
  text-align: left; border: none; border-radius: 12px; padding: 9px 12px 8px;
  background: transparent; color: #C5CDCF;
  transition: background 0.2s, color 0.2s;
}
.era-btn:hover { background: rgba(255,255,255,0.07); color: #FFFFFF; }
.era-btn .era-name { font-size: 14px; font-weight: 700; letter-spacing: 0.04em; }
.era-btn .era-year { font-family: var(--font-num); font-size: 17px; letter-spacing: 0.05em; color: #8FA0A6; justify-self: end; }
.era-btn .era-count { grid-column: 1 / -1; font-size: 10.5px; font-weight: 700; color: #8FA0A6; letter-spacing: 0.04em; }
.era-btn:not([data-horizon="now"]) .era-count::before {
  content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: #D88A6E; margin-right: 5px; vertical-align: 1px;
}
.era-btn.is-active { background: var(--surface); color: var(--ink); }
.era-btn.is-active .era-year { color: var(--accent); }
.era-btn.is-active .era-count { color: var(--accent-hover); }

/* ---- 凡例・出典 ---- */
.map-legend {
  position: absolute; left: 14px; bottom: 22px; z-index: 5;
  display: flex; flex-direction: column; gap: 4px;
  padding: 9px 11px; border-radius: 11px;
  background: var(--glass); backdrop-filter: blur(8px); border: 1px solid rgba(203,195,179,0.6);
  font-size: 10.5px; font-weight: 700; color: var(--ink-muted);
}
.map-legend span { display: inline-flex; align-items: center; gap: 7px; }
.lg-line { display: inline-block; width: 18px; height: 4px; border-radius: 2px; }
.lg-tram { background: #2E6B5E; box-shadow: 0 0 0 1.5px #FBF6EA; }
.lg-rail { background: repeating-linear-gradient(90deg, #334155 0 5px, transparent 5px 8px); height: 3px; }
.lg-bus { background: repeating-linear-gradient(90deg, #6F8797 0 4px, transparent 4px 7px); height: 3px; }
.lg-sim { background: var(--accent); }
.lg-plan { background: repeating-linear-gradient(90deg, var(--accent) 0 7px, transparent 7px 11px); }
.map-attribution {
  position: absolute; right: 10px; bottom: 6px; z-index: 5;
  font-size: 10px; color: var(--ink-muted); background: rgba(251,250,246,0.75); padding: 1px 7px; border-radius: 6px;
}

/* ---- 右カラム：情報パネル ---- */
.article-pane {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.pane-tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}
.pane-tab {
  border: none;
  background: transparent;
  padding: 12px 2px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-muted);
  border-bottom: 3px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.pane-tab:hover { color: var(--navy); }
.pane-tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--surface);
}

.pane-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  max-height: 600px;
  overflow-y: auto;
}

.briefing-title {
  margin: 4px 0 8px;
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.42;
  color: var(--navy);
}
.meta-line { font-size: 12px; color: var(--ink-muted); margin: 0; }
.briefing-text { margin: 0; font-size: 13.5px; line-height: 1.65; }

.kv-box {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 13px;
  display: grid;
  gap: 8px;
  font-size: 13px;
  margin: 0;
}
.kv-box dt { font-size: 11px; font-weight: 700; color: var(--ink-muted); letter-spacing: 0.04em; }
.kv-box dd { margin: 2px 0 0; font-weight: 700; color: var(--navy); }

.diff-card {
  border: 1px solid #F0CFA2;
  background: #FFFDF8;
  border-radius: 10px;
  padding: 11px 13px;
}
.diff-row-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  transition: border-color 0.14s, background 0.14s;
}
.diff-row-btn:hover { border-color: var(--accent); background: var(--accent-soft); }

.pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}
.pill-adopted, .pill-added { background: var(--teal-soft); color: #0F524C; }
.pill-delayed { background: var(--amber-soft); color: #8A3F06; }
.pill-deferred { background: #EEEAE2; color: #526270; }
.pill-pending, .pill-investigating, .pill-reduced, .pill-normal { background: #EAF2FA; color: #1B4F7A; }
.pill-butterfly { background: #F3ECFA; color: #6B21A8; }
.pill-world { background: #E9EFF5; color: #1E3A5F; }

.digest-item, .timeline-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 13px;
  background: var(--surface);
}
.digest-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.digest-count { font-family: var(--font-num); font-size: 17px; letter-spacing: 0.03em; color: var(--navy); }
.digest-title { margin: 0 0 4px; font-size: 13.5px; font-weight: 700; color: var(--navy); }
.digest-summary { margin: 0 0 7px; font-size: 13px; line-height: 1.65; overflow-wrap: anywhere; }
.digest-note { margin: 0; font-size: 12.2px; color: var(--ink-muted); line-height: 1.5; }
.digest-like-hint {
  margin: -4px 0 0;
  font-size: 11.5px;
  color: var(--teal);
  font-weight: 700;
}
.digest-foot {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  justify-content: flex-end;
}
.digest-detail-link {
  margin-inline-end: auto;
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
  padding-block: 6px;
  text-underline-offset: 0.2em;
}
.digest-like-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-soft);
  border: 1px solid var(--line-strong);
  color: var(--navy);
  font-size: 11.8px;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 999px;
  transition: background 0.14s, border-color 0.14s, color 0.14s;
}
.digest-like-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.digest-like-btn.is-liked {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFFFFF;
}
.digest-like-btn strong { font-variant-numeric: tabular-nums; }

.timeline-item, .timeline-card {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  border-radius: 10px;
  padding: 11px 13px;
  background: var(--surface);
  transition: border-color 0.14s, background 0.14s;
}
.timeline-item:hover, .timeline-card:hover { background: var(--surface-soft); border-left-color: var(--accent); }
.timeline-item.is-selected, .timeline-card.is-selected { background: var(--accent-soft); border-color: var(--accent); }
.tl-year { font-family: var(--font-serif); font-size: 15px; font-weight: 600; color: var(--navy); }
.tl-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
  flex-wrap: wrap;
}
.tl-btn-map {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--navy);
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
}
.tl-btn-map:hover { border-color: var(--navy); background: #F0ECE3; }
.tl-btn-article {
  display: inline-flex;
  align-items: center;
  background: var(--navy);
  color: #FFFFFF;
  text-decoration: none;
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 6px;
}
.tl-btn-article:hover { background: var(--accent); }
.timeline-card.is-tl-new { border-left-color: #187A72; background: #FAFEFD; }
.timeline-card.is-tl-changed { border-left-color: #D97706; background: #FFFDF7; }
.tl-diff-row { margin: 2px 0 6px; }
.tl-diff-badge {
  display: inline-block;
  font-size: 10.8px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}
.tl-diff-badge.is-new { background: var(--teal-soft); color: #0F524C; border: 1px solid #B5DDD8; }
.tl-diff-badge.is-changed { background: var(--amber-soft); color: #92400E; border: 1px solid #F5D29A; }

.ch-prev-diff {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #92400E;
  background: var(--amber-soft);
  border: 1px solid #F5D29A;
  padding: 1px 8px;
  border-radius: 999px;
}
.cl-prev { display: inline-block; width: 14px; height: 2px; border-top: 2px dashed #D97706; }

/* ---- 未来のSNSタイムライン ---- */
.sns-list { display: flex; flex-direction: column; gap: 10px; }
.sns-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 13px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  box-shadow: 0 1px 3px rgba(15, 34, 48, 0.04);
}
.sns-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 700;
}
.sns-main { flex: 1; min-width: 0; }
.sns-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}
.sns-who { display: flex; align-items: baseline; gap: 5px; min-width: 0; }
.sns-name { font-size: 12.8px; font-weight: 700; color: var(--navy); }
.sns-handle { font-size: 11px; color: var(--ink-muted); }
.sns-time { font-size: 10.8px; color: var(--ink-muted); white-space: nowrap; }
.sns-text {
  margin: 5px 0 8px;
  font-size: 13px;
  line-height: 1.62;
  color: var(--ink);
  word-break: break-word;
}
.sns-tag { color: var(--teal); font-weight: 700; }
.sns-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--ink-muted);
}
.sns-stats { display: flex; gap: 12px; font-variant-numeric: tabular-nums; }
.sns-loc-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 11.2px;
  font-weight: 700;
  padding: 0;
}
.sns-loc-btn:hover { text-decoration: underline; }

/* ---- 統計グラフカード ---- */
.chart-card {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px 13px;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(15, 34, 48, 0.04);
}
.chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.chart-title { margin: 0; font-size: 13.5px; font-weight: 700; color: var(--navy); }
.chart-sub { margin: 2px 0 0; font-size: 11.5px; color: var(--ink-muted); }
.ch-em { color: var(--accent); font-weight: 700; }
.chart-legend {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-muted);
}
.chart-legend span { display: inline-flex; align-items: center; gap: 4px; }
.cl-dash { display: inline-block; width: 14px; height: 2px; border-top: 2px dashed #64748B; }
.cl-solid { display: inline-block; width: 14px; height: 3px; border-radius: 2px; }
.chart-svg { width: 100%; height: auto; display: block; }
.ch-axis { fill: #64748B; font-size: 10px; font-weight: 700; }
.ch-x { fill: #475569; font-size: 10.5px; font-weight: 700; }
.ch-x.is-active { fill: var(--accent); }
.ch-xsub { fill: #7C8B99; font-size: 9.5px; }
.ch-bar-val { fill: var(--navy); font-size: 10.5px; font-weight: 700; }
.chart-note { margin: 6px 0 0; font-size: 11px; color: var(--ink-muted); }

/* ---- 道内7市比較 横棒グラフ ---- */
.rank-bars { display: flex; flex-direction: column; gap: 7px; margin-top: 4px; }
.rb-row {
  display: grid;
  grid-template-columns: 18px 104px 1fr 44px;
  align-items: center;
  gap: 7px;
  font-size: 12px;
}
.rb-row.is-hk {
  background: var(--accent-soft);
  padding: 4px 6px;
  margin: 0 -6px;
  border-radius: 6px;
  font-weight: 700;
  color: var(--accent-hover);
}
.rb-rank { font-family: var(--font-num); font-size: 15px; color: var(--ink-muted); text-align: center; }
.rb-row.is-hk .rb-rank { color: var(--accent); }
.rb-city { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rb-track {
  position: relative;
  height: 11px;
  background: #EFECE4;
  border-radius: 6px;
  overflow: hidden;
}
.rb-bar { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; }
.rb-base { background: #94A3B8; }
.rb-row.is-hk .rb-base { background: #E2B8AE; }
.rb-sim { background: var(--accent); top: 2px; bottom: 2px; }
.rb-val { text-align: right; font-variant-numeric: tabular-nums; font-size: 11.5px; }

/* ---- 年齢別人口ピラミッド / ドーナツ / 移動分担率 ---- */
.py-side { fill: #64748B; font-size: 9.5px; font-weight: 700; }
.py-age { fill: var(--navy); font-size: 10px; font-weight: 700; }
.py-num { fill: #475569; font-size: 9px; font-variant-numeric: tabular-nums; }

.donut-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.donut-svg { flex-shrink: 0; }
.dn-center-lbl { fill: #64748B; font-size: 9.5px; font-weight: 700; }
.dn-center-val { fill: var(--accent); font-size: 15px; font-weight: 700; }
.donut-legend { flex: 1; min-width: 170px; display: flex; flex-direction: column; gap: 7px; }
.dl-row {
  display: grid;
  grid-template-columns: 10px 1fr auto auto;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}
.dl-dot { width: 10px; height: 10px; border-radius: 3px; }
.dl-name { color: var(--ink); font-weight: 700; }
.dl-pct { color: var(--navy); font-variant-numeric: tabular-nums; }
.dl-pop { color: var(--ink-muted); font-size: 11px; }

.split-list { display: flex; flex-direction: column; gap: 9px; }
.split-row-lbl { font-size: 11.5px; font-weight: 700; color: var(--ink-muted); margin-bottom: 3px; }
.split-row.is-act .split-row-lbl { color: var(--accent); }
.split-bar {
  display: flex;
  height: 22px;
  border-radius: 6px;
  overflow: hidden;
  background: #EFECE4;
}
.split-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-size: 10.5px;
  font-weight: 700;
  transition: width 0.25s ease;
}
.split-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-muted);
}
.split-legend span { display: inline-flex; align-items: center; gap: 4px; }
.split-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; }

/* ---- 統計カテゴリ切替 & 仕事・経済統計 ---- */
.stats-filter {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.sf-btn {
  border: 1px solid var(--line-strong);
  background: var(--surface-soft);
  color: var(--ink-muted);
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 999px;
}
.sf-btn.is-active {
  background: var(--navy);
  border-color: var(--navy);
  color: #FFFFFF;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.kpi-box {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.kpi-lbl { font-size: 11px; font-weight: 700; color: var(--ink-muted); }
.kpi-val {
  font-size: 19px;
  font-weight: 700;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}
.kpi-delta { font-size: 11px; color: var(--ink-muted); font-weight: 700; }
.kpi-delta.is-pos { color: var(--teal); }

.ind-bars { display: flex; flex-direction: column; gap: 9px; }
.ind-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11.8px;
  margin-bottom: 3px;
}
.ind-name { font-weight: 700; color: var(--ink); }
.ind-val { font-variant-numeric: tabular-nums; color: var(--navy); font-weight: 700; }
.ind-val em { font-style: normal; font-size: 11px; color: var(--ink-muted); font-weight: 700; }
.ind-val em.is-up { color: var(--teal); }
.ind-track {
  position: relative;
  height: 11px;
  background: #EFECE4;
  border-radius: 6px;
  overflow: hidden;
}
.ind-bar-base {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: rgba(100, 116, 139, 0.28);
  border-radius: 6px;
}
.ind-bar-cur {
  position: absolute; left: 0; top: 1.5px; bottom: 1.5px;
  border-radius: 5px;
  transition: width 0.25s ease;
}


/* ---- 深掘りパネル（v3） ---- */
.panel {
  position: relative;
  display: flex; flex-direction: column; min-height: 0;
  background: var(--surface);
  border-left: 1px solid var(--line);
  z-index: 10;
}
.panel-handle, .peek-summary, .panel-era-slot:empty { display: none; }
.panel-main { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; }
.panel-main > * { flex-shrink: 0; }
.panel .pane-tabs {
  position: sticky; top: 0; z-index: 2;
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 2px;
  padding: 8px 10px 0; background: var(--surface); border-bottom: 1px solid var(--line);
}
.panel .pane-tab {
  min-width: 0; padding: 9px 0 10px; font-size: 12px; line-height: 1.3;
  white-space: normal; color: var(--ink-muted);
  background: transparent; border-bottom: 2px solid transparent;
}
.panel .pane-tab.is-active { color: var(--ink); border-bottom-color: var(--accent); background: transparent; }
.panel .pane-tab[data-tab="changes"] { font-weight: 700; }
.panel .pane-body { max-height: none; overflow: visible; padding: 18px 20px 22px; gap: 16px; flex: 1; }

.era-head { padding-bottom: 2px; }
.era-head-kicker { margin: 0; font-family: var(--font-num); font-size: 15px; letter-spacing: 0.12em; color: var(--accent); }
.era-head-title { margin: 0 0 6px; font-family: var(--font-serif); font-weight: 600; font-size: 26px; letter-spacing: 0.06em; color: var(--ink); line-height: 1.3; }
.era-head-lead { margin: 0; font-size: 13px; color: var(--ink-muted); line-height: 1.7; }
.era-head-lead strong { color: var(--accent-hover); }

.change-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.change-item {
  width: 100%; display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start;
  text-align: left; padding: 13px 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line);
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.change-item:hover { border-color: var(--accent); background: #FFFFFF; transform: translateY(-1px); }
.chg-n {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  font-family: var(--font-num); font-size: 16px; color: #FFFFFF; background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.chg-n.is-changed { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
.change-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.change-meta { font-size: 11px; font-weight: 700; color: var(--ink-muted); letter-spacing: 0.06em; display: flex; gap: 8px; }
.change-kind { color: var(--accent-hover); }
.change-q { font-family: var(--font-serif); font-weight: 600; font-size: 16px; color: var(--ink); line-height: 1.45; }
.change-name { font-size: 12px; color: var(--navy); font-weight: 700; }
.change-after { font-size: 12px; color: var(--teal); font-weight: 700; }

.decision-card {
  border-radius: 12px; padding: 14px 16px;
  background: var(--sea-soft); border: 1px solid #CFDDE2;
}
.decision-kicker { margin: 0 0 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.1em; color: var(--sea); }
.decision-title { margin: 0 0 6px; font-size: 13.5px; font-weight: 700; color: var(--ink); line-height: 1.6; }
.deep-more {
  align-self: flex-start;
  border: none; background: none; padding: 0; color: var(--accent-hover); font-size: 12.5px; font-weight: 700;
}
.deep-more:hover { text-decoration: underline; }
.mine-card {
  display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: center; text-align: left;
  padding: 11px 14px; border-radius: 12px; border: 1px solid #E7C9BB; background: var(--accent-soft); color: var(--ink);
}
.mine-card strong { display: block; font-size: 12.5px; }
.mine-card small { display: block; font-size: 11.5px; color: var(--ink-muted); }
.mine-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.mine-dot.is-pending { background: var(--amber); }
.mine-go { font-size: 12px; font-weight: 700; color: var(--accent-hover); white-space: nowrap; }

.deep { display: flex; flex-direction: column; gap: 9px; }
.deep-h {
  margin: 0; font-size: 11.5px; font-weight: 700; letter-spacing: 0.14em; color: var(--ink-muted);
  display: flex; align-items: center; gap: 10px;
}
.deep-h::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.deep-lead { margin: 0; font-size: 13.5px; font-weight: 700; color: var(--ink); line-height: 1.6; }
.deep-row { margin: 0; font-size: 12.5px; line-height: 1.6; display: flex; gap: 8px; align-items: baseline; }
.deep-row .pill { flex: none; }
.deep-cta {
  flex-direction: row; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border-radius: 12px; background: var(--surface-soft); border: 1px dashed var(--line-strong);
}
.deep-cta p { margin: 0; font-size: 12.5px; font-weight: 700; color: var(--navy); }

.q-list { display: flex; flex-direction: column; gap: 6px; }
.q-chip {
  text-align: left; padding: 11px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 2px;
}
.q-chip:hover { border-color: var(--accent); }
.q-chip span { font-family: var(--font-serif); font-weight: 600; font-size: 15px; color: var(--ink); }
.q-chip small { font-size: 11px; font-weight: 700; color: var(--ink-muted); }
.era-preview { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.era-preview button {
  width: 100%; display: grid; grid-template-columns: 84px 52px 1fr; gap: 10px; align-items: center; text-align: left;
  padding: 10px 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface);
}
.era-preview button:hover { border-color: var(--ink); }
.ep-era { font-weight: 700; font-size: 13px; color: var(--ink); display: flex; flex-direction: column; line-height: 1.3; }
.ep-era small { font-size: 10.5px; color: var(--ink-muted); font-weight: 700; }
.ep-n { font-family: var(--font-num); font-size: 24px; color: var(--accent); line-height: 1; }
.ep-n small { font-family: var(--font-sans); font-size: 10px; font-weight: 700; margin-left: 2px; color: var(--ink-muted); }
.ep-names { font-size: 11.5px; color: var(--navy); font-weight: 700; line-height: 1.5; }

/* 選択した場所の詳細 */
.back-to-list { align-self: flex-start; border: none; background: none; padding: 0; font-size: 12px; font-weight: 700; color: var(--ink-muted); }
.back-to-list:hover { color: var(--ink); }
.detail { display: flex; flex-direction: column; gap: 10px; }
.detail-head { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; }
.detail-head .chg-n { width: 34px; height: 34px; font-size: 19px; margin-top: 4px; }
.detail-kicker { margin: 0; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; color: var(--ink-muted); }
.detail-title { margin: 2px 0 6px; font-family: var(--font-serif); font-weight: 600; font-size: 21px; line-height: 1.4; color: var(--ink); }
.detail-badge { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-hover); }
.detail-q { margin: 0; font-family: var(--font-serif); font-weight: 600; font-size: 15px; color: var(--accent-hover); }
.detail-body { margin: 0; font-size: 13.5px; line-height: 1.75; }
.before-after {
  display: grid; grid-template-columns: 1fr 18px 1fr; gap: 6px; align-items: stretch;
}
.before-after > div:not(.ba-arrow) { padding: 10px 12px; border-radius: 10px; background: var(--surface-soft); border: 1px solid var(--line); }
.before-after > div:only-child { grid-column: 1 / -1; }
.before-after span { display: block; font-size: 10.5px; font-weight: 700; color: var(--ink-muted); letter-spacing: 0.04em; }
.before-after strong { display: block; font-size: 12.5px; line-height: 1.5; color: var(--navy); margin-top: 3px; }
.before-after .is-after { background: var(--teal-soft); border-color: #C8DCD4; }
.before-after .is-after strong { color: #1F5248; }
.ba-arrow { display: grid; place-items: center; color: var(--ink-muted); font-weight: 700; }
.era-track { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; position: relative; }
.era-track::before { content: ''; position: absolute; left: 12%; right: 12%; top: 13px; height: 2px; background: var(--line); }
.era-track li button {
  width: 100%; border: none; background: none; padding: 0 4px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 3px; position: relative;
}
.era-track li button::before {
  content: ''; width: 12px; height: 12px; border-radius: 50%; margin: 7px 0 4px;
  background: var(--surface); border: 2px solid var(--line-strong);
}
.era-track li:not(.is-none) button::before { border-color: var(--teal); background: var(--teal-soft); }
.era-track li.is-current button::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.et-era { font-size: 11.5px; font-weight: 700; color: var(--ink); display: flex; flex-direction: column; line-height: 1.25; }
.et-era small { font-family: var(--font-num); font-size: 12px; color: var(--ink-muted); letter-spacing: 0.05em; }
.et-badge { font-size: 10.5px; font-weight: 700; color: var(--teal); line-height: 1.35; }
.era-track li.is-none .et-badge { color: var(--ink-muted); font-weight: 400; }
.era-track li.is-current .et-badge { color: var(--accent-hover); }
.et-val { font-size: 10px; color: var(--ink-muted); line-height: 1.35; }
.mini-tl { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.mini-tl li { position: relative; display: flex; flex-direction: column; gap: 1px; }
.mini-tl li::before { content: ''; position: absolute; left: -20px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); }
.mini-tl li.is-current::before { border-color: var(--accent); background: var(--accent); }
.mini-tl-year { font-family: var(--font-serif); font-weight: 600; font-size: 13px; color: var(--accent-hover); }
.mini-tl-title { font-size: 13px; font-weight: 700; line-height: 1.55; }
.mini-tl-link { font-size: 12px; font-weight: 700; color: var(--teal); text-decoration: none; }
.mini-tl-link:hover { text-decoration: underline; }
.mini-post {
  margin: 0; padding: 10px 13px; border-radius: 12px; background: var(--surface-soft); border: 1px solid var(--line);
}
.mini-post p { margin: 0 0 4px; font-size: 13px; line-height: 1.65; }
.mini-post footer { font-size: 11px; color: var(--ink-muted); font-weight: 700; }

.share-box { border-top: 1px solid var(--line); background: var(--surface-soft); padding: 13px 20px; }
.share-box-title { margin: 0 0 8px; font-size: 12px; font-weight: 700; color: var(--navy); }
.share-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.share-feedback { margin: 6px 0 0; font-size: 12px; color: var(--teal); min-height: 16px; }
.site-footer { padding: 12px 20px 18px; font-size: 11px; color: var(--ink-muted); line-height: 1.6; }
.site-footer p { margin: 0 0 6px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.footer-links a { color: var(--ink-muted); }
.dev-states { font-size: 10.5px; }

/* ---- モーダル ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 34, 48, 0.56);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 60;
}
.modal-backdrop[hidden] { display: none; }
.modal-card {
  background: var(--surface);
  border-radius: 14px;
  width: min(520px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px 22px;
  box-shadow: var(--shadow-md);
}
.modal-wide { width: min(640px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-head h2 { margin: 0; font-family: var(--font-serif); font-size: 19px; color: var(--navy); }

.privacy-note, .followup-note {
  background: var(--surface-soft);
  border-left: 3px solid var(--teal);
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--ink-muted);
  margin: 0 0 14px;
}
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 5px; }
.req { font-size: 11px; color: var(--accent); margin-left: 4px; }
.opt { font-size: 11px; color: var(--ink-muted); margin-left: 4px; font-weight: 400; }
.field textarea, .field select {
  width: 100%;
  font: inherit;
  font-size: 14px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #FFFFFF;
  color: var(--ink);
}
.field textarea:focus, .field select:focus { outline: 2px solid var(--teal); border-color: var(--teal); }
.field-hint { text-align: right; font-size: 11.5px; color: var(--ink-muted); margin-top: 3px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.form-error {
  background: #FDECEC; border: 1px solid #F4B3B3; color: #8A1C1C;
  padding: 9px 11px; border-radius: 8px; font-size: 13px; margin-bottom: 12px;
}
.form-success {
  background: var(--teal-soft); border: 1px solid #B5DDD8; color: #0F524C;
  padding: 10px 12px; border-radius: 8px; font-size: 13px; font-weight: 700; margin-bottom: 12px;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

.followup-list { display: flex; flex-direction: column; gap: 12px; }
.followup-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--surface-soft);
}
.followup-history { margin: 8px 0 0; padding-left: 18px; font-size: 12px; color: var(--ink-muted); }

/* ---- 初回チュートリアルモーダル ---- */
.tutorial-card {
  padding: 0;
  overflow: hidden;
  width: min(540px, 100%);
}
.tut-banner {
  background: linear-gradient(135deg, #132A3C 0%, var(--navy) 100%);
  color: #F8F6F0;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 3px solid var(--gold);
}
.tut-step-badge {
  font-family: var(--font-num);
  font-size: 15px;
  letter-spacing: 0.1em;
  color: var(--gold);
}
.tut-close {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.24);
  color: #E5F1F6;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}
.tut-close:hover { background: rgba(255, 255, 255, 0.22); color: #FFFFFF; }
.tut-body {
  padding: 22px 24px 16px;
}
.tut-title {
  margin: 0 0 10px;
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.38;
}
.tut-lead {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--ink);
  line-height: 1.7;
}
.tut-points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.tut-points li {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-left: 3.5px solid var(--teal);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  line-height: 1.55;
}
.tut-points strong { color: var(--navy); }
.tut-cta-row {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.tut-footer {
  padding: 13px 24px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.tut-dots { display: flex; gap: 7px; align-items: center; }
.tut-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #D2CBBF;
  transition: width 0.2s, background 0.2s;
}
.tut-dot.is-active { width: 22px; border-radius: 999px; background: var(--accent); }
.tut-actions { display: flex; gap: 8px; align-items: center; }


/* ---- 中間幅（狭いPC・タブレット横） ---- */
@media (max-width: 1180px) {
  :root { --panel-w: 372px; }
  .brand .tag-unofficial { display: none; }
  .cta-long { display: none; }
  .map-legend { display: none; }
}

/* ---- スマホ・タブレット縦：地図を全面に、深掘りは下から引き出すシート ---- */
@media (max-width: 860px) {
  :root { --appbar-h: 52px; --peek-h: 150px; }
  .appbar { gap: 6px; padding: 0 8px 0 4px; }
  .back-text, .brand .tag-unofficial, .brand .tag-dummy { display: none; }
  .back-link { padding: 6px; font-size: 15px; }
  .brand-title { font-size: 10px; letter-spacing: 0.06em; display: flex; flex-direction: column; line-height: 1.15; }
  .brand-moshimo { font-size: 16px; margin-left: 0; letter-spacing: 0.06em; }
  .appbar-actions { gap: 5px; }
  .edition-pick { height: 34px; padding: 0 0 0 7px; }
  .edition-ico { display: none; }
  .edition-pick { position: relative; padding: 0 8px; flex: none; }
  .edition-short { display: inline-flex; align-items: baseline; white-space: nowrap; font-family: var(--font-num); font-size: 16px; letter-spacing: 0.04em; color: #EFEBE2; }
  .edition-short small { font-family: var(--font-sans); font-size: 10px; font-weight: 700; margin-left: 2px; color: #B9C3C7; }
  .edition-pick select { position: absolute; inset: 0; opacity: 0; width: 100%; max-width: none; }
  .btn-followup { height: 34px; padding: 0 9px; font-size: 11.5px; }
  .btn-cta { height: 34px; padding: 0 11px; font-size: 12.5px; }
  .btn-help { display: none; }
  .btn-office { display: none; }
  .office-chip {
    position: absolute; z-index: 15; left: 10px; bottom: calc(var(--peek-h) + 12px);
    display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px;
    background: rgba(20,35,46,0.92); color: #FBF8F1; font-size: 12.5px; font-weight: 700; text-decoration: none;
    box-shadow: 0 6px 18px rgba(20,35,46,0.25);
  }
  .brand { position: relative; flex: 1 1 auto; min-width: 0; overflow: hidden; }
  .tag-beta { position: absolute; inset-inline-start: 44px; inset-block-start: 0; font-size: 10px; line-height: 12px; padding: 0 4px; }
  .cta-long { display: none; }

  .app { display: block; }
  .map-stage { position: absolute; inset: 0; }
  .era-dock { display: none; }
  .map-legend { display: none; }
  .district-nav {
    top: 10px; left: 10px; right: 10px; max-width: none; padding: 4px 6px 4px 10px; gap: 6px; border-radius: 12px;
  }
  .district-nav-label { display: none; }
  .district-chip { font-size: 12px; padding: 6px 9px; }
  .map-tools { top: 62px; right: 10px; gap: 6px; }
  .zoom-btn { width: 38px; height: 36px; }
  .status-banner { top: 62px; left: 10px; max-width: calc(100% - 70px); font-size: 12px; }
  .map-attribution { top: 62px; bottom: auto; left: 10px; right: auto; font-size: 9.5px; }
  .status-banner:not([hidden]) ~ .map-attribution { display: none; }

  .panel {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 20;
    border-left: none; border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 30px rgba(20,35,46,0.18);
    height: var(--peek-h);
    transition: height 0.32s cubic-bezier(.2,.8,.2,1);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .panel.is-half { height: 56%; }
  .panel.is-full { height: calc(100% - 6px); }
  .panel-handle {
    display: flex; justify-content: center; align-items: center; flex: none;
    width: 100%; height: 22px; border: none; background: transparent; padding: 0; touch-action: none;
  }
  .handle-bar { width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong); }
  .panel-era-slot { display: block; flex: none; padding: 0 10px; }
  .panel-era-slot .era-rail { padding: 4px; border-radius: 14px; gap: 3px; background: var(--ink); box-shadow: none; }
  .panel-era-slot .era-btn { grid-template-columns: 1fr; padding: 7px 4px 6px; text-align: center; justify-items: center; row-gap: 0; border-radius: 10px; }
  .panel-era-slot .era-btn .era-name { font-size: 13px; }
  .panel-era-slot .era-btn .era-year { justify-self: center; font-size: 13px; }
  .panel-era-slot .era-btn .era-count { font-size: 9.5px; }
  .panel-era-slot .era-btn[data-horizon="now"] .era-count { display: none; }
  .peek-summary {
    display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; column-gap: 10px;
    flex: none; width: 100%; text-align: left; border: none; background: none; padding: 9px 16px 8px;
  }
  .peek-kicker { font-size: 10.5px; font-weight: 700; color: var(--accent-hover); letter-spacing: 0.06em; }
  .peek-text { grid-column: 1; font-size: 12.5px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .peek-text b { display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 50%; background: var(--accent); color: #FFFFFF; font-family: var(--font-num); font-weight: 400; font-size: 11px; margin-right: 4px; vertical-align: 1px; }
  .peek-open { grid-column: 2; grid-row: 1 / 3; align-self: center; font-size: 11.5px; font-weight: 700; color: var(--ink-muted); border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; }
  .panel.is-peek .panel-main { display: none; }
  .panel:not(.is-peek) .peek-summary { display: none; }
  .panel:not(.is-peek) .panel-era-slot { padding-bottom: 4px; }
  .panel .pane-tabs { padding: 4px 8px 0; }
  .panel .pane-tab { font-size: 11.5px; padding: 8px 0 9px; }
  .panel .pane-body { padding: 14px 16px 18px; }
  .era-head-title { font-size: 22px; }
  .change-q { font-size: 15px; }
  .share-box { padding: 12px 16px; }
  .site-footer { padding: 10px 16px 16px; }
  .field-row { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .btn-followup .followup-label { font-size: 0; }
  .btn-followup .followup-label::after { content: 'その後'; font-size: 11px; }
}
