[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;
  --dead: #ffb48a;
}
* { 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 { 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; }

#app { padding: 0 16px; }

/* ── 地図・操作（左）と結果（右） ── */
/* 地図の高さは操作の列と切り離して決める（同じ枠に入れていたら、操作が増えるたびに地図が削られた）。
   右の列は contain: size で行の高さを押し広げず、地図＋操作の高さの中でスクロールする */
#stage { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) 360px; border-radius: 14px; overflow: hidden; background: #08121c; border: 1px solid var(--line); }
#mapcol { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
#mapbox { position: relative; flex: none; height: clamp(420px, 76svh, 820px); container-type: inline-size; }
#map { position: absolute; inset: 0; }
#mapbox > div:not(#map), #mapbox > button { position: absolute; }
#loading { inset: 0; display: grid; place-items: center; color: var(--sub); font-size: 14px; background: #08121c; z-index: 5; }
#flash { inset: 0; background: radial-gradient(circle at 50% 45%, #ffffff 0%, #fff4d6 35%, #ffd27a 100%); pointer-events: none; z-index: 4; opacity: 0; }
#hint { left: 12px; top: 12px; max-width: calc(100% - 80px); padding: 8px 16px; border-radius: 99px; background: rgba(8, 18, 28, 0.88); border: 1px solid rgba(255, 138, 61, 0.6); font-size: 14px; font-weight: 700; pointer-events: none; white-space: nowrap; z-index: 3; }
.sp { display: none; }
@media (hover: none) { .pc { display: none; } .sp { display: inline; } }
#clock { left: 12px; top: 12px; max-width: calc(100% - 84px); padding: 8px 14px; background: rgba(8, 18, 28, 0.88); border: 1px solid var(--line); border-radius: 10px; font-variant-numeric: tabular-nums; pointer-events: none; z-index: 3; }
#clock b { font-size: 20px; }
#clock span { display: block; font-size: 12px; color: var(--sub); }
#mute { right: 10px; top: 150px; width: 44px; height: 44px; border-radius: 10px; border: 1px solid rgba(0, 0, 0, 0.2); background: #fff; color: #222; font-size: 19px; z-index: 3; }

/* 地点の板。位置は main.js が押した点の横に合わせる。地図の枠が狭いときは下端に敷く */
#pop { width: 300px; 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); z-index: 6; font-size: 13px; line-height: 1.6; }
/* 地点の板を開いているあいだは凡例を隠す（左上で重なる。× で閉じれば戻る） */
#mapbox:has(> #pop:not([hidden])) #legend { display: none; }
@container (max-width: 559px) {
  #pop { left: 8px !important; right: 8px; bottom: 8px; top: auto !important; width: auto; max-height: calc(100% - 16px); }
  /* 板を下に敷いているあいだは «上から見る» と右上のボタンを隠す（読んでいるあいだは使わない。× で閉じれば戻る） */
  #mapbox:has(> #pop:not([hidden])) :is(#view, #mute, .maplibregl-ctrl-top-right) { display: none; }
}
.pop-head { display: flex; align-items: flex-start; gap: 8px; }
.pop-head .nm { flex: 1; min-width: 0; font-size: 16px; font-weight: 800; line-height: 1.35; }
.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-zone { margin: 8px 0 0; padding: 8px 10px; border-radius: 8px; background: rgba(255, 90, 54, 0.12); border-left: 4px solid var(--c, #ff5a36); }
.pop-zone b { font-size: 15px; }
.pop-tbl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 8px 0 0; }
.pop-tbl span { color: var(--sub); }
.pop-tbl b { font-variant-numeric: tabular-nums; }
.pop-places { margin: 10px 0; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.pop-places h4 { margin: 0 0 4px; font-size: 13px; }
.pop-places ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.pop-places li { display: grid; grid-template-columns: 1fr auto; gap: 0 8px; padding: 4px 8px; border-radius: 6px; border-left: 4px solid var(--c); background: rgba(255, 255, 255, 0.04); }
.pop-places li.lv0 { --c: #5fbf6e; }
.pop-places li.lv1 { --c: #f6ad2f; }
.pop-places li.lv2 { --c: #e0443a; }
.pop-places .pl { font-size: 12px; }
.pop-places b { font-size: 12px; color: var(--c); text-align: right; }
.pop-places small { grid-column: 1 / -1; font-size: 11px; color: var(--sub); }
.pop-places small:empty { display: none; }
.pop-note { margin: 6px 0 0; font-size: 11px; color: var(--sub); }
/* 板の中身が長くてスクロールしても、爆心地にするボタンは下端に見えたままにする（スマホで隠れていた） */
/* 上の影で、ボタンの下にも続きがあると分かるようにする。2 つが横に収まらなければ、折り返さずに 2 段にする */
.pop-act { display: flex; flex-wrap: wrap; gap: 8px; position: sticky; bottom: -14px; margin: 10px -14px -14px; padding: 8px 14px 14px; background: rgb(13, 25, 37); border-top: 1px solid var(--line); box-shadow: 0 -10px 12px rgba(13, 25, 37, 0.85); }
.pop-act button { flex: 1 1 auto; min-height: 44px; padding: 4px 8px; border-radius: 10px; font-weight: 800; font-size: 13px; line-height: 1.3; white-space: nowrap; }
.pop-act .go { border: 0; background: var(--accent); color: #1a0d03; }

/* 地図のすぐ下の操作 */
#dock { flex: none; display: flex; flex-direction: column; gap: 6px; padding: 10px 12px 12px; background: var(--panel); border-top: 1px solid var(--line); }
#dock .row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#dock .lbl { flex: none; width: 2.6em; font-size: 12px; color: var(--sub); font-weight: 700; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button, .seg a { min-height: 40px; padding: 0 14px; border: 0; background: none; color: var(--sub); font-size: 13px; border-right: 1px solid var(--line); display: inline-flex; align-items: center; text-decoration: none; }
.seg > :last-child { border-right: 0; }
.seg [aria-pressed="true"], .seg [aria-current="page"] { background: rgba(255, 138, 61, 0.22); color: var(--text); font-weight: 800; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; }
.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); }
.chips button[aria-pressed="true"] { border-color: var(--accent); background: rgba(255, 138, 61, 0.22); font-weight: 800; }
.chips button small { color: var(--sub); font-size: 11px; margin-left: 4px; }
.slider { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 200px; }
.slider input { flex: 1; accent-color: var(--accent); height: 40px; margin: 0; }
.slider b { min-width: 5.5em; text-align: right; font-variant-numeric: tabular-nums; }
.tip { font-size: 12px; color: var(--sub); flex: 1; min-width: 180px; line-height: 1.5; }
#search { position: relative; flex: 1; min-width: 180px; }
#q { width: 100%; min-height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: #0d1925; color: var(--text); font: inherit; font-size: 14px; }
#q:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
#q-list { position: absolute; left: 0; right: 0; bottom: calc(100% + 4px); z-index: 10; margin: 0; padding: 4px; list-style: none; max-height: 280px; overflow: auto; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }
#q-list button { width: 100%; min-height: 40px; padding: 4px 10px; border: 0; border-radius: 6px; background: none; text-align: left; font-size: 14px; }
#q-list button:hover, #q-list button.on { background: rgba(255, 138, 61, 0.2); }
#q-list small { color: var(--sub); margin-left: 6px; font-size: 12px; }

/* ── 右の列（数字だけ） ── */
#side { min-width: 0; overflow: auto; contain: size; background: var(--panel); border-left: 1px solid var(--line); padding: 14px 16px 18px; }
#empty h2 { margin: 0 0 6px; font-size: 16px; }
#empty p { margin: 0 0 12px; font-size: 13px; color: var(--sub); line-height: 1.7; }
.res-head h2 { margin: 0; font-size: 17px; line-height: 1.4; }
.res-head p { margin: 2px 0 0; font-size: 12px; color: var(--sub); line-height: 1.5; }
.caution { margin: 10px 0 0; padding: 6px 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; border: 0; background: none; color: #ffe3a3; font-size: 12px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.dead { display: grid; gap: 6px; margin-top: 10px; }
.dead div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 8px 12px; border-radius: 10px; background: rgba(255, 90, 54, 0.1); border: 1px solid rgba(255, 138, 61, 0.35); }
.dead span { font-size: 12px; color: var(--sub); }
.dead b { font-size: 20px; color: var(--dead); font-variant-numeric: tabular-nums; line-height: 1.35; }
.dead div:last-child b { color: #ffe3a3; }
.dead small { flex-basis: 100%; font-size: 12px; color: var(--sub); }
.dead small:empty { display: none; }
#r-gz { display: flex; align-items: center; gap: 4px 8px; flex-wrap: wrap; }
#side h3 { font-size: 13px; margin: 16px 0 6px; color: var(--sub); font-weight: 700; }
.rings { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.rings li { display: grid; grid-template-columns: 12px 1fr auto; gap: 2px 8px; align-items: baseline; padding: 6px 8px; border-radius: 8px; background: #0d1925; font-size: 13px; }
.rings i { width: 12px; height: 12px; border-radius: 50%; background: var(--c); border: 2px solid var(--c2, var(--c)); align-self: center; }
.rings .nm { font-weight: 700; }
.rings .km { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.rings .ds { grid-column: 2 / 4; font-size: 12px; color: var(--sub); line-height: 1.5; }
.rings .pp { grid-column: 2 / 4; font-size: 12px; font-variant-numeric: tabular-nums; }
.rings li.none { opacity: 0.55; }
.note { font-size: 12px; color: var(--sub); line-height: 1.6; margin: 8px 0 0; }
#r-muni { margin: 0; padding: 0; list-style: none; font-size: 13px; }
#r-muni li { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 6px 4px; border-bottom: 1px dashed rgba(255, 255, 255, 0.08); }
#r-muni small { color: var(--sub); margin-left: 4px; }
#r-muni b { font-variant-numeric: tabular-nums; color: var(--dead); font-weight: 700; }
#r-hist { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: #0d1925; border: 1px solid var(--line); font-size: 12px; line-height: 1.7; }
#r-hist h4 { margin: 0 0 4px; font-size: 13px; color: var(--text); }
#r-hist .vs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 6px 0; }
#r-hist .vs div { padding: 6px 8px; border-radius: 8px; background: var(--panel2); }
#r-hist .vs b { display: block; font-size: 15px; color: var(--text); }
#r-hist p { margin: 4px 0 0; color: var(--sub); }

/* 共有・比べる */
.share { display: flex; gap: 6px; margin-top: 10px; }
.share button { flex: 1; }
.ghost { min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font-size: 13px; font-weight: 700; white-space: nowrap; }
.ghost:hover { border-color: var(--accent); }
.ghost:disabled { opacity: 0.6; cursor: progress; }
#cmp { min-height: 40px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: #0d1925; color: var(--text); font: inherit; font-size: 13px; }
#r-cmp { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: #0d1925; border: 1px dashed rgba(255, 255, 255, 0.55); font-size: 12px; line-height: 1.6; }
#r-cmp h4 { margin: 0 0 6px; font-size: 13px; }
.cmp-tbl { display: grid; grid-template-columns: auto 1fr 1fr; gap: 3px 10px; align-items: baseline; }
.cmp-tbl span { color: var(--sub); }
.cmp-tbl b { text-align: right; font-variant-numeric: tabular-nums; }
#r-cmp p { margin: 6px 0 0; color: var(--sub); }
#r-lm .ds { color: var(--text); }
#card { max-width: min(760px, calc(100vw - 32px)); max-height: calc(100svh - 32px); overflow: auto; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--text); }
#card::backdrop { background: rgba(3, 8, 14, 0.8); }
#card h2 { margin: 0 0 10px; font-size: 17px; }
#card img { display: block; width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); }
.card-act { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.card-act > * { flex: 1; min-width: 120px; }
a.primary { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
/* 現在地の印（押すと «ここにいたら»） */
.me { width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; display: grid; place-items: center; }
.me::before { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 3px solid #fff; background: #2f8bff; box-shadow: 0 0 0 6px rgba(47, 139, 255, 0.3), 0 2px 6px rgba(0, 0, 0, 0.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); }
#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.8); }
#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%; }

/* MapLibre の部品を地図の右上・右下にそろえる */
.maplibregl-ctrl-group button { width: 44px; height: 44px; }
.maplibregl-ctrl-attrib { font-size: 11px; }

#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 .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; }
.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; }

/* 狭い画面：地図 → 操作 → 結果の順に縦へ続ける（ページごとスクロールする） */
@media (max-width: 900px) {
  #stage { display: block; height: auto; }
  #mapbox { height: auto; aspect-ratio: 4 / 5; max-height: 70svh; width: 100%; }
  #side { overflow: visible; contain: none; border-left: 0; border-top: 1px solid var(--line); }
}
@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 { gap: 8px; }
  /* 日本語の名前は途中で折り返さない（言語の釦の分だけ狭く、«シミュレータ／ー» と切れていた） */
  #site-header .name { font-size: 15px; line-height: 1.3; display: block; min-width: 0; word-break: keep-all; }
  .langsw button { min-width: 40px; padding: 0 8px; }
  #dock .lbl { width: 100%; }
  #dock .lbl:empty { display: none; }
  #hint { font-size: 13px; }
}
.gz { pointer-events: none; }
#skip, #view { z-index: 3; min-height: 44px; padding: 0 16px; border-radius: 99px; border: 1px solid rgba(255, 255, 255, 0.35); background: rgba(8, 18, 28, 0.82); color: var(--text); font-weight: 800; font-size: 13px; }
#skip { left: 12px; bottom: 12px; }
#view { left: 12px; bottom: 12px; }
#skip:hover, #view:hover { border-color: var(--accent); }
#wind-dir { min-height: 40px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: #0d1925; color: var(--text); font: inherit; font-size: 13px; }
/* PC では操作の列を詰めて、地図の高さを残す（スマホは指で押すので 40px のまま） */
@media (hover: hover) and (min-width: 901px) {
  #dock { gap: 4px; padding: 8px 12px 10px; }
  #dock .chips button, #dock .seg button, #dock .seg a, #wind-dir, #q { min-height: 34px; }
  #dock .slider input { height: 30px; }
}

/* 地図の上の凡例（地図の色の見方） */
#legend { position: absolute; left: 12px; top: 60px; width: min(270px, calc(100% - 84px)); max-height: calc(100% - 130px); overflow: auto; z-index: 3; padding: 0; border-radius: 12px; background: rgba(8, 18, 28, 0.88); border: 1px solid var(--line); font-size: 12px; line-height: 1.45; }
#legend summary { cursor: pointer; min-height: 40px; display: flex; align-items: center; padding: 0 12px; font-weight: 800; font-size: 13px; list-style: none; }
#legend summary::-webkit-details-marker { display: none; }
#legend summary::after { content: "▾"; margin-left: auto; padding-left: 10px; color: var(--sub); }
#legend[open] summary::after { content: "▴"; }
#legend-body { padding: 0 12px 6px; display: grid; gap: 4px; }
.lg-row { display: grid; grid-template-columns: 18px 1fr auto; gap: 8px; align-items: center; }
.lg-sw { display: block; width: 18px; height: 12px; border-radius: 3px; }
.lg-v { color: var(--sub); font-variant-numeric: tabular-nums; white-space: nowrap; }
#legend-note { margin: 0; padding: 0 12px 10px; color: #ffe3a3; font-size: 12px; display: grid; gap: 4px; }
.zones li { grid-template-columns: 14px 1fr auto; }
.zones .sq { width: 14px; height: 14px; border-radius: 3px; border: 0; }
@media (max-width: 720px) { #legend { left: 8px; top: 56px; width: calc(100% - 76px); } }

/* 地図のカーソル。MapLibre の既定は手のひら（押すと握る手）。押すと爆心地・地点を選ぶので十字にし、
   地図を動かしている間だけ握る手、演出の最中（押しても何も起きない）は矢印 */
#map .maplibregl-canvas-container.maplibregl-interactive,
#map .maplibregl-canvas-container.maplibregl-interactive:active { cursor: crosshair; }
#map.moving .maplibregl-canvas-container.maplibregl-interactive { cursor: grabbing; }
#map.playing .maplibregl-canvas-container.maplibregl-interactive { cursor: default; }
