* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0; height: 100%;
  font-family: system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}
body { display: flex; }

/* ---------------- Topbar (sólo visible en móvil) ---------------- */
#topbar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  /* Respeta la dynamic island / notch del iPhone con viewport-fit=cover. */
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  background: #1c1f24;
  color: #e6e6e6;
  border-bottom: 1px solid #2f343c;
  z-index: 1500;
  flex-shrink: 0;
}
#topbar h1 { margin: 0; font-size: 16px; flex: 1; letter-spacing: 0.5px; }
.brand-icon {
  height: 24px;
  width: auto;
  display: inline-block;
  vertical-align: middle;
  border-radius: 4px;
  margin-right: 6px;
}
#panel h1.panel-h1 {
  display: flex;
  align-items: center;
  gap: 8px;
}
#panel h1.panel-h1 .brand-icon { margin: 0; height: 22px; }
#panel-toggle {
  background: #2a2e35;
  color: #e6e6e6;
  border: 1px solid #3a3f47;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
}

#panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1399;
  -webkit-tap-highlight-color: transparent;
}

/* ---------------- Panel lateral ---------------- */
#panel {
  width: 300px;
  flex: 0 0 auto;
  padding: 14px;
  background: #1c1f24;
  color: #e6e6e6;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#panel h1.panel-h1 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.5px;
  color: #f5f5f5;
}
#panel hr {
  border: none;
  border-top: 1px solid #2f343c;
  margin: 4px 0;
}
#panel label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  color: #c8ccd2;
}
#panel select,
#panel input[type=number],
#panel input[type=range] {
  background: #2a2e35;
  color: #e6e6e6;
  border: 1px solid #3a3f47;
  border-radius: 3px;
  padding: 4px 6px;
  font: inherit;
}
#panel button {
  background: #2a2e35;
  color: #e6e6e6;
  border: 1px solid #3a3f47;
  border-radius: 3px;
  padding: 4px 10px;
  cursor: pointer;
  font: inherit;
}
#panel button:hover { background: #353a42; }
#panel button:disabled { opacity: 0.4; cursor: default; }

#panel > label:has(#compare) {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #b8bdc4;
  cursor: pointer;
}

