:root {
  color-scheme: dark;
  --bg: #000000;
  --panel: #111820;
  --panel-2: #1b2730;
  --text: #f6f3ea;
  --muted: #b8c0c5;
  --line: rgba(246, 243, 234, 0.16);
  --accent: #54d2ae;
  --warn: #f0b84f;
  --danger: #e45f5f;
  --map-h: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 600px;
  height: 600px;
  background: #000;
  color: var(--text);
}

body {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  min-height: 54px;
  padding: 0 14px;
  border-radius: 12px;
  font-weight: 850;
}

button:active {
  transform: translateY(1px);
}

button[disabled] {
  color: rgba(246, 243, 234, 0.4);
  opacity: 0.72;
}

button:focus-visible,
input:focus-visible {
  outline: 4px solid rgba(84, 210, 174, 0.95);
  outline-offset: 3px;
  border-color: rgba(84, 210, 174, 0.95);
  box-shadow: 0 0 0 7px rgba(84, 210, 174, 0.18);
}

.shell {
  display: grid;
  grid-template-rows: auto 1fr;
  width: 600px;
  height: 600px;
  overflow: hidden;
  background: #000;
}

.panel {
  padding: max(12px, env(safe-area-inset-top)) 12px 10px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  max-width: 22rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(1.35rem, 1.35rem + 1.1vw, 2rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.icon-btn {
  width: 46px;
  min-width: 46px;
  padding: 0;
  font-size: 1.55rem;
}

.search-form {
  display: grid;
  grid-template-columns: 1fr 88px;
  gap: 8px;
  margin-top: 12px;
}

.search-form input {
  min-width: 0;
  height: 54px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  background: #05090d;
  color: var(--text);
  font-weight: 750;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.quick-grid button {
  min-width: 0;
  padding: 0 8px;
  font-size: 0.84rem;
}

.status,
.instruction {
  color: var(--muted);
  line-height: 1.25;
}

.search-panel .status {
  margin-top: 10px;
  font-size: 0.92rem;
  font-weight: 750;
}

.results {
  display: grid;
  gap: 7px;
  max-height: 24vh;
  overflow: auto;
  margin-top: 8px;
  padding-right: 2px;
}

.result {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.result strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.98rem;
}

.result small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

.result button {
  min-width: 72px;
}

.nav-readout {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 12px;
  align-items: center;
  margin-top: 10px;
}

.arrow {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid rgba(84, 210, 174, 0.48);
  background: #0f2c28;
  color: var(--accent);
  font-size: 3.2rem;
  line-height: 1;
  transition: transform 160ms ease;
}

.distance {
  min-height: 2.6rem;
  font-size: clamp(2.1rem, 2.1rem + 2vw, 3.4rem);
  line-height: 0.95;
  font-weight: 950;
  letter-spacing: 0;
}

.instruction {
  margin-top: 4px;
  font-size: 1.05rem;
  font-weight: 800;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.metrics span {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 7px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
}

.control-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.map-wrap {
  position: relative;
  min-height: 0;
}

#map {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 100%;
  min-height: var(--map-h);
  background: #000;
  touch-action: none;
}

#tileLayer,
#routeSvg {
  position: absolute;
  inset: 0;
}

#tileLayer img {
  position: absolute;
  width: 256px;
  height: 256px;
  user-select: none;
  -webkit-user-drag: none;
  filter: invert(1) hue-rotate(175deg) saturate(0.6) brightness(0.48) contrast(1.15);
  opacity: 0.68;
}

#routeSvg {
  z-index: 8;
  pointer-events: none;
}

.pin {
  position: absolute;
  z-index: 12;
  width: 20px;
  height: 20px;
  display: none;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.88), 0 8px 20px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

.user-pin {
  background: var(--accent);
}

.dest-pin {
  background: var(--danger);
}

@media (max-width: 520px) {
  .panel {
    padding-left: 10px;
    padding-right: 10px;
  }

  .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nav-readout {
    grid-template-columns: 70px 1fr;
    gap: 10px;
  }

  .arrow {
    width: 70px;
    height: 70px;
    font-size: 2.9rem;
  }
}

@media (max-height: 720px) {
  .results {
    max-height: 18vh;
  }

  .metrics {
    grid-template-columns: 1fr;
  }
}

@media (max-height: 560px) {
  .panel {
    padding-top: 7px;
    padding-bottom: 7px;
  }

  .quick-grid,
  .metrics {
    display: none;
  }

  .nav-readout {
    grid-template-columns: 56px 1fr;
    margin-top: 6px;
  }

  .arrow {
    width: 56px;
    height: 56px;
    font-size: 2.25rem;
  }
}

body.wearable-mode .search-form {
  display: none;
}

body.wearable-mode .quick-grid button {
  min-height: 64px;
  font-size: 0.98rem;
}

body.wearable-mode .status::after {
  content: "  • Šipky/Neural Band: výběr, Enter: potvrdit";
  color: rgba(184, 192, 197, 0.82);
}

@media (max-width: 599px) {
  html,
  body,
  .shell {
    width: 100vw;
    height: 100dvh;
  }
}
