body {
  display: block;
  place-items: initial;
  overflow: hidden;
}

.gyde-search-app {
  --bg: #EAEBE5;
  --surface: #F4F4EE;
  --surface-alt: #FFFFFF;
  --ink: #101814;
  --ink-soft: #2A332D;
  --muted: #6E776F;
  --hairline: rgba(16, 24, 20, 0.10);
  --hairline-strong: rgba(16, 24, 20, 0.22);
  --primary: #1F5F55;
  --primary-soft: #D6E5DF;
  --primary-dark: #163F39;
  --accent: #C57B3C;
  --accent-soft: #F1E2CC;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(360px, 440px) minmax(0, 1fr);
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
}

.search-skip {
  position: fixed;
  left: 16px;
  top: 10px;
  z-index: 100;
  transform: translateY(-140%);
  background: var(--surface-alt);
  color: var(--primary-dark);
  border: 1px solid var(--hairline-strong);
  border-radius: 999px;
  padding: 8px 12px;
}
.search-skip:focus { transform: translateY(0); }

.search-rail {
  position: relative;
  z-index: 10;
  min-width: 0;
  min-height: 0;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border-right: 1px solid var(--hairline-strong);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: 18px 0 40px -34px rgba(16, 24, 20, 0.45);
}

.search-head {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--hairline);
}

.search-beta-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--primary-dark);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.search-thread {
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 20px 16px 22px;
}

.search-welcome h1 {
  margin: 8px 0 16px;
  font-family: var(--font-display);
  font-size: 38px;
  line-height: 0.98;
  font-weight: 400;
  color: var(--ink);
}

.search-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.search-example,
.source-chip,
.web-candidate {
  border: 1px solid var(--hairline-strong);
  background: var(--surface-alt);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 8px 11px;
  font-size: 12px;
  cursor: pointer;
}

.search-turn {
  margin-top: 14px;
}

.search-turn-user {
  display: flex;
  justify-content: flex-end;
}

.search-user-text {
  max-width: 88%;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.35;
}

.search-answer {
  border: 1px solid var(--hairline-strong);
  background: var(--surface-alt);
  border-radius: 8px;
  padding: 14px;
  box-shadow: var(--shadow-md);
}

.search-answer-text {
  margin: 8px 0 12px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.48;
}
.search-answer-markdown p {
  margin: 0 0 10px;
}
.search-answer-markdown p:last-child,
.search-answer-markdown ul:last-child,
.search-answer-markdown ol:last-child {
  margin-bottom: 0;
}
.search-answer-markdown h3 {
  margin: 12px 0 7px;
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.05;
  font-weight: 400;
  color: var(--ink);
}
.search-answer-markdown ul,
.search-answer-markdown ol {
  margin: 8px 0 12px;
  padding-left: 18px;
}
.search-answer-markdown li {
  margin: 5px 0;
}
.search-answer-markdown strong {
  color: var(--ink);
  font-weight: 700;
}
.search-answer-markdown em {
  font-style: italic;
  color: var(--primary-dark);
}
.search-answer-markdown code {
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: var(--surface);
  color: var(--primary-dark);
  padding: 1px 5px;
  font-family: var(--font-mono);
  font-size: 0.88em;
}
.search-answer-markdown a {
  color: var(--primary-dark);
  font-weight: 650;
  text-decoration-color: color-mix(in srgb, var(--primary) 42%, transparent);
  text-underline-offset: 2px;
}

.search-warning {
  margin: 8px 0 12px;
  color: var(--error);
  font-size: 12px;
  line-height: 1.35;
}

.search-result-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 12px;
}

.search-result {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  text-align: left;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 9px 10px;
  cursor: pointer;
}
.search-result[aria-selected="true"] {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.result-name {
  display: block;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.16;
  overflow-wrap: anywhere;
}
.result-reason,
.result-meta {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.result-score {
  color: var(--accent-dark);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
}

.search-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.source-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 10px;
  overflow-wrap: anywhere;
}

.web-candidates {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.web-candidate {
  border-radius: 8px;
  text-align: left;
  cursor: default;
}
.web-candidate strong,
.web-candidate span {
  display: block;
}
.web-candidate span {
  margin-top: 3px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

.search-composer {
  position: sticky;
  bottom: 0;
  z-index: 4;
  min-height: 66px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px 42px;
  gap: 8px;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--hairline-strong);
  background: var(--surface);
  box-shadow: 0 -12px 24px -24px rgba(16, 24, 20, 0.55);
}
.search-composer input {
  min-width: 0;
  border: 1px solid var(--hairline-strong);
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--ink);
  outline: none;
  padding: 0 14px;
  font-size: 15px;
}
.search-composer input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent);
}
.search-icon-btn,
.search-submit {
  border-radius: 50%;
  border: 1px solid var(--hairline-strong);
  background: var(--surface-alt);
  color: var(--primary-dark);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.search-submit {
  border: none;
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-primary);
}

.search-map-pane {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.search-map-pane #map {
  position: absolute;
  inset: 0;
}

.map-result-strip {
  position: absolute;
  left: 18px;
  right: 18px;
  top: 18px;
  z-index: 20;
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 3px;
}
.map-strip-pill {
  flex: none;
  border: 1px solid var(--hairline-strong);
  background: color-mix(in srgb, var(--surface-alt) 88%, transparent);
  color: var(--ink);
  backdrop-filter: blur(10px);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-md);
}
.map-strip-pill.is-on {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.poi-drawer {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 24;
  width: min(360px, calc(100% - 36px));
  border: 1px solid var(--hairline-strong);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-alt) 94%, transparent);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-xl);
  padding: 14px;
}
.poi-drawer-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}
.poi-drawer h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 26px;
  line-height: 1.02;
  margin: 0;
}
.poi-drawer p {
  margin: 9px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.42;
}
.poi-drawer-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 760px) {
  .gyde-search-app {
    display: block;
  }
  .search-map-pane {
    position: absolute;
    inset: 0;
  }
  .search-rail {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    height: min(62dvh, 560px);
    max-height: min(62dvh, 560px);
    overflow: hidden;
    border-right: 0;
    border-top: 1px solid var(--hairline-strong);
    border-radius: 20px 20px 0 0;
  }
  .search-head {
    min-height: 58px;
    padding: 11px 14px;
  }
  .search-thread {
    padding: 14px 14px 12px;
  }
  .search-welcome h1 {
    font-size: 29px;
    margin-bottom: 12px;
  }
  .map-result-strip {
    top: calc(10px + env(safe-area-inset-top));
    left: 12px;
    right: 12px;
  }
  .poi-drawer {
    left: 12px;
    right: 12px;
    bottom: calc(62dvh + 12px);
    width: auto;
    max-height: 24dvh;
    overflow: auto;
  }
  .leaflet-control-zoom {
    margin-bottom: calc(62dvh + 16px) !important;
  }
}