.pane-block {
  padding: 8px 10px;
  background: #23272e;
  border: 1px solid #2f343c;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pane-title {
  margin: 0;
  font-size: 10px;
  color: #7d848e;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

/* ---------------- Acordeón <details> ---------------- */
.section {
  background: #23272e;
  border: 1px solid #2f343c;
  border-radius: 4px;
  padding: 0;
}
.section > summary {
  list-style: none;
  cursor: pointer;
  padding: 7px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  user-select: none;
}
.section > summary::-webkit-details-marker { display: none; }
.section > summary::before {
  content: "▸";
  font-size: 10px;
  color: #7d848e;
  margin-right: 4px;
  transition: transform 0.15s ease;
  flex-shrink: 0;
}
.section[open] > summary::before { transform: rotate(90deg); }
.section > summary:hover { background: #262a31; }
.section[open] > summary { border-bottom: 1px solid #2f343c; }
.section .section-body {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
/* Layout de dos columnas para Variable + Opción */
.section .row-2 {
  display: flex;
  gap: 6px;
}
.section .row-2 > label {
  flex: 1;
  min-width: 0;
}
.section .row-2 select { width: 100%; min-width: 0; }
/* Toggle "valores" inline al lado del título — clic no debe abrir/cerrar el details */
.ios-toggle.inline-toggle {
  margin-left: auto;
  padding: 0;
  align-self: center;
}

/* ---------------- iOS-style toggle ---------------- */
.ios-toggle,
#panel label.ios-toggle {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 2px 4px;
  font-size: 12px;
  color: #c8ccd2;
  cursor: pointer;
  user-select: none;
  align-self: flex-start;
}
.ios-toggle input { display: none; }
.ios-slider {
  position: relative;
  width: 28px;
  height: 16px;
  background: #ccc;
  border-radius: 16px;
  transition: background 0.2s;
  flex-shrink: 0;
}
.ios-slider::before {
  content: "";
  position: absolute;
  width: 12px; height: 12px;
  left: 2px; top: 2px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.ios-toggle input:checked + .ios-slider { background: #34c759; }
.ios-toggle input:checked + .ios-slider::before { transform: translateX(12px); }

/* ---------------- Step + range + export ---------------- */
#step-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  bottom: 0;
  background: #1c1f24;
  padding: 8px 0 6px;
  z-index: 5;
}
#step-controls .play-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
}
#step-controls .play-row button {
  min-width: 36px;
  height: 30px;
  padding: 0;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#step-controls .play-row button#play {
  min-width: 44px;
  background: #3a4250;
  border-color: #4a5260;
}
#step-controls .play-row button#play:hover { background: #45506a; }
/* Iconos SVG de los botones del reproductor (válido en sidebar y en barra móvil) */
#step-controls .icon,
#mobile-step-host .icon {
  width: 14px;
  height: 14px;
  display: block;
}
#play .icon-pause { display: none; }
#play.is-playing .icon-play { display: none; }
#play.is-playing .icon-pause { display: block; }
#step-controls #step {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 28px;
  background: transparent;
  cursor: pointer;
  --coverage-bg: #3b4a66;
  outline: none;
  touch-action: pan-y;
}
#step-controls #step::-webkit-slider-runnable-track {
  height: 10px;
  border-radius: 5px;
  background: var(--coverage-bg, #3b4a66);
  border: 1px solid rgba(0, 0, 0, 0.4);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
}
#step-controls #step::-moz-range-track {
  height: 10px;
  border-radius: 5px;
  background: var(--coverage-bg, #3b4a66);
  border: 1px solid rgba(0, 0, 0, 0.4);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
}
#step-controls #step::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 4px;
  height: 24px;
  background: #ffffff;
  border: none;
  border-radius: 2px;
  margin-top: -8px;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.7),
    0 1px 4px rgba(0, 0, 0, 0.55);
  cursor: ew-resize;
  transition: height 0.12s ease, width 0.12s ease;
}
#step-controls #step::-moz-range-thumb {
  width: 4px;
  height: 24px;
  background: #ffffff;
  border: none;
  border-radius: 2px;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.7),
    0 1px 4px rgba(0, 0, 0, 0.55);
  cursor: ew-resize;
  transition: height 0.12s ease, width 0.12s ease;
}
#step-controls #step:hover::-webkit-slider-thumb,
#step-controls #step:focus-visible::-webkit-slider-thumb,
#step-controls #step:active::-webkit-slider-thumb {
  width: 6px;
  height: 28px;
}
#step-controls #step:hover::-moz-range-thumb,
#step-controls #step:focus-visible::-moz-range-thumb,
#step-controls #step:active::-moz-range-thumb {
  width: 6px;
  height: 28px;
}
#step-controls #step:focus-visible::-webkit-slider-runnable-track {
  border-color: rgba(255, 255, 255, 0.4);
}
#step-controls #step:focus-visible::-moz-range-track {
  border-color: rgba(255, 255, 255, 0.4);
}
.filter-section {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.filter-section > summary {
  cursor: pointer;
  font-size: 11px;
  color: #9aa3ad;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  list-style: none;
  user-select: none;
  padding: 2px 0;
}
.filter-section > summary::-webkit-details-marker { display: none; }
.filter-section > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 6px;
  transition: transform 0.15s ease;
}
.filter-section[open] > summary::before {
  transform: rotate(90deg);
}
.filter-section[open] > summary {
  color: #cfd4db;
  margin-bottom: 6px;
}
#panel .filter-chips {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.filter-chips .chip-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.filter-chips .chip-row-label {
  font-size: 10px;
  color: #7d848e;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
}
.filter-chips .chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
/* Si solo hay un único toolbar, ocultamos su etiqueta — ya está el <summary>. */
.filter-chips > .chip-row:only-child > .chip-row-label {
  display: none;
}
#panel .filter-chip.disabled,
#panel .filter-chip:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}
#panel .filter-chip {
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  padding: 3px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
  color: #cfd4db;
  cursor: pointer;
  user-select: none;
  transition: background 0.1s ease, border-color 0.1s ease, color 0.1s ease;
}
@media (max-width: 900px) {
  #panel .filter-chip {
    font-size: 11px;
    padding: 4px 9px;
    border-radius: 11px;
  }
  #panel .filter-chips { gap: 6px; }
}
#panel .filter-chip:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.3);
}
#panel .filter-chip.active {
  background: #c98a3a;
  border-color: #e0a050;
  color: #1a1c20;
}
#panel .filter-chip.active:hover {
  background: #d49544;
}
.step-extended,
.step-combined,
.step-estimated {
  font-size: 10px;
  color: #f0b266;
  background: rgba(201, 138, 58, 0.18);
  border: 1px solid rgba(201, 138, 58, 0.45);
  border-radius: 3px;
  padding: 1px 5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
#step-label {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 8px;
  text-align: center;
}
#step-label .step-progress {
  font-size: 10px;
  color: #7d848e;
  font-variant-numeric: tabular-nums;
}
#step-label .step-time {
  font-size: 13px;
  color: #e6e6e6;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

