:root {
  color-scheme: dark;
  --bg: #0d0d10;
  --surface: #111111;
  --surface-panel: #181818;
  --surface-search: #303030;
  --surface-soft: #202020;
  --text: #f4f4f4;
  --muted: #c8c8c8;
  --line: #333333;
  --primary: #6d62ff;
  --primary-strong: #574cff;
  --danger: #ff8b83;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

button,
input {
  font: inherit;
}

.app-shell {
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  overflow: hidden;
}

.map {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(109, 98, 255, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(109, 98, 255, 0.08) 1px, transparent 1px),
    var(--bg);
  background-size: 72px 72px;
}

.maplibregl-map {
  background: var(--bg);
}

.maplibregl-canvas {
  outline: none;
}

.search-panel {
  position: relative;
  z-index: 1200;
  width: min(820px, calc(100vw - 32px));
  margin: 18px auto 0;
  padding: 12px;
  border: 1px solid #252525;
  border-radius: 8px;
  background: rgba(17, 17, 17, 0.96);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.search-panel-toggle {
  width: 100%;
  min-height: 56px;
  display: none;
  grid-template-columns: auto minmax(0, 1fr) 24px;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-bottom: 2px solid var(--primary);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--text);
  background: var(--surface-search);
  text-align: left;
  cursor: pointer;
}

.search-panel-toggle:hover,
.search-panel-toggle:focus {
  outline: none;
  background: #373737;
  border-bottom-color: #8a82ff;
}

.search-toggle-kicker {
  color: var(--muted);
  font-size: 13px;
  font-weight: 830;
  text-transform: uppercase;
}

.search-panel-summary {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 830;
}

.search-panel-toggle-icon {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  color: var(--muted);
}

.search-panel-toggle-icon::before {
  content: "";
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-1px, -2px);
  transform-origin: center;
}

.search-panel-toggle[aria-expanded="true"] .search-panel-toggle-icon::before {
  transform: rotate(225deg) translate(-1px, -2px);
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  width: min(100%, 242px);
  margin: 0 auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-search);
  overflow: hidden;
}

.mode-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  min-height: 48px;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-weight: 760;
  cursor: pointer;
}

.mode-tab + .mode-tab {
  border-left: 1px solid var(--line);
}

.mode-tab.active {
  background: #3a3a3a;
  box-shadow: inset 0 -2px 0 var(--primary);
}

.sentence {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.sentence-line {
  display: flex;
  width: 100%;
  align-items: center;
}

.sentence-line-inline {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
}

.sentence-line-center {
  justify-content: center;
}

.sentence-field-with-punctuation {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sentence-field-with-punctuation .search-box {
  flex: 1 1 auto;
}

.sentence-punctuation {
  color: var(--muted);
  font-size: 28px;
  font-weight: 840;
  line-height: 1;
}

.sentence-word {
  font-size: 22px;
  font-weight: 840;
  color: var(--muted);
  line-height: 1.15;
}

.search-box {
  min-width: 230px;
  max-width: 360px;
  min-height: 64px;
  width: 100%;
  display: grid;
  grid-template-columns: 30px 1fr 20px;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-bottom: 2px solid var(--primary);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  background: var(--surface-search);
  text-align: left;
  box-shadow: none;
  cursor: pointer;
}

.search-box-wide {
  max-width: none;
}

.search-box-text {
  min-width: 0;
  overflow: hidden;
}

.search-box:hover,
.search-box:focus {
  outline: none;
  background: #373737;
  border-bottom-color: #8a82ff;
}

.box-icon {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 24px;
  transition: opacity 140ms ease;
}

.svg-icon {
  display: inline-block;
  width: 1.35em;
  height: 1.35em;
  object-fit: contain;
  filter: invert(1);
  opacity: 0.92;
  vertical-align: middle;
}

.text-icon {
  display: inline-grid;
  place-items: center;
  min-width: 1.35em;
  min-height: 1.35em;
  color: var(--muted);
  font-weight: 800;
}

.mode-tab-icon {
  width: 20px;
  height: 20px;
}

.ui-icon {
  width: 28px;
  height: 28px;
}

.box-title {
  display: block;
  font-weight: 830;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: opacity 180ms ease;
}

.box-subtitle {
  display: block;
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: opacity 140ms ease;
}

.box-chevron {
  width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  color: var(--muted);
}

.box-chevron::before {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-1px, -2px);
  transform-origin: center;
}

#object-box.object-title-fading .box-title,
#object-box.object-subtitle-hidden .box-subtitle,
#object-box.object-icon-hidden .box-icon {
  opacity: 0;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  column-gap: 0;
  row-gap: 8px;
}

.chip-clause {
  display: inline-flex;
  align-items: center;
}

.chip-separator {
  color: var(--muted);
  font-family: inherit;
  font-size: 22px;
  font-weight: 840;
  line-height: 1.15;
}

