:root {
  color-scheme: light;
  --icon-scale: 1;
  --ink: #17221e;
  --muted: #5d6a62;
  --line: #d7ded8;
  --paper: #eef2ea;
  --panel: rgba(255, 255, 255, 0.94);
  --forest: #4f8b62;
  --buffer: #55a7a0;
  --tree: #2f6f4e;
  --nav: #2c4f85;
  --selected: #b34f31;
  --place: #7f4f9f;
  --landmark: #76702f;
  --shadow: 0 18px 50px rgba(19, 31, 25, 0.18);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden; /* Allow rotated canvas to extend beyond container */
  color: var(--ink);
  background: var(--paper);
}

button {
  border: 0;
  font: inherit;
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(60, 99, 130, 0.35);
  outline-offset: 2px;
}

.app {
  height: 100%;
}

.search-shell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.search-toggle {
  min-width: 42px;
  width: 42px;
  padding: 0;
  font-size: 1.1rem;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}

.bottom-search {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 2;
}

.bottom-search .search-toggle {
  width: auto;
  min-width: 46px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.92);
}

.search-panel {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.search-panel[hidden] {
  display: none;
}

.search-number {
  min-height: 42px;
  width: clamp(150px, 18vw, 220px);
  border-radius: 6px;
  border: 1px solid var(--line);
  padding: 0 10px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

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

.button {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  color: #fff;
  background: var(--tree);
  box-shadow: 0 10px 22px rgba(20, 36, 28, 0.22);
  white-space: nowrap;
}

.install {
  display: none;
  background: #f3d36b;
  color: #1f271f;
}

.search-button {
  background: var(--selected);
}

.icon {
  width: calc(18px * var(--icon-scale));
  height: calc(18px * var(--icon-scale));
  flex: 0 0 auto;
}

.map-stage {
  position: relative;
  height: 100%;
  /* The canvas is never transformed in 3D any more (tilt is projected in JS), so the
     overscan only ever covers the heading-up rotation and must stay clipped to the stage —
     otherwise the oversized bitmap spills out around the inspector panel. */
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(229, 236, 226, 0.95), rgba(205, 218, 203, 0.95)),
    #d8e1d4;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}

#mapCanvas {
  will-change: transform;
}

#overlayCanvas {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 1;
  cursor: default;
}

canvas.dragging {
  cursor: grabbing;
}

.legend,
.inspector {
  position: absolute;
  z-index: 2;
  background: var(--panel);
  border: 1px solid rgba(36, 56, 47, 0.15);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}
