:root {
  --bg: #f7f7f8; --panel: #ffffff; --panel-2: #f2f2f4;
  --ink: #0b0b0f; --ink-2: #4b4b57; --ink-3: #8b8b98;
  --line: rgba(15,15,20,.09); --line-2: rgba(15,15,20,.16);
  --accent: #2563eb; --accent-soft: #e6edfd;
  --ok: #0f9d63; --warn: #c76a00; --warn-soft: #fff3e0; --bad: #d92d3a; --bad-soft: #fde8ea;
  --shadow: 0 1px 1px rgba(0,0,0,.03), 0 8px 24px -10px rgba(0,0,0,.1);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #09090b; --panel: #141417; --panel-2: #1c1c21; --ink: #f4f4f6; --ink-2: #a8a8b3; --ink-3: #6e6e7a;
    --line: rgba(255,255,255,.08); --line-2: rgba(255,255,255,.16); --accent: #6d9bff; --accent-soft: #17213a;
    --ok: #3dd68c; --warn: #ffb44d; --warn-soft: #33260f; --bad: #ff6369; --bad-soft: #3a1518;
    --shadow: 0 1px 1px rgba(0,0,0,.4), 0 12px 32px -14px rgba(0,0,0,.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #09090b; --panel: #141417; --panel-2: #1c1c21; --ink: #f4f4f6; --ink-2: #a8a8b3; --ink-3: #6e6e7a;
  --line: rgba(255,255,255,.08); --line-2: rgba(255,255,255,.16); --accent: #6d9bff; --accent-soft: #17213a;
  --ok: #3dd68c; --warn: #ffb44d; --warn-soft: #33260f; --bad: #ff6369; --bad-soft: #3a1518;
  --shadow: 0 1px 1px rgba(0,0,0,.4), 0 12px 32px -14px rgba(0,0,0,.7);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column; }
button, input { font: inherit; color: inherit; }
.wrap { width: min(880px, 100%); margin: 0 auto; padding: 0 16px; }
[hidden] { display: none !important; }
.muted { color: var(--ink-3); }

/* barre du haut */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
.top-in { width: min(880px, 100%); margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 9px; color: inherit; text-decoration: none; font-weight: 600; white-space: nowrap; letter-spacing: -.01em; }
.brand img { width: 28px; height: 28px; }
.brand b { font-weight: 700; }
@media (max-width: 600px) { .brand span { display: none; } }
.search { position: relative; flex: 1; }
.search > svg { position: absolute; left: 12px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search input { width: 100%; padding: 10px 12px 10px 38px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel); outline: none; }
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.results { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow); max-height: 70vh; overflow: auto; padding: 6px; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); display: grid; place-items: center; cursor: pointer; flex: none; }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { color: var(--ink); border-color: var(--line-2); }
.icon-btn.on { color: #f5b301; }

main { padding-top: 22px; padding-bottom: 40px; flex: 1; width: 100%; }
.foot { font-size: 12px; color: var(--ink-3); padding-bottom: calc(18px + env(safe-area-inset-bottom)); }

h1 { font-size: clamp(24px, 4.5vw, 32px); letter-spacing: -.03em; margin: 0; line-height: 1.15; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin: 26px 0 10px; font-weight: 650; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }

.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--panel); cursor: pointer; font-weight: 550; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn svg { width: 17px; height: 17px; }
.btn:focus-visible, .icon-btn:focus-visible, .place:focus-visible, .chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* liste d'arrêts */
.places { display: grid; gap: 2px; }
.card .places { padding: 6px; }
.place { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 11px; text-decoration: none; color: inherit; cursor: pointer; border: 0; background: none; width: 100%; text-align: left; }
.place:hover, .place.hl { background: var(--panel-2); }
.place .pi { width: 34px; height: 34px; border-radius: 10px; background: var(--panel-2); display: grid; place-items: center; color: var(--ink-2); flex: none; }
.place .pi svg { width: 17px; height: 17px; }
.place .pn { flex: 1; min-width: 0; }
.place .pn b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.place .pn small { color: var(--ink-3); font-size: 13px; }
.place .pm { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.mtag { font-size: 11px; font-weight: 650; padding: 2px 7px; border-radius: 6px; background: var(--panel-2); color: var(--ink-2); white-space: nowrap; }
.dist { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }

.hero { padding: 26px 0 6px; }
.hero p { color: var(--ink-2); margin: 8px 0 18px; max-width: 520px; }
.empty { padding: 22px; text-align: center; color: var(--ink-3); font-size: 14px; }
.notice { padding: 14px 16px; border-radius: 14px; background: var(--warn-soft); color: var(--ink); font-size: 14px; margin-bottom: 16px; }

/* page arrêt */
.stop-head { display: flex; align-items: flex-start; gap: 12px; }
.stop-head .grow { flex: 1; min-width: 0; }
.stop-sub { color: var(--ink-3); font-size: 13px; margin-top: 4px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.live { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); font-weight: 600; }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: blink 1.8s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 18px 0 4px; }
.chip { border: 1px solid var(--line-2); background: var(--panel); border-radius: 999px; padding: 6px 13px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.lines { display: grid; gap: 12px; margin-top: 14px; }
.lgroup { overflow: hidden; }
.lhead { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.lhead .ln { font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.lhead .warn-ic { color: var(--warn); display: inline-flex; cursor: pointer; border: 0; background: none; padding: 2px; }
.lhead .warn-ic svg { width: 18px; height: 18px; }

/* pastilles de ligne */
.badge {
  --c: #6b7280; --t: #fff;
  background: var(--c); color: var(--t); font-weight: 750; font-size: 14px; letter-spacing: -.02em;
  min-width: 30px; height: 30px; padding: 0 7px; display: inline-grid; place-items: center; flex: none;
  border-radius: 7px; line-height: 1; white-space: nowrap;
}
.badge.metro, .badge.rer { border-radius: 50%; width: 30px; padding: 0; }
.badge.rer { box-shadow: inset 0 0 0 2.5px rgba(255,255,255,.55); }
.badge.train { border-radius: 8px; }
.badge.tram { border-radius: 8px; box-shadow: inset 0 3px 0 rgba(0,0,0,.18), inset 0 -3px 0 rgba(0,0,0,.18); }
.badge.bus { border-radius: 5px; font-size: 13px; }
.badge.sm { min-width: 24px; height: 24px; font-size: 12px; padding: 0 5px; }
.badge.sm.metro, .badge.sm.rer { width: 24px; padding: 0; }
.mode-ic { width: 20px; height: 20px; color: var(--ink-3); flex: none; }

.dest { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 11px 14px; }
.dest + .dest { border-top: 1px solid var(--line); }
.dest .dn { min-width: 0; }
.dest .dn b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dest .dn small { color: var(--ink-3); font-size: 12.5px; display: flex; gap: 8px; flex-wrap: wrap; }
.times { display: flex; gap: 6px; align-items: center; }
.t {
  min-width: 54px; text-align: center; padding: 5px 8px; border-radius: 9px; background: var(--panel-2);
  font-weight: 700; font-variant-numeric: tabular-nums; font-size: 15px; line-height: 1.1;
}
.t small { display: block; font-size: 10.5px; font-weight: 600; color: var(--ink-3); }
.t.first { background: var(--accent-soft); color: var(--accent); }
.t.now { background: var(--ok); color: #fff; }
.t.now small { color: rgba(255,255,255,.85); }
.t.late small { color: var(--warn); }
.t.cancel { background: var(--bad-soft); color: var(--bad); text-decoration: line-through; }
.t.cancel small { text-decoration: none; color: var(--bad); }
.t.theo { opacity: .75; }
@media (max-width: 520px) {
  .t { min-width: 46px; padding: 4px 6px; font-size: 14px; }
  .times .t:nth-child(3) { display: none; }
}

.idle { padding: 12px 14px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: var(--ink-3); }

.dis { border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); background: var(--warn-soft); border-radius: 14px; padding: 12px 14px; margin-top: 14px; }
.dis.bad { border-color: color-mix(in srgb, var(--bad) 35%, transparent); background: var(--bad-soft); }
.dis summary { cursor: pointer; font-weight: 600; display: flex; gap: 8px; align-items: center; list-style: none; }
.dis summary::-webkit-details-marker { display: none; }
.dis summary::after { content: "▾"; margin-left: auto; color: var(--ink-3); }
.dis[open] summary::after { content: "▴"; }
.dis p { margin: 8px 0 0; font-size: 14px; white-space: pre-line; color: var(--ink-2); }

.skeleton { height: 120px; border-radius: 16px; background: linear-gradient(90deg, var(--panel) 0%, var(--panel-2) 50%, var(--panel) 100%); background-size: 200% 100%; animation: sk 1.2s infinite; margin-top: 12px; border: 1px solid var(--line); }
@keyframes sk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton, .live i { animation: none; } }

#toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 16px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; z-index: 50; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
