/* =========================================================
   Rodalies Live — estils
   Mòbil: una pantalla cada cop · Tauleta: 2 columnes · Ordinador: 3 columnes
   ========================================================= */
:root {
  color-scheme: dark;
  --bg: #000;
  --pane: #000;
  --card: #1c1d20;
  --card-2: #2a2b2f;
  --line: #2a2b30;
  --text: #fff;
  --soft: #d9dade;
  --muted: #9a9ca3;
  --faint: #62646b;
  --red: #ff4d5a;
  --amber: #ffb020;
  --green: #34c759;
  --accent: #7db9e8;
  --brand: #e83428;
  --access: #1a5aa8;
  --focus: #7db9e8;
  --row: 62px;
  --radius: 18px;
  --side-w: 360px;
  --shadow: none;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f2f2f5;
    --pane: #f2f2f5;
    --card: #fff;
    --card-2: #ececf0;
    --line: #dcdce2;
    --text: #111214;
    --soft: #3a3c42;
    --muted: #6b6e76;
    --faint: #8f9199;
    --red: #d6202f;
    --amber: #b86e00;
    --green: #1d8a3a;
    --accent: #1667c4;
    --focus: #1667c4;
    --shadow: 0 1px 2px rgba(0,0,0,.06), 0 1px 1px rgba(0,0,0,.04);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: Roboto, "SF Pro Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- Estructura ---------- */
.shell { min-height: 100dvh; }
.pane { display: none; flex-direction: column; min-height: 100dvh; background: var(--pane); container-type: inline-size; }
body[data-view="home"] .p-side,
body[data-view="station"] .p-station,
body[data-view="trip"] .p-trip,
body[data-view="route"] .p-route,
body[data-view="journey"] .p-journey { display: flex; }
.pane-body { flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: 0 16px; }
.p-welcome { display: none !important; }

/* ---------- Barra superior ---------- */
.bar {
  display: flex; align-items: center; gap: 8px;
  min-height: calc(56px + var(--safe-t)); padding: var(--safe-t) 12px 0;
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--pane) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(14px); backdrop-filter: saturate(1.6) blur(14px);
}
.bar.scrolled { box-shadow: 0 1px 0 var(--line); }
.bar-title {
  font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  opacity: 0; transform: translateY(4px); transition: opacity .2s, transform .2s; min-width: 0;
}
.bar.scrolled .bar-title { opacity: 1; transform: none; }
.spacer { flex: 1; }
.icon-btn { flex: none; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; transition: background .15s; }
.icon-btn:hover { background: var(--card); }
.icon-btn:active { background: var(--card-2); }
.close { display: none; }
#fav.on path { fill: var(--amber); stroke: var(--amber); }
#fav.on { animation: pop .3s ease; }
@keyframes pop { 50% { transform: scale(1.2); } }

.brand { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 500; padding-left: 4px; }
.brand img { border-radius: 8px; }
.brand b { font-weight: 800; }
.mode { font-size: 11px; font-weight: 800; letter-spacing: .08em; padding: 3px 8px; border-radius: 6px; background: var(--amber); color: #000; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 17px;
  background: var(--card); color: var(--accent); font-size: 14px; font-weight: 700; box-shadow: var(--shadow);
}
.chip:hover { background: var(--card-2); }

h1 { font-size: 34px; line-height: 1.12; font-weight: 800; margin: 6px 0 16px; letter-spacing: -.015em; overflow-wrap: anywhere; }

/* ---------- Buscador ---------- */
.search { position: relative; display: block; margin: 6px 0 16px; }
.search input {
  width: 100%; height: 50px; border-radius: 14px; border: 0; outline: 0;
  background: var(--card); color: var(--text); font-size: 17px; padding: 0 44px 0 46px; box-shadow: var(--shadow);
  -webkit-appearance: none; appearance: none;
}
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search input::placeholder { color: var(--muted); }
.search input:focus { box-shadow: 0 0 0 2px var(--focus); }
.search > svg { position: absolute; left: 15px; top: 15px; color: var(--muted); pointer-events: none; }
.kbd {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px;
  border: 1px solid var(--line); color: var(--muted); font: 600 12px/1 ui-monospace, monospace;
}
.search .kbd { position: absolute; right: 14px; top: 14px; display: none; }
.search input:focus ~ .kbd, .search input:not(:placeholder-shown) ~ .kbd { display: none !important; }