#range-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
}
#range-controls label {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 4px;
  font-size: 11px;
}
#range-controls select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

#export-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
#export-controls > label { width: 100%; min-width: 0; }
#export-controls > label select { width: 100%; max-width: 100%; min-width: 0; }
#export-controls #export-go {
  width: 100%;
  max-width: 100%;
  padding: 6px 10px;
  min-width: 0;
  white-space: normal;
}
#export-progress { width: 100%; height: 6px; }

#status {
  font-size: 11px;
  color: #7d848e;
  min-height: 1em;
}

#status-popup {
  position: fixed;
  top: 10px;
  left: 50%;
  z-index: 1800;
  width: min(520px, calc(100vw - 24px));
  transform: translate(-50%, -130%);
  opacity: 0;
  pointer-events: none;
  transition: transform 220ms ease, opacity 180ms ease;
}
#status-popup.visible {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}
.status-popup-body {
  position: relative;
  display: grid;
  gap: 4px;
  padding: 10px 38px 11px 12px;
  color: #fff;
  background: #b4232a;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
.status-popup-title {
  font-size: 12px;
  line-height: 1.2;
}
.status-popup-message {
  font-size: 12px;
  line-height: 1.35;
}
.status-popup-close {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 4px;
  color: #fff;
  background: rgba(255,255,255,0.12);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.status-popup-close:hover {
  background: rgba(255,255,255,0.22);
}

/* ---------------- Mapas ---------------- */
#maps {
  flex: 1;
  display: flex;
  min-width: 0;
  min-height: 0;
}
.map-container { position: relative; flex: 1; min-width: 0; min-height: 0; }
.map-target { position: absolute; inset: 0; }

#failure-banner {
  position: fixed;
  top: 8px;
  left: 50%;
  z-index: 1600;
  background: rgba(220, 90, 60, 0.95);
  color: #fff;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.4;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  max-width: min(640px, calc(100vw - 16px));
  text-align: center;
  pointer-events: none;
  /* oculto por defecto: desplazado hacia arriba + invisible */
  opacity: 0;
  transform: translate(-50%, -160%);
  transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.3, 1), opacity 0.25s ease;
}
#failure-banner.visible {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}
@media (max-width: 900px) {
  #failure-banner { top: 56px; font-size: 11px; padding: 6px 10px; }
}

.map-time-label {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 750;
  background: rgba(28, 31, 36, 0.85);
  color: #f5f5f5;
  border-radius: 6px;
  padding: 6px 10px;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  font-size: 13px;
  line-height: 1.2;
}
.map-time-label .time-main {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.3px;
}
.map-time-label .time-sub {
  font-size: 11px;
  color: #b8bdc4;
  margin-top: 2px;
}

@media (max-width: 900px) {
  /* En móvil ya hay barra inferior con la fecha — ocultamos la flotante */
  .map-time-label { display: none; }
}

