* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --crema: #fbfaf6;
  --tinta: #24211c;
  --gris: #6b675e;
  --linea: #e4e0d4;
  --amarillo: #f2b90d;
  --amarillo-hover: #e0a800;
  --azul: #2f7fc1;
  --azul-oscuro: #1565c0;
  --rojo: #c62828;
  --verde: #2e7d32;
  --ambar: #b45309;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
}
html, body { height: 100%; font-family: var(--serif); color: var(--tinta); }
body { display: flex; flex-direction: column; background: var(--crema); }

#topbar {
  background: var(--crema); color: var(--tinta);
  display: flex; align-items: center; gap: 14px; padding: 12px 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 11px; }
.dot { width: 11px; height: 11px; border-radius: 50%; background: var(--rojo); animation: pulso 1.8s infinite; flex-shrink: 0; }
@keyframes pulso { 0%,100% { opacity: 1 } 50% { opacity: .3 } }
#topbar h1 { font-size: 20px; line-height: 1.1; font-weight: 700; letter-spacing: .2px; }
#subtitulo { font-size: 12.5px; color: var(--gris); font-style: italic; }
.stats { display: flex; gap: 16px; font-size: 12px; color: var(--gris); margin-left: auto; flex-wrap: wrap; }
.stats b { color: var(--tinta); font-size: 16px; }
.stats span { text-align: center; }

/* Franja tricolor, proporción de bandera 2:1:1 */
#tricolor {
  height: 8px; flex-shrink: 0;
  background: linear-gradient(180deg, var(--amarillo) 0 50%, var(--azul) 50% 75%, var(--rojo) 75% 100%);
}

.btn-primario {
  background: var(--amarillo); border: 2px solid #d9a50a; color: var(--tinta); font-weight: 700;
  padding: 12px 24px; border-radius: 8px; font-size: 16px; cursor: pointer; font-family: var(--serif);
  box-shadow: 0 2px 8px rgba(217,165,10,.45);
}
.btn-primario:hover { background: var(--amarillo-hover); }
.btn-primario:active { transform: scale(.98); }
.btn-sec {
  background: #efece2; border: 1px solid var(--linea); padding: 8px 12px; border-radius: 6px;
  font-size: 13px; cursor: pointer; font-family: var(--serif); color: var(--tinta);
}


#sel-ciudad {
  border: 1px solid var(--linea); border-radius: 999px; background: #fff; color: var(--tinta);
  padding: 6px 10px; font-size: 12.5px; font-family: var(--serif); cursor: pointer; font-weight: 700;
}

#chips {
  display: flex; gap: 6px; padding: 9px 12px; background: #fff;
  border-bottom: 1px solid var(--linea);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.chip {
  white-space: nowrap; border: 1px solid var(--linea); background: #fff; color: var(--gris);
  padding: 6px 12px; border-radius: 999px; font-size: 12.5px; cursor: pointer; font-family: var(--serif);
  display: inline-flex; align-items: center; gap: 6px;
}
.chip.on { background: var(--tinta); color: var(--crema); border-color: var(--tinta); font-weight: 700; }
.cdot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.chip:not(.on) .cdot { opacity: .45; }

#map { flex: 1; min-height: 300px; }

#aviso-modo {
  position: fixed; top: 118px; left: 50%; transform: translateX(-50%);
  background: var(--tinta); color: var(--crema); padding: 10px 16px; border-radius: 8px;
  font-size: 14px; z-index: 60; box-shadow: 0 4px 20px rgba(0,0,0,.35);
  display: flex; gap: 10px; align-items: center;
}
#aviso-modo button { background: #ffffff26; color: #fff; border: 0; padding: 5px 11px; border-radius: 5px; cursor: pointer; font-family: var(--serif); }

.oculto { display: none !important; }

#modal {
  position: fixed; inset: 0; background: rgba(36,33,28,.55); z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-caja {
  background: var(--crema); width: 100%; max-width: 540px; max-height: 92vh; overflow-y: auto;
  border-radius: 14px 14px 0 0; padding: 20px;
  border-top: 6px solid var(--amarillo);
}
@media (min-width: 640px) {
  #modal { align-items: center; }
  .modal-caja { border-radius: 12px; }
}
.modal-cabecera { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; border-bottom: 1.5px solid var(--linea); padding-bottom: 8px; }
.modal-cabecera h2 { font-size: 20px; color: var(--tinta); }
#cerrar-modal { background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--gris); line-height: 1; }

