:root {
  --dorado: #c9932f;
  --oscuro: #2b2417;
  --verde: #4c7a3f;
  --rojo: #a53d3d;
  --crema: #f6efe1;
  --gris: #6b6459;
  --laton: #b8860b;
  --ambar: #ffb000;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--crema);
  color: var(--oscuro);
  min-height: 100vh;
}

.cabecera {
  background: var(--oscuro);
  color: var(--crema);
  text-align: center;
  padding: 18px 10px 10px;
}
.cabecera h1 { margin: 0; font-size: 1.4rem; }
.subtitulo { margin: 4px 0 0; color: var(--dorado); font-style: italic; }

main#app { max-width: 480px; margin: 0 auto; padding: 16px; }

.pantalla { animation: aparecer 0.3s ease-in; }
@keyframes aparecer {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.tarjeta {
  background: white;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

h2 { margin-top: 0; }

.etiqueta-campo { display: block; font-size: 0.85rem; color: var(--gris); margin-bottom: 4px; }

input[type="text"], input[type="number"], input[type="password"], select {
  width: 100%;
  padding: 10px;
  font-size: 16px;
  border-radius: 8px;
  border: 1px solid #ccc;
  margin-bottom: 10px;
  background: white;
}

button {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  background: var(--dorado);
  color: white;
  cursor: pointer;
  margin-bottom: 10px;
}
button:disabled { background: #d8cdb0; cursor: not-allowed; }
button:hover:not(:disabled) { opacity: 0.9; }

.btn-secundario {
  background: transparent;
  color: var(--oscuro);
  border: 1px solid var(--dorado);
  font-size: 0.85rem;
  padding: 8px;
}
.btn-secundario-solido {
  background: var(--oscuro);
}

.btn-pista { background: var(--rojo); margin-top: 10px; }

.ayuda { font-size: 0.85rem; color: var(--gris); }

.crono { text-align: center; font-size: 0.9rem; color: var(--gris); margin: 0 0 10px; }

.objetivo { font-size: 1.1rem; font-weight: bold; }

/* ---------------------------------------------------------
   LISTA DE INTEGRANTES (registro dinámico)
--------------------------------------------------------- */
.fila-integrante {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  background: #f0ead9;
  padding: 8px;
  border-radius: 8px;
}
.fila-integrante input[type="text"] { margin-bottom: 0; flex: 1; }
.fila-integrante label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  white-space: nowrap;
}
.fila-integrante input[type="checkbox"] { width: 20px; height: 20px; }

/* ---------------------------------------------------------
   MODAL genérico
--------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
/* Sin este selector, [hidden] pierde el empate de especificidad contra
   ".modal-overlay { display:flex }" y el modal se queda visible siempre. */
.modal-overlay[hidden] {
  display: none;
}
.modal-caja {
  background: white;
  border-radius: 12px;
  padding: 22px;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
.modal-caja p { font-size: 1.05rem; margin-bottom: 16px; }

/* ---------------------------------------------------------
   MÁQUINA DEL TIEMPO — cuenta atrás vintage
--------------------------------------------------------- */
.maquina-tiempo {
  position: relative;
  background: linear-gradient(160deg, #3b3226, #241d15);
  border: 6px solid var(--laton);
  border-radius: 16px;
  padding: 30px 20px;
  text-align: center;
  box-shadow:
    inset 0 0 20px rgba(0,0,0,0.6),
    0 6px 18px rgba(0,0,0,0.35);
  margin: 20px 0;
}
.maquina-tiempo-remaches {
  position: absolute;
  top: 8px; left: 8px; right: 8px; bottom: 8px;
  border: 2px dashed rgba(184,134,11,0.4);
  border-radius: 10px;
  pointer-events: none;
}
.maquina-tiempo-remaches::before,
.maquina-tiempo-remaches::after {
  content: '';
  position: absolute;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--laton);
  box-shadow: 0 0 0 2px #6b4f11 inset;
}
.maquina-tiempo-remaches::before { top: -6px; left: -6px; }
.maquina-tiempo-remaches::after { bottom: -6px; right: -6px; }

.maquina-tiempo-pantalla {
  background: #0c0f0a;
  border-radius: 8px;
  padding: 16px 10px;
  box-shadow: inset 0 0 12px rgba(0,0,0,0.8);
}
#reloj-cuentaatras {
  font-family: 'Courier New', monospace;
  font-size: 2.6rem;
  font-weight: bold;
  letter-spacing: 3px;
  color: var(--ambar);
  text-shadow: 0 0 8px rgba(255,176,0,0.75), 0 0 2px rgba(255,176,0,0.9);
}
.maquina-tiempo-etiqueta {
  margin-top: 14px;
  color: var(--dorado);
  font-size: 0.75rem;
  letter-spacing: 2px;
  font-weight: bold;
}

/* ---------------------------------------------------------
   MEDIDOR "GEIGER"
--------------------------------------------------------- */
.geiger-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 160px;
  margin: 10px 0;
}
.geiger-circulo {
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(76,122,63,0.35) 0%, rgba(76,122,63,0.05) 70%);
  border: 3px solid var(--verde);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.geiger-circulo.pulso { animation: geiger-pulso var(--duracion-pulso, 1s) ease-out; }
.geiger-circulo.cerca {
  border-color: var(--rojo);
  background: radial-gradient(circle, rgba(165,61,61,0.4) 0%, rgba(165,61,61,0.05) 70%);
}
@keyframes geiger-pulso {
  0%   { opacity: 1;   transform: scale(0.85); }
  70%  { opacity: 0.25; transform: scale(1.15); }
  100% { opacity: 0.6; transform: scale(1); }
}
.geiger-numero { position: relative; z-index: 1; font-size: 2.1rem; font-weight: bold; color: var(--oscuro); text-align: center; }
.geiger-unidad { font-size: 1rem; font-weight: normal; }
.geiger-tendencia { display: block; font-size: 1rem; margin-top: 2px; }
.geiger-tendencia.subiendo { color: var(--rojo); }
.geiger-tendencia.bajando { color: var(--verde); }

.mensaje-letras {
  font-size: 1.6rem;
  letter-spacing: 4px;
  font-weight: bold;
  color: var(--oscuro);
  word-break: break-all;
}

.spinner {
  width: 36px; height: 36px;
  border: 4px solid #eee;
  border-top-color: var(--dorado);
  border-radius: 50%;
  margin: 16px auto;
  animation: girar 1s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

.pie { text-align: center; font-size: 0.75rem; color: var(--gris); padding: 10px; }

/* ---------------------------------------------------------
   PUZLE: Arrastrar y soltar
--------------------------------------------------------- */
.arrastrar-zona-origen {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 10px; background: #f0ead9; border-radius: 8px;
  margin-bottom: 12px; min-height: 60px;
}
.arrastrar-ficha {
  font-size: 2rem; padding: 6px 10px; background: white;
  border-radius: 8px; border: 2px solid var(--dorado);
  cursor: grab; touch-action: none; user-select: none;
}
.arrastrar-ficha.arrastrando { opacity: 0.4; }
.arrastrar-lista-destino { display: flex; flex-direction: column; gap: 8px; }
.arrastrar-hueco {
  min-height: 52px; border: 2px dashed #bbb; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; background: #fff;
}
.arrastrar-hueco.sobre-hover { border-color: var(--dorado); background: #fff8e6; }
.arrastrar-hueco.ocupado { border-style: solid; border-color: var(--verde); }

/* ---------------------------------------------------------
   PUZLE: Multitáctil
--------------------------------------------------------- */
.multitouch-zona {
  height: 220px; border-radius: 12px; background: #eef3e8;
  border: 3px dashed var(--verde); display: flex;
  align-items: center; justify-content: center; position: relative;
  touch-action: none; user-select: none;
}
.multitouch-texto { font-size: 1.1rem; font-weight: bold; text-align: center; z-index: 1; }
.multitouch-progreso {
  position: absolute; bottom: 0; left: 0; height: 6px;
  background: var(--verde); width: 0%; transition: width 0.1s linear;
}

/* ---------------------------------------------------------
   PUZLE: Slider de sintonía
--------------------------------------------------------- */
.slider-sintonia { width: 100%; margin: 16px 0; }
.slider-estado { text-align: center; font-weight: bold; }
.slider-estado.en-zona { color: var(--verde); }