.map-attribution {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 750;
  background: rgba(255,255,255,0.85);
  border-radius: 4px;
  padding: 3px 7px;
  font-size: 10px;
  color: #222;
  pointer-events: auto;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  user-select: none;
  max-width: 60%;
}
.map-attribution a { color: #1565c0; text-decoration: none; }
.map-attribution a:hover { text-decoration: underline; }

.legend-overlay {
  position: absolute;
  left: 8px; right: 8px; bottom: 8px;
  display: flex;
  justify-content: center;
  gap: 6px;
  pointer-events: none;
  z-index: 800;
  flex-wrap: wrap;
  max-height: 40%;
  overflow: hidden;
}
.legend-overlay canvas {
  background: rgba(255,255,255,0.92);
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  max-width: 100%;
}

.city-label {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  font-size: 9px;
  font-weight: 500;
  color: #222;
  text-shadow: 0 0 2px #fff, 0 0 2px #fff, 0 0 2px #fff;
}
.leaflet-tooltip.city-label::before { display: none; }

.leaflet-image-layer.pixelated {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.wind-icon { background: transparent; border: none; }
.wind-barb {
  width: 22px; height: 22px;
  font-size: 18px; line-height: 22px; text-align: center;
  color: #222; font-weight: bold;
}

/* ===========================================================
   MOBILE / TABLET (≤ 900px)
   =========================================================== */
@media (max-width: 900px) {
  body {
    flex-direction: column !important;
  }

  #topbar { display: flex !important; }
  #topbar h1 {
    font-size: 16px !important;
    font-weight: 600;
  }

  /* Panel SIEMPRE drawer overlay en este modo.
     - Arranca debajo del topbar (~56 px).
     - Termina encima de la step-bar (~100 px).
     Así nunca queda tapado por las dos barras fijas. */
  #panel {
    position: fixed !important;
    top: 56px !important;
    bottom: 100px !important;
    left: 0 !important;
    width: min(340px, 86vw) !important;
    height: auto !important;
    z-index: 1400 !important;
    padding-top: 14px !important;
    padding-bottom: 14px !important;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 12px rgba(0,0,0,0.5);
  }
  #panel.open { transform: translateX(0); }
  #panel h1.panel-h1 { display: none !important; }

  #maps {
    width: 100% !important;
    flex: 1 !important;
    min-height: 0;
  }
  #maps.compare-on {
    flex-direction: column;
  }
  /* Importante: ambos mapas comparten el espacio disponible (sin min-height fijo),
     así el mapa B no se sale por debajo dejando la leyenda detrás de la step-bar. */
  #maps.compare-on .map-container {
    flex: 1 1 0;
    min-height: 0;
  }

  /* Inputs cómodos pero compactos para que todo el panel quepa sin scroll */
  #panel { gap: 7px !important; padding: 12px !important; padding-top: 12px !important; padding-bottom: 12px !important; }
  #panel select,
  #panel input[type=number],
  #panel button {
    font-size: 13px;
    padding: 6px 8px;
    min-height: 32px;
  }
  #panel button { padding: 6px 12px; }
  #panel label { font-size: 11px; gap: 2px; }
  .pane-block { padding: 6px 8px !important; gap: 4px !important; }
  .pane-title { font-size: 9px !important; }
  #panel hr { margin: 2px 0 !important; }

  .ios-slider { width: 32px; height: 18px; }
  .ios-slider::before { width: 14px; height: 14px; }
  .ios-toggle input:checked + .ios-slider::before { transform: translateX(14px); }
  .ios-toggle { font-size: 12px; padding: 0 !important; }

  #panel input[type=range] { height: 22px; }
  #step-label { font-size: 12px; }
  #range-controls { gap: 6px; }
  #export-controls { gap: 6px; }
  #status { font-size: 10px; }

  /* Desde/Hasta se apilan en vertical en móvil — los textos largos no caben en una fila */
  #range-controls {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }
  #range-controls label {
    width: 100%;
    grid-template-columns: 44px minmax(0, 1fr);
  }
  #range-controls select { width: 100%; min-width: 0; max-width: 100%; }

  /* Botones de export ocupan ancho completo y no se cortan */
  #export-controls { gap: 8px; }
  #export-controls button { width: 100%; }

  /* Leyenda edge-to-edge en móvil: ocupa todo el ancho del mapa pegada al
     fondo. Sin transform: scale (degradaba la calidad). */
  .legend-overlay {
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0;
  }
  .legend-overlay canvas {
    border-radius: 0;
    box-shadow: 0 -1px 4px rgba(0,0,0,0.25);
    width: 100%;
    max-width: 100%;
  }
  .city-label { font-size: 10px; }
}

@media (max-width: 380px) {
  #panel { width: 92vw !important; }
}

