/* =========================================================
   Bus Valladolid — sistema visual
   ========================================================= */
:root {
  --bg: #f7f6f2;
  --card: #ffffff;
  --card-2: #f5f4ef;
  --ink: #1d1d1b;
  --ink-2: #3b3b37;
  --muted: #6e6d66;
  --line: #e9e7df;
  --accent: #00a082;
  --accent-2: #00b894;
  --accent-soft: #e0f5ef;
  --cta: #ffc244;
  --cta-ink: #1d1d1b;
  --cta-soft: #fff4d6;
  --amber: #c26a00;
  --amber-soft: #fff1dc;
  --red: #e8483f;
  --red-soft: #fde9e7;
  --blue: #2563eb;
  --r-lg: 24px;
  --r-md: 16px;
  --r-sm: 12px;
  --shadow: 0 1px 2px rgb(13 23 20 / .04), 0 6px 20px rgb(13 23 20 / .06);
  --shadow-lift: 0 2px 4px rgb(13 23 20 / .05), 0 14px 32px rgb(13 23 20 / .10);
  --top-h: 60px;
  --tab-h: 0px;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121211;
    --card: #1c1c1a;
    --card-2: #242421;
    --ink: #f3f2ed;
    --ink-2: #d4d3cc;
    --muted: #9c9b93;
    --line: #2f2e2a;
    --accent: #2fd3b0;
    --accent-2: #2fd3b0;
    --accent-soft: rgb(47 211 176 / .13);
    --cta: #ffc244;
    --cta-ink: #1d1d1b;
    --cta-soft: rgb(255 194 68 / .14);
    --amber: #f2a93b;
    --amber-soft: rgb(242 169 59 / .14);
    --red: #ff6b6b;
    --red-soft: rgb(255 107 107 / .14);
    --blue: #6ea8ff;
    --shadow: 0 0 0 1px rgb(255 255 255 / .04);
    --shadow-lift: 0 0 0 1px rgb(255 255 255 / .08), 0 12px 30px rgb(0 0 0 / .4);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top-h) + 12px); }
body {
  margin: 0;
  font: 15.5px/1.45 var(--font);
  font-feature-settings: "cv11", "ss01";
  background: var(--bg);
  color: var(--ink);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -.02em; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.1rem); font-weight: 800; letter-spacing: -.03em; }
h2 { font-size: 1.05rem; font-weight: 700; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid var(--cta); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 3000; background: var(--ink); color: var(--bg); padding: .6rem 1rem; border-radius: var(--r-sm); text-decoration: none; font-weight: 600; }
.skip:focus { top: 10px; }

/* ---------- iconos ---------- */
.i, .tabbar svg, .brand-mark svg {
  width: 1.25em; height: 1.25em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -.25em;
}
.i.sm { width: 1em; height: 1em; vertical-align: -.15em; }
.i.lg { width: 1.6em; height: 1.6em; }

/* ---------- barra superior y navegación ---------- */
.topbar {
  position: sticky; top: 0; z-index: 1000;
  height: var(--top-h);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0 max(1rem, env(safe-area-inset-right)) 0 max(1rem, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; font-weight: 800; letter-spacing: -.02em; font-size: 1.05rem; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, #00b894, #00876e); color: #fff;
  box-shadow: 0 4px 12px rgb(0 160 130 / .3);
}
.brand-mark svg { width: 20px; height: 20px; stroke-width: 2.2; }
.tabbar { display: flex; gap: .25rem; }
.tabbar a {
  display: flex; align-items: center; gap: .45rem;
  padding: .5rem .85rem; border-radius: 999px;
  text-decoration: none; font-weight: 600; font-size: .92rem; color: var(--muted);
  transition: background .15s, color .15s;
}
.tabbar a:hover { color: var(--ink); background: var(--card); }
.tabbar a.active { color: var(--cta-ink); background: var(--cta); }

@media (max-width: 760px) {
  :root { --tab-h: calc(64px + env(safe-area-inset-bottom)); --top-h: 54px; }
  /* backdrop-filter crearía un bloque contenedor y la barra fija quedaría arriba */
  .topbar { justify-content: center; backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1100;
    height: var(--tab-h); padding: 6px 8px env(safe-area-inset-bottom);
    justify-content: space-around; gap: 0;
    background: color-mix(in srgb, var(--card) 88%, transparent);
    backdrop-filter: saturate(1.6) blur(16px);
    -webkit-backdrop-filter: saturate(1.6) blur(16px);
    border-top: 1px solid var(--line);
  }
  .tabbar a { flex: 1; flex-direction: column; gap: 3px; padding: 6px 0; font-size: .7rem; border-radius: 12px; max-width: 96px; }
  .tabbar a:hover { background: none; }
  .tabbar a svg { width: 24px; height: 24px; }
  .tabbar a.active { background: none; color: var(--ink); }
  .tabbar a.active svg { background: var(--cta); color: var(--cta-ink); border-radius: 999px; padding: 3px 14px; width: 54px; height: 30px; margin: -3px 0; }
}

main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 1.1rem 1rem calc(1.5rem + var(--tab-h)); outline: none; }
.foot { text-align: center; color: var(--muted); font-size: .78rem; padding: 0 1rem calc(1.5rem + var(--tab-h)); margin-top: calc(-1 * var(--tab-h)); }
.foot a { color: inherit; }
body.full-map .foot { display: none; }

