:root {
  color-scheme: light;
  --ink: #15171a;
  --muted: #626872;
  --line: #dfe2e6;
  --paper: #f4f2ed;
  --panel: #ffffff;
  --red: #9f1d2d;
  --red-dark: #71121f;
  --red-soft: #f8e9eb;
  --blue: #1f5e78;
  --blue-soft: #e7f1f5;
  --green: #246747;
  --green-soft: #e8f3ed;
  --amber: #8a4f00;
  --amber-soft: #fff2da;
  --shadow: 0 18px 50px rgba(25, 31, 38, .09);
  --radius: 22px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 90% 0%, rgba(159,29,45,.08), transparent 32rem),
    var(--paper);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.skip-link {
  position: fixed; left: 12px; top: -80px; z-index: 100;
  padding: 10px 14px; background: #fff; border: 2px solid var(--ink); border-radius: 8px;
}
.skip-link:focus { top: 12px; }
.sr-only { position: absolute!important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  min-height: 72px; padding: max(12px, env(safe-area-inset-top)) max(18px, calc((100vw - 760px)/2));
  background: rgba(244,242,237,.92); backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(21,23,26,.08);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; color: var(--red); }
.brand-mark svg { width: 40px; height: 40px; }
.brand-mark path:first-child { fill: currentColor; stroke: none; }
.brand-mark path:last-child { fill: none; stroke: white; stroke-width: 3; stroke-linecap: round; }
.brand strong { display: block; font-size: 16px; line-height: 1.2; letter-spacing: .03em; }
.brand small { display: block; color: var(--muted); font-size: 10px; letter-spacing: .08em; margin-top: 3px; }
.network-status { flex: 0 0 auto; font-size: 11px; font-weight: 700; color: var(--green); background: var(--green-soft); border-radius: 999px; padding: 5px 9px; }
.network-status.offline { color: var(--amber); background: var(--amber-soft); }

