:root {
  --fondo: #0e0f13;
  --superficie: rgba(255, 255, 255, 0.045);
  --superficie-2: rgba(255, 255, 255, 0.07);
  --linea: rgba(255, 255, 255, 0.07);
  --texto: #eeede8;
  --tenue: #8d8f99;
  --ruta: #f6d36b; /* amarillo suave: acento de la página y de la ruta */
  --ruta-oscuro: #1a1608;
  --caida: #f59e57;
  --radio: 28px;
  /* Cuánto se agrandan nodos y letras del mapa cuando se ve chico (lo pone app.js). */
  --k: 1;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(60% 50% at 85% 0%, rgba(246, 211, 107, 0.09), transparent 70%),
    radial-gradient(50% 40% at 0% 100%, rgba(120, 130, 160, 0.08), transparent 70%),
    var(--fondo);
  background-attachment: fixed;
  color: var(--texto);
  font-family: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 400;
  line-height: 1.45;
}

a { color: var(--ruta); }

h1, h2, h3 { font-weight: 500; }

/* ---------- Distribución: una columna en celular; en pantallas anchas, panel a la izquierda y mapa ---------- */
.pagina {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px;
  display: grid;
  gap: 20px;
}

@media (min-width: 960px) {
  .pagina {
    max-width: 1400px;
    padding: 32px;
    gap: 24px 28px;
    /* El mapa es cuadrado y cabe completo en la altura de la pantalla. */
    grid-template-columns: 420px min(calc(100vh - 150px), calc(100% - 448px));
    grid-template-areas:
      "cabeza cabeza"
      "panel mapa"
      "como como"
      "pie pie";
    justify-content: center;
    align-items: start;
  }
  .cabeza { grid-area: cabeza; }
  .mapa-caja { grid-area: mapa; }
  .panel { grid-area: panel; }
  .como { grid-area: como; }
  .pie { grid-area: pie; }
}

