/* FONDO GRIS OSCURO SIMILAR AL BOTÓN CANDADO */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background-color: #333333;
}

*, *::before, *::after { box-sizing: border-box; }
html, body, #map { height: 100%; margin: 0; padding: 0; }

/* MAPA transparente */
#map {
  background: transparent;
}

/* BUSCADOR */
#search-wrap {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  left: 0; right: 0;
  z-index: 10000;
  display: flex; justify-content: center;
  padding-left: max(12px, env(safe-area-inset-left, 0px));
  padding-right: max(12px, env(safe-area-inset-right, 0px));
  pointer-events: none;
  transition: opacity .4s ease;
}
#search-wrap.hidden { opacity: 0; pointer-events: none; }
#search-container { width: 80vw; max-width: 560px; min-width: 240px; pointer-events: auto; position: relative; }
#pac-input {
  width: 100%;
  padding: 12px 56px 12px 16px;
  border-radius: 24px; border: none; background:#fff;
  font-size: 17px; box-shadow: 0 2px 8px rgba(0,0,0,.2); outline: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#clear-btn {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; line-height: 30px; font-size: 22px;
  border-radius: 50%; border:1px solid #666; background:#fff; color:#666;
  text-align: center; padding:0; cursor:pointer; display:none;
}

/* GRID CONTROLS */
#grid-controls {
  position: fixed;
  left: 50%;
  top: calc(env(safe-area-inset-top, 0px) + 72px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0,0,0,.7);
  padding: 8px 14px;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
  z-index: 10000;
  max-width: 95vw;
  width: auto;
  transition: opacity .4s ease;
}
#toggleGridBtn { background: none; border: none; cursor: pointer; width: 28px; height: 28px; padding: 0; }
#toggleGridBtn svg { fill: #fff; width: 24px; height: 24px; }
#gridSlider { accent-color: #fff; width: 140px; }
#gridLabel { color: #fff; font: 14px system-ui; min-width: 60px; text-align: center; }

/* RECTÁNGULO CENTRAL + GRID con estados */
#center-rect {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-60%);
  width: 80vw; aspect-ratio: 4/3; 
  box-shadow: 0 0 8px rgba(0,0,0,.5);
  z-index: 10;
  pointer-events: none;
}
/* Borde rojo para candado cerrado */
#center-rect.locked {
  border: 3px solid rgba(255, 0, 0, 0.8);
}
/* Borde verde para candado abierto */
#center-rect.open {
  border: 3px solid rgba(0, 255, 0, 0.8);
}

.grid-line {
  position: absolute; background-color: rgba(255,255,255,.55);
  pointer-events: none; z-index: 10; transition: opacity .2s;
}

/* HUD coordenadas */
#coordsHud {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(3vh + 76px);
  background: rgba(0,0,0,.85); color: #fff; font: 13px/1.3 system-ui,-apple-system,Segoe UI,Roboto,sans-serif;
  padding: 8px 10px; border-radius: 10px; box-shadow: 0 4px 14px rgba(0,0,0,.35);
  z-index: 9999; white-space: pre; display: none; text-align: left; max-height: 50vh; overflow: auto;
}

/* Candados de vértices */
.vertex-lock {
  position: absolute;
  width: 16px;
  height: 16px;
  background: rgba(0,0,0,.85);
  border-radius: 3px;
  display: none;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%);
  box-shadow: 0 1px 2px rgba(0,0,0,.5);
  z-index: 9999;
  opacity: .95;
  transition: opacity .3s ease;
}
.vertex-lock svg {
  width: 12px;
  height: 12px;
  fill: #fff;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.4));
}

/* Botón candado central */
#lockBtn {
  position: fixed; bottom: 3vh; left: 50%; transform: translateX(-50%);
  background: #333; border: none; border-radius: 50%; padding: 18px; cursor: pointer; z-index: 10001;
  transition: transform .2s ease;
}
#lockBtn svg { width: 32px; height: 32px; fill: #fff; }
#lockBtn:active { transform: translateX(-50%) scale(0.92); }

/* Controles Grid nuevos: matriz 2x4 */
#play-buttons-container {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 72px;
  display: grid;
  grid-template-columns: repeat(4, 56px);
  grid-template-rows: repeat(2, 56px);
  gap: 8px 12px;
  background: rgba(0, 0, 0, 0.7);
  padding: 8px 12px;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
  z-index: 10001;
  transition: opacity 0.4s ease;
}
#play-buttons-container.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Botones comunes play y upload */
.play-btn, .upload-btn {
  background: #444;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: background-color 0.3s ease;
  width: 56px;
  height: 56px;
  font-size: 28px;
}
.play-btn:hover, .upload-btn:hover {
  background: #666;
}

/* Icono SVG de los botones Play */
.play-btn svg {
  width: 28px;
  height: 28px;
  stroke: white;
  fill: none;
}

/* Icono simple para carga (puedes reemplazar con SVG si quieres) */
.upload-btn {
  font-size: 28px;
  line-height: 1;
  padding: 0;
}