.page-shell { width: min(100% - 28px, 720px); margin: 28px auto 64px; }
.panel { background: var(--panel); border: 1px solid rgba(21,23,26,.08); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(22px, 5vw, 36px); margin-bottom: 18px; }
.hero { overflow: hidden; position: relative; background: var(--ink); color: #fff; }
.hero::after { content: ""; position: absolute; width: 280px; height: 280px; border: 48px solid rgba(255,255,255,.055); border-radius: 50%; right: -125px; top: -100px; }
.eyebrow, .step-label { margin: 0 0 8px; font-size: 11px; font-weight: 800; letter-spacing: .18em; color: var(--red); }
.hero .eyebrow { color: #ffadb7; }
.hero h1 { position: relative; z-index: 1; margin: 0; font-size: clamp(30px, 8vw, 52px); line-height: 1.18; letter-spacing: -.035em; }
.hero-copy { position: relative; z-index: 1; color: #d9dde1; max-width: 38em; margin: 18px 0 24px; }
.critical-note { position: relative; z-index: 1; display: grid; gap: 5px; padding: 16px 18px; background: rgba(255,255,255,.1); border-left: 4px solid #ffad52; border-radius: 10px; }
.critical-note strong { color: #fff; }
.critical-note span { font-size: 13px; color: #d9dde1; }

.section-heading, .result-heading-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; }
h2 { margin: 0; font-size: clamp(22px, 5vw, 28px); line-height: 1.3; }
.text-button { border: 0; background: transparent; color: var(--red); font-weight: 700; padding: 8px 0; cursor: pointer; }
.text-button:hover { text-decoration: underline; }

.mode-selector { margin: 0; padding: 0; border: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-selector label { min-width: 0; }
.mode-selector input { position: absolute; opacity: 0; pointer-events: none; }
.mode-card { display: grid; grid-template-columns: 38px 1fr; column-gap: 10px; align-items: center; min-height: 98px; padding: 15px; border: 2px solid var(--line); border-radius: 15px; cursor: pointer; transition: .18s ease; }
.mode-card svg { grid-row: 1 / 3; width: 38px; height: 38px; fill: none; stroke: var(--muted); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.mode-card strong { line-height: 1.25; }
.mode-card small { color: var(--muted); font-size: 11px; line-height: 1.35; }
.mode-selector input:checked + .mode-card { border-color: var(--red); background: var(--red-soft); box-shadow: 0 0 0 3px rgba(159,29,45,.08); }
.mode-selector input:checked + .mode-card svg { stroke: var(--red); }
.mode-selector input:focus-visible + .mode-card { outline: 3px solid rgba(31,94,120,.4); outline-offset: 2px; }

.action-block { margin-top: 26px; }
.primary-button, .secondary-button, .official-button { display: inline-flex; justify-content: center; align-items: center; gap: 9px; border: 0; border-radius: 13px; font-weight: 800; text-decoration: none; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease; }
.primary-button { width: 100%; min-height: 60px; padding: 14px 18px; color: #fff; background: linear-gradient(135deg, var(--red), var(--red-dark)); box-shadow: 0 12px 24px rgba(159,29,45,.22); font-size: 17px; }
.primary-button svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; }
.primary-button:hover, .official-button:hover { transform: translateY(-1px); }
.primary-button:disabled { opacity: .55; cursor: wait; transform: none; }
.privacy-note { margin: 9px 0 0; color: var(--muted); font-size: 11px; text-align: center; }
.secondary-button { min-height: 46px; padding: 10px 16px; color: var(--ink); background: #fff; border: 1px solid var(--line); }
.full-width { width: 100%; margin-top: 12px; }

.manual-location { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.manual-location summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 700; }
.manual-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.manual-form label { font-size: 12px; color: var(--muted); }
.manual-form input { width: 100%; margin-top: 4px; padding: 12px; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.manual-form .secondary-button { grid-column: 1 / -1; }

.progress-panel { display: flex; align-items: center; gap: 16px; }
.progress-panel p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.spinner { width: 34px; height: 34px; flex: 0 0 auto; border: 4px solid var(--line); border-top-color: var(--red); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.risk-result { margin: 18px 0; border-radius: var(--radius); padding: 24px; border: 1px solid; box-shadow: var(--shadow); }
.risk-result.danger { color: var(--red-dark); background: var(--red-soft); border-color: #e8b4bb; }
.risk-result.clear { color: var(--green); background: var(--green-soft); border-color: #b9d8c8; }
.risk-result.uncertain { color: var(--amber); background: var(--amber-soft); border-color: #edcc92; }
.risk-kicker { margin: 0 0 5px; font-size: 11px; font-weight: 800; letter-spacing: .13em; }
.risk-result h2 { font-size: clamp(24px, 6vw, 34px); }
.risk-result p { margin: 10px 0 0; color: currentColor; }
.location-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 14px; font-size: 12px; opacity: .82; }
.result-summary { margin: -8px 0 18px; color: var(--muted); font-size: 13px; }

.shelter-list { display: grid; gap: 12px; }
.shelter-card { background: #fff; border: 1px solid var(--line); border-radius: 17px; padding: 18px; box-shadow: 0 8px 24px rgba(25,31,38,.05); }
.shelter-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.shelter-rank { flex: 0 0 auto; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 12px; font-weight: 800; }
.shelter-title-wrap { flex: 1; min-width: 0; }
.shelter-title { margin: 0; font-size: 18px; line-height: 1.4; }
.shelter-type { display: inline-block; margin-top: 5px; padding: 3px 7px; background: var(--blue-soft); color: var(--blue); border-radius: 6px; font-size: 10px; font-weight: 800; }
.shelter-distance { flex: 0 0 auto; text-align: right; }
.shelter-distance strong { display: block; font-size: 20px; line-height: 1.2; }
.shelter-distance small { color: var(--muted); }
.shelter-address { margin: 13px 0 0; color: var(--muted); font-size: 13px; }
.shelter-note { margin: 8px 0 0; padding: 8px 10px; border-radius: 8px; background: var(--amber-soft); color: var(--amber); font-size: 11px; }
.route-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.route-button { display: flex; justify-content: center; align-items: center; min-height: 42px; border-radius: 10px; text-decoration: none; font-size: 12px; font-weight: 800; color: #fff; background: var(--red); }
.route-button.secondary { color: var(--ink); background: #eef0f2; }
.empty-state { padding: 24px; border: 1px dashed var(--line); border-radius: 15px; text-align: center; color: var(--muted); background: #fff; }

.source-panel { margin-top: 26px; box-shadow: none; }
.caution-list { padding-left: 1.25em; margin: 0; color: var(--muted); font-size: 13px; }
.caution-list li + li { margin-top: 9px; }
.official-links { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 20px; }
.official-button { min-height: 48px; padding: 10px 14px; color: #fff; background: var(--ink); }
.official-button.subtle { color: var(--ink); background: #eef0f2; }
.data-status { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.footer { padding: 0 20px calc(28px + env(safe-area-inset-bottom)); text-align: center; color: var(--muted); font-size: 10px; }
.footer p { margin: 2px 0; }
.noscript { margin: 20px; padding: 16px; background: var(--red-soft); color: var(--red-dark); border-radius: 10px; }

@media (max-width: 520px) {
  .topbar { padding-left: 14px; padding-right: 14px; }
  .page-shell { width: min(100% - 20px, 720px); margin-top: 16px; }
  .panel { border-radius: 18px; padding: 21px; }
  .hero h1 { font-size: 33px; }
  .mode-selector { grid-template-columns: 1fr; }
  .mode-card { min-height: 82px; }
  .manual-form { grid-template-columns: 1fr; }
  .manual-form .secondary-button { grid-column: auto; }
  .result-heading-row { align-items: center; }
  .shelter-top { flex-wrap: wrap; }
  .shelter-title-wrap { min-width: calc(100% - 44px); }
  .shelter-distance { width: 100%; text-align: left; padding-left: 42px; }
  .shelter-distance strong { display: inline; margin-right: 5px; }
  .official-links { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto!important; animation-duration: .01ms!important; animation-iteration-count: 1!important; transition-duration: .01ms!important; }
}

.check-badge {
  display: inline-block;
  margin: 5px 0 0 5px;
  padding: 3px 7px;
  color: var(--green);
  background: var(--green-soft);
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
}

/* 20260801-5 visual map update */
:root {
  --red: #1f7a45;
  --red-dark: #165431;
  --red-soft: #e7f6ec;
}
.page-title {
  margin: 0;
  font-size: clamp(28px, 7vw, 40px);
  line-height: 1.15;
  letter-spacing: -.03em;
}
.section-lead {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}
.compact-top { align-items: flex-start; }
.brand-mark {
  width: 42px;
  height: 42px;
  color: var(--red);
}
.brand-mark svg { width: 42px; height: 42px; }
.brand-mark .bg { fill: currentColor; }
.brand-mark .fg {
  fill: none;
  stroke: #fff;
  stroke-width: 3.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.action-block {
  display: grid;
  gap: 10px;
}
.primary-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.overview-panel {
  background: linear-gradient(180deg, #ffffff, #f8faf8);
}
.hero-copy { margin: 12px 0 18px; color: var(--muted); }
.critical-note {
  background: #f6fbf7;
  border-left-color: #2f9e5f;
}
.critical-note strong { color: var(--ink); }
.critical-note span { color: var(--muted); }
.map-panel { margin: 16px 0 18px; }
.map-heading { margin-bottom: 14px; }
.map-caption { margin-top: 6px; }
.hazard-map-frame {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  background: #d7e0d9;
  border: 1px solid rgba(21,23,26,.08);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
}
.hazard-map {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background:
    linear-gradient(180deg, rgba(255,255,255,.18), rgba(255,255,255,0)),
    #d7e0d9;
}
.hazard-map[data-loading="true"]::before {
  content: '地図を描画中…';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 14px;
}
.map-tile-layer,
.map-overlay {
  position: absolute;
  inset: 0;
}
.map-tile {
  position: absolute;
  width: 256px;
  height: 256px;
  object-fit: cover;
  background: #dde5df;
}
.map-overlay {
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.map-hazard-fill {
  fill: rgba(191, 59, 46, .34);
  stroke: rgba(140, 31, 21, .8);
  stroke-width: 1.4;
}
.map-hazard-fill.flood {
  fill: rgba(27, 93, 170, .28);
  stroke: rgba(20, 78, 148, .75);
}
.map-user-ring {
  fill: rgba(255,255,255,.88);
  stroke: #101820;
  stroke-width: 1.6;
}
.map-user-core {
  fill: #ff6b4a;
  stroke: #fff;
  stroke-width: 2;
}
.map-shelter-ring {
  fill: rgba(255,255,255,.95);
  stroke: #165431;
  stroke-width: 1.4;
}
.map-shelter-core {
  fill: #1f7a45;
}
.map-safe-label {
  font-size: 10px;
  font-weight: 700;
  fill: #101820;
  paint-order: stroke;
  stroke: rgba(255,255,255,.9);
  stroke-width: 3px;
  stroke-linejoin: round;
}
.map-note {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
}
.legend-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: -1px;
}
.legend-hazard {
  background: rgba(191, 59, 46, .55);
  border: 1px solid rgba(140, 31, 21, .8);
  border-radius: 4px;
}
.legend-point { background: #ff6b4a; box-shadow: 0 0 0 2px #fff inset, 0 0 0 1px #101820; }
.legend-shelter { background: #1f7a45; box-shadow: 0 0 0 2px #fff inset, 0 0 0 1px #165431; }
.open-map-link {
  white-space: nowrap;
}
@media (max-width: 640px) {
  .topbar {
    padding-left: 16px;
    padding-right: 16px;
  }
  .page-shell {
    width: min(100% - 18px, 720px);
    margin-top: 16px;
  }
  .panel {
    padding: 20px 18px;
    border-radius: 20px;
  }
  .section-heading,
  .result-heading-row {
    gap: 10px;
  }
  .map-legend {
    gap: 8px 12px;
  }
}

/* 20260801-6 interactive hazard map */
.hazard-map-frame {
  overflow: hidden;
  border-radius: 20px;
}
.hazard-map {
  position: relative;
  width: 100%;
  height: clamp(390px, 72vw, 560px);
  aspect-ratio: auto;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  cursor: grab;
  background: #d9e1dc;
  overscroll-behavior: contain;
}
.hazard-map:active { cursor: grabbing; }
.map-scene,
.map-tile-layer,
.map-overlay {
  position: absolute;
  inset: 0;
}
.map-tile-layer { overflow: hidden; }
.map-tile {
  position: absolute;
  width: 256px;
  height: 256px;
  max-width: none;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  background: #d9e1dc;
}
.map-overlay {
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
}
.map-loading {
  position: absolute;
  top: 12px;
  left: 50%;
  z-index: 8;
  transform: translateX(-50%);
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(21,23,26,.82);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
  pointer-events: none;
}
.map-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 9;
  display: grid;
  gap: 6px;
}
.map-control-button,
.map-compass {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(21,23,26,.16);
  border-radius: 12px;
  background: rgba(255,255,255,.94);
  color: var(--ink);
  box-shadow: 0 5px 18px rgba(15,24,19,.16);
  cursor: pointer;
  font-weight: 800;
  line-height: 1;
}
.map-control-button { font-size: 25px; }
.map-control-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.map-compass {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 9;
  border-radius: 50%;
  width: 50px;
  height: 50px;
}
.map-compass.active { box-shadow: 0 0 0 3px rgba(31,122,69,.18), 0 5px 18px rgba(15,24,19,.16); }
.map-compass.unavailable { opacity: .58; }
.compass-n {
  position: absolute;
  top: 3px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: #a12929;
  z-index: 2;
}
.compass-arrow {
  width: 35px;
  height: 35px;
  transform-origin: 50% 50%;
  transition: transform .18s ease-out;
}
.compass-arrow path:first-child { fill: #b52626; }
.compass-arrow path:last-child { fill: #2f3a42; }
.map-attribution {
  position: absolute;
  right: 5px;
  bottom: 4px;
  z-index: 8;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(255,255,255,.82);
  color: #384149;
  font-size: 9px;
  line-height: 1.2;
}
.map-attribution a { text-decoration: none; }
.map-scale {
  position: absolute;
  left: 12px;
  bottom: 13px;
  z-index: 8;
  min-width: 34px;
  height: 18px;
  padding-top: 2px;
  border-left: 2px solid #172027;
  border-right: 2px solid #172027;
  border-bottom: 2px solid #172027;
  color: #172027;
  background: rgba(255,255,255,.7);
  font-size: 10px;
  font-weight: 800;
  text-align: center;
  text-shadow: 0 1px 0 #fff;
}
.map-user-pulse {
  fill: rgba(255,107,74,.18);
  stroke: rgba(255,107,74,.25);
  stroke-width: 1;
}
@media (max-width: 520px) {
  .hazard-map { height: min(108vw, 480px); }
  .map-control-button { width: 40px; height: 40px; }
  .map-compass { width: 46px; height: 46px; }
}