.chip-separator-word {
  margin-inline: 10px;
}

.chip-separator-comma {
  margin-right: 8px;
}

.chip {
  border: 1px solid var(--line);
  border-bottom: 2px solid var(--primary);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface-search);
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
}

.filter-builder {
  position: relative;
  display: grid;
  gap: 8px;
}

.filter-chips:empty {
  display: none;
}

.filter-search {
  min-height: 52px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-bottom: 2px solid var(--primary);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text);
  background: var(--surface-search);
}

.filter-search:focus-within {
  background: #373737;
  border-bottom-color: #8a82ff;
}

.filter-search-icon {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 24px;
  font-weight: 860;
}

.filter-search input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-weight: 760;
}

.filter-search input::placeholder {
  color: var(--muted);
  opacity: 1;
  transition: opacity 180ms ease;
}

.filter-search.placeholder-fading input::placeholder {
  opacity: 0;
}

.filter-search input:disabled {
  cursor: default;
}

.filter-suggestions {
  position: absolute;
  z-index: 3;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 250px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
}

.filter-suggestion {
  width: 100%;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 0;
  padding: 10px 12px;
  color: var(--text);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.filter-suggestion:hover,
.filter-suggestion:focus {
  outline: none;
  background: var(--surface-soft);
}

.filter-suggestion-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 760;
}

.primary-button {
  width: 100%;
  min-height: 48px;
  margin-top: 12px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--primary);
  font-weight: 830;
  cursor: pointer;
}

.primary-button:disabled {
  opacity: 0.45;
  cursor: default;
}

.error {
  min-height: 20px;
  margin: 10px 4px 0;
  color: var(--danger);
}

.results-drawer {
  position: absolute;
  z-index: 1100;
  left: 24px;
  top: 190px;
  bottom: 24px;
  width: min(430px, calc(100vw - 48px));
  display: none;
  flex-direction: column;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid #252525;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.results-drawer.visible {
  display: flex;
}

.results-header {
  background: var(--surface-search);
  border-bottom: 2px solid var(--primary);
}

.results-drawer-toggle {
  width: 100%;
  min-height: 78px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  gap: 12px;
  align-items: center;
  border: 0;
  padding: 18px 20px 12px;
  color: inherit;
  background: transparent;
  text-align: left;
  cursor: default;
}

.results-header-copy {
  min-width: 0;
}

.results-drawer-toggle-icon {
  width: 24px;
  height: 24px;
  display: none;
  place-items: center;
  color: var(--muted);
}

.results-drawer-toggle-icon::before {
  content: "";
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-1px, -2px);
  transform-origin: center;
}

.results-drawer-toggle[aria-expanded="false"] .results-drawer-toggle-icon::before {
  transform: rotate(225deg) translate(-1px, -2px);
}

.results-title {
  display: block;
  margin: 0;
  font-size: 24px;
  font-weight: 840;
}

.results-subtitle {
  display: block;
  margin: 4px 0 0;
  color: var(--muted);
}

.results-list {
  overflow: auto;
  padding-bottom: 12px;
}

.result-card {
  margin: 8px 16px 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-panel);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.result-card:hover,
.result-card:focus-visible {
  outline: none;
  background: #1d1d1d;
  border-color: #535353;
}

.result-card:active {
  transform: translateY(1px);
}

.result-main {
  display: flex;
  gap: 12px;
}

.result-image {
  width: 92px;
  height: 92px;
  border-radius: 8px;
  background: var(--surface-soft);
  object-fit: contain;
  object-position: center;
  flex: 0 0 auto;
}

.result-icon-placeholder {
  display: grid;
  place-items: center;
}

.result-placeholder-icon {
  width: 42px;
  height: 42px;
  opacity: 0.72;
}

.result-name {
  margin: 0;
  font-size: 18px;
}

