:root {
  --panel: rgba(18, 22, 27, 0.78);
  --line: rgba(255, 255, 255, 0.12);
  --text: #eef1f4;
  --muted: #9aa5b0;
  --accent: #ffb547;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0d1014;
}

#view {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.panel {
  position: fixed;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
}

button,
select,
input {
  font: inherit;
  color: var(--text);
}

button,
select {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 10px;
  cursor: pointer;
}

button:hover,
select:hover {
  background: rgba(255, 255, 255, 0.16);
}

select option {
  color: #111;
}

kbd {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.78em;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 4px;
  margin-left: 2px;
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

/* search */
#topbar {
  top: 12px;
  left: 12px;
  width: min(420px, calc(100vw - 24px));
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  z-index: 5;
}

#search {
  display: flex;
  gap: 6px;
  flex: 1 1 100%;
}

#q {
  flex: 1;
  min-width: 0;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 10px;
}

#search button {
  background: var(--accent);
  color: #1b1405;
  border: none;
  font-weight: 600;
}

#presets {
  flex: 1 1 100%;
}

#results {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1 1 100%;
  max-height: 260px;
  overflow-y: auto;
}

#results li {
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 0.88rem;
  cursor: pointer;
}

#results li:hover {
  background: rgba(255, 255, 255, 0.1);
}

#results li.muted {
  cursor: default;
}

/* controls */
#controls {
  top: 12px;
  right: 12px;
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  max-width: calc(100vw - 460px);
}

#controls .sun {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
  padding: 0 4px;
}

/* HUD */
#hud {
  left: 12px;
  bottom: 34px;
  padding: 10px 14px;
  min-width: 260px;
  max-width: calc(100vw - 280px);
}

#hud .speed {
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

#hud .speed small {
  font-size: 0.9rem;
  font-weight: 500;
  margin-left: 6px;
  color: var(--muted);
}

#street {
  margin-top: 6px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#place {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#region,
#coords,
#tilesInfo {
  font-size: 0.78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-top: 3px;
}

#minimap {
  position: fixed;
  right: 14px;
  bottom: 34px;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

/* street view */
#streetview {
  right: 12px;
  top: 70px;
  width: min(420px, calc(100vw - 24px));
  overflow: hidden;
}

#streetview header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 6px 6px 12px;
  font-size: 0.85rem;
  font-weight: 600;
}

#streetview header button,
#helpClose {
  padding: 0 9px;
  font-size: 1.1rem;
  line-height: 1.6;
}

#svImg {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #000;
}

#svMeta {
  font-size: 0.78rem;
  color: var(--muted);
  padding: 8px 12px 10px;
  line-height: 1.45;
}

/* help */
#help {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 18px 22px;
  width: min(440px, calc(100vw - 24px));
  z-index: 6;
}

#help[hidden],
#streetview[hidden],
#svImg[hidden],
#loading[hidden] {
  display: none;
}

#help h2 {
  margin: 0 0 4px;
}

#help p {
  margin: 6px 0 12px;
}

#help table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

#help td {
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
}

#help td:first-child {
  width: 46%;
}

#helpClose {
  position: absolute;
  right: 10px;
  top: 10px;
}

/* loading */
#loading {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(12, 15, 19, 0.88);
  z-index: 10;
  text-align: center;
  padding: 24px;
}

#loadingText {
  max-width: 520px;
  color: var(--text);
}

.spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

#attribution {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 4px 10px;
  font-size: 0.68rem;
  color: #c9d0d6;
  background: rgba(10, 12, 15, 0.6);
  white-space: nowrap;
  overflow-x: auto;
}

#attribution a {
  color: #e5e9ee;
}

@media (max-width: 860px) {
  #controls {
    top: auto;
    bottom: 255px;
    max-width: calc(100vw - 24px);
  }
  #minimap {
    width: 150px;
    height: 150px;
  }
}

/* on foot */
#crosshair {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  pointer-events: none;
  background:
    linear-gradient(#fff, #fff) center / 2px 8px no-repeat,
    linear-gradient(#fff, #fff) center / 8px 2px no-repeat;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.6);
}

#crosshair[hidden],
#hint[hidden] {
  display: none;
}

#hint {
  position: fixed;
  left: 50%;
  bottom: 70px;
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 0.95rem;
  pointer-events: none;
}
