:root{ --bg:#0f172a; --panel:#111827; --card:#1f2937; --text:#e5e7eb; --muted:#9ca3af; --accent:#22c55e; --wrong:#ef4444; --border:#334155; }
*{ box-sizing:border-box; }
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: #0f172a; /* color base de fondo */
}header.app-header{ display:flex; justify-content:space-between; align-items:center; padding:12px 16px; border-bottom:1px solid var(--border); background:linear-gradient(180deg,#0b1023,transparent); }
h1{ font-size:1.25rem; margin:0; }
.controls{ display:flex; gap:12px; align-items:center; }
.btn{ background:var(--card); color:var(--text); border:1px solid var(--border); padding:8px 12px; border-radius:10px; cursor:pointer; transition:transform .05s ease, background .2s; }
.btn:active{ transform:scale(0.98); }
.score{ display:flex; gap:12px; color:var(--muted); }


.layout{ display:grid; grid-template-columns: 420px 1fr; gap:16px; padding:16px; }
.photo-panel{ background:var(--panel); border:1px solid var(--border); border-radius:14px; padding:12px; display:flex; flex-direction:column; gap:12px; }
#photo-wrap{ aspect-ratio: 4/3; width:100%; background:var(--card); border:1px dashed var(--border); border-radius:12px; display:grid; place-items:center; overflow:hidden; }
#photo{ width:100%; height:100%; object-fit:cover; display:block; }
.feedback{ min-height:48px; padding:8px 10px; border-radius:10px; background:#0b1023; border:1px solid var(--border); color:var(--muted); }


.map-panel{ position:relative; background:var(--panel); border:1px solid var(--border); border-radius:14px; padding:8px; }
#map {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}.legend{ position:absolute; left:16px; bottom:16px; background:rgba(17,24,39,.9); border:1px solid var(--border); color:var(--muted); padding:6px 10px; border-radius:10px; font-size:.9rem; }


/* Leaflet tweaks */
.leaflet-container{ background:#0b1023; }
.leaflet-control-zoom a{ background:var(--card); border:1px solid var(--border); color:var(--text); }
.leaflet-popup-content{ color:#111; }

/* --- Overlay central --- */
#game-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  z-index: 1000;
  pointer-events: all; /* ✅ permitir clics */
}

#game-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background: transparent; /* sin sombra ni difuminado */
  pointer-events: none;
}


.game-card {
  background: rgb(203 216 240 / 72%);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  text-align: center;
  width: 320px;
  padding: 20px;
  pointer-events: all; /* permitir clics dentro */
}

.game-card h2 {
  margin: 0 0 10px;
  color: #111;
}

.lives {
  font-size: 1.2rem;
  margin-bottom: 10px;
}

.photo-container {
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: 12px;
  overflow: hidden;
  background: #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.photo-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.btn-start {
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  padding: 10px 20px;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.2s;
}

.btn-start:hover {
  background: #1d4ed8;
}

.btn-start:active {
  transform: scale(0.98);
}

/* --- Botón inferior --- */
.btn-confirm {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #2e5f87;
  color: #fff;
  font-size: 1.1rem;
  border: none;
  border-radius: 17px;
  padding: 10px 38px;
  cursor: pointer;
  z-index: 999;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  transition: background 0.2s ease, transform 0.1s ease;
  display: none;
}

.btn-confirm:hover {
  background: #2a5b88;
}

.btn-confirm:active {
  transform: translateX(-50%) scale(0.98);
}


/* --- HUD contenedor general --- */
/* El contenedor principal debe ser relativo para que el absolute funcione */
.hud {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  z-index: 999;
  display: none;
  position: relative; /* importante para referencia del centrado */
}

/* --- Contenedor superior (vidas + foto) --- */
.hud-top {
  display: flex;
  align-items: center;
  background: none; /* sin fondo */
}

/* --- Bloque de vidas --- */
.hud-lives-box {
background: rgb(203 216 240 / 72%);
    border: 1px solid #ddd;
    border-radius: 14px 0px 0px 14px;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
}

.hud-title {
  margin: 0;
  font-weight: 600;
  font-size: 0.8rem; /* más pequeño */
  color: #111;
}

.lives {
  font-size: 0.95rem; /* corazones más pequeños */
  margin-top: 1px;
  line-height: 1;
}

/* --- Foto más grande y con menos radio --- */
/* --- HUD imagen clicable y botón de ampliar --- */
.hud-photo-box {
  position: relative;
  cursor: pointer;
}

.hud-photo-box img {
  width: 90px;
  height: 90px;
  border-radius: 8px;
  object-fit: cover;
  border: none;
}

/* --- Icono de expandir flotante sobre la esquina --- */
.expand-photo {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 26px;
  height: 26px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  z-index: 5;
  opacity: 0.95;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.expand-photo:hover {
  transform: scale(1.1);
  opacity: 1;
}

.expand-photo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}



/* --- Caja de puntos --- */
.hud-points-box {
position: absolute;
    top: 95px;
    width: 90px;
    display: flex;
    justify-content: center;
    padding: -12px;
}

/* Estilo de los puntos */
.points {
  background: #ff054b;
  color: white;
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  text-align: center;
}

/* --- Popup de resultado (inferior centrado) --- */
.result-popup {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  background: #ff3366;
  color: white;
  text-align: center;
  padding: 18px 28px;
  border-radius: 16px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  z-index: 2000;
  width: 260px;
  transition: opacity 0.3s ease, transform 0.3s ease;
  font-family: system-ui, sans-serif;
}

.result-popup.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 20px);
}

.result-popup h3 {
  font-size: 29px;
  margin-top: 0px;
  margin-bottom: 10px;
}

.result-popup p {
  margin: 2px 0;
  font-size: 17px;
}

.btn-next {
  background: white;
  color: #ff3366;
  font-weight: bold;
  border: none;
  border-radius: 12px;
  padding: 12px 42px;
  margin-top: 15px;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.2s ease;
}

.btn-next:active {
  transform: scale(0.97);
}

/* --- Botón de resultado correcto --- */
.btn-success {
  background: white;
  color: #169e04;
  font-weight: bold;
  border: none;
  border-radius: 12px;
  padding: 12px 42px;
  margin-top: 15px;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.2s ease;
}

.btn-next:active {
  transform: scale(0.97);
}


/* --- Modal de nueva ronda --- */
.round-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  transition: opacity 0.3s ease;
}
.round-modal.hidden {
  opacity: 0;
  pointer-events: none;
}

