* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color: #1a1a1a;
}

body {
  display: flex;
}

#sidebar {
  width: 260px;
  flex: 0 0 260px;
  padding: 14px 16px;
  background: #f7f7f8;
  border-right: 1px solid #d9d9dc;
  overflow-y: auto;
  height: 100vh;
  display: flex;
  flex-direction: column;
  transition: flex-basis 0.25s ease, width 0.25s ease, padding 0.25s ease;
}

body.sidebar-hidden #sidebar {
  width: 0;
  height: 0;
  flex: 0 0 0;
  padding: 0;
  border: 0;
  overflow: hidden;
}

#sidebar-toggle {
  position: fixed;
  top: 10px;
  left: 222px;
  z-index: 10;
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  background: white;
  border: 1px solid #c9c9cf;
  border-radius: 4px;
  color: #333;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: left 0.25s ease;
}

#sidebar-toggle:hover { background: #f0f0f0; }

body.sidebar-hidden #sidebar-toggle { left: 10px; }

#sidebar h1 {
  font-size: 16px;
  margin: 0 0 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.field {
  margin-bottom: 10px;
}

.field label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: #555;
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.field input,
.field select {
  width: 100%;
  padding: 5px 8px;
  font-size: 13px;
  border: 1px solid #c9c9cf;
  border-radius: 4px;
  background: white;
}

.input-row {
  display: flex;
  gap: 4px;
}
.input-row input { flex: 1 1 auto; min-width: 0; width: auto; }
.input-row select { flex: 0 0 auto; width: auto; }

.row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.row .field {
  flex: 1;
  margin-bottom: 0;
}

.field input[type="range"] {
  width: 100%;
  padding: 0;
  margin-top: 5px;
  accent-color: #0a7e8c;
}

.compass-wrap {
  display: flex;
  justify-content: center;
  margin: 2px 0 10px;
}

#compass {
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}

.readout {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  color: #333;
  padding: 5px 8px;
  background: #ececee;
  border-radius: 4px;
}

.status {
  font-size: 11px;
  color: #a94442;
  min-height: 14px;
  margin-top: 6px;
}

#sidebar footer {
  margin-top: auto;
  padding-top: 10px;
  font-size: 10px;
  color: #888;
  line-height: 1.4;
  border-top: 1px solid #ddd;
}

#sidebar footer p { margin: 0; }
#sidebar footer a { color: #888; }

#map {
  flex: 1;
  height: 100vh;
  position: relative;
}

#tile-progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: #0a7e8c;
  opacity: 0;
  transition: width 0.15s ease, opacity 0.3s ease;
  pointer-events: none;
  z-index: 5;
}
#tile-progress.active { opacity: 1; }

.hover-readout {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 600;
  color: #222;
}

@media (max-width: 700px) {
  body { flex-direction: column; }
  #sidebar { width: 100%; flex: 0 0 auto; height: auto; border-right: none; border-bottom: 1px solid #d9d9dc; }
  #map { height: 60vh; }
  body.sidebar-hidden #map { height: 100vh; }
  #sidebar-toggle {
    left: auto;
    right: 10px;
  }
  body.sidebar-hidden #sidebar-toggle {
    left: 10px;
    right: auto;
  }
}