/* ---------- piezas comunes ---------- */
.card { background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.card + .card { margin-top: 1rem; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 1.5rem .25rem .6rem; }
.section-title h2 { font-size: .78rem; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.section-title .muted { font-size: .8rem; font-weight: 600; }
.eyebrow { margin: 0 0 .3rem; color: var(--accent); font-weight: 750; font-size: .76rem; text-transform: uppercase; letter-spacing: .08em; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 46px; padding: 0 1.15rem; border-radius: var(--r-md); border: 0; cursor: pointer;
  background: var(--cta); color: var(--cta-ink); font-weight: 800; text-decoration: none;
  transition: transform .12s, box-shadow .15s, background .15s;
  box-shadow: 0 4px 14px rgb(255 178 0 / .32);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgb(255 178 0 / .4); background: #ffcb5c; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn.ghost { background: var(--card-2); color: var(--ink); box-shadow: none; border: 1px solid var(--line); }
.btn.small { min-height: 38px; padding: 0 .85rem; font-size: .85rem; border-radius: var(--r-sm); }
.btn.block { width: 100%; }

.field {
  width: 100%; min-height: 48px; font: inherit; font-size: 1rem;
  padding: .75rem 1rem; border-radius: var(--r-md);
  border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.field::placeholder { color: var(--muted); }
.field:focus { outline: none; border-color: var(--cta); box-shadow: 0 0 0 4px var(--cta-soft); }
select.field {
  appearance: none; padding-right: 2.6rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 21px) 50%, calc(100% - 15px) 50%; background-size: 6px 6px; background-repeat: no-repeat;
}

.seg { display: flex; gap: 4px; padding: 4px; background: var(--card-2); border: 1px solid var(--line); border-radius: 999px; }
.seg button {
  flex: 1; min-width: 0; min-height: 38px; border: 0; border-radius: 999px; background: none; cursor: pointer;
  font-size: .88rem; font-weight: 650; color: var(--muted); padding: 0 .75rem; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  transition: background .15s, color .15s;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-selected="true"], .seg button[aria-checked="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / .1); }
@media (prefers-color-scheme: dark) { .seg button[aria-selected="true"], .seg button[aria-checked="true"] { background: #34332e; } }
.dirs button { text-transform: capitalize; }

.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2.1rem; height: 1.6rem; padding: 0 .45rem;
  border-radius: 7px; font-size: .8rem; font-weight: 800; letter-spacing: -.01em;
  background: var(--lc, #5a6b7a); color: var(--lt, #fff);
  font-variant-numeric: tabular-nums;
}
.badge.lg { min-width: 2.9rem; height: 2.25rem; font-size: 1rem; border-radius: 10px; }
.badges { display: flex; flex-wrap: wrap; gap: .3rem; }
.badges a { text-decoration: none; transition: transform .12s; }
.badges a:hover { transform: translateY(-1px); }
.code {
  display: inline-flex; align-items: center; gap: .25rem;
  font-size: .74rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums;
  background: var(--card-2); border: 1px solid var(--line); padding: .1rem .45rem; border-radius: 6px;
}

/* indicador de tiempo real (ondas, como el de las apps de transporte) */
.rt-ico { color: var(--accent); display: inline-flex; vertical-align: -.1em; margin-right: .25rem; }
.rt-ico svg { width: .9em; height: .9em; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; }
.rt-ico .w1 { animation: wave 1.6s infinite; }
.rt-ico .w2 { animation: wave 1.6s .3s infinite; }
@keyframes wave { 0%, 100% { opacity: .2; } 40% { opacity: 1; } }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2); animation: pulse 1.8s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgb(0 184 148 / .55); } 70% { box-shadow: 0 0 0 7px rgb(0 184 148 / 0); } 100% { box-shadow: 0 0 0 0 rgb(0 184 148 / 0); } }

.empty { padding: 1.8rem 1.2rem; text-align: center; color: var(--muted); font-weight: 500; }
.empty .i { display: block; margin: 0 auto .6rem; width: 30px; height: 30px; opacity: .55; }
.error { color: var(--red); }
.alert {
  display: flex; gap: .6rem; align-items: flex-start;
  background: var(--amber-soft); color: var(--amber); border-radius: var(--r-md);
  padding: .75rem .95rem; margin-bottom: .6rem; font-size: .9rem; font-weight: 600;
}
details.alert { display: block; }
details.alert summary { cursor: pointer; list-style: none; display: flex; gap: .55rem; align-items: center; }
details.alert summary::-webkit-details-marker { display: none; }
details.alert p { margin: .55rem 0 0; color: var(--ink-2); font-weight: 450; line-height: 1.5; }

/* esqueletos de carga */
.skel { display: grid; gap: .85rem; padding: 1.1rem; }
.skel i { display: block; height: 14px; border-radius: 7px; background: linear-gradient(90deg, var(--card-2) 0%, var(--line) 50%, var(--card-2) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
.skel i:nth-child(3n+1) { width: 70%; } .skel i:nth-child(3n+2) { width: 92%; } .skel i:nth-child(3n) { width: 52%; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ---------- listas ---------- */
.list { list-style: none; margin: 0; padding: 0; background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.list > li + li { border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: .85rem; padding: .8rem 1rem; text-decoration: none; transition: background .15s; min-height: 62px; }
a.row:hover { background: var(--card-2); }
.row-main { display: grid; gap: .3rem; min-width: 0; flex: 1; }
.row-title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; }
.row-side { color: var(--muted); font-size: .84rem; white-space: nowrap; font-weight: 650; }
.chev { color: var(--muted); opacity: .5; }
.stop-ico { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }

/* ---------- inicio: ¿A dónde vas? ---------- */
.home-head { margin: .5rem .25rem 1rem; }
.home-head h1 { font-size: clamp(1.9rem, 1.4rem + 2vw, 2.5rem); letter-spacing: -.035em; }
.greet { margin: 0 0 .25rem; color: var(--muted); font-weight: 600; font-size: .95rem; }
.search-card { background: var(--card); border-radius: 26px; box-shadow: var(--shadow-lift); padding: .35rem .5rem; position: relative; border: 2px solid transparent; transition: border-color .15s, box-shadow .15s; }
.search-card:focus-within { border-color: var(--cta); box-shadow: 0 0 0 5px var(--cta-soft), var(--shadow-lift); }
.sc-row { display: flex; align-items: center; gap: .8rem; padding: 0 .4rem; min-height: 56px; }
.sc-row + .sc-row { border-top: 1px solid var(--line); margin-left: 2rem; padding-left: 0; }
.sc-row + .sc-row .sc-dot { margin-left: -2rem; margin-right: .8rem; }
.sc-dot { flex: none; width: 13px; height: 13px; border-radius: 50%; }
.sc-dot.from { border: 3.5px solid var(--accent); background: var(--card); }
.sc-dot.to { background: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
.from-btn { flex: 1; text-align: left; background: none; border: 0; padding: .6rem 0; cursor: pointer; font-size: .95rem; color: var(--muted); min-height: 48px; font-weight: 500; }
.from-btn b { color: var(--ink); font-weight: 650; }
.to-input { flex: 1; min-width: 0; border: 0; background: none; font: inherit; font-size: 1.15rem; font-weight: 650; color: var(--ink); padding: .8rem 0; outline: none; }
.to-input::placeholder { color: var(--muted); font-weight: 600; }
.swap { flex: none; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--card-2); display: grid; place-items: center; cursor: pointer; color: var(--muted); transition: transform .25s, color .15s; }
.swap:hover { color: var(--ink); transform: rotate(180deg); }
.locating { display: inline-flex; align-items: center; gap: .55rem; color: var(--muted); }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent); border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.link { color: var(--accent); font-weight: 700; margin-left: .25rem; }
.from-box { padding: .2rem .4rem .5rem; }

.sugg-list { list-style: none; margin: 0; padding: .25rem 0 .2rem; border-top: 1px solid var(--line); }
.sugg-list:empty { display: none; }
.sugg { width: 100%; display: flex; align-items: center; gap: .8rem; text-align: left; background: none; border: 0; border-radius: var(--r-md); padding: .5rem .4rem; cursor: pointer; min-height: 54px; transition: background .12s; }
.sugg:hover, .sugg:focus-visible { background: var(--card-2); outline: none; }
.sugg b { display: block; font-weight: 650; }
.sugg small { color: var(--muted); font-size: .82rem; }
.sugg-ico { flex: none; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--card-2); color: var(--muted); }
.sugg-ico.stop { background: var(--accent-soft); color: var(--accent); }
.sugg-ico.place { background: var(--red-soft); color: var(--red); }
.sugg-ico.fav { background: var(--amber-soft); color: var(--amber); }
.sugg-ico.me { background: color-mix(in srgb, var(--blue) 14%, transparent); color: var(--blue); }
.sugg-list .empty { padding: 1rem; }
.when { margin-top: .8rem; }
.when-time { margin-top: .6rem; }

/* paradas cercanas en vivo */
.board + .board { border-top: 1px solid var(--line); }
.board { padding-bottom: .45rem; }
.board-head { display: flex; align-items: center; gap: .75rem; padding: .85rem 1rem .45rem; text-decoration: none; transition: background .15s; }
.board-head:hover { background: var(--card-2); }
.board-head .row-main { gap: .05rem; }
.board-head small { color: var(--muted); font-weight: 600; font-size: .8rem; }
.dep { display: flex; align-items: center; gap: .7rem; padding: .4rem 1rem; }
.dep-dest { flex: 1; min-width: 0; font-weight: 600; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: capitalize; }
.dep-time { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 1rem; }
.dep-time.rt { color: var(--accent); }
.dep-time small { font-weight: 650; font-size: .74rem; color: var(--muted); margin-left: 2px; }
.dep-none { padding: .35rem 1rem .6rem; color: var(--muted); font-size: .88rem; }

/* paradas más cercanas al origen/destino */
.near-box { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin: 1rem 0 0; }
.near-box:empty { display: none; }
.near-item { display: grid; gap: .25rem; align-content: start; padding: .85rem .95rem; background: var(--card); border-radius: var(--r-md); box-shadow: var(--shadow); text-decoration: none; transition: transform .15s, box-shadow .15s; }
.near-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.near-item small { font-size: .68rem; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; align-items: center; gap: .4rem; }
.near-item b { font-size: .92rem; line-height: 1.25; font-weight: 650; }
.near-item .walk { font-size: .8rem; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: .3rem; }
.near-item .dot { width: 8px; height: 8px; border-radius: 50%; }
@media (max-width: 420px) { .near-box { grid-template-columns: 1fr; } }

/* opciones de trayecto */
.options { list-style: none; margin: 0; padding: 0; display: grid; gap: .7rem; }
.option {
  width: 100%; display: grid; gap: .75rem; text-align: left; cursor: pointer;
  background: var(--card); border: 2px solid transparent; border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 1rem 1.05rem;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.option:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.option.sel { border-color: var(--cta); box-shadow: 0 0 0 4px var(--cta-soft), var(--shadow); }
.opt-top { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; }
.leave { display: grid; gap: .1rem; }
.leave b { font-size: 1.45rem; font-weight: 800; letter-spacing: -.025em; color: var(--accent); font-variant-numeric: tabular-nums; line-height: 1.1; }
.leave small { color: var(--muted); font-weight: 600; font-size: .82rem; }
.leave.soon b { color: var(--amber); }
.leave.now b { color: var(--red); animation: blink 1s steps(2) infinite; }
.leave.late b { color: var(--muted); text-decoration: line-through; font-size: 1.1rem; }
.leave.walk b { color: var(--ink); font-size: 1.25rem; }
@keyframes blink { 50% { opacity: .5; } }
.arrive { text-align: right; display: grid; gap: .1rem; }
.arrive b { font-size: 1.2rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.arrive small { color: var(--muted); font-weight: 600; font-size: .82rem; }
.trackbar { display: flex; gap: 4px; height: 30px; }
.trackbar .tw { flex: var(--w) 1 0; min-width: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); background: var(--card-2); border: 1.5px dashed var(--line); }
.trackbar .tw .i { width: 15px; height: 15px; }
.trackbar .tb { flex: var(--w) 1 0; min-width: 46px; border-radius: 8px; background: var(--lc); color: var(--lt); display: flex; align-items: center; gap: .3rem; padding: 0 .55rem; font-weight: 800; font-size: .84rem; overflow: hidden; white-space: nowrap; }
.trackbar .tb .i { width: 15px; height: 15px; }
.opt-meta { display: flex; flex-wrap: wrap; gap: .3rem 1rem; color: var(--muted); font-size: .84rem; font-weight: 500; }
.opt-meta span { display: inline-flex; align-items: center; gap: .3rem; }
.opt-meta b { color: var(--ink-2); font-weight: 650; }

.detail { margin-top: 1rem; }
.notify-row { padding: 1rem 1.05rem 0; }
.steps { list-style: none; margin: 0; padding: 1rem 1.05rem 1.15rem; }
.step { display: grid; grid-template-columns: 3rem 30px 1fr; gap: .65rem; position: relative; padding-bottom: 1.1rem; }
.step:last-child { padding-bottom: 0; }
.step-time { font-weight: 750; font-variant-numeric: tabular-nums; font-size: .92rem; padding-top: .3rem; }
.step-node { display: grid; justify-items: center; align-content: start; position: relative; }
.step-node .n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--card-2); color: var(--muted); border: 1.5px solid var(--line); position: relative; z-index: 1; }
.step-node .n .i { width: 15px; height: 15px; }
.step.bus .step-node .n { background: var(--lc); color: var(--lt); border: 0; }
.step.end .step-node .n { background: var(--red); color: #fff; border: 0; }
.step-node::after { content: ""; position: absolute; top: 30px; bottom: -1.1rem; width: 3px; background: var(--line); border-radius: 2px; }
.step.bus .step-node::after { background: var(--lc); }
.step.walk .step-node::after { background: none; width: 0; border-left: 3px dotted var(--line); }
.step:last-child .step-node::after { display: none; }
.step-body { display: grid; gap: .3rem; padding-top: .3rem; font-size: .93rem; }
.step-body .muted { font-size: .84rem; }
.step-body a { color: var(--ink); font-weight: 650; text-decoration-color: var(--line); text-underline-offset: 3px; }
.step-body a:hover { text-decoration-color: var(--accent); }

/* ---------- parada ---------- */
.stop-hero { display: grid; gap: .85rem; padding: 1.15rem 1.15rem 1.05rem; }
.stop-hero-top { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.stop-hero h1 { font-size: clamp(1.35rem, 1.1rem + 1.2vw, 1.85rem); margin-top: .15rem; }
.stop-meta { display: flex; flex-wrap: wrap; gap: .4rem .75rem; align-items: center; color: var(--muted); font-size: .84rem; font-weight: 600; }
.fav {
  flex: none; width: 46px; height: 46px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--card-2); color: var(--muted); cursor: pointer; display: grid; place-items: center;
  transition: transform .12s, color .15s, background .15s;
}
.fav:hover { transform: translateY(-1px); color: var(--amber); }
.fav[aria-pressed="true"] { color: var(--amber); background: var(--amber-soft); border-color: transparent; }
.fav[aria-pressed="true"] .i { fill: currentColor; }

.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 1.15rem .35rem; }
.card-head .muted { font-size: .78rem; font-weight: 600; white-space: nowrap; }
.arrivals { list-style: none; margin: 0; padding: 0 0 .35rem; }
.arrival { display: flex; align-items: center; gap: .75rem; padding: .7rem 1.15rem; }
.arrival + .arrival { border-top: 1px solid var(--line); }
.arrival > a { text-decoration: none; }
.arr-main { flex: 1; min-width: 0; display: grid; gap: .12rem; }
.headsign { font-weight: 700; text-transform: capitalize; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arr-sub { color: var(--muted); font-size: .8rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arr-warn { color: var(--amber); font-size: .78rem; font-weight: 650; }
.eta { text-align: right; min-width: 3.4rem; font-variant-numeric: tabular-nums; }
.eta b { display: block; font-size: 1.6rem; font-weight: 800; line-height: 1; letter-spacing: -.035em; }
.eta small { font-size: .68rem; font-weight: 750; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.arrival.rt .eta b { color: var(--accent); }
.arrival.sched .eta b { color: var(--ink-2); font-weight: 650; }
.arrival.unreachable { opacity: .5; }
.bell { flex: none; width: 42px; height: 42px; border-radius: 12px; border: 0; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; opacity: .75; transition: background .15s, color .15s; }
.bell:hover { background: var(--card-2); opacity: 1; }
.bell.on { color: var(--accent); background: var(--accent-soft); opacity: 1; }

/* ---------- mapas ---------- */
.map { height: 320px; background: var(--card-2); }
.map.small { height: 250px; }
.map-card { position: relative; isolation: isolate; }
.map-full { position: relative; isolation: isolate; margin: -1.1rem -1rem 0; height: calc(100dvh - var(--top-h) - var(--tab-h)); }
.map-full .map { height: 100%; }
body.full-map main { max-width: none; padding-bottom: 0; }
@media (min-width: 761px) { .map-full { margin: -1.1rem -1rem 0; } }
.line-map { height: 56vh; min-height: 320px; }
.base-tiles { filter: saturate(.3) contrast(.94) brightness(1.04); }
@media (prefers-color-scheme: dark) { .base-tiles { filter: saturate(.25) invert(.92) hue-rotate(180deg) brightness(.92) contrast(.88); } }
.leaflet-container { font-family: var(--font); background: var(--card-2); }
.leaflet-bar { border: 0 !important; box-shadow: var(--shadow-lift) !important; border-radius: 12px !important; overflow: hidden; }
.leaflet-bar a { width: 38px !important; height: 38px !important; line-height: 38px !important; background: var(--card) !important; color: var(--ink) !important; border-color: var(--line) !important; }
.leaflet-popup-content-wrapper { border-radius: 18px; box-shadow: var(--shadow-lift); background: var(--card); color: var(--ink); }
.leaflet-popup-tip { background: var(--card); }
.leaflet-popup-content { margin: 14px 16px; }
.leaflet-popup-close-button { top: 6px !important; right: 6px !important; }
.leaflet-control-attribution { font-size: 10px; background: color-mix(in srgb, var(--card) 80%, transparent) !important; color: var(--muted); }
.leaflet-control-attribution a { color: var(--muted); }

.map-pill {
  position: absolute; z-index: 500; left: 50%; bottom: 16px; translate: -50% 0;
  display: inline-flex; align-items: center; gap: .5rem;
  background: color-mix(in srgb, var(--card) 92%, transparent); color: var(--ink);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-size: .8rem; font-weight: 650; padding: .5rem .9rem; border-radius: 999px; box-shadow: var(--shadow-lift); white-space: nowrap;
}
.map-pill:empty { display: none; }
.dot-off { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.map-chips {
  position: absolute; z-index: 600; left: 0; right: 0; top: 10px;
  display: flex; gap: .4rem; overflow-x: auto; padding: 2px 12px 10px; scrollbar-width: none;
}
.map-chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px; min-width: 40px; padding: 5px; border-radius: 13px; cursor: pointer;
  background: color-mix(in srgb, var(--card) 94%, transparent); border: 2px solid transparent;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 10px rgb(0 0 0 / .14); font-weight: 700; font-size: .85rem;
  transition: transform .12s, border-color .15s, opacity .15s;
}
.chip:hover { transform: translateY(-1px); }
.chip.all { padding: 0 1rem; }
.chip.all.on { background: var(--cta); color: var(--cta-ink); }
.chip.on { border-color: var(--cta); box-shadow: 0 0 0 3px var(--cta-soft), 0 2px 10px rgb(0 0 0 / .14); }
.map-chips.filtering .chip:not(.on) { opacity: .6; }
.map-locate { position: absolute; z-index: 600; right: 12px; bottom: 16px; width: 44px; height: 44px; border-radius: 14px; border: 0; background: var(--card); color: var(--blue); box-shadow: var(--shadow-lift); display: grid; place-items: center; cursor: pointer; }
.map-locate:hover { transform: translateY(-1px); }

.bus-marker span {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 38px; height: 26px; border-radius: 9px;
  background: var(--lc); color: var(--lt);
  font: 800 12px/1 var(--font); letter-spacing: -.02em;
  border: 2.5px solid #fff; box-shadow: 0 2px 8px rgb(0 0 0 / .35);
  transition: transform .2s;
}
.bus-marker:hover span { transform: scale(1.12); }
.bus-marker .dir { position: absolute; inset: -10px; pointer-events: none; }
.bus-marker .dir::before {
  content: ""; position: absolute; left: 50%; top: 0; translate: -50% 0;
  border: 5px solid transparent; border-bottom: 7px solid var(--lc); border-top: 0;
  filter: drop-shadow(0 0 1.5px #fff);
}
.me-marker span { display: block; width: 18px; height: 18px; border-radius: 50%; background: #2563eb; border: 3px solid #fff; box-shadow: 0 0 0 7px rgb(37 99 235 / .2), 0 2px 6px rgb(0 0 0 / .3); }

.pop { display: grid; gap: .35rem; min-width: 215px; font: 14px/1.4 var(--font); }
.pop-head { display: flex; align-items: center; gap: .5rem; font-weight: 750; }
.pop .muted { font-size: .8rem; display: flex; align-items: center; gap: .3rem; }
.pop-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-top: .35rem; font-weight: 750; }
.pop-stops { list-style: none; margin: 0; padding: 0; }
.pop-stops li { display: flex; justify-content: space-between; gap: .75rem; padding: .2rem 0; font-size: .86rem; }
.pop-stops a { color: var(--ink); text-decoration: none; }
.pop-stops a:hover { text-decoration: underline; }
.pop-stops b { font-variant-numeric: tabular-nums; color: var(--accent); white-space: nowrap; }
.pop .btn { margin-top: .5rem; }

/* ---------- línea ---------- */
.line-head { display: flex; align-items: center; gap: .9rem; margin: .4rem .25rem 1rem; }
.line-head .badge { min-width: 3.4rem; height: 3rem; font-size: 1.3rem; border-radius: 14px; }
.line-head h1 { font-size: clamp(1.2rem, 1rem + 1vw, 1.6rem); }
.tabs-row { display: grid; gap: .5rem; margin: 1rem 0 .9rem; }
.live-sum { display: flex; align-items: center; gap: .5rem; margin: 0 .25rem .6rem; color: var(--muted); font-size: .85rem; font-weight: 600; }
.line-stops { list-style: none; margin: 0; padding: .45rem 0; background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.line-stops li { position: relative; }
.line-stops li::before { content: ""; position: absolute; left: 1.55rem; top: 0; bottom: 0; width: 4px; background: var(--c); }
.line-stops li:first-child::before { top: 50%; }
.line-stops li:last-child::before { bottom: 50%; }
.line-stops li > a::before {
  content: ""; position: absolute; left: calc(1.55rem - 5px); top: 50%; translate: 0 -50%;
  width: 14px; height: 14px; border-radius: 50%; background: var(--card); border: 3.5px solid var(--c); box-sizing: border-box;
}
.line-stops li.has-bus > a::before { background: var(--c); }
.line-stops a { position: relative; display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .7rem 1rem .7rem 3.2rem; text-decoration: none; min-height: 54px; transition: background .15s; }
.line-stops a:hover { background: var(--card-2); }
.ls-main { flex: 1; display: grid; min-width: 0; gap: .1rem; }
.ls-main .row-title { font-size: .93rem; }
.ls-eta { text-align: right; white-space: nowrap; display: grid; justify-items: end; font-variant-numeric: tabular-nums; }
.ls-eta b { font-weight: 800; }
.ls-eta b.rt { color: var(--accent); }
.ls-eta small { font-size: .72rem; color: var(--muted); font-weight: 600; }
.near-tag { color: var(--blue); font-weight: 700; font-size: .75rem; display: inline-flex; align-items: center; gap: .25rem; }
.line-stops li.near { background: color-mix(in srgb, var(--blue) 7%, transparent); }
.bus-here { display: flex; align-items: center; gap: .55rem; padding: .55rem 1rem 0 calc(1.55rem - 11px); font-size: .8rem; font-weight: 700; color: var(--accent); position: relative; }
.bus-pin { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--c); color: #fff; z-index: 1; box-shadow: 0 0 0 3px var(--card); animation: nudge 1.4s ease-in-out infinite; }
.bus-pin .i { width: 15px; height: 15px; }
@keyframes nudge { 50% { transform: translateY(3px); } }

.tt-controls { display: grid; gap: .6rem; margin-bottom: .8rem; }
.tt-head { display: flex; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.15rem; border-bottom: 1px solid var(--line); }
.tt-head .muted { font-size: .84rem; margin-top: .25rem; font-weight: 500; }
.tt-next { text-align: right; color: var(--muted); font-size: .72rem; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; }
.tt-next b { display: block; font-size: 1.75rem; color: var(--accent); letter-spacing: -.03em; text-transform: none; font-variant-numeric: tabular-nums; }
.tt-next small { display: block; text-transform: none; letter-spacing: 0; font-weight: 600; font-size: .8rem; }
.tt-grid { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tt-grid th { width: 3.4rem; text-align: right; padding: .6rem .8rem .6rem 1rem; color: var(--muted); font-weight: 800; vertical-align: top; font-size: .9rem; }
.tt-grid td { padding: .38rem 1rem .38rem 0; }
.tt-grid tr + tr { border-top: 1px solid var(--line); }
.tt-grid span { display: inline-block; min-width: 2.5rem; padding: .22rem .4rem; margin: .12rem; border-radius: 8px; text-align: center; font-weight: 650; font-size: .92rem; }
.tt-grid span.past { color: var(--muted); opacity: .4; font-weight: 500; }
.tt-grid span.next { background: var(--cta); color: var(--cta-ink); }
.tt-grid span.rt { color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.tt-grid span.next.rt { color: var(--cta-ink); }
.tt-grid sup { font-size: .62rem; margin-left: 1px; }
.hint { color: var(--muted); font-size: .82rem; text-align: center; margin: 1rem; line-height: 1.5; }

/* ---------- avisos ---------- */
#toast {
  position: fixed; z-index: 2000; left: 50%; bottom: calc(1rem + var(--tab-h)); translate: -50% 180%;
  display: flex; align-items: center; gap: .6rem;
  width: max-content; max-width: min(92vw, 520px); background: var(--ink); color: var(--bg); padding: .85rem 1.15rem; border-radius: 16px;
  box-shadow: 0 10px 30px rgb(0 0 0 / .3); transition: translate .35s cubic-bezier(.2, .9, .3, 1.15); font-size: .9rem; font-weight: 600;
}
#toast.show { translate: -50% 0; }

/* ---------- entrada suave de cada vista ---------- */
.view-in > * { animation: rise .35s cubic-bezier(.2, .8, .2, 1) both; }
.view-in > *:nth-child(2) { animation-delay: .04s; }
.view-in > *:nth-child(3) { animation-delay: .08s; }
.view-in > *:nth-child(n+4) { animation-delay: .12s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

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

/* tarjeta para activar la ubicación */
.promo { display: grid; grid-template-columns: auto 1fr; gap: .9rem 1rem; align-items: center; padding: 1.2rem; margin-top: 1.25rem;
  background: linear-gradient(135deg, var(--cta-soft), var(--card) 70%); }
.promo h2 { font-size: 1.05rem; }
.promo p { margin: .3rem 0 0; font-size: .9rem; line-height: 1.45; }
.promo .btn { grid-column: 1 / -1; }
.promo-ico { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--cta); color: var(--cta-ink); }
@media (min-width: 600px) { .promo { grid-template-columns: auto 1fr auto; } .promo .btn { grid-column: auto; } }

.board-head .badges { margin-top: .35rem; }
.board-head .badge { height: 1.4rem; min-width: 1.9rem; font-size: .74rem; }
.nearest { color: var(--accent); font-weight: 750; }
.board:first-child .stop-ico { background: var(--cta); color: var(--cta-ink); }
.board-head { align-items: flex-start; }
.board-head .stop-ico { margin-top: 2px; }
.board-head .chev { margin-top: 10px; }
.bus-marker .dir { transition: transform .4s linear, opacity .3s; }

/* popups en tiempo real */
.pop-head .i { color: var(--accent); }
.pop-deps { list-style: none; margin: .35rem 0 .1rem; padding: 0; display: grid; gap: .3rem; }
.pop-deps li { display: flex; align-items: center; gap: .5rem; font-size: .86rem; }
.pop-deps li span:not(.badge):not(.rt-ico) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.pop-deps b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pop-deps b.rt { color: var(--accent); }
.pop-none { margin: .3rem 0; }
.pop-stop { padding: .45rem 0; border-top: 1px solid var(--line); }
.pop-stop:first-of-type { border-top: 0; }
.pop-stop > a { color: var(--ink); text-decoration: none; }
.pop-stop > a:hover { text-decoration: underline; }
.leaflet-popup-content .skel { padding: .6rem 0; }
.leaflet-container a.btn, .leaflet-container a.btn:hover { color: var(--cta-ink); }
.leaflet-container .pop-stops a, .leaflet-container .pop-stop > a { color: var(--ink); }

/* ---------- v3: ajustes, lugares guardados, compartir, sin conexión ---------- */
.top-btn {
  order: 3; flex: none; width: 42px; height: 42px; border-radius: 13px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink-2); display: grid; place-items: center; cursor: pointer;
  transition: transform .12s, background .15s;
}
.top-btn:hover { transform: translateY(-1px); }
.top-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.tabbar { order: 2; margin-left: auto; }
@media (max-width: 760px) { .top-btn { position: absolute; right: 12px; top: 50%; translate: 0 -50%; width: 38px; height: 38px; } }

.offline {
  position: sticky; top: var(--top-h); z-index: 900;
  text-align: center; font-size: .82rem; font-weight: 700; padding: .45rem 1rem;
  background: var(--amber-soft); color: var(--amber);
}

.pill {
  display: inline-flex; align-items: center; gap: .4rem; min-height: 38px; padding: 0 .9rem;
  border-radius: 999px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
  font-weight: 650; font-size: .86rem; cursor: pointer; white-space: nowrap;
  transition: transform .12s, border-color .15s, background .15s;
}
.pill:hover { transform: translateY(-1px); border-color: var(--cta); }
.pill:active { transform: translateY(1px); }
.pill.ghost { color: var(--muted); border-style: dashed; background: transparent; }
.quick { display: flex; gap: .5rem; margin-top: .8rem; overflow-x: auto; scrollbar-width: none; }
.quick:empty { display: none; }
.result-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }

.hero-actions { display: flex; gap: .5rem; }
.hero-actions .fav:hover { color: var(--accent); }

.sugg-li { display: flex; align-items: center; gap: .25rem; }
.sugg-li .sugg { flex: 1; min-width: 0; }
.sugg-del { flex: none; width: 40px; height: 40px; border: 0; background: none; color: var(--muted); border-radius: 12px; cursor: pointer; display: grid; place-items: center; opacity: .6; }
.sugg-del:hover { background: var(--card-2); opacity: 1; }
.sugg-del .i { width: 16px; height: 16px; }

/* hoja de ajustes */
dialog.sheet {
  border: 0; padding: 0; margin: auto auto 0; width: min(100%, 520px); max-height: 90dvh;
  border-radius: 26px 26px 0 0; background: var(--card); color: var(--ink);
  box-shadow: 0 -10px 40px rgb(0 0 0 / .25);
}
@media (min-width: 761px) { dialog.sheet { margin: auto; border-radius: 26px; } }
dialog.sheet::backdrop { background: rgb(0 0 0 / .45); backdrop-filter: blur(2px); }
dialog.sheet[open] { animation: sheet-up .3s cubic-bezier(.2, .9, .3, 1); }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
.sheet-in { padding: 1.1rem 1.2rem calc(1.4rem + env(safe-area-inset-bottom)); display: grid; gap: .5rem; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .4rem; }
.sheet-head h2 { font-size: 1.35rem; font-weight: 800; }
.sheet-x { width: 40px; height: 40px; border-radius: 12px; border: 0; background: var(--card-2); cursor: pointer; display: grid; place-items: center; color: var(--ink-2); }
.set-label { margin: .8rem 0 .1rem; font-weight: 750; font-size: .92rem; }
.set-help { margin: 0; color: var(--muted); font-size: .82rem; line-height: 1.45; }
.set-list { display: grid; gap: .5rem; margin: 1rem 0 .5rem; }
.set-list:empty { display: none; }

/* foco del título al navegar (solo visible con teclado) */
h1:focus { outline: none; }
h1:focus-visible { outline: 3px solid var(--cta); outline-offset: 4px; }

/* impresión: horarios y trayectos legibles en papel */
@media print {
  .topbar, .tabbar, .foot, .map-card, .map, .notify-row, .bell, .fav, .result-actions, .quick, .when, #toast { display: none !important; }
  body { background: #fff; color: #000; }
  .card, .option, .list { box-shadow: none !important; border: 1px solid #ccc; }
}

.geo-steps { grid-column: 1 / -1; margin: 0; padding-left: 1.2rem; display: grid; gap: .45rem; font-size: .9rem; line-height: 1.45; color: var(--ink-2); }
.geo-steps b { color: var(--ink); }
