@font-face { font-family: "DM Sans"; src: url("fuentes/DMSans-500.ttf") format("truetype"); font-weight: 400 500; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("fuentes/DMSans-700.ttf") format("truetype"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("fuentes/DMSans-800.ttf") format("truetype"); font-weight: 800 900; font-display: swap; }

:root {
  --noche: #0b0f24;
  --noche-2: #1a1736;
  --morado: #2a1f3a;
  --lima: #E7FF00;
  --tinta: #14160a;
  --blanco: #ffffff;
  --suave: #C9CCE0;
  --tenue: #8b8fae;
  --caja: rgba(255, 255, 255, 0.06);
  --borde: rgba(255, 255, 255, 0.12);
  --rojo: #ff6b6b;
  --verde: #5CF2A2;
  --r: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--blanco);
  background: var(--noche);
  background-image: linear-gradient(170deg, var(--noche) 0%, var(--noche-2) 60%, var(--morado) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.lima { color: var(--lima); }
[hidden] { display: none !important; }

.app {
  max-width: 480px; min-height: 100dvh; margin: 0 auto;
  display: flex; flex-direction: column; position: relative;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
@media (min-width: 700px) {
  /* Sin flex centrado en el body: si la página es más alta que la ventana, se puede subir hasta arriba. */
  body { padding: 24px 0; }
  .app {
    min-height: min(860px, calc(100dvh - 48px)); width: 420px; margin: 0 auto;
    border: 1px solid var(--borde); border-radius: 28px; overflow: hidden;
    background: rgba(11, 15, 36, 0.55); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  }
}

/* Cabecera y barra de progreso */
.top { padding: 14px 16px 4px; }
.top-fila { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--suave); font-weight: 600; }
.top-nivel { color: var(--lima); letter-spacing: 0.04em; text-transform: uppercase; font-weight: 800; }
.barra { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-top: 10px; }
.barra i { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.14); transition: background 0.3s; }
.barra i.hecho { background: var(--lima); }
.barra i.ahora { background: linear-gradient(90deg, var(--lima) 50%, rgba(255, 255, 255, 0.14) 50%); }

/* Pantallas */
.pantalla { display: none; flex: 1; flex-direction: column; padding: 0 16px; animation: entra 0.35s ease; }
.pantalla.activa { display: flex; }
@keyframes entra { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.centro { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 18px; padding: 32px 0 16px; }
.nivel { flex: 1; padding: 18px 0 12px; display: flex; flex-direction: column; gap: 14px; }
.pie {
  position: sticky; bottom: 0; padding: 12px 0 calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(26, 23, 54, 0) 0%, rgba(26, 23, 54, 0.97) 18px);
  display: flex; flex-direction: column; gap: 10px;
}

/* Tipografía */
.titulo-xl { font-size: clamp(32px, 9vw, 40px); line-height: 1.05; font-weight: 800; letter-spacing: -0.02em; }
.titulo { font-size: 28px; line-height: 1.1; font-weight: 800; letter-spacing: -0.01em; }
.titulo-s { font-size: 20px; line-height: 1.2; font-weight: 800; }
.sub { font-size: 17px; line-height: 1.45; color: var(--suave); }
.texto { font-size: 16px; line-height: 1.45; color: #E9EAF4; }
.texto.peque { font-size: 14px; color: var(--suave); }
.paso-etq { font-size: 13px; font-weight: 800; color: var(--lima); letter-spacing: 0.05em; text-transform: uppercase; }
.chip { align-self: flex-start; font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--lima); border: 1px solid rgba(231, 255, 0, 0.45); padding: 6px 10px; border-radius: 99px; }
.aviso { font-size: 12px; color: var(--tenue); text-align: center; }
.mini-lista { list-style: none; display: grid; gap: 8px; }
.mini-lista li { background: var(--caja); border: 1px solid var(--borde); border-radius: 12px; padding: 12px 14px; font-size: 15px; color: var(--suave); }
.mini-lista b { color: var(--lima); font-size: 18px; margin-right: 6px; }
.fuente { font-size: 12px; color: var(--tenue); }

/* Botones */
.btn {
  display: flex; align-items: center; justify-content: center; text-align: center; text-decoration: none;
  min-height: 58px; width: 100%; border: 0; border-radius: var(--r);
  background: var(--lima); color: var(--tinta); font-size: 18px; font-weight: 800;
  box-shadow: 0 8px 24px rgba(231, 255, 0, 0.22); transition: transform 0.08s, opacity 0.2s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.35; box-shadow: none; cursor: default; }
.btn-sec { background: transparent; color: var(--lima); border: 2px solid var(--lima); box-shadow: none; }
.btn-texto { background: none; border: 0; color: var(--suave); text-decoration: underline; font-size: 15px; padding: 14px; }
.btn:focus-visible, .op:focus-visible, .tarjeta:focus-visible, .btn-texto:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

/* Opciones */
.ops { display: grid; gap: 10px; }
.op {
  text-align: left; width: 100%; min-height: 56px; padding: 14px 16px; border-radius: 14px;
  background: var(--caja); border: 1.5px solid var(--borde); font-size: 16px; font-weight: 600; line-height: 1.3;
  display: flex; gap: 12px; align-items: center; transition: border-color 0.2s, background 0.2s;
}
.op .ic { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, 0.08); font-size: 15px; }
.op small { display: block; font-weight: 500; color: var(--tenue); font-size: 13px; margin-top: 2px; }
.op.bien { border-color: var(--verde); background: rgba(92, 242, 162, 0.12); }
.op.bien .ic { background: var(--verde); color: var(--tinta); }
.op.mal { border-color: var(--rojo); background: rgba(255, 107, 107, 0.1); animation: tiembla 0.35s; }
.op.mal .ic { background: var(--rojo); color: var(--tinta); }
.op.sel { border-color: var(--lima); background: rgba(231, 255, 0, 0.1); }
.op.sel .ic { background: var(--lima); color: var(--tinta); }
@keyframes tiembla { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.feedback { min-height: 0; font-size: 15px; line-height: 1.4; border-radius: 12px; padding: 0 14px; transition: all 0.25s; }
.feedback:not(:empty) { padding: 12px 14px; background: #221d44; border: 1px solid var(--borde); }
.feedback.bien { background: rgba(92, 242, 162, 0.12); border: 1px solid rgba(92, 242, 162, 0.5); }
.feedback.mal { background: rgba(255, 107, 107, 0.1); border: 1px solid rgba(255, 107, 107, 0.5); }
.feedback b { color: var(--blanco); }

/* Navegador simulado (lista) */
.web { border-radius: 14px; overflow: hidden; border: 1px solid var(--borde); background: rgba(0, 0, 0, 0.25); }
.web-barra { font-size: 12px; color: var(--tenue); padding: 8px 12px; background: rgba(255, 255, 255, 0.05); display: flex; gap: 6px; align-items: center; }
.web-barra::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--verde); }
.fila { display: flex; justify-content: space-between; gap: 10px; padding: 12px; border-top: 1px solid var(--borde); font-size: 14px; width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; }
.fila b { font-weight: 700; }
.fila .monto { font-weight: 800; white-space: nowrap; }
.fila.redimida { opacity: 0.45; text-decoration: line-through; }
.fila.redimida .monto::after { content: " · redimida"; font-weight: 600; text-decoration: none; }
.fila.toc { cursor: pointer; }
.fila.toc:active { background: rgba(231, 255, 0, 0.08); }
.fila.bien { background: rgba(92, 242, 162, 0.14); }
.fila.mal { background: rgba(255, 107, 107, 0.12); }

