* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-size: clamp(15px, 1.6vw, 20px); min-height: 100vh; color: #fff;
  font-family: "Trebuchet MS", Arial, sans-serif;
  background: linear-gradient(#0b1d3a, #1b4b7a 60%, #2e6fa3);
}
#nieve { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
main { position: relative; z-index: 1; max-width: 1200px; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 60px max(16px, env(safe-area-inset-left)); text-align: center; }
h1 { margin: 8px 0; font-size: clamp(1.4rem, 3.2vw, 2.4rem); text-shadow: 0 2px 6px #0008; }
#subtitulo { margin: 0 0 20px; opacity: .85; }

.ruta { display: flex; align-items: center; gap: 10px; margin: 20px 0 10px; }
.extremo { font-size: 2rem; }
.barra { position: relative; flex: 1; height: 14px; background: #ffffff33; border-radius: 10px; }
#progreso { height: 100%; width: 0; background: linear-gradient(90deg, #ffd54f, #ff7043); border-radius: 10px; transition: width 1s; }
#sobre { position: absolute; top: -16px; left: 0; font-size: 1.8rem; transform: translateX(-50%); transition: left 1s; }

.estado { font-size: 1.2rem; font-weight: bold; margin: 18px 0 4px; }
.cuenta { margin: 0 0 24px; opacity: .9; }

ol { list-style: none; padding: 0; margin: 0; text-align: left; }
li { display: flex; gap: 14px; padding: 12px 14px; margin-bottom: 10px; border-radius: 12px; background: #ffffff14; opacity: .45; }
li .ico { font-size: 1.8rem; }
li b { display: block; }
li small { display: block; opacity: .85; }
li .fecha { font-size: .8rem; opacity: .7; }
li.hecho { opacity: 1; background: #2e7d3255; }
li.actual { opacity: 1; background: #ff704355; outline: 2px solid #ffd54f; animation: pulso 2s infinite; }
@keyframes pulso { 50% { outline-color: transparent; } }

#respuesta { margin-top: 30px; padding: 24px; border-radius: 16px; background: #fff; color: #7b1e1e; text-align: left; box-shadow: 0 8px 30px #0008; }
#respuesta h2 { margin-top: 0; text-align: center; }
#respMensaje { white-space: pre-line; font-size: 1.1rem; line-height: 1.5; }
.oculto { display: none; }


.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 38%); gap: clamp(14px, 3vw, 32px); align-items: start; }
.col-mapa { position: sticky; top: 12px; }
#mapa { display: block; width: 100%; height: auto; max-height: calc(100vh - 24px); margin: 0 auto; border-radius: 18px; box-shadow: 0 8px 30px #0008; }
#mapa .parada { fill: #ffffff55; stroke: #fff; stroke-width: 2; }
#mapa .parada.hecha { fill: #66bb6a; }
#mapa .parada.actual { fill: #ff7043; }
#sobreMapa { filter: drop-shadow(0 2px 3px #000a); }
.estado { font-size: clamp(1.1rem, 2.2vw, 1.5rem); }
li { padding: clamp(10px, 1.6vw, 16px); }
#respMensaje { font-size: clamp(1rem, 2vw, 1.3rem); }

/* Teléfono / ventana angosta: mapa arriba, una columna */
@media (max-width: 599px) {
  .layout { grid-template-columns: 1fr; }
  .col-mapa { position: static; order: -1; max-width: 340px; margin: 0 auto; }
  #mapa { max-height: none; }
}
/* Tablet horizontal bajita: mapa limitado por alto */
@media (orientation: landscape) and (max-height: 820px) {
  #mapa { max-height: calc(100vh - 24px); width: auto; max-width: 100%; }
}

#tabs { display: flex; justify-content: center; gap: 10px; margin: 6px 0 18px; flex-wrap: wrap; }
#tabs button {
  font: inherit; font-weight: bold; color: #fff; cursor: pointer;
  padding: 12px 22px; min-height: 48px; border-radius: 30px;
  border: 2px solid #ffffff55; background: #ffffff1a;
}
#tabs button.activa { background: #ffd54f; color: #5b2a00; border-color: #ffd54f; }

#setup { max-width: 520px; margin: 10px auto; padding: 24px; border-radius: 18px; background: #ffffff1c; backdrop-filter: blur(4px); text-align: left; }
#setup h2 { margin-top: 0; text-align: center; }
#setup label { display: block; margin-bottom: 14px; font-weight: bold; }
#setup input { display: block; width: 100%; margin-top: 6px; padding: 12px; font: inherit; border: 0; border-radius: 10px; min-height: 48px; }
#setup button, footer button { font: inherit; font-weight: bold; cursor: pointer; border: 0; border-radius: 30px; }
#setup button { width: 100%; padding: 14px; min-height: 52px; background: #ffd54f; color: #5b2a00; font-size: 1.1rem; }
#setup small { display: block; margin-top: 12px; opacity: .8; text-align: center; }
.error { color: #ffcdd2; font-weight: bold; margin: 0 0 10px; }
footer { margin-top: 36px; opacity: .85; }
footer button { padding: 10px 18px; min-height: 44px; background: #ffffff22; color: #fff; border: 1px solid #ffffff55; }