.section-title { color: var(--muted); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin: 24px 4px 8px; }
.list { display: flex; flex-direction: column; gap: 6px; }
.station {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--card); border-radius: 14px; padding: 13px 16px; font-size: 17px; font-weight: 600;
  box-shadow: var(--shadow); transition: background .15s;
}
.station:hover, .dep:hover { background: var(--card-2); }
.station[aria-current="true"] { box-shadow: inset 0 0 0 2px var(--accent); }
.station .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.station .dist { color: var(--muted); font-size: 14px; font-weight: 400; white-space: nowrap; }
.lines { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; max-width: 50%; }
.ghost-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; background: var(--card); border-radius: 14px; padding: 14px; font-weight: 600; color: var(--accent); box-shadow: var(--shadow);
}
.ghost-btn:hover { background: var(--card-2); }

/* ---------- A prop meu ---------- */
.section-title.row { display: flex; align-items: center; justify-content: space-between; }
.link-btn { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-size: 13px; font-weight: 700; text-transform: none; letter-spacing: 0; padding: 4px 6px; border-radius: 8px; }
.link-btn:hover { background: var(--card); }
.empty.small { padding: 14px 16px; font-size: 14px; line-height: 1.4; margin-bottom: 8px; text-align: left; }
.fav-card { background: var(--card); border-radius: 14px; padding: 4px 8px 8px; box-shadow: var(--shadow); }
.fav-card.current { box-shadow: inset 0 0 0 2px var(--accent); }
.fav-main { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 9px 8px 6px; font-size: 17px; font-weight: 600; }
.fav-main .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fav-main:hover .name { text-decoration: underline; text-underline-offset: 3px; }
.mini-deps { margin: 0 2px; border-top: 1px solid var(--line); padding-top: 6px; display: flex; flex-direction: column; }
.mini-dep { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 8px; text-align: left; font-size: 15px; }
.mini-dep:hover { background: var(--card-2); }
.md-dest { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.md-when { font-weight: 700; font-variant-numeric: tabular-nums; }
.md-empty { color: var(--muted); font-size: 14px; padding: 6px; }

/* Distintiu de línia (quadrat tipus Rodalies) */
.badge { display: inline-grid; place-items: center; min-width: 28px; height: 22px; padding: 0 5px; border-radius: 3px; font-weight: 800; font-size: 13px; letter-spacing: -.02em; flex: none; }
.badge.big { width: 52px; height: 52px; font-size: 25px; border-radius: 3px; }

/* ---------- Sortides ---------- */
.deps { display: flex; flex-direction: column; gap: 6px; }
.dep {
  display: flex; align-items: center; gap: 16px; width: 100%; text-align: left;
  background: var(--card); border-radius: 8px; padding: 14px 18px; box-shadow: var(--shadow); transition: background .15s;
}
.deps > .dep:first-child { border-top-left-radius: var(--radius); border-top-right-radius: var(--radius); }
.deps > .dep:last-child { border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius); }
/* Tren seleccionado: borde del color de su línea (--lc) */
.dep[aria-current="true"] { background: var(--card-2); box-shadow: inset 0 0 0 2px var(--lc, var(--accent)); }
.dep .mid { flex: 1; min-width: 0; }
.dep .dest { font-size: 21px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dep .meta { font-size: 16px; margin-top: 4px; display: flex; align-items: center; gap: 8px; color: var(--soft); white-space: nowrap; }
.dep .right { text-align: right; flex: none; }
.dep .when { font-size: 23px; font-weight: 700; font-variant-numeric: tabular-nums; }
.dep .via { font-size: 15px; margin-top: 4px; min-height: 1.2em; color: var(--soft); }
.dep .via b { font-size: 17px; color: var(--text); }
.dep.canceled .dest { text-decoration: line-through; color: var(--muted); }
.dot-sep { opacity: .7; }
.c-red { color: var(--red) !important; } .c-amber { color: var(--amber) !important; } .c-green { color: var(--green) !important; } .c-muted { color: var(--muted) !important; }
.wc { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 3px; background: var(--access); flex: none; }
.empty { color: var(--muted); text-align: center; padding: 36px 16px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.empty.plain { background: none; box-shadow: none; }
.station-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.station-head h1 { flex: 1; min-width: 0; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--green); animation: blink 2s ease-in-out infinite; }
.live.stale::before { background: var(--faint); animation: none; }
@keyframes blink { 50% { opacity: .35; } }

/* ---------- Mapa lineal del tren ---------- */
.trip-head { display: flex; align-items: center; gap: 12px; margin: -4px 0 22px; flex-wrap: wrap; }
.pill { border: 2px solid currentColor; border-radius: 10px; padding: 2px 12px; font-size: 17px; font-weight: 600; }
.trip-head .num { font-size: 19px; font-variant-numeric: tabular-nums; color: var(--soft); }
.timeline { --tw: 116px; position: relative; background: var(--card); border-radius: 26px; padding: 22px 16px 22px 0; box-shadow: var(--shadow); }
.rail { position: absolute; top: 22px; bottom: 22px; left: var(--tw); width: 26px; border-radius: 13px; }
.stop { position: relative; display: grid; grid-template-columns: var(--tw) 26px 1fr; height: var(--row); }
.stop .times { text-align: right; padding-right: 20px; font-variant-numeric: tabular-nums; }
.stop .est { font-size: 22px; font-weight: 700; line-height: 30px; }
.stop .sch { font-size: 16px; color: var(--muted); text-decoration: line-through; line-height: 20px; }
.stop .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--card); margin: 8px auto 0; position: relative; z-index: 1; }
.stop .info { padding-left: 20px; min-width: 0; }
.stop .nm { font-size: 21px; font-weight: 700; line-height: 30px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stop .vi { font-size: 15px; line-height: 22px; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stop.passed .nm, .stop.passed .est, .stop.passed .vi { opacity: .5; }
.stop.passed .dot { opacity: .6; }
.stop.skipped .nm { text-decoration: line-through; color: var(--muted); }
.train {
  position: absolute; left: calc(var(--tw) + 13px - 21px); width: 42px; height: 42px; border-radius: 50%;
  background: var(--card); border: 3px solid var(--text); color: var(--text); display: grid; place-items: center; z-index: 2;
}
.train.pulse::after {
  content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 2px solid var(--text); opacity: 0;
  animation: pulse 2s ease-out infinite;
}
@keyframes pulse { 0% { transform: scale(.7); opacity: .6; } 100% { transform: scale(1.35); opacity: 0; } }
.legend { color: var(--muted); font-size: 13px; margin: 12px 4px 0; }

.placeholder { display: grid; place-items: center; text-align: center; color: var(--muted); min-height: 60vh; padding: 24px; }
.placeholder svg { color: var(--faint); margin-bottom: 12px; }
.placeholder p { margin: 0; max-width: 260px; line-height: 1.45; }

.foot { color: var(--faint); font-size: 12px; text-align: center; padding: 22px 16px calc(20px + var(--safe-b)); }
.skeleton { height: 82px; border-radius: 10px; background: linear-gradient(90deg, var(--card) 0%, var(--card-2) 50%, var(--card) 100%); background-size: 200% 100%; animation: sk 1.2s linear infinite; }
.skeleton.title { height: 38px; width: 60%; margin: 6px 0 18px; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }

.toast.update { bottom: calc(66px + var(--safe-b)); gap: 12px; padding: 8px 8px 8px 16px; }
.toast.update button { background: var(--accent); color: #fff; font-weight: 800; padding: 6px 14px; border-radius: 16px; }
.toast {
  position: fixed; left: 50%; bottom: calc(16px + var(--safe-b)); transform: translateX(-50%); z-index: 20;
  display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 22px;
  background: var(--text); color: var(--bg); font-size: 14px; font-weight: 600; white-space: nowrap;
  box-shadow: 0 6px 24px rgba(0,0,0,.35);
}

/* ---------- Els meus viatges ---------- */
.myj-card { position: relative; display: flex; align-items: flex-start; background: var(--card); border-radius: 14px; box-shadow: var(--shadow); }
.myj-card.current { box-shadow: inset 0 0 0 2px var(--accent); }
.myj-main { flex: 1; min-width: 0; text-align: left; padding: 12px 4px 12px 16px; display: flex; flex-direction: column; gap: 6px; }
.myj-top .name { display: block; font-size: 16px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.myj-mid { display: flex; align-items: center; gap: 10px; }
.myj-times { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.myj-status { font-size: 14px; font-weight: 600; color: var(--soft); }
.myj-del { margin: 6px 6px 0 0; color: var(--muted); width: 36px; height: 36px; }
.save-btn.on path { fill: var(--amber); stroke: var(--amber); }
.save-btn.on { animation: pop .3s ease; }

/* Vaig en aquest tren */
.follow-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin: -8px 0 18px;
  padding: 13px; border-radius: 14px; background: var(--card); color: var(--accent); font-weight: 700; box-shadow: var(--shadow);
}
.follow-btn:hover { background: var(--card-2); }
.follow-box { background: var(--card); border-radius: 14px; padding: 12px 16px; margin: -8px 0 18px; box-shadow: inset 0 0 0 2px var(--green); display: flex; flex-direction: column; gap: 10px; }
.follow-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 15px; color: var(--soft); }
.follow-on { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; color: var(--green); }
.follow-on svg { stroke: currentColor; }
.follow-row select {
  flex: 1; min-width: 0; height: 40px; border: 0; border-radius: 10px; padding: 0 10px;
  background: var(--card-2); color: var(--text); font: 600 15px/1 inherit; color-scheme: inherit;
}

/* ---------- Planificador de rutes ---------- */
.route-btn {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; margin: -4px 0 16px;
  background: var(--card); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); transition: background .15s;
}
.route-btn:hover { background: var(--card-2); }
.route-ico { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--brand); color: #fff; }
.route-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.route-txt b { font-size: 16px; }
.route-txt small { color: var(--muted); font-size: 13px; }
.route-btn > svg { color: var(--muted); flex: none; }
.route-from { margin: -6px 0 16px; }

.planner { background: var(--card); border-radius: 18px; padding: 10px 6px 12px 14px; box-shadow: var(--shadow); margin-bottom: 20px; }
.pl-fields { display: flex; align-items: center; gap: 10px; }
.pl-rail { flex: none; display: flex; flex-direction: column; align-items: center; align-self: stretch; padding: 21px 0; }
.pl-dot { width: 12px; height: 12px; border-radius: 50%; border: 3px solid var(--text); }
.pl-dot.d { background: var(--text); border-radius: 3px; }
.pl-line { flex: 1; width: 2px; margin: 4px 0; background: repeating-linear-gradient(var(--muted) 0 4px, transparent 4px 8px); }
.pl-inputs { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.pl-field { position: relative; }
.pl-field input {
  width: 100%; height: 46px; border: 0; outline: 0; border-radius: 12px; padding: 0 14px;
  background: var(--card-2); color: var(--text); font-size: 16px; font-weight: 600; -webkit-appearance: none; appearance: none;
}
.pl-field input::placeholder { color: var(--muted); font-weight: 400; }
.pl-field input:focus { box-shadow: 0 0 0 2px var(--focus); }
.pl-field input::-webkit-search-cancel-button { -webkit-appearance: none; }
.pl-sugg {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30; max-height: 340px; overflow-y: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 6px; box-shadow: 0 12px 32px rgba(0,0,0,.35);
}
.pl-opt { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; border-radius: 10px; text-align: left; font-weight: 600; }
.pl-opt .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-opt.sel, .pl-opt:hover { background: var(--card-2); }
.pl-none { color: var(--muted); padding: 10px; }
.pl-swap { flex: none; color: var(--accent); }
.pl-when { display: flex; align-items: center; gap: 6px; margin: 12px 8px 0 22px; flex-wrap: wrap; }
.seg { height: 34px; padding: 0 14px; border-radius: 17px; font-size: 14px; font-weight: 700; color: var(--muted); background: var(--card-2); }
.seg.on { background: var(--text); color: var(--bg); }
#pl-time { height: 34px; border: 0; border-radius: 17px; padding: 0 12px; background: var(--card-2); color: var(--text); font: 700 15px/1 inherit; color-scheme: inherit; }

.r-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 19px; font-weight: 800; line-height: 1.25; }
.r-arrow { color: var(--muted); font-weight: 400; }
.r-sub { color: var(--muted); font-size: 14px; margin: 4px 0 12px; }
.recent { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: var(--card); border-radius: 14px; padding: 13px 16px; font-weight: 600; box-shadow: var(--shadow); }
.recent:hover { background: var(--card-2); }
.recent .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.placeholder.small { min-height: 0; padding: 28px 12px; }

.jlist { display: flex; flex-direction: column; gap: 8px; }
.jcard {
  display: flex; flex-direction: column; gap: 8px; width: 100%; text-align: left;
  background: var(--card); border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow); transition: background .15s;
}
.jcard:hover { background: var(--card-2); }
.jcard[aria-current="true"] { background: var(--card-2); box-shadow: inset 0 0 0 2px var(--text); }
.j-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.j-time { font-size: 23px; font-weight: 800; font-variant-numeric: tabular-nums; }
.j-arrow { color: var(--muted); font-weight: 400; }
.j-dur { font-size: 16px; font-weight: 700; color: var(--soft); white-space: nowrap; }
.j-chain { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.j-x { color: var(--muted); font-weight: 700; }
.j-leave { font-size: 14px; color: var(--soft); white-space: nowrap; }
.j-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: var(--card-2); color: var(--soft); }
.jcard[aria-current="true"] .tag, .jcard:hover .tag { background: var(--bg); }
.tag.amber { color: var(--amber); background: color-mix(in srgb, var(--amber) 16%, transparent) !important; }
.tag.red { color: var(--red); background: color-mix(in srgb, var(--red) 16%, transparent) !important; }
.j-via { font-size: 13px; color: var(--muted); }
.jcard.risk-missed .j-time, .jcard.risk-canceled .j-time { text-decoration: line-through; color: var(--muted); }
.ghost-btn.more { margin-top: 10px; }

/* Detall del viatge */
.j-h1 { font-size: 26px; }
.j-summary { background: var(--card); border-radius: 18px; padding: 14px 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.j-big { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; }
.j-sum-meta { color: var(--soft); font-size: 15px; margin-top: 2px; }
.alert { border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; font-size: 15px; line-height: 1.4; }
.alert.amber { background: color-mix(in srgb, var(--amber) 15%, transparent); color: var(--amber); }
.alert.red { background: color-mix(in srgb, var(--red) 15%, transparent); color: var(--red); }
.alert .ghost-btn { margin-top: 10px; }
.leg { margin-bottom: 4px; }
.leg-head { display: flex; align-items: center; gap: 12px; margin: 6px 0 8px; }
.leg-head .badge.big { width: 46px; height: 46px; font-size: 21px; }
.leg-title { flex: 1; min-width: 0; }
.leg-dest { font-size: 19px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leg-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; color: var(--soft); margin-top: 2px; }
.leg-note { margin: 0 2px 10px; font-size: 14px; font-weight: 600; color: var(--soft); }
.leg .timeline { --row: 56px; }
.stop.marked .nm { font-weight: 800; }
.stop .mark { color: var(--text); }
.xfer {
  display: flex; align-items: center; gap: 12px; margin: 14px 0; padding: 12px 16px; border-radius: 14px;
  border: 2px dashed var(--line); color: var(--soft); font-size: 14px; line-height: 1.4;
}
.xfer b { color: var(--text); font-size: 15px; }
.xfer svg { flex: none; color: var(--muted); }
.xfer.risk-tight, .xfer.risk-risky { border-color: color-mix(in srgb, var(--amber) 60%, transparent); }
.xfer.risk-tight svg, .xfer.risk-risky svg { color: var(--amber); }
.xfer.risk-missed { border-color: color-mix(in srgb, var(--red) 60%, transparent); }
.xfer.risk-missed svg, .xfer.risk-missed b { color: var(--red); }

/* Columnes estretes (mòbil petit o columna d'ordinador) */
@container (max-width: 420px) {
  .pane-body { padding: 0 12px; }
  h1 { font-size: 29px; }
  .dep { padding: 13px 14px; gap: 12px; }
  .badge.big { width: 44px; height: 44px; font-size: 21px; }
  .dep .dest { font-size: 19px; }
  .dep .meta { font-size: 15px; }
  .dep .when { font-size: 20px; }
  .timeline { --tw: 90px; --row: 58px; }
  .stop .times { padding-right: 14px; } .stop .info { padding-left: 14px; }
  .stop .est { font-size: 19px; } .stop .sch { font-size: 14px; }
  .stop .nm { font-size: 18px; } .stop .vi { font-size: 14px; }
}

/* ---------- Tauleta: llista + detall ---------- */
@media (min-width: 760px) {
  body { overflow: hidden; }
  .shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); height: 100dvh; min-height: 0; }
  .pane { min-height: 0; height: 100dvh; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--card-2) transparent; }
  .p-side { display: flex; border-right: 1px solid var(--line); background: var(--bg); }
  .p-side .bar { background: color-mix(in srgb, var(--bg) 86%, transparent); }
  .pane:not(.p-side) { background: var(--pane); }
  .p-station .back, .p-route .back { display: none; }
  body[data-view="home"] .p-welcome { display: grid !important; }
  .search .kbd { display: inline-grid; }
  .pane-body { padding: 0 24px; }
  .station-head h1 { font-size: 38px; }
}
@media (min-width: 760px) and (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) { --pane: #f7f7f9; --bg: #ececf0; }
}