.round-content {
  position: relative;
  background: #f5f7fa;
  border-radius: 18px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
  width: 320px;
  padding: 18px;
  text-align: center;
  animation: popup 0.25s ease;
}

@keyframes popup {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.round-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #111;
  margin-bottom: 10px;
}

.round-content img {
  width: 100%;
  border-radius: 12px;
  object-fit: cover;
  aspect-ratio: 4/3;
 
}

.round-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 12px;
  padding: 6px 10px;
  margin-top: 10px;
}

.round-lives {
  font-size: 1.1rem;
}

.round-points {
  background: #ff054b;
  color: #fff;
  font-weight: 600;
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 0.85rem;
}

.round-close {
  position: absolute;
  top: -15px;
  right: -15px;
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  z-index: 10;
}

.round-close img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.round-close:hover {
  transform: scale(1.05);
  transition: transform 0.15s ease;
}

/* --- Pantalla inicial tipo nueva ronda --- */
.start-screen {
  background: #f5f7fa;
  border-radius: 18px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
  width: 320px;
  padding: 18px;
  text-align: center;
  animation: popup 0.25s ease;
}

.start-screen img {
  width: 100%;
  border-radius: 12px;
  object-fit: cover;
  aspect-ratio: 4/3;
}

.start-screen .round-footer {
  margin-bottom: 12px;
}

.start-screen .btn-start {
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  padding: 10px 20px;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.2s;
  width: 100%;
}

.start-screen .btn-start:hover {
  background: #1d4ed8;
}

.start-screen .btn-start:active {
  transform: scale(0.98);
}

/* --- Modal de fin de vidas --- */
.game-over {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  background: rgba(0, 0, 0, 0.6);
  transition: opacity 0.3s ease;
}

.game-over.hidden {
  opacity: 0;
  pointer-events: none;
}

.game-over-card {
  background: #f5f7fa;
  border-radius: 18px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
  text-align: center;
  width: 300px;
  padding: 20px;
  animation: popup 0.25s ease;
}

.game-over-card h2 {
  margin: 0 0 8px;
  color: #111;
}

.game-over-card p {
  margin: 0 0 16px;
  color: #333;
}

.btn-retry {
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  padding: 10px 20px;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.2s;
  width: 100%;
}

.btn-retry:hover {
  background: #1d4ed8;
}

.btn-retry:active {
  transform: scale(0.98);
}

/* --- Estilo uniforme para los corazones de vida --- */
.heart-icon {
  width: 24px;
  height: 24px;
  margin: 0 2px;
  display: inline-block;
  object-fit: contain;
  vertical-align: middle;
  border-radius: 0px !important;
}

/* Evita que flex o grid los estire */
#lives, 
#round-lives, 
#overlay-lives {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;
  gap: 2px;
}

#round-lives img,
#overlay-lives img,
#lives img {
  flex-shrink: 0;
  flex-grow: 0;
  width: 24px !important;
  height: 24px !important;
  object-fit: contain;
}
