[hidden] { display: none !important; }
/* 言語: <html lang> と違うほうの文言を伏せる（src/lang.js が描く前に決める） */
html[lang="ja"] [lang="en"], html[lang="en"] [lang="ja"] { display: none !important; }
:root {
  --bg: #0b1622;
  --panel: #111f2d;
  --panel2: #172a3b;
  --line: rgba(255, 255, 255, 0.12);
  --text: #eaf1f7;
  --sub: #95a9ba;
  --accent: #ff8a3d;
  --accent2: #ffc067;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", system-ui, sans-serif; }
button { font: inherit; color: inherit; cursor: pointer; }

#site-header { display: flex; align-items: center; gap: 12px; max-width: 1200px; margin: 0 auto; padding: 12px 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; }
.header-sub { margin-left: 8px; font-size: 12px; font-weight: 500; color: var(--sub); }
.langsw { margin-left: auto; display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; flex: none; }
.langsw button { font-size: 12px; padding: 0 12px; min-height: 44px; min-width: 44px; border: 0; background: none; color: var(--sub); }
.langsw button[aria-pressed="true"] { background: rgba(255, 255, 255, 0.12); color: var(--text); font-weight: 800; }

#app { padding: 0 16px; }

/* ── 地図と右の列 ── */
/* PC：地図（左）と «選ぶ・結果»（右）を 1 枚の枠に並べる。高さは 76svh まで */
#stage { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) 360px; height: min(76svh, 760px); border-radius: 14px; overflow: hidden; background: #08121c; border: 1px solid var(--line); }
#mapbox { position: relative; min-width: 0; min-height: 0; user-select: none; -webkit-user-select: none; }
#map { display: block; width: 100%; height: 100%; touch-action: pan-x pan-y; cursor: pointer; }
#map.dragging { cursor: grabbing; }
#mapbox > div { position: absolute; }
#ov-left { left: 12px; top: 12px; max-width: calc(100% - 80px); display: flex; flex-direction: column; align-items: flex-start; gap: 8px; pointer-events: none; }
#clock { padding: 8px 14px; background: rgba(8, 18, 28, 0.86); border: 1px solid var(--line); border-radius: 10px; backdrop-filter: blur(4px); font-variant-numeric: tabular-nums; }
#clock b { font-size: 20px; letter-spacing: 0.02em; }
#clock span { display: block; font-size: 11px; color: var(--sub); }
#tally { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); font-size: 13px; line-height: 1.6; }
#tally:empty { display: none; }
#tally b { font-size: 16px; color: #ffb48a; }
#legend { display: flex; flex-wrap: wrap; gap: 2px; padding: 5px; background: rgba(8, 18, 28, 0.82); border: 1px solid var(--line); border-radius: 8px; }
#legend span { min-width: 26px; padding: 2px 4px; border-radius: 4px; background: var(--c); color: #111; font-size: 11px; font-weight: 800; text-align: center; }
#legend span:nth-child(n + 8), #legend span:nth-child(3) { color: #fff; }
#zoom { right: 12px; top: 12px; display: flex; flex-direction: column; gap: 6px; }
#zoom button { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: rgba(8, 18, 28, 0.82); font-size: 20px; line-height: 1; }
#zoom button:hover { background: rgba(40, 60, 80, 0.95); }
#busy { left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 10px 20px; border-radius: 99px; background: rgba(8, 18, 28, 0.9); border: 1px solid var(--line); font-weight: 700; pointer-events: none; }
#loading { inset: 0; display: grid; place-items: center; color: var(--sub); font-size: 14px; background: #08121c; }

/* 押した場所の板。位置は main.js が押した点の横に合わせる。地図が狭いときは下端に敷く */
#pop { width: 320px; max-height: calc(100% - 24px); overflow: auto; padding: 12px 14px 14px; border-radius: 12px; background: rgba(13, 25, 37, 0.97); border: 1px solid rgba(255, 138, 61, 0.7); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }
/* 地図の枠が狭い（560px 未満）ときは下端に敷く。幅で決めるのは CSS（窓の幅を変えた直後も JS を待たずに切り替わる）。
   敷いている間は、拡大ボタンと左上の列を隠す（読んでいる間は使わない。× で閉じれば戻る） */
#mapbox { container-type: inline-size; }
@container (max-width: 559px) {
  #pop { left: 8px !important; right: 8px; bottom: 8px; top: auto !important; width: auto; max-height: calc(100% - 16px); padding: 10px 12px 12px; }
  #mapbox:has(> #pop:not([hidden])) #zoom, #mapbox:has(> #pop:not([hidden])) #ov-left { display: none; }
}
.pop-head { display: flex; align-items: flex-start; gap: 10px; }
.pop-head .nm { flex: 1; min-width: 0; font-size: 17px; font-weight: 800; line-height: 1.3; }
.pop-head .nm small { display: block; font-size: 12px; font-weight: 500; color: var(--sub); }
.pop-x { flex: none; width: 40px; height: 40px; margin: -6px -8px 0 0; border: 0; background: none; color: var(--sub); font-size: 22px; border-radius: 8px; }
.pop-x:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.pop-shake { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.pl-pt { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.pl-pt small { font-size: 11px; color: var(--sub); }
.pl-badge { font-size: 26px; font-weight: 900; min-width: 2.4em; text-align: center; border-radius: 10px; padding: 2px 10px; color: #111; }
.pl-badge.dark { color: #fff; }
.pop-shake .when { font-size: 13px; color: var(--sub); line-height: 1.6; }
.pop-shake .when b { color: var(--text); font-size: 15px; }
.pop-dmg { margin: 10px 0 0; padding: 8px 10px; border-radius: 8px; background: rgba(255, 90, 54, 0.12); font-size: 13px; line-height: 1.7; }
.pop-dmg b { color: #ffb48a; font-size: 15px; }
.pop-dmg small { color: var(--sub); font-size: 12px; }
.pop-house { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 8px; align-items: center; margin: 8px 0 0; font-size: 12px; color: var(--sub); }
.pop-house i { display: block; height: 8px; border-radius: 4px; background: #ff5a36; min-width: 1px; }
.pop-house b { color: var(--text); font-variant-numeric: tabular-nums; text-align: right; }
.pop-say { margin: 8px 0 0; font-size: 13px; line-height: 1.7; }
.pop-act { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pop-act button, .pop-act a { flex: 1 1 0; min-width: 0; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 6px 12px; border-radius: 10px; font-weight: 800; font-size: 13px; text-decoration: none; text-align: center; line-height: 1.35; padding: 6px 8px; }
.pop-act .go { border: 0; background: var(--accent); color: #1a0d03; }
.pop-act a { border: 1px solid var(--line); background: var(--panel2); color: var(--text); }

/* ── 右の列 ── */
#side { min-width: 0; overflow: auto; scroll-padding-top: 56px; background: var(--panel); border-left: 1px solid var(--line); }
#tabs { display: flex; position: sticky; top: 0; z-index: 1; border-bottom: 1px solid var(--line); background: #0e1b28; }
#tabs button { flex: 1; min-height: 48px; border: 0; background: none; color: var(--sub); font-weight: 700; font-size: 13px; border-bottom: 3px solid transparent; padding: 0 6px; }
#tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); background: var(--panel); }
.tab-body { padding: 12px 14px 4px; display: flex; flex-direction: column; gap: 10px; }
.seg { display: flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { flex: 1 1 auto; min-height: 40px; padding: 0 10px; border: 0; background: none; color: var(--sub); font-size: 13px; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: rgba(255, 138, 61, 0.2); color: var(--text); font-weight: 800; }
.slider { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 8px; }
.slider .lb { font-size: 13px; color: var(--sub); }
.slider b { font-variant-numeric: tabular-nums; }
.slider input { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); height: 40px; margin: 0; }
.size { margin: 0; font-size: 13px; color: var(--sub); }
.warn { margin: 0; padding: 8px 12px; border-left: 3px solid var(--accent2); background: rgba(255, 192, 103, 0.08); font-size: 13px; line-height: 1.6; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { min-height: 40px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--panel2); font-size: 13px; }
.chips button:hover { border-color: var(--accent); }
.cards { display: flex; flex-direction: column; gap: 8px; padding-bottom: 8px; }
.card { text-align: left; border: 1px solid var(--line); border-radius: 10px; background: var(--panel2); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; min-height: 44px; }
.card:hover { border-color: rgba(255, 138, 61, 0.6); }
.card[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.card b { font-size: 14px; }
.card .m { font-size: 12px; color: var(--accent2); font-weight: 700; }

#summary { padding: 12px 14px 16px; border-top: 1px solid var(--line); }
.sum-head { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.sum-head h2 { margin: 0; font-size: 16px; line-height: 1.4; }
.sum-head p { margin: 2px 0 0; font-size: 12px; color: var(--sub); line-height: 1.5; }
.primary { min-height: 44px; padding: 0 14px; border-radius: 10px; border: 0; background: var(--accent); color: #1a0d03; font-weight: 800; white-space: nowrap; }
.primary:hover { filter: brightness(1.08); }
.hypo { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 0; font-size: 12px; color: var(--sub); }
.dead { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: rgba(255, 90, 54, 0.1); border: 1px solid rgba(255, 138, 61, 0.35); }
.dead-total span { display: block; font-size: 12px; color: var(--sub); }
.dead-total b { display: block; font-size: 28px; color: #ffb48a; font-variant-numeric: tabular-nums; }
.causes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.causes div { padding: 6px 8px; border-radius: 8px; background: rgba(8, 18, 28, 0.6); }
.causes span { display: block; font-size: 11px; color: var(--sub); }
.causes b { display: block; font-size: 15px; font-variant-numeric: tabular-nums; }
.caution { margin: 12px 0 0; padding: 8px 10px; border-radius: 8px; background: rgba(255, 214, 102, 0.1); border: 1px solid rgba(255, 214, 102, 0.4); color: #ffe3a3; font-size: 12px; line-height: 1.6; }
.linkish { display: inline-flex; align-items: center; min-height: 40px; padding: 0 4px; margin-right: 6px; border: 0; background: none; color: #ffe3a3; font-size: 12px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.memorial { margin: 0 0 10px; font-size: 12px; color: var(--sub); line-height: 1.6; }
#notice { max-width: min(560px, calc(100vw - 32px)); max-height: calc(100svh - 32px); overflow: auto; padding: 22px 22px 20px; border: 1px solid rgba(255, 214, 102, 0.5); border-radius: 14px; background: var(--panel); color: var(--text); line-height: 1.7; }
#notice::backdrop { background: rgba(3, 8, 14, 0.78); }
#notice h2 { margin: 0 0 10px; font-size: 19px; color: #ffe3a3; }
#notice .lead { margin: 0 0 10px; font-weight: 700; }
#notice ul { margin: 0 0 16px; padding-left: 1.2em; font-size: 14px; }
#notice li + li { margin-top: 6px; }
#notice b { color: #ffe3a3; }
#notice .primary { width: 100%; }
.evac { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; font-size: 12px; color: var(--sub); }
#tally .tally-parts { display: block; font-size: 11px; color: var(--sub); }
.pop-tsu { margin: 8px 0 0; padding: 8px 10px; border-radius: 8px; background: rgba(60, 150, 255, 0.14); font-size: 13px; line-height: 1.7; }
.pop-tsu b { color: #9fd0ff; font-size: 15px; }
.big3 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.big3 div { padding: 8px 10px; border-radius: 10px; background: #0d1925; border: 1px solid var(--line); }
.big3 div:last-child { grid-column: 1 / -1; }
/* 狭い列で «人口» の «口» だけが次の行に落ちていた。文節で折り、行の長さをそろえる */
.big3 span { display: block; font-size: 12px; color: var(--sub); text-wrap: balance; word-break: auto-phrase; }
.big3 b { display: block; font-size: 19px; font-variant-numeric: tabular-nums; margin-top: 2px; }
.big3 div:nth-child(-n + 2) b { color: #ffb48a; }
.note { font-size: 12px; color: var(--sub); line-height: 1.6; margin: 8px 0 0; }
#summary h3, #details h3 { font-size: 13px; margin: 14px 0 6px; color: var(--sub); font-weight: 700; }
#r-pref { margin: 0; padding: 0; list-style: none; font-size: 13px; }
#r-pref button { width: 100%; display: grid; grid-template-columns: 3em 4.6em 1fr; gap: 8px; align-items: center; min-height: 40px; padding: 4px 6px; border: 0; border-bottom: 1px dashed rgba(255, 255, 255, 0.08); background: none; text-align: left; font-size: 13px; }
#r-pref button:hover { background: rgba(255, 255, 255, 0.05); }
#r-pref .p { font-weight: 700; }
#r-pref .t { color: var(--sub); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.c { display: inline-block; text-align: center; border-radius: 4px; font-weight: 800; color: #111; font-size: 12px; padding: 1px 4px; }
.c.dark { color: #fff; }

/* ── 地図の下：詳しい表 ── */
#details { max-width: 1200px; margin: 14px auto 0; padding: 4px 16px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; font-size: 13px; }
.res-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.bar { display: grid; grid-template-columns: 3.2em 1fr 4.6em; gap: 8px; align-items: center; margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.bar i { display: block; height: 10px; border-radius: 3px; background: var(--c); min-width: 2px; }
.bar span:last-child { text-align: right; color: var(--sub); }
#r-official, #r-history { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: #0d1925; border: 1px solid var(--line); line-height: 1.7; }
#r-official h3, #r-history h3 { margin-top: 0; }
#r-official ul, #r-history ul { margin: 0; padding-left: 1.2em; }
.vs { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.vs div { flex: 1; min-width: 140px; padding: 8px 10px; border-radius: 8px; background: var(--panel2); }
.vs b { font-size: 18px; display: block; }
table.obs { border-collapse: collapse; width: 100%; margin-top: 6px; }
table.obs th, table.obs td { border-bottom: 1px solid var(--line); padding: 5px 6px; text-align: left; }
table.obs th { color: var(--sub); font-weight: 600; }
table.obs .c { min-width: 2.8em; }
table.obs td:not(:first-child) { white-space: nowrap; }
table.obs tr.grp th { padding-top: 10px; color: #ffe3a3; font-size: 12px; }
.src { color: var(--sub); font-size: 12px; margin: 6px 0 0; }
.disclaimer { margin: 14px 0 0; font-size: 12px; color: var(--sub); line-height: 1.7; }

#guide-section { max-width: 1200px; margin: 24px auto; padding: 0 4px; line-height: 1.8; color: #cdd9e3; font-size: 14px; }
#guide-section h2 { font-size: 18px; color: var(--text); }
#guide-section ol { padding-left: 1.4em; font-size: 12px; color: var(--sub); }
#guide-section .steps { display: grid; gap: 10px; }
#guide-section .steps section { padding: 10px 14px; border-radius: 10px; background: #0d1925; border: 1px solid var(--line); }
#guide-section .steps h3 { margin: 0 0 4px; font-size: 15px; color: var(--text); }
#guide-section .steps p { margin: 4px 0 0; }
#guide-section .src { font-size: 12px; color: var(--sub); line-height: 1.7; overflow-wrap: anywhere; }
#guide-section .own { font-size: 12px; color: #ffe3a3; line-height: 1.7; }
.warn a { color: #ffe3a3; font-weight: 700; text-underline-offset: 3px; }
.related-apps, #ad-section { max-width: 1200px; margin: 28px auto 0; padding: 0 4px; }
.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-copy { margin: 6px 0 0; }
.footer-refs { margin: 6px 0 0; line-height: 1.7; font-size: 12px; }
.footer-refs a { color: var(--sub); }

/* 狭い画面：地図の下に右の列を続ける（ページごとスクロールする） */
@media (max-width: 900px) {
  #stage { display: block; height: auto; }
  #mapbox { aspect-ratio: 4 / 5; max-height: 72svh; width: 100%; }
  #side { overflow: visible; border-left: 0; border-top: 1px solid var(--line); }
  #tabs { position: static; }
  .res-grid { grid-template-columns: 1fr; }
}
@media (min-width: 600px) and (max-width: 900px) {
  #mapbox { aspect-ratio: 4 / 3; }
}
@media (max-width: 720px) {
  #app { padding: 0 10px; }
  .header-sub { display: block; margin: 0; }
  #site-header .name { font-size: 16px; line-height: 1.3; }
  #site-header .name a { min-height: 40px; }
  #legend span { min-width: 0; padding: 2px 3px; font-size: 11px; }
}
