/* North East Buses – Find My Bus (live map page) */
:root {
  --brand: #4338ca;
  --brand-soft: #eef0ff;
  --ink: #111827;
  --text: #374151;
  --muted: #6b7280;
  --line: #eceef2;
  --soft: #f7f8fa;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(17, 24, 39, .12);
  --sidebar: 320px;
}
body.neb-page {
  margin: 0;
  background: #fff;
  color: var(--text);
  font: 15px/1.6 system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
body.neb-page * { box-sizing: border-box; }
button { font: inherit; cursor: pointer; }
a { color: var(--brand); }
.is-hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--muted); }

/* ---------- Intro ---------- */
.page-intro { padding: 36px 0 28px; }
.intro-inner { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.intro-text { min-width: 0; }
.crumbs { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--brand); }
.crumbs span { margin: 0 6px; color: #c4c8d0; }
.page-intro h1 { margin: 0; font-size: 28px; line-height: 1.2; letter-spacing: -0.02em; color: var(--ink); font-weight: 700; }
.lede { margin: 8px 0 0; color: var(--muted); max-width: 720px; }
.intro-tools { display: flex; align-items: center; gap: 10px; flex: none; }

.live-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: 999px;
  background: var(--soft); border: 1px solid var(--line);
  font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap;
}
.live-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: #9ca3af; }
.live-pill.ok .dot { background: var(--ok); animation: neb-pulse 2s infinite; }
.live-pill.warn .dot { background: var(--warn); }
.live-pill.bad .dot { background: var(--bad); }
@keyframes neb-pulse { 0% { box-shadow: 0 0 0 0 rgba(22,163,74,.5); } 70% { box-shadow: 0 0 0 8px rgba(22,163,74,0); } 100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); } }
.tool-btn {
  display: none; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font-size: 13px; font-weight: 600;
}
.tool-btn img { display: block; }

