/* Road navigation and manual correction mode. */
.road-mode-toggle {
  position: absolute;
  top: 42px;
  right: 10px;
  z-index: 12;
  padding: 6px 9px;
  border: 1px solid #c8aa82;
  border-radius: 5px;
  background: #f5e6c8;
  color: #5a4632;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}
.road-mode-toggle:hover,
.road-mode-toggle.active {
  border-color: #5a4632;
  background: #e8833a;
  color: #3d2c1e;
}
.road-overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: none;
  pointer-events: none;
}
.map-wrap.road-active .road-overlay { display: block; }
.map-wrap.road-active .site-labels { opacity: .18; pointer-events: none; }
.map-wrap.road-active .map-companions,
.map-wrap.road-active .completion-marks { opacity: .24; pointer-events: none; }
.map-wrap.road-editing .road-overlay { pointer-events: auto; cursor: crosshair; }
.map-wrap.road-drawing .road-overlay { cursor: crosshair; }
.road-overlay { touch-action: none; }
.road-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}
#roadLines { opacity: .72; }
.map-wrap.road-editing #roadLines { opacity: .92; }
.road-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 2.6;
  pointer-events: stroke;
  cursor: pointer;
}
.road-casing,
.road-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.road-casing { stroke: rgba(255, 248, 231, .92); stroke-width: .9; }
.road-line { stroke-width: .46; }
.road-kind-main { stroke: #8f6d45; }
.road-kind-walk { stroke: #5f8d58; }
.road-kind-bridge { stroke: #4e86a8; stroke-dasharray: 1.5 .7; }
.road-segment:hover .road-casing,
.road-casing.is-selected { stroke: #fff8e7; stroke-width: 1.15; }
.road-segment:hover .road-line,
.road-line.is-selected { stroke: #e8833a; stroke-width: .72; }
.road-node {
  fill: #fff8e7;
  stroke: #5a7e3e;
  stroke-width: .28;
  pointer-events: all;
  cursor: grab;
}
.road-node-hit {
  fill: transparent;
  stroke: transparent;
  pointer-events: all;
  cursor: grab;
}
.road-node-hit:active { cursor: grabbing; }
.road-node:hover,
.road-node.is-selected {
  fill: #e8833a;
  stroke: #5a4632;
  stroke-width: .42;
}
.road-node:active { cursor: grabbing; }
.road-draft-line {
  fill: none;
  stroke: #c85050;
  stroke-width: .65;
  stroke-dasharray: 1.2 .6;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.road-draft-node {
  fill: #fff8e7;
  stroke: #c85050;
  stroke-width: .3;
  pointer-events: none;
}
.route-casing,
.route-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.route-casing { stroke: #fff8e7; stroke-width: 1.75; }
.route-line { stroke: #d64f2f; stroke-width: 1.05; }
.road-markers { position: absolute; inset: 0; pointer-events: none; }
.road-marker {
  position: absolute;
  display: grid;
  place-items: center;
  width: 2.15rem;
  height: 2.15rem;
  border: 2px solid #fff8e7;
  border-radius: 50%;
  background: #6a994e;
  color: #fff8e7;
  font-size: .75rem;
  font-weight: 900;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 2px #5a4632;
}
.road-marker-end { background: #c85050; }

.road-panel { display: grid; gap: .75rem; }
.road-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  padding-bottom: .65rem;
  border-bottom: 1px solid #dfc9a4;
}
.road-panel-head span {
  display: block;
  color: #a9642f;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .08em;
}
.road-panel-head h3 { margin: .1rem 0 0; color: #3d2c1e; font-size: 1.05rem; }
.road-panel-head small { color: #786450; font-size: .72rem; white-space: nowrap; }
.road-view-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .25rem;
  padding: .25rem;
  border: 1px solid #c8aa82;
  border-radius: .375rem;
  background: #f5e6c8;
}
.road-view-switch button {
  min-height: 2.35rem;
  border: 0;
  border-radius: .25rem;
  background: transparent;
  color: #786450;
  font: inherit;
  font-size: .78rem;
  font-weight: 800;
  cursor: pointer;
}
.road-view-switch button.active { background: #e8833a; color: #3d2c1e; }
.road-help { margin: 0; color: #786450; font-size: .78rem; line-height: 1.55; }
.road-route-form { display: grid; gap: .55rem; }
.road-route-form label,
.road-draw-box label,
.road-selected-card label {
  display: grid;
  gap: .28rem;
  color: #5a4632;
  font-size: .75rem;
  font-weight: 800;
}
.road-route-form select,
.road-draw-box :is(input, select),
.road-selected-card :is(input, select) {
  width: 100%;
  min-width: 0;
  padding: .55rem .6rem;
  border: 1px solid #c8aa82;
  border-radius: .3rem;
  background: #fffdf5;
  color: #3d2c1e;
  font: inherit;
  font-size: .84rem;
}
.road-route-actions,
.road-draw-actions,
.road-edit-actions {
  display: flex;
  gap: .45rem;
}
.road-edit-actions.secondary { flex-wrap: wrap; }
.road-edit-actions.secondary .btn { flex: 1 1 7rem; }
.road-route-result,
.road-route-empty,
.road-ai-note,
.road-edit-status,
.road-draw-box,
.road-selected-card {
  padding: .7rem;
  border: 1px solid #dfc9a4;
  border-radius: .35rem;
  background: #fffdf5;
  color: #3d2c1e;
}
.road-route-result { display: grid; gap: .12rem; border-color: #96c882; background: #edf5e5; }
.road-route-result b { color: #35552b; font-size: 1.1rem; }
.road-route-result span { font-size: .8rem; font-weight: 800; }
.road-route-result small { color: #786450; font-size: .7rem; }
.road-route-empty { color: #786450; font-size: .76rem; line-height: 1.5; }
.road-clear-route { justify-self: start; }
.road-ai-note { display: grid; gap: .25rem; border-style: dashed; background: #f8efde; }
.road-ai-note b { color: #5a7e3e; font-size: .76rem; }
.road-ai-note span { color: #786450; font-size: .72rem; line-height: 1.55; }
.road-edit-status { display: flex; justify-content: space-between; gap: .5rem; font-size: .76rem; font-weight: 800; }
.road-edit-status small { color: #786450; font-weight: 400; text-align: right; }
.road-draw-box { display: grid; gap: .55rem; border-color: #e0aa78; background: #fff4e4; }
.road-draw-box > b { color: #a9642f; font-size: .82rem; }
.road-draw-box > small { color: #786450; font-size: .7rem; line-height: 1.5; }
.road-selected-card { display: grid; gap: .45rem; }
.road-selected-card b { color: #35552b; font-size: .8rem; }
.road-selected-card span,
.road-selected-card small { color: #786450; font-size: .72rem; line-height: 1.5; }
.road-selected-card.is-empty { color: #786450; font-size: .75rem; line-height: 1.5; }
.road-line-style { display: grid; gap: .35rem; }
.road-line-style-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.road-line-style-head b { color: #5a4632; font-size: .75rem; }
.road-line-style-head span { color: #8b7258; font-size: .68rem; }
.road-curve-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .25rem;
  padding: .25rem;
  border: 1px solid #c8aa82;
  border-radius: .375rem;
  background: #f5e6c8;
}
.road-curve-switch button {
  min-height: 2.15rem;
  border: 0;
  border-radius: .25rem;
  background: transparent;
  color: #786450;
  font: inherit;
  font-size: .76rem;
  font-weight: 800;
  cursor: pointer;
}
.road-curve-switch button.active { background: #e8833a; color: #3d2c1e; }
.road-feature-editor { display: grid; gap: .45rem; }
.road-feature-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.road-feature-head b { color: #5a4632; font-size: .75rem; }
.road-feature-head span { color: #8b7258; font-size: .68rem; font-weight: 600; }
.road-feature-options { display: flex; flex-wrap: wrap; gap: .35rem; }
.road-feature-options .road-feature-chip {
  position: relative;
  display: inline-flex;
  width: auto;
  cursor: pointer;
}
.road-feature-chip input,
.road-draw-box .road-feature-chip input,
.road-selected-card .road-feature-chip input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}
.road-feature-chip span {
  padding: .32rem .52rem;
  border: 1px solid #c8aa82;
  border-radius: 999px;
  background: #fffdf5;
  color: #786450;
  font-size: .7rem;
  font-weight: 700;
  line-height: 1.2;
}
.road-feature-chip input:checked + span {
  border-color: #5f8d58;
  background: #e8f2df;
  color: #35552b;
}
.road-feature-chip input:focus-visible + span {
  outline: 2px solid #e8833a;
  outline-offset: 2px;
}
.road-feature-chip-custom { gap: 0; cursor: default; }
.road-feature-chip-custom > span {
  border-color: #5f8d58;
  border-radius: 999px 0 0 999px;
  background: #e8f2df;
  color: #35552b;
}
.road-feature-remove {
  display: grid;
  place-items: center;
  min-width: 1.6rem;
  align-self: stretch;
  padding: 0 .4rem;
  border: 1px solid #5f8d58;
  border-left: 0;
  border-radius: 0 999px 999px 0;
  background: #dcebd3;
  color: #35552b;
  font: inherit;
  font-size: .82rem;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}
.road-feature-remove:hover { background: #c9dfbb; }
.road-feature-remove:focus-visible { outline: 2px solid #e8833a; outline-offset: 2px; }
.road-feature-custom { display: flex; gap: .4rem; }
.road-feature-custom input { flex: 1 1 auto; }
.road-feature-custom .btn { flex: 0 0 auto; min-width: 4rem; }
.road-copy-box { display: grid; gap: .45rem; padding: .6rem; border: 1px dashed #8eb678; border-radius: .35rem; background: #f2f7ec; }
.road-copy-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.road-copy-head b { color: #35552b; font-size: .76rem; }
.road-copy-head span { color: #6e825f; font-size: .68rem; }
.road-copy-row { display: flex; gap: .4rem; }
.road-copy-row select { flex: 1 1 auto; }
.road-copy-row .btn { flex: 0 0 auto; min-width: 5.2rem; }
.road-file-button {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  text-align: center;
}
.road-file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

@media (max-width: 39rem) {
  .road-mode-toggle { top: auto; right: 10px; bottom: 10px; }
  .road-overlay { touch-action: none; }
  .road-panel { gap: .6rem; }
  .road-edit-status { display: grid; }
  .road-edit-status small { text-align: left; }
  .road-copy-row { display: grid; grid-template-columns: minmax(0, 1fr); }
  .road-copy-row .btn { width: 100%; }
}