/* Benvinguda */
.p-welcome { place-items: center; text-align: center; padding: 32px; }
.welcome-inner { max-width: 420px; }
.welcome-inner img { border-radius: 18px; box-shadow: 0 12px 40px rgba(232,52,40,.35); }
.p-welcome h2 { font-size: 28px; line-height: 1.2; margin: 22px 0 10px; letter-spacing: -.01em; }
.p-welcome p { color: var(--muted); line-height: 1.5; margin: 0 0 10px; }
.p-welcome .hint { font-size: 14px; margin-top: 18px; }

/* ---------- Ordinador: tres columnes ---------- */
@media (min-width: 1200px) {
  :root { --side-w: 340px; }
  .shell { grid-template-columns: var(--side-w) minmax(380px, 1fr) minmax(440px, 1.1fr); }
  .p-welcome { grid-column: 2 / -1; }
  body[data-view="station"] .p-trip,
  body[data-view="trip"] .p-station,
  body[data-view="route"] .p-journey,
  body[data-view="journey"] .p-route { display: flex; }
  .p-journey { border-left: 1px solid var(--line); }
  .p-journey .back { display: none; }
  .p-journey .close { display: grid; }
  body[data-view="route"] .p-journey .close { display: none; }
  .p-trip { border-left: 1px solid var(--line); }
  body.no-station[data-view="trip"] .p-station { display: none; }
  body.no-station[data-view="trip"] .p-trip { grid-column: 2 / -1; border-left: 0; }
  /* Sin columna de estación al lado (tren abierto desde un viaje): flecha para volver en vez de cerrar */
  body.no-station[data-view="trip"] .p-trip .back { display: grid; }
  body.no-station[data-view="trip"] .p-trip .close { display: none; }
  .p-trip .back { display: none; }
  .p-trip .close { display: grid; }
  body[data-view="station"] .p-trip .close { display: none; }
}
@media (min-width: 1600px) {
  :root { --side-w: 380px; }
}

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