.cabeza h1 {
  margin: 0;
  font-size: clamp(1.7rem, 7vw, 2.6rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cabeza p {
  margin: 6px 0 0;
  font-size: 1.05rem;
  font-weight: 300;
  color: var(--tenue);
}

/* ---------- Mapa ---------- */
.mapa-caja {
  position: relative;
  border-radius: var(--radio);
  overflow: hidden;
  background: #14161c;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.8);
}

.mapa-caja svg {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  touch-action: manipulation;
}

.aviso-mapa {
  position: absolute;
  inset: auto 0 0 0;
  margin: 0;
  padding: 10px 16px;
  font-size: 0.85rem;
  color: var(--tenue);
  background: linear-gradient(transparent, rgba(14, 15, 19, 0.9));
}

.aviso-mapa:empty { display: none; }

.mapa { opacity: 0; transition: opacity 800ms ease; }
.mapa.visible { opacity: 1; }
.velo { fill: #0e0f13; opacity: 0.4; pointer-events: none; }

.nodo { cursor: pointer; opacity: 0; transition: opacity 250ms ease; }
.nodo.visible { opacity: 1; }
.nodo.visible.fuera { opacity: 0.45; }

/* Área de toque más grande que el punto, para dedos. */
.toque { fill: transparent; }

.cuerpo {
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(var(--k));
  transition: transform 300ms ease;
}

.disco {
  fill: #1b1d24;
  stroke: rgba(255, 255, 255, 0.85);
  stroke-width: 2.5;
  transition: fill 250ms ease, stroke 250ms ease;
}

.nodo.menor .disco { stroke: rgba(255, 255, 255, 0.45); }
.nodo.visitado .disco { fill: var(--ruta); stroke: var(--ruta-oscuro); }
.nodo.caida .disco { fill: var(--caida); stroke: var(--ruta-oscuro); }
.nodo:hover .disco { stroke: var(--ruta); }

.anillo {
  fill: none;
  stroke: var(--caida);
  stroke-width: 4;
  stroke-dasharray: 10 8;
  opacity: 0;
}

.nodo.caida .anillo {
  opacity: 1;
  animation: girar 2.4s linear infinite;
  transform-box: fill-box;
  transform-origin: center;
}

@keyframes girar { to { transform: rotate(360deg); } }

.cifra {
  fill: #ffffff;
  font-size: 17px;
  font-weight: 600;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

.nodo.visitado .cifra,
.nodo.caida .cifra { fill: var(--ruta-oscuro); }

.nombre {
  fill: #ffffff;
  font-size: calc(20px * var(--k));
  font-weight: 600;
  text-anchor: middle;
  paint-order: stroke;
  stroke: #0e0f13;
  stroke-width: calc(5px * var(--k));
  stroke-linejoin: round;
  pointer-events: none;
}

.nodo.menor .nombre { font-size: calc(16px * var(--k)); fill: #dcdbd6; }

/* Mapa chico: con ruta, solo se nombran la caída y las zonas de la ruta. */
.compacto:not(.sin-ruta) .nodo:not(.caida):not(.visitado) .nombre { display: none; }
.compacto .nodo .nombre { font-size: calc(15px * var(--k)); }

.tramo {
  stroke: var(--ruta);
  stroke-width: calc(7px * var(--k));
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  filter: drop-shadow(0 0 8px rgba(246, 211, 107, 0.6));
}

.parada circle {
  fill: #0e0f13;
  stroke: var(--ruta);
  stroke-width: 2.5;
}

.parada text {
  fill: var(--ruta);
  font-size: 16px;
  font-weight: 600;
  text-anchor: middle;
  dominant-baseline: central;
}

.parada .escala {
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(var(--k));
  animation: pop 350ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes pop { from { transform: scale(0); } to { transform: scale(var(--k)); } }

/* ---------- Panel: un solo bloque de vidrio, secciones separadas por líneas finas ---------- */
.panel {
  padding: 8px 22px;
  border: 1px solid var(--linea);
  border-radius: var(--radio);
  background: var(--superficie);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.panel > * { padding: 18px 0; }
.panel > * + * { border-top: 1px solid var(--linea); }

.controles { display: grid; gap: 16px; }

.campo { display: grid; gap: 8px; }

.etiqueta {
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--tenue);
}

select {
  width: 100%;
  min-height: 48px;
  padding: 10px 44px 10px 18px;
  border: 1px solid var(--linea);
  border-radius: 999px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23eeede8' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E")
      no-repeat right 18px center,
    var(--superficie-2);
  color: var(--texto);
  font: inherit;
  font-size: 1rem;
  appearance: none;
  cursor: pointer;
}

select option { background: #1b1d24; color: var(--texto); }

.tiempo {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Barra en forma de píldora; --progreso lo pone app.js. */
.tiempo input {
  --progreso: 50%;
  flex: 1;
  min-width: 0;
  height: 28px;
  margin: 0;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.tiempo input::-webkit-slider-runnable-track {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--ruta) var(--progreso), var(--superficie-2) var(--progreso));
}

.tiempo input::-moz-range-track {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--ruta) var(--progreso), var(--superficie-2) var(--progreso));
}

.tiempo input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  margin-top: -7px;
  border: 5px solid var(--ruta);
  border-radius: 50%;
  background: var(--fondo);
}

.tiempo input::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 5px solid var(--ruta);
  border-radius: 50%;
  background: var(--fondo);
}

.tiempo output {
  min-width: 3.4em;
  font-size: 1.9rem;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  text-align: right;
  letter-spacing: -0.01em;
}

.boton {
  min-height: 50px;
  padding: 12px 20px;
  border: 0;
  border-radius: 999px;
  background: var(--ruta);
  color: var(--ruta-oscuro);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter 150ms ease, transform 150ms ease;
}

.boton:hover:not(:disabled) { filter: brightness(1.06); }
.boton:active:not(:disabled) { transform: scale(0.98); }
.boton:disabled { opacity: 0.5; cursor: default; }

/* Pestañas en forma de píldora. */
.pestanas {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 18px;
  border-radius: 999px;
  background: var(--superficie-2);
}

.pestana {
  min-height: 40px;
  padding: 8px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--tenue);
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 200ms ease, color 200ms ease;
}

.pestana:hover:not(.activa) { color: var(--texto); }
.pestana.activa { background: var(--ruta); color: var(--ruta-oscuro); font-weight: 600; }

[role="tabpanel"][hidden] { display: none; }

.resultado h2 {
  margin: 0 0 4px;
  font-size: 1.6rem;
  font-weight: 400;
  line-height: 1.15;
}

.texto {
  margin: 0 0 14px;
  font-weight: 300;
  color: var(--tenue);
}

.cifras {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 8px;
  margin: 0 0 18px;
}

.cifras div {
  padding: 12px 14px;
  border-radius: 20px;
  background: var(--superficie-2);
}

.cifras dt {
  font-size: 0.75rem;
  color: var(--tenue);
}

.cifras dd {
  margin: 2px 0 0;
  font-size: 1.7rem;
  font-weight: 400;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.cifras .destacada { background: var(--ruta); }
.cifras .destacada dt { color: rgba(26, 22, 8, 0.7); }
.cifras .destacada dd { color: var(--ruta-oscuro); font-weight: 600; }

/* Itinerario como línea de tiempo: un punto numerado por zona, unido por una línea. */
.itinerario {
  margin: 0;
  padding: 0;
  list-style: none;
}

.itinerario .parada-it {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0 8px;
  padding: 2px 0 2px 42px;
}

.itinerario .parada-it::before {
  content: attr(data-n);
  position: absolute;
  left: 0;
  top: 2px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--ruta);
  color: var(--ruta-oscuro);
}

.itinerario .parada-it:first-child::before { background: var(--caida); }
.itinerario .parada-it b { font-weight: 500; font-size: 1.05rem; }
.itinerario .parada-it span { font-variant-numeric: tabular-nums; color: var(--tenue); font-weight: 300; }
.itinerario .parada-it small { grid-column: 1 / -1; color: var(--tenue); font-weight: 300; }

.itinerario .viaje {
  margin-left: 13px;
  padding: 8px 0 8px 28px;
  border-left: 2px dashed rgba(246, 211, 107, 0.4);
  font-size: 0.85rem;
  font-weight: 300;
  color: var(--tenue);
}

.ranking .texto b { font-weight: 500; color: var(--texto); }

.ranking ol {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 4px;
}

.ranking button {
  width: 100%;
  min-height: 48px;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 8px 14px 8px 8px;
  border: 0;
  border-radius: 20px;
  background: transparent;
  color: var(--texto);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 150ms ease;
}

.ranking button:hover { background: var(--superficie-2); }
.ranking button.activa { background: rgba(246, 211, 107, 0.12); }

.ranking .n {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  background: var(--superficie-2);
  color: var(--tenue);
}

.ranking li:first-child .n { background: var(--ruta); color: var(--ruta-oscuro); font-weight: 600; }
.ranking .v { font-size: 1.3rem; font-weight: 400; color: var(--ruta); font-variant-numeric: tabular-nums; }
.ranking small { display: block; color: var(--tenue); font-size: 0.8rem; font-weight: 300; }

/* ---------- ¿Cómo se calcula? (a lo ancho, sin tarjeta) ---------- */
.como {
  padding-top: 8px;
}

.como > h2 {
  margin: 0 0 18px;
  font-size: 1.4rem;
  font-weight: 400;
}

.pasos {
  display: grid;
  gap: 22px;
}

@media (min-width: 960px) {
  .como { padding-top: 24px; border-top: 1px solid var(--linea); }
  .pasos { grid-template-columns: repeat(3, 1fr); gap: 40px; }
}

.pasos .num {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(246, 211, 107, 0.5);
  color: var(--ruta);
  font-size: 0.9rem;
}

.pasos h3 {
  margin: 10px 0 4px;
  font-size: 1.1rem;
}

.pasos p {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 300;
  color: #b9bac1;
}

.pasos b { font-weight: 500; color: var(--texto); }

.pie {
  padding: 12px 0 28px;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 300;
  color: var(--tenue);
}

.pie p { margin: 4px 0; }
.pie a { color: var(--tenue); }

.pie .firma {
  display: inline-block;
  margin-bottom: 8px;
  padding: 8px 20px;
  border-radius: 999px;
  border: 1px solid var(--linea);
  background: var(--superficie);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--texto);
  text-decoration: none;
}

.pie .firma:hover { border-color: rgba(246, 211, 107, 0.5); }
