html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #0b1020;
}

#map {
  position: absolute;
  inset: 0;
}

/* ---- loading overlay ---- */
#loading {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: #0b1020;
  color: #cfd8ea;
  font-size: 15px;
  letter-spacing: 0.03em;
  transition: opacity 0.6s ease;
}
#loading.done {
  opacity: 0;
  pointer-events: none;
}
.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: #7fb3ff;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- control panel ---- */
#panel {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 10;
  width: 218px;
  background: rgba(12, 18, 34, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: #e8edf6;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  user-select: none;
}
#panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 10px 9px 12px;
}
#panel-title {
  font-weight: 600;
  font-size: 14.5px;
  letter-spacing: 0.02em;
}
#panel-toggle {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #e8edf6;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
#panel-toggle:hover { background: rgba(255, 255, 255, 0.2); }
#panel.collapsed #panel-body { display: none; }

#panel-body { padding: 0 12px 12px; }

.section-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #93a3bd;
  margin: 8px 0 6px;
}

#presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
#presets button {
  flex: 1 1 45%;
  background: rgba(127, 179, 255, 0.14);
  border: 1px solid rgba(127, 179, 255, 0.35);
  color: #dce9ff;
  border-radius: 7px;
  padding: 6px 4px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}
#presets button:hover { background: rgba(127, 179, 255, 0.3); }

#textured-row {
  display: block;
  margin-top: 9px;
  font-size: 12px;
  color: #dce9ff;
  cursor: pointer;
}
#textured-row input { vertical-align: -2px; margin-right: 3px; }

#help { font-size: 11.5px; color: #b9c5d8; line-height: 1.9; }
.help-row kbd {
  display: inline-block;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 5px;
  font-size: 10.5px;
  font-family: inherit;
  margin-right: 1px;
}

/* keyboard rows are pointless on touch-only devices, and vice versa */
.touch-help { display: none; }
@media (pointer: coarse) {
  .help-row:not(.touch-help) { display: none; }
  .touch-help { display: block; }
  #panel { width: 196px; }
}

@media (max-width: 480px) {
  #panel { width: 180px; }
}