#form-reporte label { display: block; font-size: 13.5px; font-weight: 700; margin: 13px 0 5px; color: var(--tinta); }
#form-reporte input:not([type=radio]), #form-reporte textarea {
  width: 100%; padding: 10px; border: 1px solid var(--linea); border-radius: 6px; font-size: 15px;
  font-family: var(--serif); background: #fff; color: var(--tinta);
}
#form-reporte input:focus, #form-reporte textarea:focus { outline: 2px solid var(--azul); }
.tipos { display: flex; flex-wrap: wrap; gap: 6px; }
.tipo { display: inline-flex !important; margin: 0 !important; }
.tipo input {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.tipo span {
  border: 1.5px solid var(--linea); padding: 7px 12px; border-radius: 6px; font-size: 13.5px;
  cursor: pointer; background: #fff;
}
.tipo input:checked + span { border-color: var(--azul-oscuro); background: #e9f2fb; font-weight: 700; color: var(--azul-oscuro); }
.tipo input:focus-visible + span { outline: 2px solid var(--azul); }
.ubicacion-fila { display: flex; gap: 8px; align-items: center; margin-top: 15px; flex-wrap: wrap; }
#coords-texto { font-size: 13px; color: var(--azul-oscuro); font-weight: 700; }
.nota { font-size: 12.5px; color: var(--gris); margin: 13px 0; background: #f4f1e8; padding: 10px 12px; border-radius: 6px; border-left: 3px solid var(--amarillo); }
#btn-enviar { width: 100%; }
#form-msg { font-size: 14px; margin-top: 8px; text-align: center; font-weight: 700; }

#pie { background: #26231d; color: #c9c4b8; font-size: 12.5px; padding: 9px 16px; }
#pie summary { cursor: pointer; font-weight: 700; }
#pie p { margin-top: 6px; line-height: 1.55; max-width: 800px; }
#pie a { color: #8ec5ee; }

/* Popups */
.maplibregl-popup-content { font-family: var(--serif); padding: 13px 15px; border-radius: 8px; max-width: 300px; border-top: 4px solid var(--amarillo); }
.pop-tipo { display: inline-block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--gris); }
.pop-titulo { font-weight: 700; font-size: 15px; margin: 1px 0 2px; padding-right: 14px; color: var(--tinta); }
.pop-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; margin: 3px 0; }
.pop-badge.verificado { background: #e2efe3; color: var(--verde); }
.pop-badge.reportado { background: #f7ecd8; color: var(--ambar); }
.pop-badge.caido { background: #e5e7eb; color: #374151; }
.pop-hace { font-size: 11.5px; color: var(--gris); margin-left: 4px; font-style: italic; }
.pop-desc { font-size: 13px; color: var(--tinta); margin: 5px 0; line-height: 1.45; }
.pop-necesita { font-size: 13px; background: #fdf6ec; border-left: 3px solid var(--ambar); padding: 6px 9px; margin: 6px 0; border-radius: 4px; }
.pop-tel a { font-size: 13.5px; font-weight: 700; color: var(--azul-oscuro); text-decoration: none; }

/* Marcadores de reportes: gota por tipo, borde blanco */
.marcador {
  width: 20px; height: 20px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  border: 2.5px solid #fff; cursor: pointer; box-shadow: 0 2px 5px rgba(0,0,0,.35);
}
.marcador.reportado { opacity: .62; }
.m-derrumbe { background: var(--rojo); }
.m-acopio { background: var(--azul-oscuro); }
.m-albergue { background: var(--verde); }
.m-necesidad { background: #e09600; }
.m-desaparecido { background: #6d28d9; }
.m-otro { background: #55606a; }

@media (max-width: 640px) {
  #topbar { padding: 9px 12px; gap: 8px; }
  .stats { gap: 10px; font-size: 11px; }
  .stats b { font-size: 14px; }
  #btn-reportar {
    position: fixed; bottom: 48px; right: 14px; z-index: 50;
    box-shadow: 0 6px 20px rgba(217,165,10,.65); padding: 16px 26px; border-radius: 999px; font-size: 17px;
  }
}

/* Foto en popup */
.pop-foto { width: 100%; border-radius: 6px; margin-top: 8px; max-height: 170px; object-fit: cover; }

/* Barra inferior */
#barra-inferior {
  background: #26231d; display: flex; border-top: 1px solid #3a352c;
}
#barra-inferior button {
  flex: 1; background: none; border: 0; color: #e8e3d6; font-family: var(--serif);
  font-size: 13.5px; font-weight: 700; padding: 13px 8px; cursor: pointer;
  border-right: 1px solid #3a352c;
}
#barra-inferior button:last-child { border-right: 0; }
#barra-inferior button:hover { background: #322d25; }
#btn-donar { color: var(--amarillo); }

/* Paneles deslizantes */
.panel { position: fixed; inset: 0; background: rgba(36,33,28,.55); z-index: 90; display: flex; align-items: flex-end; justify-content: center; }
.panel-caja {
  background: var(--crema); width: 100%; max-width: 560px; max-height: 85vh; overflow-y: auto;
  border-radius: 14px 14px 0 0; padding: 18px 18px 30px; border-top: 6px solid var(--amarillo);
}
@media (min-width: 640px) { .panel { align-items: center; } .panel-caja { border-radius: 12px; max-height: 88vh; } }
.panel-cabecera { display: flex; justify-content: space-between; align-items: center; border-bottom: 1.5px solid var(--linea); padding-bottom: 8px; margin-bottom: 10px; }
.panel-cabecera h2 { font-size: 20px; color: var(--tinta); }
.cerrar-panel { background: none; border: 0; font-size: 24px; color: var(--gris); cursor: pointer; line-height: 1; }
.panel-intro { font-size: 13px; color: var(--gris); line-height: 1.5; margin-bottom: 14px; }
.panel-intro a { color: var(--azul-oscuro); }
.vacio { color: var(--gris); font-style: italic; padding: 10px 0; }

/* Lista donar */
.grupo-ciudad { margin-bottom: 18px; }
.grupo-ciudad > h3 { font-size: 15px; color: var(--tinta); border-bottom: 2px solid var(--amarillo); display: inline-block; padding-bottom: 2px; margin-bottom: 8px; }
.tarjeta-donar { background: #fff; border: 1px solid var(--linea); border-radius: 8px; padding: 12px; margin-bottom: 8px; }
.td-etiqueta { display: inline-block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; padding: 2px 8px; border-radius: 999px; margin-bottom: 5px; }
.td-etiqueta.acopio { background: #e9f2fb; color: var(--azul-oscuro); }
.td-etiqueta.albergue { background: #e2efe3; color: var(--verde); }
.td-titulo { font-weight: 700; font-size: 15px; color: var(--tinta); }
.td-desc { font-size: 12.5px; color: var(--gris); margin: 3px 0; line-height: 1.4; }
.td-necesita { font-size: 13px; background: #fdf6ec; border-left: 3px solid var(--ambar); padding: 6px 8px; border-radius: 4px; margin: 6px 0; }
.td-acciones { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.td-btn { flex: 1; text-align: center; background: var(--amarillo); color: var(--tinta); font-weight: 700; font-size: 13px; padding: 9px 10px; border-radius: 6px; text-decoration: none; white-space: nowrap; }
.td-btn.sec { background: #efece2; color: var(--tinta); border: 1px solid var(--linea); }
.td-verif { font-size: 11px; color: var(--verde); font-style: italic; margin-top: 7px; }

/* Lista sismos */
.sismo-principal { display: flex; gap: 12px; align-items: center; background: #fdecea; border: 1px solid #f3c2bd; border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.sp-mag { font-size: 30px; font-weight: 800; color: var(--rojo); line-height: 1; flex-shrink: 0; }
.sp-info { font-size: 13px; color: var(--tinta); line-height: 1.4; }
.sp-hace { color: var(--gris); font-style: italic; font-size: 12px; }
.sismo-h { font-size: 14px; color: var(--tinta); margin-bottom: 6px; }
.tabla-sismos { width: 100%; border-collapse: collapse; }
.tabla-sismos td { padding: 7px 4px; border-bottom: 1px solid var(--linea); font-size: 12.5px; vertical-align: middle; }
.mag-chip { display: inline-block; min-width: 34px; text-align: center; color: #fff; font-weight: 700; font-size: 12.5px; padding: 2px 7px; border-radius: 6px; }
.ts-lugar { color: var(--tinta); line-height: 1.3; }
.ts-hace { color: var(--gris); white-space: nowrap; text-align: right; font-style: italic; }
.sismo-fuente { font-size: 11.5px; color: var(--gris); margin-top: 10px; font-style: italic; }
.sismo-resumen { font-size: 12.5px; color: var(--gris); background: #f4f1e8; padding: 8px 10px; border-radius: 6px; margin-bottom: 12px; }
.sismo-resumen b { color: var(--tinta); }
.ts-sentido { display: inline-block; font-size: 10px; font-weight: 700; color: var(--ambar); background: #fdf0dd; padding: 1px 5px; border-radius: 4px; text-transform: uppercase; letter-spacing: .4px; vertical-align: middle; }

/* Marcador de necesidad urgente: late para llamar la atención aunque no reste honestidad al "sin verificar" */
.marcador.urgente { opacity: 1 !important; animation: latido-urg 1.1s infinite; z-index: 10; }
@keyframes latido-urg {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224,150,0,.6), 0 2px 5px rgba(0,0,0,.35); }
  50% { box-shadow: 0 0 0 8px rgba(224,150,0,0), 0 2px 5px rgba(0,0,0,.35); }
}
.pop-urgente { font-size: 12.5px; background: #fdecea; border-left: 3px solid var(--rojo); color: #8a1c16; padding: 7px 9px; border-radius: 4px; margin: 6px 0; font-weight: 700; line-height: 1.4; }
.pop-urgente a { color: var(--rojo); }
