/* ==========================================================================
   Quantum Rescue Tokyo — Setagaya Pilot
   --------------------------------------------------------------------------
   配色は避難誘導サインの語彙から取っている。緑（ISO 7010 の safe condition、
   日本の誘導灯の緑）を基準色に、注意の琥珀、超過の朱を足した三色。
   紙面は再生紙の冷たいグレーグリーン、市民画面は夜間の被災を想定した暗面。

   書体は Web フォントを読み込まない。市民画面は通信が落ちた状態で動くことが
   要件なので、フォントの取得に依存させない。端末のゴシック体を、
   ウェイトと字間の対比で使い分ける。数値はすべて等幅で桁を揃える。
   ========================================================================== */

:root {
  --ink:        #101614;
  --ink-soft:   #1B2320;
  --paper:      #E7EBE5;
  --paper-2:    #DDE2DA;
  --line:       #C3CBC1;
  --slate:      #5C6B64;

  --guide:      #0E7A43;
  --guide-lift: #3FCE86;
  --guide-wash: #D6E8DD;
  --caution:    #E8A317;
  --over:       #B8332A;

  --gothic: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic Medium",
            "Yu Gothic", "Noto Sans JP", "Meiryo", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "SFMono-Regular", "Roboto Mono",
          "Noto Sans Mono", Menlo, monospace;

  --step: 0.5rem;
  --radius: 3px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--gothic);
  -webkit-text-size-adjust: 100%;
}

body { line-height: 1.6; }

/* -- 共通の版面要素 ------------------------------------------------------ */

.eyebrow {
  font-family: var(--mono);
  font-size: 0.688rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--slate);
  margin: 0 0 0.35rem;
}

.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.rule { height: 1px; background: var(--line); border: 0; margin: 1.5rem 0; }

button { font-family: inherit; cursor: pointer; }

