* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #1a1a2e;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

#map-canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  cursor: grab;
  touch-action: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#status {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  pointer-events: none;
}

#tooltip {
  display: none;
  position: fixed;
  left: 0;
  bottom: 0;
  background: rgba(20, 20, 40, 0.92);
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  border-right: 1px solid rgba(255, 255, 255, 0.15);
  padding: 10px 16px;
  padding-left: calc(16px + env(safe-area-inset-left, 0px));
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  color: #fff;
  font-family: 'Silkscreen', monospace;
  font-size: 16px;
  pointer-events: none;
  z-index: 100;
  min-width: 180px;
  text-transform: uppercase;
  line-height: 1.2;
}

.tooltip-name {
  font-size: 20px;
  margin-bottom: 2px;
}

.tooltip-owner {
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 2px;
}

.tooltip-route {
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 2px;
}

.tooltip-status {
  color: #4aff6a;
}

.tooltip-speed {
  color: rgba(255, 255, 255, 0.5);
  margin-top: 2px;
}

/* Search UI */
#search-toggle {
  position: fixed;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  background: rgba(20, 20, 40, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 18px;
  color: #fff;
  font-size: 18px;
  line-height: 36px;
  text-align: center;
  cursor: pointer;
  z-index: 200;
  user-select: none;
  -webkit-user-select: none;
  transition: opacity 0.15s;
}

#search-toggle:hover {
  background: rgba(40, 40, 70, 0.9);
}

#search-toggle.hidden {
  opacity: 0;
  pointer-events: none;
}

#search-bar {
  position: fixed;
  top: 12px;
  right: 12px;
  display: none;
  align-items: center;
  background: rgba(20, 20, 40, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  padding: 0 12px;
  z-index: 200;
  height: 36px;
  width: 260px;
  max-width: calc(100vw - 24px);
}

#search-bar.open {
  display: flex;
}

#search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: #fff;
  font-family: 'Silkscreen', monospace;
  font-size: 13px;
  padding: 0;
  text-transform: uppercase;
}

#search-input::placeholder {
  color: rgba(255, 255, 255, 0.35);
  text-transform: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 12px;
}

#search-close {
  color: rgba(255, 255, 255, 0.5);
  font-size: 20px;
  cursor: pointer;
  margin-left: 6px;
  line-height: 1;
}

#search-close:hover {
  color: #fff;
}

/* Mobile: scale tooltip down to 50% (portrait and landscape) */
@media (max-width: 768px), (max-height: 500px) {
  #tooltip {
    transform: scale(0.5);
    transform-origin: bottom left;
  }
}

/* Fullscreen prompt for landscape mobile */
#fs-prompt {
  display: none;
  position: fixed;
  bottom: 8px;
  right: 8px;
  background: rgba(20, 20, 40, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 12px;
  padding: 6px 14px;
  cursor: pointer;
  z-index: 300;
  user-select: none;
  -webkit-user-select: none;
}