/* ---------- Map app ---------- */
.app {
  position: relative;
  display: flex;
  align-items: stretch;
  min-height: 460px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.sidebar {
  width: var(--sidebar); flex: 0 0 var(--sidebar);
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 24px;
}
.search-label { display: block; margin: 0 0 8px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.search-hint { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }
.sidebar > div + div { margin-top: 20px; }
.map-wrap { position: relative; flex: 1; min-width: 0; }
/* Desktop and tablet: the whole map fits on screen below the header (exact height set by app.js) */
@media (min-width: 861px) {
  .app { height: calc(100vh - 290px); height: var(--app-h, calc(100vh - 290px)); }
  .sidebar { overflow-y: auto; }
}
#map { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: #eef0f3; }
.noscript { position: absolute; z-index: 1000; top: 16px; left: 16px; right: 16px; background: #fff; border-radius: 10px; padding: 4px 16px; box-shadow: var(--shadow); }

.stats { display: flex; gap: 8px; }
.stats > div { flex: 1; background: var(--soft); border-radius: 12px; padding: 12px 6px; text-align: center; }
.stats .big { display: block; font-size: 22px; line-height: 1.2; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.stats .lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

.search input {
  width: 100%; padding: 11px 14px 11px 40px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--soft) url(../img/icon-search.svg) no-repeat 13px 50%;
  background-size: 17px 17px;
  font: inherit; color: var(--ink);
}
.search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); background-color: #fff; }

.active-filter {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--brand-soft); border-radius: 12px; padding: 9px 12px;
  font-weight: 600; font-size: 13.5px; color: var(--brand);
}
.active-filter button { border: 0; background: var(--brand); color: #fff; border-radius: 8px; padding: 4px 12px; font-size: 12.5px; }

.panel h2 {
  margin: 0 0 10px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600;
  display: flex; align-items: baseline; justify-content: space-between;
}
.panel h2 .hint { text-transform: none; letter-spacing: 0; font-weight: 400; }

.ops { list-style: none; margin: 0; padding: 0; }
.ops li + li { margin-top: 2px; }
.ops li button {
  width: 100%; display: flex; align-items: center; gap: 10px;
  background: none; border: 0; border-radius: 10px; padding: 8px 10px; text-align: left; color: var(--ink);
}
.ops li button:hover { background: var(--soft); }
.ops .sw { width: 12px; height: 12px; border-radius: 4px; flex: none; background: var(--c); }
.ops .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.ops .n { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.ops li.off button { opacity: .45; }
.ops li.off .sw { background: transparent; box-shadow: inset 0 0 0 2px var(--c); }

.routes { display: flex; flex-wrap: wrap; gap: 6px; }
.routes button {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 9px; padding: 4px 10px; min-width: 42px; font-weight: 700; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
}
.routes button i { font-style: normal; font-weight: 500; color: var(--muted); font-size: 11px; }
.routes button:hover { border-color: var(--brand); color: var(--brand); }
.routes button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.routes button.on i { color: #c7cbff; }
.empty { color: var(--muted); font-size: 13.5px; }

/* ---------- Bus markers ----------
   One consistent label for every bus: a rounded rectangle in the operator's
   colour with a thin white outline. Long route numbers use smaller text.
   The arrow sits just outside the label edge in the direction of travel
   (--d is the distance from the centre to the edge, set by the script). */
.bus-icon { background: none; border: 0; }
.bus { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); display: flex; align-items: center; justify-content: center; }
.bus .lbl {
  position: relative; z-index: 2;
  box-sizing: border-box; width: 32px; height: 20px; padding: 0 2px;
  border-radius: 5px;
  background: var(--c, #555); color: var(--t, #fff); border: 1px solid var(--o, #fff);
  font: 700 11.5px/18px system-ui, "Segoe UI", Roboto, sans-serif;
  letter-spacing: -0.01em; text-align: center; white-space: nowrap; overflow: hidden;
  box-shadow: 0 1px 3px rgba(17, 24, 39, .35);
}
.bus.len4 .lbl { font-size: 10px; letter-spacing: -0.03em; }
.bus.len5 .lbl { font-size: 8.5px; letter-spacing: -0.04em; }
.bus .arr { position: absolute; z-index: 1; left: 50%; top: 50%; width: 0; height: 0; transform: rotate(var(--b, 0deg)); }
.bus .arr:before {
  content: ""; position: absolute; left: -5px;
  top: calc(-1 * var(--d, 10px) - 6px);
  border-left: 5px solid transparent; border-right: 5px solid transparent;
  border-bottom: 7px solid var(--a, var(--c, #555));
}
.bus.nobrg .arr { display: none; }
.bus.old .lbl { opacity: .55; }
.bus.sel .lbl { box-shadow: 0 0 0 2px #111827, 0 2px 8px rgba(0,0,0,.35); }
.zoom-far .bus .lbl { width: 10px; height: 10px; padding: 0; font-size: 0; line-height: 0; border-radius: 3px; }
.zoom-far .bus .arr { display: none; }
.zoom-far .bus.sel .lbl { width: 14px; height: 14px; }
.me-dot { position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #2563eb; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(37,99,235,.22); transform: translate(-50%,-50%); }

/* ---------- Grey map background ---------- */
.leaflet-tile-pane { filter: grayscale(1) brightness(1.04) contrast(.92); }

/* ---------- Map overlays ---------- */
.banner {
  position: absolute; z-index: 1000; top: 16px; left: 50%; transform: translateX(-50%);
  width: 560px; max-width: calc(100% - 32px);
  background: #fff; border-left: 4px solid var(--warn); border-radius: 12px;
  padding: 12px 16px; box-shadow: var(--shadow); font-size: 14px; color: var(--ink);
}
.banner.bad { border-left-color: var(--bad); }
.fab {
  position: absolute; z-index: 1000; right: 10px; bottom: 100px;
  width: 36px; height: 36px; border-radius: 10px;
  background: #fff; border: 2px solid rgba(0,0,0,.2); background-clip: padding-box;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.fab:hover { background-color: #f4f4f5; }
.fab.active { box-shadow: 0 0 0 3px var(--brand-soft); }
.fab img { display: block; }

/* ---------- Bus and stop panels: bottom sheets (stop panel sits on the right on bigger screens) ---------- */
.sheet {
  position: absolute; z-index: 1001; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column;
  max-height: 48%;
  background: #fff; border-radius: 18px 18px 0 0;
  box-shadow: 0 -10px 30px rgba(17, 24, 39, .16);
  animation: neb-sheet-up .22s ease-out;
}
.sheet.is-hidden { display: none; }
.sheet-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 2px 24px 20px; }
/* Close tab: a small half circle sitting on top of the panel, with a down arrow */
.sheet { padding-top: 14px; }
.sheet-handle {
  position: absolute; left: 50%; top: -24px; z-index: 1;
  width: 56px; height: 25px; margin: 0 0 0 -28px; padding: 0;
  border: 0; border-radius: 28px 28px 0 0; background: #fff;
  box-shadow: 0 -5px 10px -2px rgba(17, 24, 39, .14);
  cursor: pointer; touch-action: none;
}
.sheet-handle:hover, .sheet-handle:focus { background: #fff; outline: none; }
.sheet-handle:focus-visible { box-shadow: 0 0 0 2px var(--brand); }
.sheet-handle .chev {
  position: absolute; left: 50%; top: 50%; width: 9px; height: 9px; margin: -4px 0 0 -5px;
  border-right: 2.5px solid #6b7280; border-bottom: 2.5px solid #6b7280; border-radius: 1px;
  transform: rotate(45deg);
}
.sheet-handle:hover .chev, .sheet-handle:focus .chev { border-color: var(--ink); }
@keyframes neb-sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes neb-sheet-left { from { transform: translateX(100%); } to { transform: none; } }

/* The bus sheet on wider screens: details laid out across the map */
@media (min-width: 861px) {
  .bus-sheet .sheet-body {
    display: grid; grid-template-columns: minmax(240px, 1.1fr) minmax(260px, 1.6fr) minmax(220px, 1fr);
    gap: 4px 36px; align-items: start; padding: 2px 32px 24px;
  }
  .bus-sheet .d-grid { margin: 2px 0 0; }
  .bus-sheet .d-actions { flex-direction: column; }
  .bus-sheet .d-tt { margin-top: 10px; }

  .stop-sheet {
    top: 0; left: auto; width: 380px; max-width: 45%; max-height: none;
    border-radius: 18px 0 0 18px; box-shadow: -10px 0 30px rgba(17, 24, 39, .14);
    animation-name: neb-sheet-left;
  }
  /* side panel: the same half circle, on its left edge, arrow pointing right */
  .stop-sheet { padding-top: 0; }
  .stop-sheet .sheet-handle {
    left: -24px; top: 24px; width: 25px; height: 56px; margin: 0;
    border-radius: 28px 0 0 28px; box-shadow: -5px 0 10px -2px rgba(17, 24, 39, .14);
  }
  .stop-sheet .sheet-handle .chev { transform: rotate(-45deg); margin: -5px 0 0 -6px; }
  .stop-sheet .deps { max-height: none; }
  .stop-sheet .sheet-body { padding-top: 20px; }
}

/* Keep map buttons clear of an open panel */
.map-wrap .leaflet-bottom, .map-wrap .leaflet-right, .map-wrap .fab { transition: transform .22s ease; }
.map-wrap.sheet-open .leaflet-bottom, .map-wrap.sheet-open .fab { transform: translateY(calc(-1 * var(--sheet-h, 0px) - 26px)); }
.map-wrap.side-open .leaflet-right, .map-wrap.side-open .fab { transform: translateX(calc(-1 * var(--side-w, 0px) - 26px)); }

/* While a bus is selected, the other buses fade so its route stands out */
#map.has-sel .bus-icon:not(.sel-wrap) .bus { opacity: .28; }
.d-routenote { margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.d-routenote:empty { display: none; }
.d-routenote .sw { display: inline-block; width: 18px; height: 4px; border-radius: 2px; background: var(--c); vertical-align: 3px; margin-right: 6px; box-shadow: 0 0 0 1px rgba(17, 24, 39, .15); }
.stop-live { margin: 10px 0 0; font-size: 11.5px; color: var(--muted); }

.icon-btn { background: none; border: 0; color: var(--muted); border-radius: 8px; }
.detail-head { display: flex; gap: 14px; align-items: center; }
.route-badge {
  flex: none; min-width: 50px; height: 42px; padding: 0 10px; border-radius: 12px;
  background: var(--c, var(--brand)); color: var(--t, #fff); font-weight: 800; font-size: 19px;
  box-shadow: inset 0 0 0 1px rgba(17, 24, 39, .12);
  display: flex; align-items: center; justify-content: center;
}
.d-to { font-size: 16px; font-weight: 700; line-height: 1.3; color: var(--ink); }
.d-op { color: var(--muted); font-size: 13px; }
.d-grid { display: grid; grid-template-columns: auto 1fr; gap: 5px 16px; margin: 16px 0; font-size: 13.5px; }
.d-grid dt { color: var(--muted); }
.d-grid dd { margin: 0; font-weight: 500; color: var(--ink); }
.d-actions { display: flex; gap: 8px; }
.btn { flex: 1; border: 1px solid var(--brand); background: var(--brand); color: #fff; border-radius: 10px; padding: 9px 10px; font-weight: 600; font-size: 13px; }
.btn:hover { background: #3730a3; }
.btn.ghost { background: #fff; color: var(--brand); }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.ghost.pressed { background: var(--brand); color: #fff; }

.scrim { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: rgba(17,24,39,.3); z-index: 1040; }
.leaflet-container { font: inherit; }
.leaflet-control-attribution { font-size: 10.5px; }

/* ---------- Content below the map ---------- */
.content { padding: 56px 0 72px; }
.content .section + .section, .ad-block + .section { margin-top: 64px; }
.content h2 { margin: 0 0 8px; font-size: 22px; letter-spacing: -0.01em; color: var(--ink); }
.content h3 { margin: 28px 0 10px; font-size: 16px; color: var(--ink); }
.content p { margin: 0 0 12px; }

.ad-block { max-width: 970px; margin: 0 auto; text-align: center; }
.content .section + .ad-block { margin-top: 64px; }
.ad-label { margin: 0 0 6px !important; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #9ca3af; }
.neb-ad { min-height: 100px; }

.facts { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.fact { flex: 1 1 200px; background: var(--soft); border-radius: 14px; padding: 16px 18px; }
.fact .k { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.fact .v { display: block; margin-top: 4px; font-weight: 600; color: var(--ink); }

.live-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.live-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.live-table td { padding: 12px; border-bottom: 1px solid var(--line); color: var(--ink); }

.route-links { list-style: none; margin: 24px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.route-links a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 84px; padding: 12px 14px; border-radius: 14px;
  border: 1px solid var(--line); background: #fff; text-decoration: none;
  transition: border-color .15s ease, transform .15s ease;
}
.route-links a:hover { border-color: var(--brand); transform: translateY(-1px); }
.rl-num { font-size: 18px; font-weight: 800; color: var(--ink); line-height: 1.2; }
.rl-meta { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.route-links a.is-live .rl-meta { color: var(--ok); font-weight: 600; }

.op-links { list-style: none; margin: 20px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.op-links li { background: var(--soft); border-radius: 12px; padding: 10px 16px; }
.op-name { font-weight: 600; color: var(--ink); }

.faq-grid { display: flex; flex-wrap: wrap; gap: 8px 48px; }
.faq-grid > div { flex: 1 1 420px; }
.faq-grid p { color: var(--muted); }

/* ---------- Mobile ---------- */
@media (max-width: 860px) {
  .page-intro { padding: 24px 0 20px; }
  .page-intro h1 { font-size: 22px; }
  .lede { font-size: 14px; }
  .intro-inner { flex-direction: column; align-items: flex-start; gap: 14px; }
  .tool-btn { display: inline-flex; }
  .app { height: 72vh; min-height: 440px; }
  .sidebar {
    overflow-y: auto;
    position: absolute; top: 0; bottom: 0; left: 0; z-index: 1050;
    width: 86%; max-width: var(--sidebar);
    transform: translateX(-105%);
    transition: transform .22s ease;
    box-shadow: var(--shadow);
  }
  .app.drawer-open .sidebar { transform: none; }
  .sheet { max-height: 62%; }
  .sheet-body { padding: 0 18px 16px; }
  .fab { bottom: 110px; }
  .content { padding: 40px 0 56px; }
  .content .section + .section, .ad-block + .section { margin-top: 48px; }
  .live-table th:nth-child(2), .live-table td:nth-child(2) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .live-pill.ok .dot { animation: none; }
  .sidebar, .route-links a { transition: none; }
}

/* ---------- Bus stop panel ---------- */
.stop-head { display: flex; gap: 12px; align-items: flex-start; }
.stop-badge {
  flex: none; display: inline-flex; align-items: center; height: 26px; padding: 0 9px; border-radius: 8px;
  background: var(--brand-soft); color: var(--brand); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
}
.stop-ind { display: inline-block; margin-left: 4px; padding: 0 7px; border-radius: 6px; background: #111827; color: #fff; font-size: 12px; line-height: 20px; vertical-align: 2px; }
.stop-routes { margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 4px; }
.stop-routes span { font-size: 11.5px; font-weight: 700; color: var(--ink); background: var(--soft); border-radius: 6px; padding: 1px 7px; }
.stop-loading { color: var(--muted); margin: 14px 0 0; }
.deps { list-style: none; margin: 14px 0 0; padding: 0; max-height: 300px; overflow-y: auto; }
.deps li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.deps li.has-live { cursor: pointer; }
.deps li.has-live:hover .dep-to { color: var(--brand); }
.dep-route { flex: none; min-width: 40px; text-align: center; background: var(--c, #555); color: var(--t, #fff); box-shadow: inset 0 0 0 1px rgba(17, 24, 39, .12); font-weight: 800; font-size: 13px; border-radius: 8px; padding: 3px 6px; }
.dep-to { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-weight: 500; }
.dep-due { flex: none; text-align: right; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.dep-due small { display: block; font-size: 10.5px; font-weight: 500; color: var(--muted); }
.dep-due.live { color: var(--ok); }
.dep-due i, .dep-note i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-right: 5px; vertical-align: 1px; }
.dep-note { margin: 10px 0 0; font-size: 11.5px; color: var(--muted); }
.leaflet-tooltip { font: 600 12px/1.3 system-ui, "Segoe UI", Roboto, sans-serif; border-radius: 8px; }

/* ---------- Routes grouped by operator ---------- */
.op-group { margin-top: 32px; }
.op-group-title { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin: 0 !important; font-size: 17px !important; }
.op-sw { width: 12px; height: 12px; border-radius: 4px; background: var(--brand); flex: none; }
.op-group-meta { font-size: 13px; font-weight: 500; color: var(--muted); }
.op-group .route-links { margin-top: 14px; }
.op-group-title a { color: var(--ink); text-decoration: none; }
.op-group-title a:hover { color: var(--brand); text-decoration: underline; }
.op-group-title a.op-track {
  margin-left: auto; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line);
  font-size: 13px; font-weight: 600; color: var(--brand); white-space: nowrap; text-decoration: none;
}
.op-group-title a.op-track:hover { border-color: var(--brand); background: var(--brand-soft); text-decoration: none; }
@media (max-width: 860px) { .op-group-title a.op-track { margin-left: 0; } }
.route-links a:not(.is-live) .rl-meta { color: #9ca3af; }

/* ---------- Bus stop pins ---------- */
.leaflet-marker-icon.stop-pin { filter: drop-shadow(0 1px 2px rgba(17, 24, 39, .35)); cursor: pointer; }
.leaflet-marker-icon.stop-pin:hover { filter: drop-shadow(0 1px 4px rgba(17, 24, 39, .6)); }

/* ---------- Same route number, different operators ---------- */
.route-choice { background: var(--soft); border-radius: 12px; padding: 12px; }
.route-choice p { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.rc-ops { display: flex; flex-direction: column; gap: 6px; }
.rc-ops button {
  display: flex; align-items: center; gap: 8px; width: 100%;
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 8px 10px; font-size: 13.5px; font-weight: 600; color: var(--ink); text-align: left;
}
.rc-ops button .sw { width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; }
.rc-ops button.on { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.rc-ops button:hover { border-color: var(--brand); }

/* Colour swatches get a faint edge so white or very light operator colours still show */
.ops .sw, .rc-ops button .sw, .op-sw { box-shadow: inset 0 0 0 1px rgba(17, 24, 39, .18); }
.ops li.off .sw { box-shadow: inset 0 0 0 2px var(--c); }

/* ---------- Full-screen map ---------- */
.fab-full { bottom: 146px; }
.app.is-full, .app:fullscreen {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 5000;
  width: 100%; height: 100% !important; min-height: 0; max-height: none;
  border: 0; background: #fff;
}
html.neb-map-full, html.neb-map-full body { overflow: hidden; }

/* ---------- Links from the map to timetables ---------- */
.tt-link { margin: 14px 0 0 !important; font-size: 13.5px; font-weight: 600; }
.tt-link a { text-decoration: none; }
.d-tt { margin: 12px 0 0; font-size: 13.5px; font-weight: 600; }
.d-tt a { text-decoration: none; }

/* ---------- Timetable pages ---------- */
.tt-badge {
  display: inline-block; min-width: 56px; padding: 2px 12px; margin-right: 6px;
  border-radius: 10px; color: #fff; text-align: center; font-size: .9em; vertical-align: 2px;
  box-shadow: inset 0 0 0 1px rgba(17, 24, 39, .12);
}
.tool-link {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line); background: #fff;
  color: var(--ink); font-weight: 600; font-size: 14px; text-decoration: none;
}
.tool-link:hover { border-color: var(--brand); color: var(--brand); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(22, 163, 74, .18); }
.tt-content { padding-top: 32px; }
.tt-day { margin: 0 0 8px; }
.tt-day div { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.tt-day label { font-weight: 600; color: var(--ink); }
.tt-day select {
  padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff;
  font: inherit; color: var(--ink); min-width: 230px;
}
.tt-go { flex: none; }
.tt-dir h2 { margin-bottom: 4px; }
.tt-facts { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 18px; }
.tt-facts .fact { flex: 1 1 150px; padding: 12px 16px; }
.tt-scroll {
  overflow-x: auto;
  border: 1px solid var(--line); border-radius: 14px; background: #fff;
}
.tt-table { border-collapse: separate; border-spacing: 0; font-size: 14px; font-variant-numeric: tabular-nums; }
.tt-table th, .tt-table td { padding: 7px 12px; border-bottom: 1px solid #f1f2f5; white-space: nowrap; text-align: center; }
.tt-table thead th { background: var(--soft); color: var(--muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.tt-table th.tt-stop {
  position: sticky; left: 0; z-index: 1; text-align: left; white-space: normal;
  min-width: 210px; max-width: 280px; background: #fff; color: var(--ink); font-weight: 500;
  border-right: 1px solid var(--line);
}
.tt-table thead th.tt-stop { background: var(--soft); color: var(--muted); }
.tt-table tr.tt-major th, .tt-table tr.tt-major td { font-weight: 600; color: var(--ink); }
.tt-table tr.tt-end th, .tt-table tr.tt-end td { font-weight: 700; }
.tt-table tr.tt-minor th, .tt-table tr.tt-minor td { color: #4b5563; }
/* Main stops only (switch above each table; needs JavaScript, so without it every stop shows) */
.tt-compact .tt-table tr.tt-minor { display: none; }
.tt-compact .tt-table tr.tt-minor.tt-live-row { display: table-row; }
.tt-toggle { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin: 0 0 12px !important; }
.tt-toggle.is-hidden { display: none; }
.tt-toggle .tool-link { cursor: pointer; font: inherit; font-size: 14px; font-weight: 600; }
.tt-toggle .muted { font-size: 13px; }
/* Different destinations in one timetable */
.tt-ends { margin: -2px 0 0 !important; font-size: 13.5px; }
.tt-table tr.tt-dest th { font-size: 11.5px; font-weight: 600; text-transform: none; letter-spacing: 0; white-space: normal; min-width: 64px; max-width: 96px; line-height: 1.25; vertical-align: bottom; }
.tt-table tr.tt-dest th.tt-dest-main { color: var(--muted); }
.tt-table tr.tt-dest th.tt-dest-other { color: #b45309; background: #fff7ed; }
/* Live buses */
.tt-livebar { margin: 0 0 12px !important; padding: 10px 14px; border-radius: 12px; background: #f0fdf4; color: #166534; font-size: 13.5px; }
.tt-livebar.is-hidden { display: none; }
.tt-livebar a { font-weight: 600; }
.tt-livebar .live-dot { display: inline-block; vertical-align: 1px; margin-right: 6px; }
.tt-table .tt-livecol { background: #f0fdf4; }
.tt-table thead th.tt-livecol { color: #166534; }
.tt-live-tag { display: block; font-weight: 700; color: #166534; text-transform: uppercase; }
.tt-live-tag i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-right: 5px; vertical-align: 1px; animation: neb-pulse 1.6s ease-in-out infinite; }
.tt-table thead th.tt-livecol small { display: block; font-size: 10.5px; text-transform: none; letter-spacing: 0; font-weight: 600; }
.tt-table td.tt-passed { color: #b6bcc6 !important; }
.tt-table td.tt-bus { position: relative; background: var(--ok) !important; color: #fff !important; font-weight: 700; border-radius: 6px; box-shadow: 0 0 0 2px #fff inset; }
.tt-key { white-space: nowrap; }
.tt-key-bus { display: inline-block; width: 22px; height: 12px; border-radius: 4px; background: var(--ok); vertical-align: -1px; margin: 0 4px 0 6px; }
@keyframes neb-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.tt-table tbody tr:hover th, .tt-table tbody tr:hover td { background: #fafafe; }
.tt-table .tt-next { background: var(--brand-soft) !important; color: var(--brand); }
.tt-table thead .tt-next { color: var(--brand); }
.tt-ind { display: inline-block; padding: 0 6px; border-radius: 5px; background: var(--soft); color: var(--muted); font-size: 11.5px; font-weight: 600; }
.tt-skip { color: #c4c8d0; }
.tt-note { margin-top: 10px !important; font-size: 13px; }
.tt-none { font-size: 16px; }
.tt-search { max-width: 520px; }
.tt-links { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.tt-links a {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; height: 100%;
  border: 1px solid var(--line); border-radius: 14px; background: #fff; text-decoration: none;
}
.tt-links a:hover { border-color: var(--brand); }
.tl-num { flex: none; min-width: 48px; text-align: center; font-size: 18px; font-weight: 800; color: var(--ink); }
.tl-name { font-size: 13px; color: var(--muted); line-height: 1.35; }
.tt-group + .tt-group { margin-top: 40px !important; }

/* ---------- Responsive: tablets ---------- */
@media (min-width: 861px) and (max-width: 1100px) {
  :root { --sidebar: 280px; }
  .sidebar { padding: 20px; }
}

/* ---------- Responsive: phones ---------- */
@media (max-width: 860px) {
  .fab-full { bottom: 156px; }
  .tt-table { font-size: 13px; }
  .tt-table th.tt-stop { min-width: 140px; max-width: 170px; }
  .tt-table th, .tt-table td { padding: 6px 9px; }
  .tt-day select { min-width: 0; width: 100%; }
  .tt-links { grid-template-columns: 1fr; }
  .page-intro h1 .tt-badge { min-width: 44px; }
}

/* ---------- Responsive: large monitors and TVs ---------- */
@media (min-width: 1600px) {
  body.neb-page { font-size: 16px; }
  :root { --sidebar: 360px; }
  .page-intro h1 { font-size: 32px; }
  .tt-table { font-size: 15px; }
}
@media (min-width: 2200px) {
  body.neb-page { font-size: 19px; }
  :root { --sidebar: 440px; }
  .page-intro h1 { font-size: 40px; }
  .lede { font-size: 19px; max-width: 1000px; }
  .stats .big { font-size: 30px; }
  .stats .lbl, .panel h2, .search-label { font-size: 14px; }
  .search input { font-size: 18px; padding: 14px 16px 14px 46px; }
  .ops .name, .ops .n { font-size: 17px; }
  .stop-sheet { width: 460px; }
  .d-to { font-size: 20px; }
  .d-grid, .deps li { font-size: 16px; }
  .tt-table { font-size: 18px; }
  .tt-table th.tt-stop { min-width: 300px; max-width: 380px; }
  .route-links a { min-width: 104px; }
  .rl-num { font-size: 22px; }
}

/* Ads on timetable pages: clearly separated, with space reserved so nothing jumps */
.tt-ad { margin: 48px auto !important; }
.tt-group + .tt-ad { margin-top: 40px !important; }

/* ---------- Never scroll sideways ----------
   Nothing of ours is wider than the screen; this also stops anything added
   later (such as an ad Google inserts) from making the whole page scroll sideways. */
html, body.neb-page { max-width: 100%; overflow-x: hidden; }
@supports (overflow-x: clip) {
  html, body.neb-page { overflow-x: clip; }
}
.content, .neb-wrap, .section, .ad-block, .faq-grid > div { min-width: 0; }
.neb-ad { max-width: 100%; overflow: hidden; }
.content img, .content table { max-width: 100%; }
.content .tt-table { max-width: none; }   /* timetables scroll inside their own box instead */

/* ---------- Bus stop pages ---------- */
.stop-content { padding-top: 32px; }
.page-intro h1 .stop-ind { font-size: .55em; line-height: 1.6; padding: 0 10px; border-radius: 8px; vertical-align: 6px; }
.stop-deps { max-height: none; max-width: 760px; margin-top: 8px; }
.stop-deps li { padding: 12px 0; font-size: 15px; }
.stop-deps .dep-route { min-width: 52px; font-size: 15px; padding: 5px 8px; }
.dep-to small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.stop-updated { margin-top: 12px !important; font-size: 13px; }
.stop-near { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px 24px; }
.stop-near li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.stop-near a { font-weight: 600; text-decoration: none; }
.stop-near .muted { float: right; font-size: 13px; }
.tt-table th.tt-stop a { color: inherit; text-decoration: none; }
.tt-table th.tt-stop a:hover { color: var(--brand); text-decoration: underline; }
.stop-page-link { margin: 12px 0 0 !important; font-size: 13px; font-weight: 600; }
.stop-page-link a { text-decoration: none; }
@media (min-width: 2200px) {
  .stop-deps li, .stop-deps .dep-route { font-size: 19px; }
}
.deps-h { margin: 14px 0 0; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stop-content .deps-h { margin-top: 4px; }
.deps-h + .deps { margin-top: 6px; }
.sheet .deps { max-height: none; }   /* the panel itself scrolls, so long next-hour lists aren't a box inside a box */

/* "See buses near you?" card on the map */
.near-card {
  position: absolute; z-index: 1002; bottom: 24px; left: 50%; transform: translateX(-50%);
  width: 360px; max-width: calc(100% - 32px);
  background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 16px 18px;
  animation: neb-fade-in .25s ease-out;
}
.near-card p { margin: 0 0 12px; font-size: 14px; line-height: 1.45; color: var(--text); }
.near-card strong { color: var(--ink); font-size: 15px; }
.near-actions { display: flex; gap: 8px; }
@keyframes neb-fade-in { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 860px) { .near-card { bottom: auto; top: 12px; } }
.ad-block.ad-list { margin: 40px auto 8px; }
.content .ad-block.ad-end { margin-top: 64px; }