/* ---------- Mobile floating step host (recibe #step-controls movido) ---------- */
#mobile-step-host { display: none; }
@media (max-width: 900px) {
  #mobile-step-host {
    display: block;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 1450;
    background: linear-gradient(180deg, rgba(28,31,36,0.85) 0%, rgba(28,31,36,0.96) 30%);
    backdrop-filter: blur(8px) saturate(1.2);
    -webkit-backdrop-filter: blur(8px) saturate(1.2);
    color: #e6e6e6;
    padding: 10px 14px 8px;
    /* Suma del safe-area-inset (home indicator del iPhone) + un hueco
       visual para que el dedo no toque la barra al arrastrar el slider. */
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
    border-top: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 -6px 20px rgba(0,0,0,0.35);
  }
  #mobile-step-host #step-controls {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    margin: 0;
    /* En móvil el fondo lo pone #mobile-step-host. Quitamos el del propio
       #step-controls (sidebar) para que no quede un rectángulo más oscuro
       superpuesto al gradiente. */
    background: transparent;
    padding: 0;
    position: static;
  }
  /* Botones centrados en su fila */
  #mobile-step-host #step-controls > button {
    /* Usaremos un truco: los 3 botones van en una fila aparte */
  }
  #mobile-step-host .mobile-buttons-row {
    display: flex;
    justify-content: center;
    gap: 10px;
  }
  #mobile-step-host button {
    background: rgba(255,255,255,0.08);
    color: #f5f5f5;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 999px;
    min-width: 36px; min-height: 30px;
    padding: 0;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  #mobile-step-host button:active { background: rgba(255,255,255,0.18); }
  #mobile-step-host #play {
    background: #4a90e2;
    border-color: #4a90e2;
    min-width: 42px;
    font-size: 14px;
  }
  #mobile-step-host #play:active { background: #357ab8; }

  #mobile-step-host input[type=range] {
    height: 32px;
    accent-color: #4a90e2;
    margin: 0 4px;
    /* Sin esto, el navegador interpreta el primer movimiento del dedo
       como pan de la página y el slider no recibe el drag. */
    touch-action: none;
  }
  #mobile-step-host #step-label {
    font-size: 11.5px;
    color: #b8bdc4;
    text-align: center;
    letter-spacing: 0.3px;
    /* En móvil: fecha arriba del todo (no la tapa el dedo al arrastrar el
       slider que va abajo), botones en medio, slider al fondo. */
    order: 1;
    margin: 0;
  }
  #mobile-step-host .mobile-buttons-row { order: 2; }
  #mobile-step-host #step { order: 3; }

  body { padding-bottom: 0; }
  /* El padding-bottom real lo fija JS según la altura medida del step-bar.
     Como fallback ponemos uno razonable. */
  #maps { padding-bottom: 110px; }

  /* Atribución: más compacta y con wrap controlado en móvil */
  .map-attribution {
    font-size: 9px;
    padding: 2px 6px;
    max-width: 72%;
    line-height: 1.3;
  }
}

/* ---------------- Ko-fi support widget ---------------- */
.floatingchat-container-wrap,
.floatingchat-container,
#kofi-widget-overlay,
iframe[src*="ko-fi.com"] {
  display: none !important;
}

.kofi-widget-slot {
  flex: 0 0 auto;
  overflow: hidden;
}
.kofi-widget-frame {
  display: block;
  width: 100%;
  height: 42px;
  border: 0;
  background: transparent;
  overflow: hidden;
}
.kofi-widget-panel {
  width: 178px;
  height: 42px;
  margin: 12px auto 0;
}
.kofi-widget-topbar {
  display: none;
}
.kofi-cup-link {
  display: none;
}

.kofi-support {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 6px;
  background: #c98a3a;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  white-space: nowrap;
}
.kofi-support:hover { background: #d49544; }
.kofi-support::before {
  content: "";
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  border-radius: 50%;
  background:
    radial-gradient(circle at 62% 45%, #ff6b6b 0 3px, transparent 3.5px),
    linear-gradient(#fff, #fff);
}

@media (max-width: 900px) {
  .kofi-widget-panel { display: none; }
  .kofi-cup-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: #c98a3a;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
    text-decoration: none;
  }
  .kofi-cup {
    width: 20px;
    height: 20px;
    background: url("https://storage.ko-fi.com/cdn/cup-border.png") center / contain no-repeat;
    animation: kofi-cup-wiggle 1.8s ease-in-out infinite;
    transform-origin: 50% 80%;
  }
  .kofi-cup-link:active .kofi-cup {
    animation-duration: 0.45s;
  }
}

@media (max-width: 380px) {
  .kofi-cup-link {
    width: 36px;
    height: 36px;
  }
}

@keyframes kofi-cup-wiggle {
  0%, 72%, 100% { transform: rotate(0deg) translateY(0); }
  78% { transform: rotate(-10deg) translateY(-1px); }
  84% { transform: rotate(9deg) translateY(0); }
  90% { transform: rotate(-6deg) translateY(-1px); }
  96% { transform: rotate(4deg) translateY(0); }
}
