/* Address search follows the supplied dark reference while the route map keeps
   its existing theme. Load after journey.css. */
.place-dialog {
  --place-bg: #111212;
  --place-field: #323333;
  --place-line: #414345;
  --place-text: #f1f2f3;
  --place-muted: #a7acb2;
  --place-blue: #65a7ff;
  position: fixed;
  inset: 20px auto 20px 20px;
  width: 460px;
  max-width: calc(100vw - 40px);
  height: calc(100dvh - 40px);
  max-height: calc(100dvh - 40px);
  min-width: 0;
  margin: 0;
  padding: 22px 18px 14px;
  border: 0;
  border-radius: 32px;
  background: var(--place-bg);
  color: var(--place-text);
  color-scheme: dark;
  box-shadow: 0 18px 65px #0005, 0 2px 12px #0003;
  overflow: hidden;
  overscroll-behavior: contain;
  font-size: 1rem;
  line-height: 1.5;
}
.place-dialog:not([open]) { display: none; }
.place-dialog[open] { display: flex; flex-direction: column; }
.place-dialog::backdrop { background: #04191e29; }
.place-dialog button,
.place-dialog input { font: inherit; color: inherit; }
.place-dialog button { -webkit-tap-highlight-color: transparent; }
.place-dialog svg {
  display: block;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.place-dialog :is(button, input, a):focus-visible {
  outline: 2px solid var(--place-blue);
  outline-offset: 3px;
}
#place-context {
  flex: 0 0 auto;
  margin: 0 7px 11px;
  color: #b6bbc1;
  font-size: .875rem;
  line-height: 1.45;
}
.place-search-top {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--place-line);
}
.place-search-box {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 11px;
  min-width: 0;
  min-height: 56px;
  padding: 5px 5px 5px 16px;
  border: 1px solid transparent;
  border-radius: 30px;
  background: var(--place-field);
  color: #c7cbce;
}
.place-search-box:focus-within { border-color: #647385; }
.place-search-box > svg { width: 22px; height: 22px; }
#place-query {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 4px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--place-text);
  caret-color: var(--place-blue);
  font-size: 1.125rem;
  line-height: 1.4;
  box-shadow: none;
}
#place-query::placeholder { color: #b0b6bc; opacity: 1; font-size: 1rem; }
#place-query:focus-visible { outline: 0; }
#place-query::-webkit-search-decoration,
#place-query::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
#place-clear,
#place-close {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #c6c9cd;
  background: transparent;
}
#place-clear:hover { color: #fff; background: #44474a; }
#place-clear svg { width: 22px; height: 22px; }
#place-close {
  width: 56px;
  height: 56px;
  background: #454748;
  color: #fff;
}
#place-close:hover { background: #55585b; }
#place-close svg { width: 25px; height: 25px; }
.place-shortcut {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 15px;
  width: 100%;
  min-height: 60px;
  padding: 15px 10px;
  border: 0;
  border-bottom: 1px solid var(--place-line);
  border-radius: 0;
  background: transparent;
  color: var(--place-text);
  text-align: left;
  font-size: 1rem;
  line-height: 1.5;
}
.place-shortcut:hover { background: #202326; }
.place-shortcut:focus-visible { outline-offset: -3px; }
.place-shortcut svg { flex: 0 0 24px; color: #f0f1f2; }
#place-map-point { color: #d8dde3; }
#place-search-status {
  flex: 0 0 auto;
  margin: 10px 9px 7px;
  color: var(--place-muted);
  font-size: .875rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
#place-search-status:empty { display: none; }
#place-results {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  margin: 0;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #62686e transparent;
  -webkit-overflow-scrolling: touch;
}
.place-results-heading {
  margin: 0;
  padding: 17px 9px 7px;
  color: #aeb7c3;
  font-size: .75rem;
  font-weight: 650;
  line-height: 1.4;
  letter-spacing: .06em;
}
.place-result-wrapper { list-style: none; margin: 0; padding: 0; }
.place-result {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 66px;
  padding: 14px 9px;
  border: 0;
  border-bottom: 1px solid var(--place-line);
  border-radius: 0;
  background: transparent;
  color: var(--place-text);
  text-align: left;
  font-size: 1rem;
  line-height: 1.5;
}
.place-result:hover { background: #202428; }
.place-result-active,
.place-result-active:hover { background: #1d2d42; }
.place-result:focus-visible { outline-offset: -3px; background: #1d2d42; }
.place-result-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 24px;
  width: 24px;
  min-height: 28px;
  color: #f1f3f5;
}
.place-result-copy { display: block; flex: 1 1 auto; min-width: 0; }
.place-result-name {
  display: block;
  color: var(--place-text);
  font-size: 1rem;
  font-weight: 450;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.place-result-detail {
  display: block;
  margin-top: 3px;
  color: #aeb6bf;
  font-size: .8125rem;
  font-weight: 400;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.place-result-detail:empty { display: none; }
.place-result-match { background: transparent; color: var(--place-blue); font: inherit; }
.place-result-power {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 30px;
  padding: 4px 8px;
  border-radius: 7px;
  background: #0d2d58;
  color: #78b4ff;
  font-size: .875rem;
  line-height: 1.4;
  white-space: nowrap;
}
.place-result-kind { color: #aeb7c3; font-size: .8125rem; line-height: 1.5; }
.place-state-message {
  margin: 0;
  padding: 17px 10px;
  color: #b4bcc5;
  font-size: .875rem;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
#place-search-footer {
  flex: 0 0 auto;
  margin: 0;
  padding: 12px 8px 0;
  border-top: 1px solid var(--place-line);
  color: #aab2bc;
  font-size: .75rem;
  line-height: 1.6;
}
#place-search-footer p { margin: 0; }
#place-search-footer .place-search-privacy { display: block; margin-top: 5px; }
#place-search-footer p + p { margin-top: 5px; }
#place-search-footer a { color: #c4dbf8; text-decoration: underline; text-underline-offset: 3px; }

/* Keep both direct map selection and address search in reach. */
.map-pick-toolbar { width: 420px; max-width: calc(100vw - 510px); }
#open-place-search {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 9px;
  min-width: 0;
  min-height: 44px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #4e5a69;
  text-align: left;
  font-size: .875rem;
  font-weight: 550;
}
#open-place-search > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#open-place-search > svg { width: 20px; height: 20px; flex: 0 0 20px; }
#open-place-search:hover { background: #f2f5fa; }
.map-pick-toolbar .map-target { flex: 0 0 44px; width: 44px; padding: 0; gap: 0; font-size: 0; }
.map-pick-toolbar .mini-letter { width: 22px; height: 22px; font-size: .75rem; }
.place-button .place-search-indicator { width: 18px; height: 18px; flex: 0 0 18px; color: #8793a1; }

@media (max-width: 760px) {
  .place-dialog {
    inset: calc(10px + env(safe-area-inset-top)) 10px calc(10px + env(safe-area-inset-bottom));
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
    height: calc(100dvh - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    max-height: calc(100dvh - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    padding: 19px 15px 13px;
    border-radius: 29px;
  }
  #place-context { margin: 0 5px 9px; font-size: .8125rem; }
  .place-search-top { gap: 8px; padding-bottom: 16px; }
  .place-search-box { min-height: 52px; padding-left: 13px; gap: 8px; }
  .place-search-box > svg { width: 21px; height: 21px; }
  #place-query { font-size: 1.0625rem; }
  #place-query::placeholder { font-size: 1rem; }
  #place-close { width: 52px; height: 52px; }
  .place-shortcut { gap: 13px; min-height: 57px; padding: 13px 7px; }
  .place-result { gap: 13px; min-height: 65px; padding: 13px 7px; }
  .place-result-power { padding: 4px 7px; font-size: .8125rem; }
  .place-results-heading { padding-left: 7px; padding-right: 7px; }
  #place-search-status { margin-left: 7px; margin-right: 7px; }
  #place-search-footer { padding: 10px 7px 0; }
  .map-pick-toolbar { left: 12px; right: 73px; width: auto; max-width: 320px; }
  #open-place-search { padding: 8px 5px; gap: 7px; }
  .map-pick-toolbar .map-target { flex-basis: 44px; width: 44px; }
}
@media (max-width: 360px) {
  .place-dialog { padding-left: 12px; padding-right: 12px; }
  .place-search-top { gap: 7px; }
  .place-search-box { padding-left: 11px; gap: 6px; }
  .place-search-box > svg { width: 18px; height: 18px; }
  #place-close { width: 48px; height: 48px; }
  .place-result, .place-shortcut { gap: 10px; padding-left: 5px; padding-right: 5px; }
  .place-result-power { padding-left: 6px; padding-right: 6px; }
}
@media (max-height: 540px) {
  .place-dialog { padding-top: 12px; padding-bottom: 10px; border-radius: 23px; }
  #place-context { margin-bottom: 5px; font-size: .8125rem; }
  .place-search-top { padding-bottom: 10px; }
  .place-search-box, #place-close { min-height: 48px; height: 48px; }
  #place-close { width: 48px; }
  .place-shortcut { min-height: 48px; padding-top: 9px; padding-bottom: 9px; }
  #place-search-status { margin-top: 6px; margin-bottom: 5px; font-size: .8125rem; }
  #place-search-footer { padding-top: 7px; line-height: 1.45; }
}
/* A landscape viewport or an open virtual keyboard can leave too little room
   for fixed shortcuts plus results. Let the whole dialog scroll in that case. */
@media (max-height: 440px) {
  .place-dialog { overflow-y: auto; }
  .place-search-top { position: sticky; top: -1px; z-index: 2; background: var(--place-bg); }
  #place-results { flex: 0 0 auto; overflow: visible; }
}