:focus-visible {
  outline: 3px solid var(--caution);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* 合成データ警告。実データに差し替わったら build 時に消える。 */
.synthetic-banner {
  background: repeating-linear-gradient(
    -45deg, var(--caution) 0 14px, #0000 14px 28px), #2A2205;
  color: #FFF4D6;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  padding: 0.55rem 1rem;
  text-align: center;
}
.synthetic-banner b { color: #fff; }

.scenario-banner {
  padding: 0.55rem 1rem;
  background: #FFF3CD;
  border-bottom: 1px solid #D2A72E;
  color: #5A4300;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
}

/* ==========================================================================
   市民画面
   ========================================================================== */

body.citizen {
  background: var(--ink);
  color: #EDF2EE;
  min-height: 100vh;
}

.phone {
  max-width: 30rem;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
}

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 0 1rem;
  border-bottom: 1px solid #2C3733;
}
.masthead .wordmark {
  font-size: 0.938rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin: 0;
}
.masthead .wordmark span { color: var(--guide-lift); }
.masthead .place {
  font-family: var(--mono);
  font-size: 0.688rem;
  letter-spacing: 0.2em;
  color: #7E8E87;
}

.locate {
  margin: 1.5rem 0 0;
  padding: 0.9rem 1rem;
  border: 1px solid #2C3733;
  border-radius: var(--radius);
  background: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.locate .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--guide-lift);
  flex: none;
  box-shadow: 0 0 0 0 rgba(63, 206, 134, 0.6);
}
@media (prefers-reduced-motion: no-preference) {
  .locate .dot.live { animation: ping 2.4s ease-out infinite; }
}
@keyframes ping {
  0%   { box-shadow: 0 0 0 0 rgba(63, 206, 134, 0.5); }
  70%  { box-shadow: 0 0 0 12px rgba(63, 206, 134, 0); }
  100% { box-shadow: 0 0 0 0 rgba(63, 206, 134, 0); }
}
.locate .label { font-size: 0.875rem; color: #C4D0CA; }
.locate .label b { color: #fff; font-weight: 600; }

.manual-location {
  margin-top: 0.75rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid #2C3733;
  border-radius: var(--radius);
  background: var(--ink-soft);
  color: #C4D0CA;
  font-size: 0.813rem;
}
.manual-location summary { cursor: pointer; }
.manual-location label { display: block; margin-top: 0.65rem; color: #8FA098; }
.manual-location select {
  width: 100%; margin-top: 0.35rem; padding: 0.65rem;
  border: 1px solid #405049; border-radius: var(--radius);
  color: #EDF2EE; background: #101614; font-family: inherit;
}

.scenario-line {
  margin: 1.75rem 0 0.5rem;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.big-action {
  display: block;
  width: 100%;
  margin-top: 1rem;
  padding: 1.4rem 1rem;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #04140B;
  background: var(--guide-lift);
  border: 0;
  border-radius: var(--radius);
}
.big-action:active { transform: translateY(1px); }
.big-action[disabled] { opacity: 0.45; cursor: default; }

.link-action {
  display: block;
  width: 100%;
  margin-top: 0.9rem;
  padding: 0.85rem;
  font-size: 0.938rem;
  color: #C4D0CA;
  background: none;
  border: 1px solid #2C3733;
  border-radius: var(--radius);
}

/* 配慮モードの選択 */
.needs { margin-top: 1.75rem; }
.needs h2 { font-size: 1rem; font-weight: 700; margin: 0 0 0.25rem; }
.needs p { font-size: 0.813rem; color: #8FA098; margin: 0 0 1rem; }
.needs-grid { display: grid; gap: 0.6rem; }
.need {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  width: 100%;
  padding: 1rem;
  text-align: left;
  font-size: 1.063rem;
  color: #EDF2EE;
  background: var(--ink-soft);
  border: 1px solid #2C3733;
  border-radius: var(--radius);
}
.need .glyph { font-size: 1.5rem; line-height: 1; flex: none; }
.need[aria-pressed="true"] {
  border-color: var(--guide-lift);
  background: #0D2419;
  box-shadow: inset 3px 0 0 var(--guide-lift);
}
.need:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  border-style: dashed;
}
.needs .needs-warning {
  margin-top: 0.8rem;
  padding: 0.8rem;
  color: #F4D7A1;
  background: #2A2112;
  border-left: 3px solid var(--caution);
  border-radius: 0.35rem;
  line-height: 1.6;
}

/* 避難先の提示 */
.rescue { padding-top: 1.5rem; }
.rescue .for-whom {
  font-family: var(--mono);
  font-size: 0.688rem;
  letter-spacing: 0.2em;
  color: var(--guide-lift);
}
.rescue h2 {
  margin: 0.35rem 0 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: #97A79F;
}
.shelter-name {
  margin: 0.4rem 0 0;
  font-size: clamp(2.25rem, 11vw, 3.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.12;
  text-wrap: balance;
}
.trip {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #2C3733;
}
.trip .figure { font-size: 2rem; font-weight: 700; }
.trip .unit { font-size: 0.938rem; color: #8FA098; margin-left: 0.15rem; }
.trip-note { margin: 0.35rem 0 0; color: #72827A; font-size: 0.688rem; }

/* 進捗バー（駅の案内表示のような一本線） */
.walkline { margin-top: 1.25rem; }
.walkline .track {
  position: relative;
  height: 3px;
  background: #2C3733;
}
.walkline .track::after {
  content: "";
  position: absolute; inset: 0 auto 0 0;
  width: var(--progress, 40%);
  background: var(--guide-lift);
}
.walkline .ends {
  display: flex; justify-content: space-between;
  margin-top: 0.4rem;
  font-family: var(--mono);
  font-size: 0.688rem;
  letter-spacing: 0.14em;
  color: #7E8E87;
}

/* 「なぜここ？」 */
.why { margin-top: 1.5rem; }
.why > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.9rem 1rem;
  border: 1px solid #2C3733;
  border-radius: var(--radius);
  font-size: 0.938rem;
  color: #C4D0CA;
  display: flex; justify-content: space-between; align-items: center;
}
.why > summary::-webkit-details-marker { display: none; }
.why > summary::after { content: "＋"; color: var(--guide-lift); }
.why[open] > summary::after { content: "－"; }
.why .body {
  padding: 1.1rem 1rem 0.25rem;
  border: 1px solid #2C3733;
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
}
.reason {
  display: flex; gap: 0.7rem;
  padding: 0.55rem 0;
  font-size: 0.875rem;
  line-height: 1.55;
  border-bottom: 1px dotted #2C3733;
}
.reason:last-child { border-bottom: 0; }
.reason .mark { flex: none; font-family: var(--mono); font-weight: 700; }
.reason.good .mark { color: var(--guide-lift); }
.reason.cost .mark { color: var(--caution); }
.reason.cost { color: #D3C08C; }

.occupancy-note {
  margin-top: 1rem;
  display: flex; align-items: center; gap: 0.75rem;
  font-size: 0.813rem; color: #8FA098;
}

.disclaimer {
  margin-top: 2rem;
  padding: 0.9rem 1rem;
  border-left: 3px solid var(--caution);
  background: #191F1C;
  font-size: 0.75rem;
  line-height: 1.7;
  color: #A9B7B0;
}

.minimap { margin-top: 1.5rem; background: var(--ink-soft); border: 1px solid #2C3733; }
.minimap svg { display: block; width: 100%; height: auto; }

/* ==========================================================================
   行政画面
   ========================================================================== */

body.admin {
  background: var(--paper);
  color: var(--ink);
}

.admin-bar {
  display: flex; align-items: center; gap: 1.25rem;
  padding: 0.85rem 1.5rem;
  background: var(--ink);
  color: #EDF2EE;
  flex-wrap: wrap;
}
.admin-bar .wordmark {
  font-size: 0.875rem; font-weight: 700; letter-spacing: 0.04em; margin: 0;
}
.admin-bar .wordmark span { color: var(--guide-lift); }
.admin-bar nav { margin-left: auto; display: flex; gap: 1rem; }
.admin-bar a { color: #9DACA5; text-decoration: none; font-size: 0.813rem; }
.admin-bar a[aria-current] { color: #fff; border-bottom: 2px solid var(--guide-lift); }

.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  border-bottom: 1px solid var(--line);
  background: var(--paper-2);
}
.stat {
  padding: 0.85rem 1.25rem;
  border-right: 1px solid var(--line);
}
.stat:last-child { border-right: 0; }
.stat .k {
  font-family: var(--mono); font-size: 0.625rem;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--slate);
}
.stat .v {
  font-family: var(--mono); font-size: clamp(1rem, 1.8vw, 1.375rem); font-weight: 600;
  font-variant-numeric: tabular-nums; line-height: 1.25;
}
.stat .v.warn { color: var(--over); }
.stat .v.ok { color: var(--guide); }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 21rem;
  gap: 0;
  align-items: start;
}
@media (max-width: 62rem) {
  .workspace { grid-template-columns: 1fr; }
}

.panel { padding: 1.5rem; }
.panel + .panel { border-top: 1px solid var(--line); }
.side {
  border-left: 1px solid var(--line);
  background: var(--paper-2);
  min-height: 100%;
}
@media (max-width: 62rem) { .side { border-left: 0; border-top: 1px solid var(--line); } }

h2.section {
  font-size: 1.125rem; font-weight: 700; margin: 0 0 0.2rem;
  letter-spacing: 0.01em;
}
.hint { font-size: 0.813rem; color: var(--slate); margin: 0 0 1.1rem; }

/* -- 署名要素：収容ブロック ------------------------------------------------
   避難所ひとつを 1 枚の枠として描く。枠は施設、塗りは中の人。
   収容率が 100% を超えると塗りが枠の外へあふれる。体育館の床に貼られた
   区画テープを俯瞰した図の見立て。                                        */

.blocks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(2.25rem, 1fr));
  gap: 0.45rem 0.4rem;
  align-items: end;
}
.block {
  position: relative;
  height: 3.25rem;
  padding-top: 0.85rem;   /* あふれ分を描く余白 */
  border: 0;
  background: none;
  cursor: pointer;
}
.block .frame {
  position: relative;
  height: 2.4rem;
  border: 1px solid var(--slate);
  background: #fff;
  overflow: visible;
}
.block .fill {
  position: absolute;
  left: -1px; right: -1px; bottom: 0;
  background: var(--guide);
  transition: height 180ms linear, background-color 180ms linear;
}
@media (prefers-reduced-motion: reduce) { .block .fill { transition: none; } }
.block.warn .fill { background: var(--caution); }
.block.over .fill { background: var(--over); }
.block.over .frame { border-color: var(--over); }
.block.closed .frame { background: repeating-linear-gradient(
    45deg, var(--paper-2) 0 4px, var(--line) 4px 5px); }
.block.closed .fill { display: none; }
.block .cap {
  display: block;
  margin-top: 0.2rem;
  font-family: var(--mono); font-size: 0.563rem;
  color: var(--slate); text-align: center;
  font-variant-numeric: tabular-nums;
}
.block[aria-pressed="true"] .frame { outline: 2px solid var(--ink); outline-offset: 2px; }

.legend {
  display: flex; flex-wrap: wrap; gap: 1rem;
  margin-top: 1rem; font-size: 0.75rem; color: var(--slate);
}
.legend i {
  display: inline-block; width: 0.75rem; height: 0.75rem;
  margin-right: 0.35rem; vertical-align: -1px;
}

/* 比較の 2 面 */
.compare {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem;
}
@media (max-width: 48rem) { .compare { grid-template-columns: 1fr; } }
.compare h3 {
  margin: 0 0 0.15rem; font-size: 0.938rem; font-weight: 700;
}
.compare .caption { font-size: 0.75rem; color: var(--slate); margin: 0 0 0.9rem; }

.verdict {
  margin: 1.75rem 0 0;
  padding: 1.1rem 1.25rem;
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  display: flex; align-items: center; justify-content: center;
  gap: 1.25rem; flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 0.938rem; letter-spacing: 0.16em; text-transform: uppercase;
}
.verdict .arrow { color: var(--guide); font-weight: 700; }

/* 実行ボタン */
.run {
  display: block; width: 100%;
  margin: 1.25rem 0 0;
  padding: 1.15rem;
  font-size: 1.063rem; font-weight: 700; letter-spacing: 0.08em;
  color: #EDF2EE; background: var(--ink);
  border: 0; border-radius: var(--radius);
}
.run:hover { background: var(--guide); }
.run[disabled] { opacity: 0.5; cursor: default; }
.run .k { font-family: var(--mono); font-size: 0.75rem; opacity: 0.7; }

.progress {
  margin-top: 0.85rem; font-family: var(--mono); font-size: 0.75rem;
  color: var(--slate); min-height: 3.2rem;
}
.progress .bar { height: 3px; background: var(--line); margin: 0.4rem 0; }
.progress .bar i { display: block; height: 100%; background: var(--guide); width: 0; }
.progress dl {
  display: grid; grid-template-columns: auto auto; gap: 0 0.75rem;
  margin: 0; justify-content: start;
}
.progress dt { color: var(--slate); }
.progress dd { margin: 0; font-variant-numeric: tabular-nums; }

/* サイドの操作系 */
.control { margin-bottom: 1.5rem; }
.control > label, .control > .label {
  display: block;
  font-family: var(--mono); font-size: 0.625rem;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--slate); margin-bottom: 0.4rem;
}
.control select, .control input[type="range"] { width: 100%; }
.control select {
  padding: 0.5rem; border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; font-family: inherit; font-size: 0.875rem;
}
.control .value {
  float: right; font-family: var(--mono); font-size: 0.75rem; color: var(--ink);
}
.control .desc { font-size: 0.75rem; color: var(--slate); margin: 0.35rem 0 0; }

.preset-row { display: grid; gap: 0.4rem; }
.preset {
  text-align: left; padding: 0.6rem 0.75rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; font-size: 0.813rem;
}
.preset[aria-pressed="true"] { border-color: var(--guide); box-shadow: inset 3px 0 0 var(--guide); }
.preset small { display: block; color: var(--slate); font-size: 0.688rem; }

/* 表 */
table.metrics { width: 100%; border-collapse: collapse; font-size: 0.813rem; }
table.metrics th, table.metrics td {
  padding: 0.5rem 0.4rem; border-bottom: 1px solid var(--line); text-align: right;
}
table.metrics th:first-child, table.metrics td:first-child { text-align: left; }
table.metrics thead th {
  font-family: var(--mono); font-size: 0.625rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--slate);
}
table.metrics td.num { font-variant-numeric: tabular-nums; font-family: var(--mono); }
table.metrics td.better { color: var(--guide); font-weight: 600; }
table.metrics td.worse { color: var(--over); }

/* 区の俯瞰図 */
.wardmap { background: #fff; border: 1px solid var(--line); }
.wardmap svg { display: block; width: 100%; height: auto; }
.flow { stroke: var(--guide); stroke-opacity: 0.28; fill: none; }
.flow.long { stroke: var(--caution); stroke-opacity: 0.5; }
.area-dot { fill: var(--slate); fill-opacity: 0.5; }
.shelter-dot { fill: var(--guide); }
.shelter-dot.over { fill: var(--over); }
.shelter-dot.warn { fill: var(--caution); }

.footnote {
  padding: 1.5rem; border-top: 1px solid var(--line);
  font-size: 0.75rem; line-height: 1.8; color: var(--slate);
}
.footnote h3 { font-size: 0.813rem; color: var(--ink); margin: 0 0 0.35rem; }
.footnote code { font-family: var(--mono); font-size: 0.75rem; }
.footnote ul { margin: 0.4rem 0 1rem; padding-left: 1.1rem; }

/* ==========================================================================
   v6 — 共通モード切替・実地図・シナリオラボ
   ========================================================================== */

.mode-switch {
  display: inline-flex;
  flex: none;
  padding: 0.2rem;
  gap: 0.2rem;
  border: 1px solid #3A4641;
  border-radius: 999px;
  background: #0B100E;
}
.mode-switch a {
  display: block;
  padding: 0.42rem 0.72rem;
  border: 0 !important;
  border-radius: 999px;
  color: #93A39B;
  text-decoration: none;
  font-family: var(--mono);
  font-size: 0.688rem;
  line-height: 1;
  letter-spacing: 0.08em;
}
.mode-switch a[aria-current] {
  color: #07130D !important;
  background: var(--guide-lift);
}
.admin-bar .mode-switch { margin-left: auto; }
.admin-bar .mode-switch a { color: #93A39B; }

/* -- 市民画面：情報と地図を同時に見せる -------------------------------- */

.citizen-layout {
  display: grid;
  grid-template-columns: minmax(24rem, 30rem) minmax(32rem, 1fr);
  max-width: 92rem;
  margin: 0 auto;
  min-height: calc(100vh - 2.25rem);
}
.citizen-layout .phone {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 1.35rem 3rem;
  border-right: 1px solid #2C3733;
}
.masthead > div { min-width: 0; }
.masthead .place { display: block; margin-top: 0.2rem; }

.hazard-picker {
  margin-top: 1rem;
  padding: 0.85rem 0.9rem;
  border: 1px solid #2C3733;
  border-radius: 0.55rem;
  background: linear-gradient(135deg, #16201C, #101614);
}
.hazard-picker label {
  display: block;
  margin-bottom: 0.4rem;
  color: #8FA098;
  font-family: var(--mono);
  font-size: 0.625rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.hazard-picker select {
  width: 100%;
  padding: 0.65rem;
  border: 1px solid #405049;
  border-radius: 0.35rem;
  color: #EDF2EE;
  background: #0C1210;
  font: inherit;
}
.hazard-picker p {
  margin: 0.6rem 0 0;
  color: #A9B7B0;
  font-size: 0.75rem;
  line-height: 1.6;
}
.hazard-subpicker {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #314039;
}
.hazard-subpicker[hidden] { display: none; }
.hazard-subpicker label { color: #A9C6B8; }
.link-action:disabled { opacity: 0.4; cursor: not-allowed; }

.official-action {
  display: block;
  margin-top: 0.9rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid #49695A;
  border-radius: 0.35rem;
  color: #E6FFF1;
  background: #12281C;
  text-align: center;
  text-decoration: none;
  font-size: 0.813rem;
  font-weight: 700;
}
.official-action:hover { background: #163723; }
.official-action.compact { margin-top: 0.8rem; padding: 0.65rem; }

.plan-origin {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.15rem 0.7rem;
  margin-bottom: 1.35rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid #2F4C3E;
  border-left: 3px solid var(--guide-lift);
  border-radius: 0.35rem;
  background: #101D17;
}
.plan-origin span {
  grid-row: 1 / span 2;
  align-self: center;
  color: var(--guide-lift);
  font-family: var(--mono);
  font-size: 0.563rem;
  letter-spacing: 0.12em;
  writing-mode: vertical-rl;
}
.plan-origin b { font-size: 0.813rem; }
.plan-origin small { color: #8FA098; font-size: 0.688rem; line-height: 1.55; }

.citizen-map-panel {
  position: sticky;
  top: 0;
  align-self: start;
  min-width: 0;
  min-height: 100vh;
  padding: 1.25rem;
  color: #EDF2EE;
  background:
    radial-gradient(circle at 90% 5%, rgba(63,206,134,.10), transparent 30rem),
    #141C19;
}
.map-panel-head, .section-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.map-panel-head h2 {
  margin: 0;
  font-size: clamp(1.15rem, 2.2vw, 1.75rem);
  line-height: 1.25;
}
.citizen-map-panel .eyebrow { color: #7F9289; }

.data-badge {
  display: inline-block;
  flex: none;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--guide);
  border-radius: 999px;
  color: var(--guide);
  background: #EEF7F1;
  font-family: var(--mono);
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 1.2;
}
.citizen-map-panel .data-badge,
.data-badge.demo { border-color: #4B725E; color: #A9E8C7; background: #163022; }
.data-badge.assumption { border-color: var(--guide); }
.data-badge.not-applicable { border-color: var(--slate); color: var(--slate); background: #F1F3F0; }

.weather-context {
  margin: 0.8rem 0;
  padding: 0.55rem 0.7rem;
  border: 1px solid #314039;
  border-radius: 0.35rem;
  color: #AAB8B1;
  background: rgba(8, 15, 12, 0.55);
  font-family: var(--mono);
  font-size: 0.688rem;
  line-height: 1.55;
}
.weather-context b { color: #D7E7DF; }
.weather-context small { display: block; color: #718179; }
.weather-context.admin-weather {
  margin: 0 0 1.25rem;
  border-color: var(--line);
  color: var(--slate);
  background: rgba(255,255,255,.5);
}
.weather-context.admin-weather b { color: var(--ink); }

/* -- Leaflet上の共通表現 ------------------------------------------------ */

.map-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid #34423C;
  border-radius: 0.65rem;
  background-color: #C7D0C8;
  background-image:
    linear-gradient(rgba(255,255,255,.28) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.28) 1px, transparent 1px);
  background-size: 24px 24px;
}
.geo-map {
  width: 100%;
  min-height: 25rem;
  height: min(70vh, 43rem);
  background: transparent;
}
.admin-map-frame .geo-map { height: min(68vh, 40rem); min-height: 31rem; }
.leaflet-container { font-family: var(--gothic); }
.leaflet-popup-content { margin: 0.75rem 0.9rem; line-height: 1.55; }
.leaflet-control-attribution { font-size: 0.625rem !important; }

.map-offline-note {
  display: none;
  position: absolute;
  z-index: 500;
  left: 0.65rem;
  right: 0.65rem;
  bottom: 1.65rem;
  padding: 0.45rem 0.6rem;
  border-radius: 0.3rem;
  color: #FFF4D6;
  background: rgba(42,34,5,.90);
  font-size: 0.688rem;
  pointer-events: none;
}
.geo-map.map-tiles-unavailable ~ .map-offline-note { display: block; }
.map-fallback { margin: 0; padding: 2rem; color: var(--slate); background: #fff; }
.route-badge {
  position: absolute;
  z-index: 500;
  top: 0.65rem;
  right: 0.65rem;
  max-width: calc(100% - 5.5rem);
  padding: 0.5rem 0.65rem;
  border: 1px solid rgba(255,255,255,.75);
  border-radius: 999px;
  color: #fff;
  background: rgba(6,41,74,.90);
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  font-family: var(--mono);
  font-size: 0.688rem;
  font-weight: 700;
  pointer-events: none;
}

.qrt-map-icon { border: 0 !important; background: none !important; }
.occupancy-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 2px solid rgba(255,255,255,.95);
  border-radius: 50%;
  color: #fff;
  background: var(--pin);
  box-shadow: 0 2px 7px rgba(0,0,0,.34);
  font-family: var(--mono);
  font-size: 0.625rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  transform: translateZ(0);
}
.occupancy-pin.yellow { color: #211A04; }
.occupancy-pin.facility {
  font-size: 0.75rem;
  font-weight: 800;
}
.occupancy-pin.facility.reserve {
  color: #211A04;
  background: var(--caution);
  border-style: dashed;
}
.occupancy-pin.closed {
  border-style: dashed;
  background: rgba(73,83,78,.88);
}
.occupancy-pin.selected {
  width: 42px;
  height: 42px;
  border-width: 3px;
  box-shadow: 0 0 0 5px rgba(9,110,222,.33), 0 3px 10px rgba(0,0,0,.45);
  font-size: 0.72rem;
}
.map-wide-view .occupancy-pin:not(.selected) {
  width: 30px;
  height: 30px;
  font-size: 0.54rem;
  opacity: 0.9;
}

.map-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-top: 0.65rem;
  color: #9DACA5;
  font-size: 0.688rem;
  line-height: 1.5;
}
.map-actions button, .map-fit {
  flex: none;
  padding: 0.45rem 0.65rem;
  border: 1px solid #4B5B54;
  border-radius: 0.3rem;
  color: inherit;
  background: transparent;
  font-size: 0.688rem;
}
.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.9rem;
  margin-top: 0.7rem;
  color: inherit;
  font-size: 0.688rem;
}
.map-legend i {
  display: inline-block;
  width: 0.72rem;
  height: 0.72rem;
  margin-right: 0.3rem;
  border-radius: 50%;
  vertical-align: -1px;
}
.map-legend i.green { background: var(--guide); }
.map-legend i.yellow { background: var(--caution); }
.map-legend i.red { background: var(--over); }
.map-legend i.route {
  width: 1.25rem; height: 3px; border-radius: 0;
  background: repeating-linear-gradient(90deg,#096EDE 0 5px,transparent 5px 8px);
}
.map-legend i.facility-symbol {
  width: 1.15rem;
  height: 1.15rem;
  margin-right: 0.35rem;
  border: 2px solid rgba(255,255,255,.9);
  color: #fff;
  font-style: normal;
  font-family: var(--mono);
  font-size: 0.54rem;
  font-weight: 800;
  line-height: 0.9rem;
  text-align: center;
}
.map-legend i.facility-symbol.fire { background: var(--over); }
.map-legend i.facility-symbol.flood { background: #2467C9; }
.map-legend i.facility-symbol.reserve { color: #211A04; background: var(--caution); }
.map-legend i.flow-green,
.map-legend i.flow-amber { width: 1.25rem; height: 3px; border-radius: 0; }
.map-legend i.flow-green { background: var(--guide); }
.map-legend i.flow-amber { background: var(--caution); }
.map-data-note {
  margin: 0.7rem 0 0;
  color: #8FA098;
  font-size: 0.688rem;
  line-height: 1.65;
}
.map-data-note a { color: var(--guide-lift); }
.hazard-source {
  margin: 0.75rem 0 0;
  padding-top: 0.7rem;
  border-top: 1px solid #314039;
  color: #788980;
  font-size: 0.625rem;
  line-height: 1.65;
}
.hazard-source a { color: #A9E8C7; }
.result-source {
  margin: 0.9rem 0 0;
  color: #7E8E87;
  font-size: 0.688rem;
  line-height: 1.7;
}
.status-swatch {
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  flex: none;
  background: var(--swatch);
}
.status-pill {
  flex: none;
  padding: 0.2rem 0.42rem;
  border-radius: 999px;
  color: #fff;
  font-family: var(--mono);
  font-size: 0.625rem;
  font-weight: 800;
}
.status-pill.fire { background: var(--over); }
.status-pill.flood { background: #2467C9; }
.admin .map-data-note { color: var(--slate); }
.admin .map-data-note a { color: var(--guide); }

/* -- 行政地図と操作 ---------------------------------------------------- */

.allocation-map-panel { background: #EDF0EB; }
.section-head-row .hint { margin-bottom: 0; }
.map-toolbar {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 0.65rem 0.9rem;
  margin: 1rem 0 0.8rem;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  background: rgba(255,255,255,.65);
}
.map-toolbar > label {
  color: var(--slate);
  font-family: var(--mono);
  font-size: 0.625rem;
  letter-spacing: 0.08em;
}
.map-toolbar select {
  display: block;
  min-width: 9rem;
  margin-top: 0.2rem;
  padding: 0.38rem 0.45rem;
  border: 1px solid var(--line);
  background: #fff;
  font: inherit;
}
.map-toolbar .check-control {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-height: 2rem;
}
.segmented { display: inline-flex; padding: 0.15rem; border: 1px solid var(--line); background: #fff; }
.segmented button {
  padding: 0.48rem 0.7rem;
  border: 0;
  color: var(--slate);
  background: transparent;
  font-size: 0.75rem;
}
.segmented button[aria-pressed="true"] { color: #fff; background: var(--ink); }
.segmented button:disabled { opacity: .4; cursor: not-allowed; }
.map-toolbar .map-fit { color: var(--ink); border-color: var(--line); background: #fff; }
.admin-map-frame { border-color: var(--line); border-radius: 0.35rem; }

.map-readout { margin-top: 0.65rem; }
.map-summary { margin: 0; color: var(--slate); font-size: 0.75rem; }
.shelter-inspector {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.6rem;
  padding: 0.7rem 0.8rem;
  border-left: 3px solid var(--guide);
  background: #fff;
}
.shelter-inspector div { display: grid; gap: 0.15rem; }
.shelter-inspector b { font-size: 0.875rem; }
.shelter-inspector span { color: var(--slate); font-size: 0.75rem; }
.shelter-inspector button {
  flex: none; padding: 0.45rem 0.65rem;
  border: 1px solid var(--over); color: var(--over); background: #fff;
}

.load-bars {
  margin-top: 1rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.42);
}
.load-bars > summary { cursor: pointer; font-size: 0.813rem; font-weight: 700; }
.load-bars .compare { margin-top: 1rem; }

.hazard-status {
  margin-top: 0.55rem;
  padding: 0.65rem 0.7rem;
  border-left: 3px solid var(--guide);
  color: var(--slate);
  background: rgba(255,255,255,.6);
  font-size: 0.72rem;
  line-height: 1.55;
}
.hazard-status b { color: var(--ink); }
.hazard-status p { margin: 0.25rem 0 0; }
.hazard-status .capacity-balance {
  margin-top: 0.55rem;
  padding-top: 0.45rem;
  border-top: 1px solid rgba(92,107,100,.25);
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 700;
}
.hazard-status .capacity-balance.ok { color: var(--guide); }
.hazard-status .capacity-balance.short { color: var(--over); }
.hazard-status.demo { border-color: var(--caution); background: #FFF7E5; }
.hazard-status.not-applicable { border-color: var(--slate); background: #ECEFEB; }

.run span, .run b, .run small { display: block; }
.run span { font-family: var(--mono); font-size: 0.625rem; opacity: .7; }
.run b { margin-top: 0.12rem; font-size: 1rem; }
.run small { margin-top: 0.15rem; font-family: var(--mono); font-size: 0.625rem; opacity: .72; }

.anneal-phases {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.25rem;
  margin: 0 0 0.6rem;
  padding: 0;
  list-style: none;
}
.anneal-phases li {
  padding: 0.25rem 0.15rem;
  border-bottom: 2px solid var(--line);
  color: #8B9690;
  text-align: center;
  font-size: 0.563rem;
}
.anneal-phases li.active { border-color: var(--caution); color: var(--ink); font-weight: 700; }
.anneal-phases li.done { border-color: var(--guide); color: var(--guide); }
.compute-truth { margin: 0.55rem 0 0; line-height: 1.5; }
.verify-row { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.55rem; }
.verify-row span { padding: 0.25rem 0.4rem; border-radius: 0.2rem; }
.verify-row .ok { color: var(--guide); background: var(--guide-wash); }
.verify-row .ng { color: var(--over); background: #F6DAD7; }

@media (max-width: 64rem) {
  .citizen-layout { grid-template-columns: 1fr; max-width: 44rem; }
  .citizen-layout .phone { border-right: 0; }
  .citizen-map-panel { position: relative; min-height: 0; }
  .geo-map { height: 32rem; min-height: 22rem; }
}

@media (max-width: 38rem) {
  .citizen-layout { display: block; }
  .masthead { align-items: center; }
  .mode-switch a { padding: 0.4rem 0.55rem; font-size: 0.625rem; }
  .citizen-map-panel { padding: 1rem; }
  .map-panel-head, .section-head-row { display: grid; }
  .map-actions { align-items: flex-start; }
  .admin-map-frame .geo-map { min-height: 26rem; height: 30rem; }
  .shelter-inspector { align-items: flex-start; }
}
