[hidden] { display: none !important; }
/* 言語は <html lang> で決まる（src/lang.js）。要らないほうの文言を伏せる */
html[lang="ja"] [lang="en"], html[lang="en"] [lang="ja"] { display: none !important; }
:root {
  --bg: #0a0e14;
  --panel: #111821;
  --line: #243140;
  --text: #e7edf3;
  --sub: #93a4b4;
  --zombie: #7dff5a;
  --accent: #ffc46e;
  --danger: #ff6b5e;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif; font-size: 15px; line-height: 1.6; }
button { font: inherit; color: inherit; cursor: pointer; }

#site-header { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; max-width: 1200px; margin: 0 auto; padding: 10px 16px; }
#site-header .apps-link { color: var(--sub); text-decoration: none; font-size: 14px; display: inline-flex; align-items: center; min-height: 40px; white-space: nowrap; }
#site-header .name { font-weight: 800; font-size: 18px; margin: 0; }
#site-header .name a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; min-height: 40px; }
#site-header .tagline { color: var(--sub); font-size: 14px; }
.langsw { margin-left: auto; display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; flex: none; }
.langsw button { min-width: 44px; min-height: 40px; padding: 0 12px; border: 0; background: none; color: var(--sub); font-size: 12px; }
.langsw button[aria-pressed="true"] { background: rgba(255, 255, 255, 0.12); color: var(--text); font-weight: 800; }

#main { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

#toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 4px 0 10px; }
#tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }
#cond { position: relative; }
#cond small { margin-left: 8px; color: var(--sub); font-size: 12px; }
.cond-body { position: absolute; z-index: 30; right: 0; top: calc(100% + 4px); display: grid; gap: 10px; padding: 12px; border-radius: 10px; background: #17202b; border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6); }
.cond-body .group { justify-content: space-between; }
.act.icon { width: 40px; padding: 0; }
.group { display: flex; align-items: center; gap: 8px; }
.group .lb { color: var(--sub); font-size: 13px; white-space: nowrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); }
.seg button { min-height: 40px; min-width: 44px; padding: 0 12px; border: 0; background: transparent; font-size: 14px; color: var(--sub); white-space: nowrap; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: #1f4a22; color: #dcffd2; font-weight: 700; }
.seg button:hover { color: var(--text); }

.act { min-height: 40px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 14px; white-space: nowrap; }
.act:hover { border-color: #3e9c45; }
.act[aria-pressed="true"] { background: #7a5a1c; border-color: #d6a23c; color: #fff; font-weight: 700; }
.act.primary { background: #2c7a33; border-color: #3e9c45; color: #fff; font-weight: 700; }

#town-bar { display: flex; flex: 1 1 360px; flex-wrap: wrap; align-items: center; gap: 8px 12px; min-width: 0; }
#town-bar .lb { color: var(--accent); font-size: 14px; font-weight: 800; white-space: nowrap; }
#town-search { position: relative; flex: 0 1 280px; min-width: 160px; }
#town-input { width: 100%; min-height: 40px; padding: 0 12px; border-radius: 8px; border: 1px solid #6d5a2b; background: var(--panel); color: var(--text); font: inherit; font-size: 16px; }
#town-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; margin: 0; padding: 4px; list-style: none; border-radius: 8px; background: #17202b; border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6); }
#town-list button { display: flex; justify-content: space-between; gap: 12px; width: 100%; min-height: 40px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--text); align-items: center; text-align: left; }
#town-list button:hover { background: #24313f; }
#town-list span { color: var(--sub); font-size: 13px; white-space: nowrap; }
#town-list .none { padding: 10px; color: var(--sub); font-size: 14px; }
#town-chosen { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.town-who b { font-size: 17px; }
.town-who small { margin-left: 6px; color: var(--sub); font-size: 12px; }
#town-status { padding: 6px 12px; border-radius: 999px; background: #17324a; color: #bfe3ff; font-weight: 700; font-size: 14px; }
#town-status[data-tone="near"] { background: #5a4516; color: #ffe0a0; }
#town-status[data-tone="danger"] { background: #5a1f1a; color: #ffc5bf; }
#town-status[data-tone="fallen"] { background: #2b323a; color: #c9d2db; }

#game { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 12px; align-items: start; }

/* 地図と操作を 1 枚にして、ページを送らなくても両方が見えるようにする */
#stage { container-type: inline-size; position: relative; width: 100%; aspect-ratio: 4 / 3; max-height: max(340px, calc(100svh - 310px)); background: #06090e; border-radius: 12px 12px 0 0; overflow: hidden; border: 1px solid var(--line); }
#dock { container-type: inline-size; display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 12px 12px; background: var(--panel); }
.dock-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.dock-lb { font-size: 14px; font-weight: 800; white-space: nowrap; }
.dock-val { font-size: 13px; color: var(--sub); }
#plan { display: grid; gap: 8px; }
#h-routes { display: flex; flex-wrap: wrap; gap: 6px; }
#h-routes .act[aria-pressed="true"] { background: #7a2a22; border-color: #ff5a4e; }
/* お題：挑戦中だけ、地図の下の列のいちばん上に出す */
#quest-bar { display: grid; gap: 6px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.qb-goal { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
#qb-title { font-size: 13px; color: #ffd76a; }
#qb-goal { font-size: 16px; font-weight: 800; }
.qb-cond { font-size: 12px; color: var(--sub); }
.qb-now { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 13px; }
.qb-stat b { font-size: 18px; color: #7dff5a; font-variant-numeric: tabular-nums; }
.qb-medals { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.qb-m { display: inline-flex; align-items: center; gap: 4px; }
.qb-m.over { opacity: 0.4; text-decoration: line-through; }
.qb-rival { color: #ff9a90; font-weight: 700; }
.qb-best { color: var(--sub); }
#qb-left { color: #ffd76a; font-weight: 700; }
#btn-quest-exit { margin-left: auto; }
.medal { display: inline-grid; place-items: center; flex: none; width: 22px; height: 22px; border-radius: 50%; background: #2a333d; color: var(--sub); font-size: 12px; font-weight: 800; line-height: 1; }
.medal.m3 { background: radial-gradient(circle at 35% 30%, #fff1b0, #e2b23a 60%, #9a6f12); color: #3b2a00; }
.medal.m2 { background: radial-gradient(circle at 35% 30%, #ffffff, #b9c4cf 60%, #6c7884); color: #1e252c; }
.medal.m1 { background: radial-gradient(circle at 35% 30%, #ffd9b0, #c27a3e 60%, #7a4518); color: #2e1604; }
/* お題の板（はじめの画面と一覧）。地図の上を覆い、中で送る */
#menu { z-index: 8; position: absolute; inset: 0; display: flex; overflow: auto; padding: 14px; background: rgba(6, 9, 14, 0.8); }
#menu-home, #menu-list { width: min(460px, 100%); margin: auto; padding: 16px 18px; border-radius: 14px; background: rgba(14, 20, 28, 0.97); border: 1px solid #6b5a22; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7); }
#menu-list { width: min(760px, 100%); }
.menu-x { flex: none; width: 40px; height: 40px; margin-left: auto; border-radius: 8px; border: 1px solid var(--line); background: #17202b; color: var(--text); font-size: 18px; }
.menu-kicker { margin: 0; font-size: 14px; font-weight: 800; color: #ffd76a; }
#today-date { margin-left: 8px; color: var(--text); }
.qcard { display: grid; gap: 3px; margin-bottom: 12px; padding: 12px 14px; border-radius: 10px; background: #17202b; border: 1px solid var(--line); }
.qc-goal { font-size: 17px; }
.qc-goal b { font-size: 22px; color: #ffd76a; }
.qc-cond, .qc-par { font-size: 13px; color: var(--sub); }
.qc-me { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 13px; }
.menu-go { width: 100%; min-height: 48px; font-size: 16px; }
.menu-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.menu-row .act { min-height: 44px; }
.menu-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.menu-head h2 { margin: 0; font-size: 19px; }
#quest-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.qitem { display: grid; gap: 2px; width: 100%; height: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: #17202b; color: var(--text); text-align: left; font: inherit; cursor: pointer; }
.qitem:hover { border-color: #d6a23c; }
.qitem .qcard, .qitem > .qc-goal { margin: 0; }
.qi-tag { font-size: 12px; font-weight: 800; color: #ffd76a; }
.qitem .qc-goal { font-size: 14px; }
.qitem .qc-goal b { font-size: 17px; }
#result-medal { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; color: #ffd76a; font-size: 15px; font-weight: 800; }
#result-medal .medal { width: 46px; height: 46px; font-size: 20px; box-shadow: 0 0 18px rgba(255, 215, 106, 0.45); animation: medal-pop 0.6s ease-out; }
@keyframes medal-pop { 0% { transform: scale(0.2) rotate(-30deg); opacity: 0; } 70% { transform: scale(1.18) rotate(6deg); opacity: 1; } 100% { transform: scale(1) rotate(0); } }
#btn-pause.attn { animation: attn 1.1s ease-in-out infinite; border-color: #3e9c45; }
@keyframes attn { 50% { box-shadow: 0 0 16px rgba(125, 255, 90, 0.7); } }
#turn { z-index: 5; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(380px, calc(100% - 24px)); padding: 16px 18px; border-radius: 14px; background: rgba(14, 20, 28, 0.97); border: 1px solid #2f6fa8; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7); }
#turn h2 { margin: 0 0 8px; font-size: 19px; }
#turn ul { margin: 0 0 12px; padding-left: 1.2em; font-size: 14px; }
#turn .act { width: 100%; min-height: 44px; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; touch-action: pan-x pan-y; }
#map.dragging { cursor: grabbing; }

#stage { --top: 8px; }
#stage:has(#ticker:not([hidden])) { --top: 40px; }
#hud { position: absolute; left: 8px; top: var(--top); padding: 4px 8px; border-radius: 8px; background: rgba(6, 9, 14, 0.55); pointer-events: none; text-shadow: 0 1px 6px #000; }
.hud-day { font-size: 15px; font-weight: 700; color: var(--text); }
.hud-rate { font-size: 44px; font-weight: 800; line-height: 1.05; color: var(--zombie); font-variant-numeric: tabular-nums; }
.hud-rate small { font-size: 22px; margin-left: 2px; }
.hud-lb { font-size: 12px; color: var(--sub); }

#here { margin-top: 8px; padding: 6px 10px; width: 186px; border-radius: 8px; background: rgba(10, 14, 20, 0.82); border: 1px solid var(--line); text-shadow: none; }
.here-name { font-size: 12px; color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.here-row { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.here-row span { color: var(--sub); }
.here-row b { font-variant-numeric: tabular-nums; }
.here-row b.z { color: var(--zombie); }
.here-scale { margin-top: 3px; font-size: 11px; color: var(--sub); }

#caption { align-self: center; max-width: 100%; padding: 7px 16px; border-radius: 8px; background: rgba(8, 12, 18, 0.88); border-left: 4px solid #d6a23c; color: var(--text); font-weight: 700; font-size: 15px; text-align: center; }

#vignette { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 1.5s; box-shadow: inset 0 0 130px 30px rgba(190, 18, 18, 0.85); }
#stage[data-stage="2"] #vignette { opacity: 0.22; }
#stage[data-stage="3"] #vignette { opacity: 0.7; animation: pulse 1.6s ease-in-out infinite; }
#stage[data-stage="4"] #vignette { opacity: 0.45; box-shadow: inset 0 0 160px 50px rgba(20, 0, 0, 0.95); }
#stage[data-stage="4"] #map { filter: saturate(0.5) brightness(0.82); }
@keyframes pulse { 50% { opacity: 0.32; } }
#stage.shaking { animation: quake 0.5s linear; }
@keyframes quake { 10% { transform: translate(-6px, 3px); } 30% { transform: translate(6px, -4px); } 50% { transform: translate(-5px, -3px); } 70% { transform: translate(4px, 4px); } 90% { transform: translate(-2px, 1px); } }

#ticker { position: absolute; left: 0; right: 0; top: 0; min-height: 32px; display: flex; align-items: center; gap: 10px; padding: 4px 12px; background: rgba(14, 18, 26, 0.92); border-bottom: 2px solid #8c1c1c; font-size: 15px; font-weight: 700; pointer-events: none; }
#ticker b { flex: none; padding: 1px 8px; border-radius: 3px; background: #c02020; color: #fff; font-size: 13px; }
#ticker[data-hot="1"] span { color: #ffb4ac; }
#ticker-text { min-width: 0; }
#ticker-text.in { animation: ticker-in 0.35s ease-out; }
@keyframes ticker-in { from { opacity: 0; transform: translateY(8px); } }

#counter { position: absolute; left: 50%; top: var(--top); transform: translateX(-50%); padding: 2px 14px 4px; border-radius: 8px; background: rgba(6, 9, 14, 0.62); text-align: center; pointer-events: none; }
.counter-lb { font-size: 12px; color: var(--sub); }
#counter-num { font-size: 34px; line-height: 1.05; font-weight: 900; color: var(--zombie); font-variant-numeric: tabular-nums; white-space: nowrap; text-shadow: 0 0 14px rgba(125, 255, 90, 0.45); }
#stage[data-stage="3"] #counter-num, #stage[data-stage="4"] #counter-num { color: #ff7a6e; text-shadow: 0 0 16px rgba(255, 60, 40, 0.6); }
#counter-sub { font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; }
#counter-sub span + span { margin-left: 1em; }

#alert { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); padding: 10px 28px; font-size: 40px; font-weight: 900; color: #fff; background: rgba(8, 12, 18, 0.82); border-top: 3px solid var(--zombie); border-bottom: 3px solid var(--zombie); white-space: nowrap; pointer-events: none; }
#alert[data-danger="1"] { border-color: #ff4a3c; color: #ffd6d0; }
#alert.show { animation: alert-in 2.2s ease-out both; }
@keyframes alert-in { 0% { opacity: 0; transform: translate(-50%, -50%) scale(1.5); } 12% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }

#msg { align-self: flex-end; max-width: min(320px, 100%); padding: 8px 14px; border-radius: 14px 14px 2px 14px; background: #1f6f3a; color: #fff; font-size: 15px; font-weight: 600; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5); animation: msg-in 0.3s ease-out; }
#msg[data-sys="1"] { background: #30373f; color: #c6d0da; font-weight: 500; }
#msg small { display: block; font-size: 11px; opacity: 0.8; }
@keyframes msg-in { from { opacity: 0; transform: translateY(12px); } }
#chat { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 14px; }
#chat li { padding: 4px 10px; border-radius: 10px; background: #1b3a26; }
#chat li.sys { background: transparent; color: var(--sub); padding: 2px 4px; }

#hint { align-self: center; padding: 8px 16px; border-radius: 999px; background: rgba(20, 40, 22, 0.86); border: 1px solid #3a7a3e; color: #dcffd2; font-weight: 700; white-space: nowrap; animation: hint 1.6s ease-in-out infinite; }
@keyframes hint { 50% { box-shadow: 0 0 18px rgba(125, 255, 90, 0.5); } }
#loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--sub); pointer-events: none; }

/* 案内・帯・再生の列は同じ縦の並びに入れて、再生の列が折り返しても重ならないようにする。右は拡大ボタンのぶん空ける */
#bottom { position: absolute; left: 12px; right: 130px; bottom: 12px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; pointer-events: none; }
#viewbar { display: flex; flex-wrap: wrap; gap: 6px; pointer-events: auto; }
#viewbar .act:not(.primary) { background: rgba(17, 24, 33, 0.9); }
#playback { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
#playback > button, #zoom button { min-width: 40px; min-height: 40px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: rgba(17, 24, 33, 0.9); color: var(--text); font-size: 14px; white-space: nowrap; }
#playback > * { flex: none; }
#btn-reset .narrow { display: none; }
#playback .seg { background: rgba(17, 24, 33, 0.9); }
#zoom { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 8px; }
#zoom button { flex: none; } /* 縦に並べる狭い幅で 40px を切らないように */

#result { z-index: 7; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(420px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow: auto; padding: 18px 20px; border-radius: 14px; background: rgba(14, 20, 28, 0.96); border: 1px solid #3a7a3e; box-shadow: 0 10px 50px rgba(0, 0, 0, 0.7); }
#share, #shared { z-index: 7; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(520px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow: auto; padding: 16px; border-radius: 14px; background: rgba(14, 20, 28, 0.97); border: 1px solid #3a7a3e; box-shadow: 0 10px 50px rgba(0, 0, 0, 0.7); }
#share-img { display: block; width: 100%; border-radius: 8px; }
#share-text { margin: 10px 0; font-weight: 700; }
#share-url { width: 100%; min-height: 40px; margin-top: 10px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--line); background: #0d141c; color: var(--sub); font: inherit; font-size: 13px; }
#shared h2 { margin: 0 0 6px; font-size: 19px; }
#shared p { margin: 0 0 12px; color: var(--sub); font-size: 14px; }
#result-town { color: var(--text) !important; font-size: 17px !important; font-weight: 800; }
#place { z-index: 6; position: absolute; left: clamp(8px, var(--x, 8px), calc(100% - 244px)); top: clamp(8px, var(--y, 8px), calc(100% - var(--bh, 200px) - 8px)); width: 236px; padding: 10px 12px 12px; border-radius: 12px; background: rgba(14, 20, 28, 0.97); border: 1px solid #3a7a3e; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7); }
.place-name { padding-right: 40px; margin-bottom: 4px; }
.place-name b { font-size: 16px; }
.place-name small { margin-left: 6px; color: var(--sub); font-size: 12px; }
#place-close { position: absolute; right: 4px; top: 4px; width: 40px; height: 40px; border: 0; background: transparent; color: var(--sub); font-size: 20px; }
#place-drop, #place-town { display: block; width: 100%; min-height: 44px; margin-top: 8px; border-radius: 8px; border: 1px solid var(--line); background: #1a2430; font-weight: 700; }
#place-drop { background: #2c7a33; border-color: #3e9c45; color: #fff; }
#result-human { margin: 0 0 8px; color: #8fd4ff; font-size: 13px; line-height: 1.6; }
#result h2 { margin: 0 0 6px; font-size: 21px; line-height: 1.35; }
#result p { margin: 0 0 12px; color: var(--sub); font-size: 14px; }
#result-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin: 0 0 14px; }
#result-stats div { display: flex; flex-direction: column-reverse; }
#result-stats dt { font-size: 12px; color: var(--sub); }
#result-stats dd { margin: 0; font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.result-note { margin: 0 0 10px !important; font-size: 12px !important; }
.result-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.result-btns button { min-height: 44px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line); background: #1a2430; }
.result-btns .primary { background: #2c7a33; border-color: #3e9c45; color: #fff; font-weight: 700; }

#side { display: grid; gap: 10px; }
#side section { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
#side h3 { margin: 0 0 6px; font-size: 13px; color: var(--sub); font-weight: 600; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stats div { display: flex; flex-direction: column; min-width: 0; }
.stats b { font-size: 18px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stats b.z { color: var(--zombie); }
.stats span { font-size: 12px; color: var(--sub); }

#chart-wrap { position: relative; height: 96px; }
#chart { width: 100%; height: 100%; display: block; }
#chart-tip { position: absolute; top: 0; padding: 1px 6px; font-size: 12px; background: #000a; border-radius: 4px; pointer-events: none; white-space: nowrap; }

#regions, #news { list-style: none; margin: 0; padding: 0; }
#regions { display: grid; gap: 4px; }
#regions li { display: grid; grid-template-columns: 8em minmax(0, 1fr) 3.4em; gap: 8px; align-items: center; font-size: 13px; }
#regions .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#regions .bar { height: 7px; border-radius: 4px; background: #1b2531; overflow: hidden; }
#regions .bar i { display: block; height: 100%; background: var(--zombie); }
#regions .pct { text-align: right; font-variant-numeric: tabular-nums; color: var(--sub); }
#news { display: grid; gap: 3px; max-height: 190px; overflow: auto; font-size: 13px; }
#news li { color: var(--sub); }
#news li.hot { color: var(--danger); font-weight: 600; }
#news li b { color: var(--text); font-weight: 600; margin-right: 6px; font-variant-numeric: tabular-nums; }

#guide-section { margin: 28px 0; line-height: 1.8; color: #cdd9e3; font-size: 14px; }
#guide-section h2 { font-size: 18px; color: var(--text); }
.guide-content { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.guide-col { padding: 10px 14px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); }
.guide-col h3 { margin: 0 0 4px; font-size: 15px; color: var(--text); }
.guide-col p { margin: 0; }
.guide-col p + p { margin-top: 8px; }

/* 関連アプリ・広告の枠・フッター（全アプリ共通の骨格。手本は quake-map） */
.related-apps, #ad-section { max-width: 1200px; margin: 28px auto 0; padding: 0; }
.related-apps-title { font-size: 18px; margin: 0 0 10px; }
.related-apps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(180px, calc(50% - 5px)), 1fr)); gap: 10px; }
.related-app-link.ra-card { display: flex; flex-direction: column; overflow: hidden; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); text-decoration: none; transition: transform 0.15s, border-color 0.15s; }
.related-app-link.ra-card:hover { transform: translateY(-2px); border-color: rgba(255, 255, 255, 0.24); }
.ra-card .ra-thumb { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.ra-card .ra-name { display: block; padding: 8px 12px 10px; font-size: 13px; font-weight: 700; line-height: 1.4; }
#site-footer { max-width: 1200px; margin: 0 auto; padding: 24px 16px 40px; color: var(--sub); font-size: 13px; text-align: center; }
.footer-links { display: flex; justify-content: center; gap: 10px; align-items: center; }
.footer-link { color: var(--sub); text-decoration: none; display: inline-flex; align-items: center; min-height: 40px; }
.footer-refs a { display: inline-block; color: var(--sub); } /* 折り返しで隣のリンクに箱が重ならないように */

@media (max-width: 560px) {
  #town-bar { width: 100%; order: 9; }
  #tools { gap: 4px; }
  #cond small { display: none; }
  #cond-btn { padding: 0 10px; }
  #btn-share { padding: 0 8px; }
  #town-bar { flex-wrap: nowrap; }
  #town-bar:has(#town-chosen:not([hidden])) { flex-wrap: wrap; }
  #town-search { flex: 1 1 0; min-width: 0; }
  /* 街を選んだら、名前と状況を 1 行目に、ボタンを 2 行目に並べて地図を押し下げない */
  #town-bar:has(#town-chosen:not([hidden])) .lb { display: none; }
  #town-chosen { display: contents; }
  .town-who small { display: none; }
  #town-status { flex: 1 1 auto; text-align: center; }
  #town-bar .act { padding: 0 10px; }
}
@media (max-width: 880px) {
  #game { grid-template-columns: minmax(0, 1fr); }
  .guide-content { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  #site-header .name { font-size: 16px; }
  #stage { aspect-ratio: 1 / 1; max-height: 56svh; }
  .hud-rate { font-size: 34px; }
  #hint { font-size: 13px; }
  #caption { width: 100%; font-size: 13px; }
  #bottom { right: 12px; }
  #zoom { top: calc(var(--top) + 2px); bottom: auto; flex-direction: column; }
  #stage:has(#ticker:not([hidden])) #zoom { top: 56px; }
  #playback { gap: 6px; flex-wrap: nowrap; }
  #playback > button { padding: 0 9px; }
  #btn-reset .wide { display: none; }
  #btn-reset .narrow { display: inline; font-size: 20px; }
  #playback #btn-reset { padding: 0; min-width: 40px; }
  #dock { padding: 10px 8px; }
  #playback { justify-content: space-between; }
  #playback .seg button { min-width: 40px; padding: 0; }
  #viewbar .act { padding: 0 8px; font-size: 13px; }
  .group { flex-wrap: wrap; }
  .seg button { padding: 0 9px; }
  .seg.small button { min-width: 40px; padding: 0 4px; }
}
/* 地図が小さすぎて、数字の板を出すと再生の列にかかる幅 */
@media (max-width: 360px) {
  #here { display: none; }
}
/* 地図の枠が狭いときは、左上の板の項目を減らす */
@container (max-width: 620px) {
  .here-row.opt, .here-scale { display: none; }
}
/* 地図の枠が中くらいなら、感染者の数を左上の数字と重ならない右へ寄せる */
@container (max-width: 800px) {
  #counter { left: auto; right: 12px; transform: none; padding: 2px 8px; text-align: right; }
  #counter-num { font-size: 26px; }
  #counter-sub span { display: block; }
  #counter-sub span + span { margin-left: 0; }
}
/* 地図の枠が狭いとき：テロップと大きな文字を小さくする */
@container (max-width: 620px) {
  #counter-num { font-size: 22px; }
  #counter-sub { font-size: 11px; }
  #counter-sub span { display: block; }
  #ticker { font-size: 13px; }
  #alert { top: 34%; font-size: 24px; padding: 8px 16px; }
  /* テロップは 2 行になることがあるので、そのぶん下げる */
  #stage:has(#ticker:not([hidden])) #hud, #stage:has(#ticker:not([hidden])) #counter { top: 56px; }
  /* 枠が狭いので、拡大中の数字の板と、感染者の数・家族の連絡を同時に出さない */
  #stage:has(#here:not([hidden])) #counter { display: none; }
  #stage:has(#msg:not([hidden])) #here { display: none; }
}
/* 現場の字幕にも地域と数が出るので、字幕のあいだは数字の板を畳む（字幕が板の下端にかかる） */
@container (max-width: 800px) {
  #stage:has(#caption:not([hidden])) #here { display: none; }
}
/* スマホは右上に拡大ボタンがあるので、感染者の数をその左に置く */
@media (max-width: 560px) {
  #counter { right: 56px !important; }
  /* スマホは地図の枠が低いので、お題の結果の板を詰めて «結果を共有» まで収める */
  #result-medal { margin-bottom: 2px; }
  #result-medal .medal { width: 34px; height: 34px; font-size: 16px; }
  #result h2 { font-size: 18px; }
  #result-stats { margin-bottom: 8px; }
  #result-stats dd { font-size: 16px; }
  #result .result-btns { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 6px; }
  #result .result-btns button { padding: 0 6px; }
}