/* Ficha */
.ficha { border-radius: 14px; border: 1px solid var(--borde); background: var(--caja); padding: 14px; display: grid; gap: 10px; }
.ficha-dir { font-weight: 800; font-size: 17px; }
.dato { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; border-top: 1px dashed var(--borde); padding-top: 9px; }
.dato span:first-child { color: var(--suave); }
.dato span:last-child { font-weight: 700; text-align: right; }
.dato.ojo span:last-child { color: var(--lima); }

/* Mapa y escena */
.mapa { position: relative; border-radius: 14px; overflow: hidden; border: 1px solid var(--borde); touch-action: none; user-select: none; }
.mapa svg { display: block; width: 100%; height: auto; }
.pin {
  position: absolute; width: 56px; height: 56px; display: grid; place-items: center; font-size: 34px;
  touch-action: none; cursor: grab; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6)); z-index: 2;
}
.pin.arrastrando { cursor: grabbing; transform: scale(1.15); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips .op { width: auto; min-height: 48px; padding: 10px 14px; }
.zona { cursor: pointer; transition: opacity 0.2s; }
.foto-punto { cursor: pointer; }
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.flash.va { animation: flash 0.35s; }
@keyframes flash { 0% { opacity: 0.85; } 100% { opacity: 0; } }
.contador { font-weight: 800; color: var(--lima); }

/* Tarjetas para elegir */
.tarjetas { display: grid; gap: 12px; }
.tarjeta { border-radius: 16px; border: 1.5px solid var(--borde); background: var(--caja); padding: 14px; display: grid; gap: 10px; }
.tarjeta-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.tarjeta-dir { font-weight: 800; font-size: 16px; line-height: 1.25; }
.tarjeta-com { font-size: 13px; color: var(--suave); margin-top: 2px; }
.tarjeta-salida { text-align: right; white-space: nowrap; }
.tarjeta-salida small { display: block; font-size: 11px; color: var(--tenue); }
.tarjeta-salida b { font-size: 18px; color: var(--lima); }
.tarjeta-acc { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tarjeta-acc button { min-height: 48px; border-radius: 12px; font-weight: 800; font-size: 15px; }
.b-ficha { background: transparent; border: 1.5px solid var(--borde); }
.b-elegir { background: var(--lima); color: var(--tinta); border: 0; }
.tarjeta .ficha { background: rgba(0, 0, 0, 0.2); }

/* Subasta */
.subasta { align-items: center; text-align: center; gap: 12px; }
.reloj-caja { position: relative; width: 132px; height: 132px; }
.reloj { width: 100%; height: 100%; transform: rotate(-90deg); }
.reloj-fondo { fill: none; stroke: rgba(255, 255, 255, 0.1); stroke-width: 9; }
.reloj-arco { fill: none; stroke: var(--lima); stroke-width: 9; stroke-linecap: round; stroke-dasharray: 326.7; transition: stroke-dashoffset 0.25s linear, stroke 0.3s; }
.reloj-arco.urge { stroke: var(--rojo); }
.reloj-num { position: absolute; inset: 0; display: grid; place-content: center; font-size: 40px; font-weight: 800; line-height: 1; }
.reloj-num small { font-size: 12px; color: var(--tenue); font-weight: 600; }
.precio-caja { display: grid; gap: 2px; }
.precio-etq { font-size: 14px; color: var(--suave); font-weight: 600; }
.precio-etq.tuyo { color: var(--verde); }
.precio { font-size: 44px; font-weight: 800; letter-spacing: -0.02em; }
.precio.salta { animation: salta 0.3s; }
@keyframes salta { 50% { transform: scale(1.08); color: var(--lima); } }
.precio-nota { font-size: 12px; color: var(--tenue); }
.registro { list-style: none; width: 100%; display: grid; gap: 6px; min-height: 120px; align-content: start; }
.registro li { display: flex; justify-content: space-between; font-size: 14px; padding: 8px 12px; border-radius: 10px; background: var(--caja); animation: entra 0.25s; }
.registro li.yo { background: rgba(92, 242, 162, 0.14); color: var(--verde); font-weight: 700; }
.deposito { width: 100%; font-size: 13px; color: var(--suave); background: rgba(231, 255, 0, 0.07); border: 1px solid rgba(231, 255, 0, 0.25); border-radius: 12px; padding: 10px 12px; text-align: left; line-height: 1.45; }
.deposito b { color: var(--lima); }
.empuje { text-align: center; font-weight: 800; min-height: 20px; color: var(--rojo); font-size: 15px; }
.btn-puja { font-size: 20px; min-height: 64px; }
.btn-puja.late { animation: late 0.8s infinite; }
@keyframes late { 50% { box-shadow: 0 0 0 8px rgba(231, 255, 0, 0.25); } }

/* Ganaste */
.resumen { display: grid; gap: 8px; }
.resumen .dato { border-top: 1px solid var(--borde); font-size: 15px; }
.resumen .dato.grande span:last-child { color: var(--lima); font-size: 22px; font-weight: 800; }
.form { display: grid; gap: 12px; padding: 16px; border-radius: 18px; background: var(--caja); border: 1px solid var(--borde); margin-top: 6px; }
.form label { display: grid; gap: 6px; font-size: 14px; font-weight: 700; color: var(--suave); }
.form input {
  min-height: 52px; border-radius: 12px; border: 1.5px solid var(--borde); background: rgba(0, 0, 0, 0.3);
  padding: 0 14px; font-size: 17px; font-weight: 500; outline: none;
}
.form input:focus { border-color: var(--lima); }
.error { color: var(--rojo); font-size: 14px; min-height: 0; }
.final { display: grid; gap: 14px; }
.cert {
  border-radius: 18px; padding: 18px; display: grid; gap: 8px;
  background: linear-gradient(160deg, #141a3a, #2a1f3a); border: 1.5px dashed rgba(231, 255, 0, 0.55);
}
.cert .cert-aviso { justify-self: start; background: var(--lima); color: var(--tinta); font-weight: 800; font-size: 12px; padding: 5px 10px; border-radius: 8px; }
.cert h4 { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--lima); }
.cert .cert-nombre { font-size: 24px; font-weight: 800; line-height: 1.15; }
.cert p { font-size: 14px; color: var(--suave); line-height: 1.45; }
.cert .cert-num { font-size: 12px; color: var(--tenue); }
.invita { display: grid; gap: 10px; padding: 16px; border-radius: 18px; border: 1px solid rgba(231, 255, 0, 0.35); background: rgba(231, 255, 0, 0.05); }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(5, 7, 18, 0.78); display: grid; place-items: end center; z-index: 20; padding: 16px; animation: entra 0.2s; }
.modal-caja { width: 100%; max-width: 448px; background: #1c1838; border: 1.5px solid var(--rojo); border-radius: 22px; padding: 20px; display: grid; gap: 14px; margin-bottom: env(safe-area-inset-bottom); }
.modal-caja .titulo-s { color: var(--rojo); }
@media (min-width: 700px) { .modal { place-items: center; } }

#confeti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 30; }
.firma-pie { text-align: center; font-size: 11px; color: var(--tenue); padding: 0 16px 12px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Destino (bienvenida) */
.destino { display: flex; gap: 12px; align-items: flex-start; background: rgba(231, 255, 0, 0.07); border: 1px solid rgba(231, 255, 0, 0.3); border-radius: 14px; padding: 12px 14px; }
.destino p { font-size: 15px; line-height: 1.45; color: #E9EAF4; }
.destino b { color: var(--blanco); }
.destino-ic { font-size: 22px; line-height: 1; }

/* Resultados de búsqueda (paso 1) */
.busqueda { display: grid; gap: 10px; }
.busqueda .op { align-items: flex-start; }
.res-url { display: block; font-size: 12px; color: var(--verde); font-weight: 600; margin-bottom: 3px; }
.res-anuncio { display: inline-block; font-size: 10px; font-weight: 800; border: 1px solid var(--tenue); color: var(--suave); border-radius: 4px; padding: 0 4px; margin-right: 6px; }
.op .res-desc { display: block; font-weight: 500; color: var(--suave); font-size: 13px; margin-top: 4px; }
.fila .fila-sub { display: block; font-size: 12px; color: var(--tenue); font-weight: 500; margin-top: 2px; }
.fila.elegida { background: rgba(231, 255, 0, 0.12); box-shadow: inset 3px 0 0 var(--lima); }

/* Zonas de inundación (paso 4) */
.zona-info { display: grid; gap: 8px; }
.zona-info .op { cursor: default; }
.zona-info .op b { display: block; }

/* Comparables (paso 5) */
.calle { touch-action: manipulation; }
.casa { cursor: pointer; }
.casa .lote { fill: #2b4a36; stroke: #3f6b4e; stroke-width: 1.5; }
.casa .techo { fill: #9a96a8; stroke: #6f6c7d; stroke-width: 1; }
.casa .etq { fill: #0b0f24; stroke: #C9CCE0; stroke-width: 1; }
.casa .etq-t { fill: #fff; pointer-events: none; }
.casa .rec-t { fill: #14160a; pointer-events: none; }
.casa.tuya .lote { stroke: #E7FF00; stroke-width: 2.5; fill: #34502f; }
.casa.tuya .etq { fill: #E7FF00; stroke: none; }
.casa.tuya .etq-t { fill: #14160a; }
.casa.bien .lote { stroke: #5CF2A2; stroke-width: 3; }
.casa.bien .etq { fill: #5CF2A2; stroke: none; }
.casa.bien .etq-t { fill: #0b0f24; }
.casa.mal .lote { stroke: #ff6b6b; stroke-width: 3; }
.casa.mal .etq { fill: #ff6b6b; stroke: none; }
.estimado { display: grid; gap: 8px; padding: 14px; border-radius: 14px; background: rgba(231, 255, 0, 0.08); border: 1px solid rgba(231, 255, 0, 0.4); }
.estimado .dato span:last-child { color: var(--lima); font-size: 18px; }
.estimado p { font-size: 14px; color: var(--suave); line-height: 1.45; }

/* Registros públicos (paso 6) */
.docs { border-radius: 14px; overflow: hidden; border: 1px solid var(--borde); background: rgba(0, 0, 0, 0.25); }
.docs .fila { align-items: center; }
.doc-tipo { font-size: 11px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--tenue); }

/* ¿Listo? */
.repaso { list-style: none; display: grid; gap: 6px; }
.repaso li { font-size: 14px; color: var(--suave); padding: 9px 12px; border-radius: 10px; background: var(--caja); }
.repaso li::before { content: "✓ "; color: var(--verde); font-weight: 800; }

/* Subasta: valor de mercado y tope */
.mercado { width: 100%; display: grid; gap: 8px; text-align: left; padding: 12px; border-radius: 12px; background: var(--caja); border: 1px solid var(--borde); }
.mercado .dato { border-top: 0; padding-top: 0; font-size: 13px; }
.medidor { position: relative; height: 10px; border-radius: 5px; background: rgba(255, 255, 255, 0.1); overflow: visible; }
.medidor i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; background: var(--verde); transition: width 0.3s, background 0.3s; }
.medidor i.pasado { background: var(--rojo); }
.medidor b { position: absolute; left: 50%; top: -4px; bottom: -4px; width: 2px; background: var(--lima); }
.medidor-txt { font-size: 12px; color: var(--suave); }
.medidor-txt.pasado { color: var(--rojo); font-weight: 800; }

/* Consejos (perder / pasar el 50 %) */
.psico { display: grid; gap: 10px; padding: 16px; border-radius: 16px; background: var(--caja); }
.psico ul { list-style: none; display: grid; gap: 8px; }
.psico li { font-size: 14px; color: var(--suave); line-height: 1.45; padding-left: 14px; position: relative; }
.psico li::before { content: ""; position: absolute; left: 0; top: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--lima); }
.psico li b { color: #fff; }
.psico-frio { font-size: 15px; padding: 12px; border-radius: 12px; border: 1.5px solid var(--lima); background: rgba(231, 255, 0, 0.08); line-height: 1.45; }
.consejo:empty { display: none; }
.consejo { border-radius: 14px; padding: 14px; font-size: 15px; line-height: 1.45; display: grid; gap: 8px; }
.consejo.ojo { background: rgba(255, 107, 107, 0.1); border: 1.5px solid var(--rojo); }
.consejo.bien { background: rgba(92, 242, 162, 0.1); border: 1.5px solid var(--verde); }
.consejo b.t { font-size: 17px; }
.z-d { display: block; font-weight: 500; color: #E9EAF4; margin-top: 2px; }
