/* #region zone:map.style.panels — ปุ่มชั้นข้อมูล คำอธิบายสี ตัวเลือกเส้นทาง และปุ่มต่าง ๆ บนแผนที่ */
/* Bottom-right map key: clear of Google's zoom control (right 10px) and the Terms strip (bottom ~16px). */
.legend {
  position: absolute;
  right: 64px;
  bottom: 24px;
  width: 304px;
  max-height: min(460px, 60dvh);
  padding: var(--u-space-1) 6px 6px;
  border-radius: var(--r-card);
  display: flex;
  flex-direction: column;
  font-size: var(--fs-xs);
  color: var(--muted);
  z-index: 4;
  background: var(--glass-strong);
}
.legend h2 {
  font-size: var(--fs-sm);
  font-weight: 650;
  color: var(--text);
  margin: 0;
}

/* bottom 40px keeps Google's logo (bottom-left of the map) visible, as the Maps ToS requires. */
.sheet {
  position: absolute;
  top: 84px;
  left: 16px;
  bottom: 40px;
  width: 420px;
  border-radius: var(--r-panel);
  z-index: 4;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sheet-handle {
  display: none;
}
.sheet-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: var(--u-space-3);
}
.quota {
  font-size: var(--fs-xs);
  color: var(--faint);
  text-align: center;
  padding-bottom: var(--u-space-1);
}

.directions {
  border-radius: var(--r-card);
  background: var(--card);
  border: 1px solid var(--card-line);
}
.directions > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--u-space-3) 14px;
  cursor: pointer;
  font-weight: 650;
  list-style: none;
}
.directions > summary::-webkit-details-marker {
  display: none;
}
.directions[open] > summary {
  border-bottom: 1px solid var(--card-line);
}
.route-form {
  padding: var(--u-space-3) 14px 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}
.route-form > *,
.mode-option {
  min-width: 0;
}
.route-fields {
  position: relative;
  display: grid;
  gap: 6px;
  padding-right: 48px;
}
.route-fields::before {
  content: '';
  position: absolute;
  left: 13px;
  top: 30px;
  bottom: 30px;
  border-left: 2px dotted var(--faint);
  opacity: 0.6;
}
.route-field {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 var(--u-space-1) 0 2px;
  border-radius: var(--r-control);
  background: var(--glass-strong);
  border: 1px solid var(--card-line);
}
.route-field:focus-within {
  border-color: var(--accent);
}
.route-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  height: var(--u-tap);
}
.route-field .icon-button {
  width: var(--u-tap);
  height: var(--u-tap);
}
.route-field input:focus-visible {
  outline: none;
}
.pin {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--on-accent);
  background: var(--accent);
  flex: none;
  margin-left: 2px;
  position: relative;
  z-index: 1;
}
.pin-b {
  color: var(--on-heavy);
  background: var(--level-heavy);
}
.swap {
  position: absolute;
  right: 0;
  top: 50%;
  translate: 0 -50%;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid var(--card-line);
  background: var(--glass-strong);
  cursor: pointer;
  transition: rotate var(--t-med) var(--ease-out);
}
.swap:hover {
  rotate: 180deg;
  color: var(--accent-strong);
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--u-space-2);
  min-height: 46px;
  padding: 10px var(--u-space-4);
  border-radius: var(--r-control);
  border: 1px solid transparent;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
  transition:
    background var(--t-fast),
    transform var(--t-fast);
}
.button:active {
  transform: scale(0.98);
}
.button.primary {
  background: var(--accent);
  color: var(--on-accent);
}
.button.primary:hover {
  background: var(--accent-strong);
}
.button.primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.button.quiet {
  min-height: 38px;
  padding: 6px var(--u-space-3);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: var(--fs-sm);
}

/* Travel-mode segmented control + avoid-tolls/highways/ferries chips (route panel, above "Get route"). */
.route-options {
  display: grid;
  gap: var(--u-space-2);
}
.mode-select {
  display: flex;
  gap: var(--u-space-2);
  padding: 3px;
  border-radius: var(--r-control);
  background: var(--glass-strong);
  border: 1px solid var(--card-line);
}
.mode-option {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 6px var(--u-space-2);
  border: 0;
  border-radius: calc(var(--r-control) - 3px);
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition:
    background var(--t-fast) var(--ease-out),
    color var(--t-fast) var(--ease-out);
}
.mode-option:hover {
  color: var(--accent-strong);
}
.mode-option.is-selected {
  background: var(--accent);
  color: var(--on-accent);
}
.avoid-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--u-space-2);
}
.avoid-chip {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 6px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--card-line);
  background: var(--glass-strong);
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
  transition:
    background var(--t-fast) var(--ease-out),
    color var(--t-fast) var(--ease-out),
    border-color var(--t-fast) var(--ease-out),
    opacity var(--t-fast);
}
.avoid-chip:hover:not(:disabled) {
  border-color: var(--accent);
}
.avoid-chip[aria-pressed='true'] {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-color: var(--accent);
}
.avoid-chip:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
@media (max-width: 420px) {
  /* Compact: icon only once the row gets tight, but the label stays for screen readers (same technique as
     .visually-hidden — never `display: none`, which would also drop the button's accessible name). */
  .mode-option span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

/* #endregion */
