:root {
  color-scheme: dark;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  --ink: #f4f1e8;
  --muted: #a8b0ab;
  --panel: rgba(14, 22, 21, 0.94);
  --line: rgba(255, 255, 255, 0.13);
  --accent: #e53b35;
  --accent-strong: #ff5149;
  --gold: #e7bd61;
}

* { box-sizing: border-box; }

html,
body,
.map-app,
.map {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body { background: #101817; color: var(--ink); }
button, input { font: inherit; }

.map { position: fixed; inset: 0; z-index: 0; background: #cad4cf; }

.leaflet-tile-pane { filter: saturate(0.9) contrast(1.08) brightness(0.9); }
.leaflet-control-attribution { font-size: 9px; background: rgba(255,255,255,.82) !important; }
.leaflet-control-zoom { display: none; }

.top-controls {
  position: fixed;
  z-index: 500;
  top: max(12px, env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  max-width: 620px;
  margin: 0 auto;
}

.search-box {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 44px;
  align-items: center;
  min-height: 52px;
  padding-left: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(0,0,0,.28);
  backdrop-filter: blur(12px);
}

.search-prefix { color: var(--accent-strong); font-size: 20px; font-weight: 800; }
.search-box input {
  min-width: 0;
  height: 50px;
  border: 0;
  outline: 0;
  padding: 0 10px;
  color: var(--ink);
  background: transparent;
  font-size: 17px;
  letter-spacing: 0;
}
.search-box input::placeholder { color: #8d9691; }

.icon-button,
.map-button {
  display: grid;
  place-items: center;
  border: 0;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
}
.icon-button svg,
.map-button svg { width: 23px; height: 23px; stroke-width: 2; }

.suggestions {
  margin-top: 6px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 30px rgba(0,0,0,.32);
}
.suggestion {
  display: block;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 11px 14px;
  color: var(--ink);
  text-align: left;
  background: transparent;
}
.suggestion:last-child { border-bottom: 0; }
.suggestion-words { display: block; font-size: 15px; font-weight: 700; }
.suggestion-words::before { content: "///"; color: var(--accent-strong); margin-right: 2px; }
.suggestion-place { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }

.locate-button {
  position: fixed;
  z-index: 450;
  right: 14px;
  bottom: calc(146px + env(safe-area-inset-bottom));
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  box-shadow: 0 6px 20px rgba(0,0,0,.3);
}
.locate-button.active { color: var(--accent-strong); }

.zoom-hint {
  position: fixed;
  z-index: 430;
  left: 50%;
  bottom: calc(143px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 150px);
  border-radius: 4px;
  padding: 7px 10px;
  background: rgba(14,22,21,.83);
  color: #d9dedb;
  font-size: 11px;
  text-align: center;
}

.result-panel {
  position: fixed;
  z-index: 500;
  right: 0;
  bottom: 0;
  left: 0;
  min-height: 126px;
  padding: 13px 18px calc(13px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 -8px 24px rgba(0,0,0,.22);
  backdrop-filter: blur(14px);
}
.result-label { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.words {
  display: block;
  width: 100%;
  margin: 4px 0 5px;
  overflow: hidden;
  border: 0;
  padding: 0;
  color: var(--ink);
  background: transparent;
  font-size: clamp(21px, 6vw, 29px);
  font-weight: 750;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0;
}
.words::first-letter { color: var(--accent-strong); }
.result-details { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 12px; }
.status { min-height: 16px; margin-top: 5px; color: var(--gold); font-size: 11px; }

.player-position {
  width: 20px;
  height: 20px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #1977d4;
  box-shadow: 0 0 0 7px rgba(25,119,212,.2), 0 2px 7px rgba(0,0,0,.4);
}
.selected-position {
  width: 18px;
  height: 18px;
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 0;
  background: var(--accent);
  box-shadow: 0 2px 8px rgba(0,0,0,.45);
  transform: rotate(-45deg);
}
.hidden { display: none !important; }

@media (min-width: 700px) {
  .result-panel { right: 18px; bottom: 18px; left: auto; width: 440px; border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
  .locate-button { right: 24px; bottom: 174px; }
  .zoom-hint { bottom: 28px; }
}