.result-type {
  margin: 3px 0 0;
  color: var(--muted);
  font-style: italic;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.tag {
  border-radius: 999px;
  color: var(--text);
  background: var(--surface-search);
  padding: 6px 9px;
  font-size: 13px;
}

.open-button {
  display: inline-flex;
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  color: #fff;
  background: var(--primary);
  text-decoration: none;
  font-weight: 760;
}

.picker {
  width: min(640px, calc(100vw - 40px));
  max-height: min(720px, calc(100vh - 60px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.picker::backdrop {
  background: rgba(0, 0, 0, 0.36);
}

.picker-search {
  display: grid;
  grid-template-columns: 42px 1fr 48px;
  align-items: center;
  min-height: 74px;
  background: var(--surface-search);
  border-bottom: 2px solid var(--primary);
}

.picker-search span {
  display: grid;
  place-items: center;
  text-align: center;
  color: #c8c8c8;
  font-size: 28px;
}

.picker-search-icon {
  width: 28px;
  height: 28px;
}

.picker-search input {
  width: 100%;
  border: 0;
  outline: none;
  color: #fff;
  background: transparent;
  font-size: 24px;
  font-weight: 700;
}

.picker-search input::placeholder {
  color: var(--muted);
}

.picker-search button {
  border: 0;
  color: #d8d8d8;
  background: transparent;
  font-size: 34px;
  cursor: pointer;
}

.picker-list {
  max-height: 520px;
  overflow: auto;
  padding: 12px 0;
}

.picker-row {
  width: 100%;
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 12px;
  align-items: start;
  border: 0;
  padding: 12px 24px;
  color: #fff;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.picker-row > span:last-child {
  min-width: 0;
}

.picker-row:hover,
.picker-row:focus {
  background: var(--surface-soft);
}

.picker-row-icon {
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 34px;
}

.picker-list-icon {
  width: 34px;
  height: 34px;
}

.picker-row-title {
  display: block;
  font-size: 23px;
  font-weight: 840;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-row-subtitle {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: #d2d2d2;
  font-size: 18px;
  line-height: 1.32;
  margin-top: 2px;
  overflow: hidden;
}

.picker-divider {
  border-top: 1px solid var(--line);
  margin: 8px 0;
}

.picker-actions {
  display: none;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.picker-actions.visible {
  display: flex;
}

.picker-actions button {
  border: 0;
  border-radius: 8px;
  color: var(--text);
  background: var(--surface-search);
  padding: 10px 16px;
  cursor: pointer;
}

.listevon-map-marker {
  appearance: none;
  -webkit-appearance: none;
  display: block;
  width: 36px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  line-height: 0;
  position: absolute;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  color: var(--primary);
}

.listevon-map-marker > svg {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 5px 7px rgba(0, 0, 0, 0.38));
  pointer-events: none;
}

.listevon-map-marker > svg path {
  fill: currentColor;
  stroke: #ffffff;
  stroke-linejoin: round;
  stroke-width: 3;
}

.listevon-map-marker-symbol {
  position: absolute;
  left: 50%;
  top: 16px;
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  transform: translate(-50%, -50%);
  color: #ffffff;
  filter: invert(1);
  object-fit: contain;
  opacity: 0.96;
  pointer-events: none;
}

.listevon-map-marker-symbol.text-icon {
  color: #ffffff;
  filter: none;
  font-size: 10px;
  line-height: 1;
}

.listevon-map-marker:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 3px;
}

.maplibregl-ctrl-group,
.maplibregl-ctrl-attrib {
  color: var(--text) !important;
  background: rgba(17, 17, 17, 0.9) !important;
}

.maplibregl-ctrl-group button {
  background-color: transparent !important;
}

.maplibregl-popup-content {
  border-radius: 8px;
  color: #202020;
  font: 14px/1.35 Inter, ui-sans-serif, system-ui, sans-serif;
}

@media (max-width: 839px) {
  .results-drawer {
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: 100%;
    max-height: 58vh;
    max-height: 58dvh;
    border-radius: 24px 24px 0 0;
  }

  .results-drawer-toggle {
    cursor: pointer;
  }

  .results-drawer-toggle:hover,
  .results-drawer-toggle:focus-visible {
    outline: none;
    background: #373737;
  }

  .results-drawer-toggle-icon {
    display: inline-grid;
  }

  .results-drawer.results-drawer-collapsed {
    bottom: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    max-height: 116px;
    min-height: 104px;
    border-radius: 24px;
  }

  .results-drawer.results-drawer-collapsed .results-list {
    display: none;
  }

  .results-drawer.results-drawer-collapsed .results-drawer-toggle {
    min-height: 104px;
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .results-drawer.results-drawer-collapsed .results-title,
  .results-drawer.results-drawer-collapsed .results-subtitle {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .search-panel {
    margin-top: 10px;
  }

  .search-panel.has-results {
    max-height: min(54vh, calc(100vh - 20px));
    max-height: min(54dvh, calc(100dvh - 20px));
    overflow: auto;
    scrollbar-gutter: stable both-edges;
  }

  .search-panel.has-results .search-panel-toggle {
    display: grid;
  }

  .search-panel.has-results:not(.search-panel-collapsed) .search-panel-toggle {
    margin-bottom: 8px;
  }

  .search-panel.has-results.search-panel-collapsed {
    width: min(430px, calc(100vw - 20px));
    padding: 8px;
    overflow: visible;
  }

  .search-panel.has-results.search-panel-collapsed .search-panel-body {
    display: none;
  }

  .search-panel.has-results.search-panel-collapsed ~ .results-drawer.visible {
    max-height: calc(100vh - 104px);
    max-height: calc(100dvh - 104px);
  }

  .search-panel.has-results.search-panel-collapsed ~ .results-drawer.visible.results-drawer-collapsed {
    max-height: 116px;
  }
}

@media (max-width: 370px) {
  .sentence-line-inline {
    grid-template-columns: 1fr;
  }
}
