/* 通れる道マップ専用。既存の支援ナビの配色・文字サイズ規則を継承する。 */

.visually-hidden {
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

body[data-page="road"] .wrap {
  max-width: 1180px;
}

.road-hero {
  background:
    radial-gradient(circle at 86% 18%, rgba(246, 194, 70, 0.2), transparent 26%),
    linear-gradient(145deg, #12332a 0%, #1d4b3e 100%);
  color: #fff;
  padding: 24px 0 22px;
}

.road-hero__eyebrow {
  color: #f6c246;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  margin: 0 0 8px;
}

.road-hero h1 {
  border: 0;
  color: #fff;
  font-size: clamp(1.65rem, 5.8vw, 2.4rem);
  line-height: 1.32;
  margin: 0 0 8px;
  padding: 0;
}

.road-hero__lead {
  color: #eef8f4;
  margin: 0;
  max-width: 48rem;
}

.road-source-status {
  align-items: center;
  background: #fff;
  border: 1px solid #cfdad5;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(18, 51, 42, 0.08);
  display: grid;
  gap: 6px;
  margin: -12px auto 18px;
  padding: 14px 16px;
  position: relative;
  z-index: 2;
}

.road-source-status__line {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.road-live-dot {
  background: #1a7f54;
  border: 3px solid #d9f2e7;
  border-radius: 50%;
  height: 14px;
  width: 14px;
}

.road-source-status strong {
  color: #12332a;
}

.road-source-status small {
  color: #52645e;
  line-height: 1.55;
}

.road-quick-guide {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0 0 18px;
}

.road-quick-guide__item {
  align-items: center;
  background: #fff;
  border: 1px solid #d6dfdb;
  border-radius: 12px;
  display: flex;
  font-size: 0.88rem;
  font-weight: 700;
  gap: 9px;
  line-height: 1.45;
  min-height: 60px;
  padding: 10px 12px;
}

.road-quick-guide__num {
  align-items: center;
  background: #12332a;
  border-radius: 50%;
  color: #fff;
  display: inline-flex;
  flex: 0 0 28px;
  font-size: 0.82rem;
  height: 28px;
  justify-content: center;
}

.road-map-shell {
  background: #e8eeeb;
  border: 1px solid #c8d4cf;
  border-radius: 18px;
  box-shadow: 0 14px 36px rgba(18, 51, 42, 0.12);
  margin: 0 0 20px;
  overflow: hidden;
  position: relative;
}

.road-toolbar {
  align-items: stretch;
  background: #fff;
  border-bottom: 1px solid #d6dfdb;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 12px;
}

.road-tool-button {
  align-items: center;
  background: #fff;
  border: 1.5px solid #b8c8c1;
  border-radius: 11px;
  color: #174438;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  gap: 7px;
  justify-content: center;
  min-height: 48px;
  padding: 8px 11px;
}

.road-tool-button:hover,
.road-tool-button:focus-visible {
  background: #eef7f3;
  border-color: #2b6b58;
}

.road-tool-button:focus-visible,
.road-mode-toggle:focus-within,
.road-extra-toggle:focus-within {
  outline: 3px solid #f6c246;
  outline-offset: 2px;
}

.road-tool-button svg {
  height: 20px;
  width: 20px;
}

.road-area-control {
  align-items: center;
  background: #f3f7f5;
  border: 1px solid #c8d4cf;
  border-radius: 11px;
  display: grid;
  gap: 2px;
  grid-column: 1 / -1;
  grid-template-columns: auto 1fr;
  min-height: 48px;
  padding: 6px 8px 6px 12px;
}

.road-area-control span {
  color: #52645e;
  font-size: 0.75rem;
  font-weight: 800;
  padding-right: 8px;
}

.road-area-control select {
  background: #fff;
  border: 1px solid #aebfb8;
  border-radius: 8px;
  color: #163e33;
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 800;
  min-height: 38px;
  padding: 5px 34px 5px 10px;
  width: 100%;
}

.road-area-control select:focus-visible {
  outline: 3px solid #f6c246;
  outline-offset: 1px;
}

.road-mode-picker {
  background: #f8faf9;
  border: 0;
  border-bottom: 1px solid #d6dfdb;
  margin: 0;
  padding: 11px 12px;
}

.road-mode-picker legend {
  color: #12332a;
  float: left;
  font-size: 0.86rem;
  font-weight: 900;
  margin: 0 0 9px;
  padding: 0;
  width: 100%;
}

.road-modes {
  clear: both;
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr;
}

.road-mode-toggle {
  align-items: center;
  background: #fff;
  border: 2px solid #d6dfdb;
  border-radius: 11px;
  cursor: pointer;
  display: grid;
  gap: 4px 9px;
  grid-template-columns: auto 1fr auto;
  min-height: 68px;
  padding: 9px 10px;
}

.road-mode-toggle input {
  accent-color: #1f6651;
  height: 22px;
  margin: 0;
  width: 22px;
}

.road-mode-toggle span {
  display: grid;
  gap: 2px;
}

.road-mode-toggle strong {
  color: #163e33;
  font-size: 0.9rem;
  line-height: 1.3;
}

.road-mode-toggle small {
  color: #5a6d66;
  font-size: 0.75rem;
  line-height: 1.35;
}

.road-mode-toggle em {
  align-self: start;
  background: #e5f3ed;
  border-radius: 99px;
  color: #176047;
  font-size: 0.66rem;
  font-style: normal;
  font-weight: 900;
  padding: 3px 7px;
}

.road-mode-toggle.is-active {
  background: #edf8f3;
  border-color: #1f7055;
  box-shadow: inset 0 0 0 1px #1f7055;
}

.road-mode-toggle--reference em {
  background: #f0f2f1;
  color: #53625d;
}

.road-mode-toggle--reference {
  border-color: #c8d4cf;
  width: 100%;
}

.road-mode-toggle.is-loading {
  background: #fff8e5;
  border-color: #d99e20;
}

.road-mode-help {
  background: #fff;
  border-bottom: 1px solid #d6dfdb;
  display: grid;
  gap: 2px;
  padding: 10px 14px;
}

.road-mode-help strong {
  color: #193f34;
  font-size: 0.84rem;
}

.road-mode-help span {
  color: #5b6c66;
  font-size: 0.76rem;
  line-height: 1.45;
}

.road-map {
  height: min(72vh, 820px);
  min-height: 520px;
  position: relative;
  width: 100%;
}

.road-map-loading {
  align-items: center;
  background: #e8eeeb;
  color: #294c42;
  display: flex;
  font-weight: 800;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: absolute;
  text-align: center;
  z-index: 3;
}

.road-map-loading[hidden] {
  display: none;
}

.road-map-message {
  background: rgba(18, 51, 42, 0.94);
  border-radius: 10px;
  bottom: 12px;
  color: #fff;
  font-size: 0.84rem;
  left: 50%;
  line-height: 1.45;
  max-width: calc(100% - 24px);
  padding: 9px 13px;
  position: absolute;
  text-align: center;
  transform: translateX(-50%);
  width: max-content;
  z-index: 4;
}

.road-map-message:empty {
  display: none;
}

.road-legend {
  background: #fff;
  border-top: 1px solid #d6dfdb;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 11px 13px;
}

.road-legend__item {
  align-items: center;
  color: #344d45;
  display: none;
  font-size: 0.78rem;
  font-weight: 700;
  gap: 6px;
}

.road-legend__item.is-visible {
  display: inline-flex;
}

.road-legend__line {
  border-radius: 4px;
  display: inline-block;
  height: 5px;
  width: 26px;
}

.road-legend__line--dashed {
  background-image: linear-gradient(
    90deg,
    currentColor 0 55%,
    transparent 55% 78%,
    currentColor 78% 100%
  ) !important;
  color: #6d3fc0;
}

.road-extra-options {
  background: #f8faf9;
  border-top: 1px solid #d6dfdb;
  padding: 0;
}

.road-extra-options summary {
  color: #52645e;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 10px 13px;
}

.road-extra-options__body {
  border-top: 1px solid #d6dfdb;
  display: grid;
  gap: 8px;
  padding: 10px 13px;
}

.road-extra-toggle {
  align-items: center;
  background: #fff;
  border: 1px solid #d6dfdb;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  gap: 9px;
  padding: 10px 13px;
}

.road-extra-toggle input {
  accent-color: #6d3fc0;
  height: 20px;
  width: 20px;
}

.road-extra-toggle span,
.road-extra-toggle strong,
.road-extra-toggle small {
  display: block;
}

.road-extra-toggle strong {
  color: #344d45;
  font-size: 0.8rem;
}

.road-extra-toggle small {
  color: #61726c;
  font-size: 0.72rem;
  margin-top: 2px;
}

.road-detail {
  background: #fff;
  border: 1px solid #c5d2cd;
  border-top: 6px solid var(--restriction-color, #d20f20);
  border-radius: 16px;
  bottom: 62px;
  box-shadow: 0 18px 54px rgba(18, 51, 42, 0.3);
  left: 18px;
  max-height: min(68vh, 620px);
  max-width: 560px;
  overflow: auto;
  padding: 18px;
  position: absolute;
  width: calc(100% - 36px);
  z-index: 8;
}

.road-detail[hidden] {
  display: none;
}

.road-detail__head {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.road-detail__head h2 {
  border: 0;
  color: var(--restriction-color, #7f151b);
  font-size: 1.15rem;
  margin: 0 0 8px;
  padding: 0;
}

.road-detail__close {
  align-items: center;
  background: #f0f3f2;
  border: 0;
  border-radius: 50%;
  color: #294c42;
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 42px;
  font-size: 1.35rem;
  height: 42px;
  justify-content: center;
}

.road-detail__grid {
  display: grid;
  gap: 7px 12px;
  grid-template-columns: auto 1fr;
  margin: 0 0 14px;
}

.road-detail__grid dt {
  color: #61726c;
  font-size: 0.82rem;
  font-weight: 700;
}

.road-detail__grid dd {
  color: #1c312a;
  font-size: 0.9rem;
  font-weight: 700;
  margin: 0;
  overflow-wrap: anywhere;
}

.road-detail__actions {
  display: grid;
  gap: 10px;
}

.road-safety-note {
  background: #fff4df;
  border-left: 4px solid #d58b00;
  border-radius: 12px;
  color: #5e4100;
  font-size: 0.9rem;
  line-height: 1.65;
  margin: 0 0 20px;
  padding: 14px 16px;
}

.road-list-search {
  border: 2px solid #b7c7c1;
  border-radius: 12px;
  font: inherit;
  margin: 0 0 12px;
  min-height: 52px;
  padding: 10px 13px;
  width: 100%;
}

.road-list-search:focus {
  border-color: #2b6b58;
  outline: 3px solid #f6c246;
  outline-offset: 1px;
}

.road-list {
  display: grid;
  gap: 9px;
  max-height: 420px;
  overflow: auto;
}

.road-list__item {
  background: #fff;
  border: 1px solid #d6dfdb;
  border-left: 5px solid #d7191c;
  border-radius: 10px;
  color: #1c312a;
  cursor: pointer;
  display: block;
  font: inherit;
  padding: 11px 12px;
  text-align: left;
  width: 100%;
}

.road-list__item:hover,
.road-list__item:focus-visible {
  background: #f0f7f4;
  outline: 2px solid #2b6b58;
}

.road-list__item strong,
.road-list__item small {
  display: block;
}

.road-list__item small {
  color: #61726c;
  margin-top: 3px;
}

.road-attribution {
  color: #52645e;
  font-size: 0.78rem;
  line-height: 1.65;
}

.maplibregl-ctrl-group button {
  height: 42px;
  width: 42px;
}

.maplibregl-ctrl-attrib {
  font-size: 10px;
}

@media (min-width: 640px) {
  .road-toolbar {
    grid-template-columns: repeat(2, max-content) minmax(230px, 1fr);
  }

  .road-area-control {
    grid-column: auto;
  }

  .road-modes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .road-quick-guide {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

}

@media (max-width: 639px) {
  .road-detail {
    border-radius: 18px 18px 0 0;
    bottom: calc(72px + env(safe-area-inset-bottom));
    left: 0;
    max-height: 68vh;
    max-width: none;
    position: fixed;
    width: 100%;
  }
}

@media (max-width: 420px) {
  .road-map {
    height: 66vh;
    min-height: 470px;
  }

  .road-tool-button {
    font-size: 0.84rem;
  }

}

@media (prefers-reduced-motion: reduce) {
  .road-map-shell *,
  .road-map-shell *::before,
  .road-map-shell *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
