

:root {
  --lite-bg: #f5f5f5;
  --lite-surface: #fff;
  --lite-text: #1a1a1a;
  --lite-muted: #5c5c5c;
  --lite-border: #ddd;
  --lite-accent: #1e88e5;
}

[data-theme="dark"] {
  --lite-bg: #121212;
  --lite-surface: #1e1e1e;
  --lite-text: #eee;
  --lite-muted: #aaa;
  --lite-border: #333;
  --lite-accent: #64b5f6;
}

* { box-sizing: border-box; }

body.home-page.lite-page {
  margin: 0;
  padding-top: var(--header-h);
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--color-page-bg, var(--lite-bg));
  color: var(--color-page-text, var(--lite-text));
}

.lite-main-below-header {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

body.home-page.lite-page #map.lite-map {
  position: relative;
  top: auto;
  left: auto;
  right: auto;
  bottom: auto;
  width: 100%;
  height: 100%;
  flex: 1;
  min-height: 180px;
  z-index: 0;
  touch-action: none;
  -ms-touch-action: none;
}


body.home-page.lite-page #map.lite-map.leaflet-container {
  touch-action: none;
  -ms-touch-action: none;
}

body.map-leaflet-popup-open.home-page.lite-page #map.lite-map.leaflet-container,
body.map-leaflet-popup-open.home-page.lite-page #map.lite-map.leaflet-container.leaflet-grab,
body.map-leaflet-popup-open.home-page.lite-page #map.lite-map.leaflet-container.leaflet-grab-leaflet,
body.map-leaflet-popup-open.home-page.lite-page #map.lite-map .leaflet-interactive,
body.map-leaflet-popup-open.home-page.lite-page #map.lite-map path.leaflet-interactive,
body.map-leaflet-popup-open.home-page.lite-page #map.lite-map .leaflet-interactive.poi-circle {
  cursor: default !important;
}

body.home-page.lite-page #map.lite-map .leaflet-control-container {
  z-index: 1200;
}

body.home-page.lite-page .leaflet-control.lite-fab-noop .fab-btn {
  opacity: 0.88;
  cursor: default;
  pointer-events: none;
}

body.home-page.lite-page .leaflet-control.refresh-control.lite-fab-noop {
  display: block;
}

html[data-theme="dark"] body.home-page.lite-page .leaflet-control.lite-fab-noop .fab-btn {
  opacity: 0.92;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.lite-map-area {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.lite-map {
  flex: 1;
  min-height: 180px;
  width: 100%;
  z-index: 0;
}

.lite-bottom-stack {
  flex-shrink: 0;
  background: var(--lite-surface);
  border-top: 1px solid var(--lite-border);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.lite-qr-scan-wrap {
  display: flex;
  justify-content: center;
  padding: 0 max(12px, env(safe-area-inset-left, 0px)) 10px max(12px, env(safe-area-inset-right, 0px));
  background: var(--lite-surface);
}

.lite-qr-scan-btn {
  width: min(420px, 100%);
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(37, 99, 235, 0.35);
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .01em;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25);
}

.lite-bottom-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  
  padding: 10px max(12px, env(safe-area-inset-left, 0px)) 10px max(12px, env(safe-area-inset-right, 0px));
  background: var(--lite-surface);
}

.lite-bottom-bar__fullmap {
  justify-self: start;
  min-width: 0;
  min-height: 44px;
  align-self: center;
}

.lite-bottom-bar__list {
  justify-self: center;
  white-space: nowrap;
}

.lite-bar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 22px;
  border: 1px solid var(--lite-border);
  background: var(--lite-surface);
  color: var(--lite-text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.lite-ref-toggle {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  justify-self: end;
}

.lite-ref-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 22px;
  border: 1px solid var(--lite-border);
  background: var(--lite-surface);
  color: var(--lite-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.lite-ref-btn.active {
  border-color: var(--lite-accent);
  color: var(--lite-accent);
  font-weight: 600;
}

.lite-list-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  
  bottom: var(--lite-bottom-stack-h, 56px);
  z-index: 1390;
  background: rgba(0, 0, 0, 0.35);
}

.lite-list-backdrop[hidden] {
  display: none !important;
}

.lite-list-wrap {
  position: fixed;
  left: 0;
  right: 0;
  
  bottom: var(--lite-bottom-stack-h, 56px);
  z-index: 1400;
  display: flex;
  flex-direction: column;
  max-height: min(52vh, 480px);
  background: var(--lite-surface);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
  transform: translateY(calc(100% + 24px));
  transition: transform 0.22s cubic-bezier(0.32, 0.72, 0, 1);
  pointer-events: none;
  visibility: hidden;
  box-sizing: border-box;
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

.lite-list-wrap.lite-list-wrap--open {
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
}

.lite-search {
  margin: 8px 12px 0;
  padding: 12px 14px;
  border: 1px solid var(--lite-border);
  border-radius: 12px;
  
  font-size: 16px;
  width: calc(100% - 24px);
  max-width: 100%;
  background: var(--lite-bg);
  color: var(--lite-text);
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

.lite-search:focus {
  outline: none;
  border-color: var(--lite-accent);
  box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.28);
}

[data-theme="dark"] .lite-search:focus {
  box-shadow: 0 0 0 3px rgba(100, 181, 246, 0.32);
}

.lite-list-content {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 8px 12px max(12px, env(safe-area-inset-bottom, 0px));
  flex: 1;
  min-height: 0;
}

.lite-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 48px;
  padding: 12px 8px;
  border-bottom: 1px solid var(--lite-border);
  cursor: pointer;
  font-size: 15px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.lite-row:active {
  background: rgba(30, 136, 229, 0.08);
}

[data-theme="dark"] .lite-row:active {
  background: rgba(100, 181, 246, 0.12);
}
.lite-row__label { flex: 1; min-width: 0; word-break: break-word; }
.lite-row__meta {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  flex-shrink: 0;
}
.lite-row__dist { color: var(--lite-muted); font-size: 11px; white-space: nowrap; }
.lite-row .row-travel { min-height: 16px; }
.lite-row .travel-reach { font-size: 12px; font-weight: 650; color: var(--lite-text); }
.leaflet-popup.lite-popup .travel-reach-wrap {
  margin: 0 0 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--lite-border);
}
.leaflet-popup.lite-popup .llegapp-schedule-bar {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--lite-border);
}
.lite-empty { padding: 16px 8px; color: var(--lite-muted); text-align: center; }

.leaflet-popup.lite-popup .leaflet-popup-content-wrapper {
  border-radius: 10px;
  background: var(--lite-surface);
  color: var(--lite-text);
}
.leaflet-popup.lite-popup .leaflet-popup-content {
  margin: 10px 12px;
  min-width: 200px;
  max-width: 280px;
}
.lite-popup__title { font-weight: 600; margin-bottom: 8px; font-size: 15px; }
.lite-popup__body { font-size: 14px; line-height: 1.4; }
.lite-popup__row { margin: 4px 0; padding: 4px 0; border-bottom: 1px solid var(--lite-border); }


.leaflet-popup.lite-popup button.lite-popup__row--bus-route {
  display: block;
  width: 100%;
  margin: 6px 0;
  padding: 8px 10px;
  min-height: 44px;
  box-sizing: border-box;
  border: 1px solid var(--lite-border);
  border-radius: 10px;
  background: var(--lite-surface);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}

.leaflet-popup.lite-popup button.lite-popup__row--bus-route * {
  pointer-events: none;
}

.leaflet-popup.lite-popup button.lite-popup__row--bus-route:hover {
  background: color-mix(in srgb, var(--lite-accent) 9%, var(--lite-surface));
  border-color: color-mix(in srgb, var(--lite-accent) 28%, var(--lite-border));
}

.leaflet-popup.lite-popup button.lite-popup__row--bus-route:focus {
  outline: none;
}

.leaflet-popup.lite-popup button.lite-popup__row--bus-route:focus-visible {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--lite-accent) 32%, transparent);
}


.leaflet-popup.lite-popup button.lite-popup__row--tram-route {
  display: block;
  width: 100%;
  margin: 6px 0;
  padding: 8px 10px;
  min-height: 44px;
  box-sizing: border-box;
  border: 1px solid var(--lite-border);
  border-radius: 10px;
  background: var(--lite-surface);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  touch-action: manipulation;
}

.leaflet-popup.lite-popup button.lite-popup__row--tram-route * {
  pointer-events: none;
}

.leaflet-popup.lite-popup button.lite-popup__row--tram-route:hover {
  background: color-mix(in srgb, var(--lite-accent) 9%, var(--lite-surface));
  border-color: color-mix(in srgb, var(--lite-accent) 28%, var(--lite-border));
}

.leaflet-popup.lite-popup button.lite-popup__row--tram-route:focus {
  outline: none;
}

.leaflet-popup.lite-popup button.lite-popup__row--tram-route:focus-visible {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--lite-accent) 32%, transparent);
}

.lite-popup__line-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  padding: 2px 7px;
  margin-right: 6px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}
.lite-popup__muted { color: var(--lite-muted); font-size: 12px; }
.lite-popup__callout--tram-sched {
  font-size: 12px;
  line-height: 1.4;
  padding: 8px 10px;
  margin-bottom: 8px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--lite-muted) 12%, transparent);
  border: 1px solid var(--lite-border);
  color: var(--lite-text, inherit);
}
.lite-popup__callout--tram-incident {
  font-size: 12px;
  line-height: 1.4;
  padding: 8px 10px;
  margin-bottom: 8px;
  border-radius: 8px;
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
}
html[data-theme="dark"] .lite-popup__callout--tram-incident {
  background: #431407;
  border-color: #9a3412;
  color: #fed7aa;
}
html[data-theme="dark"] .lite-popup__tram-messages summary {
  color: var(--lite-muted);
}
.lite-popup__tram-messages {
  margin-bottom: 8px;
  font-size: 12px;
}
.lite-popup__tram-messages summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--lite-muted);
}
.lite-popup__tram-messages ul {
  margin: 8px 0 0;
  padding-left: 1.1rem;
}
.lite-popup__tram-messages li + li {
  margin-top: 6px;
}
.leaflet-interactive.poi-circle.tram-disabled {
  stroke: #6a6a6a;
  fill: #bdbdbd;
}
.lite-popup__error { color: #c62828; }

.lite-popup__row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.lite-popup__row-left {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.lite-popup__row-bottom {
  margin-top: 4px;
}

.lite-incidents[hidden] { display: none !important; }
.lite-incidents { position: fixed; inset: 0; z-index: 20000; }
.lite-incidents__backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.4); }
.lite-incidents__sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 75vh;
  background: var(--lite-surface);
  border-radius: 16px 16px 0 0;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
}
.lite-incidents__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--lite-border);
}
.lite-incidents__title { margin: 0; font-size: 18px; }
.lite-incidents__close {
  border: none;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  cursor: pointer;
  color: var(--lite-text);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.lite-incidents__close:focus-visible {
  outline: 2px solid var(--lite-accent);
  outline-offset: 2px;
}
.lite-incidents__body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 12px 16px max(24px, env(safe-area-inset-bottom, 0px));
  font-size: 14px;
}
.lite-inc__banner { padding: 8px; border-radius: 8px; margin-bottom: 10px; text-align: center; font-weight: 600; }
.lite-inc__banner--total { background: #ffcdd2; color: #b71c1c; }
.lite-inc__banner--partial { background: #fff9c4; color: #f57f17; }
.lite-inc__card { border: 1px solid var(--lite-border); border-radius: 8px; padding: 10px; margin-bottom: 10px; }
.lite-inc__card header { font-weight: 600; margin-bottom: 6px; }
.lite-inc__ok { color: #2e7d32; padding: 8px; }
.lite-inc__transport-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--lite-border); }

.lite-bar-btn:focus-visible,
.lite-ref-btn:focus-visible {
  outline: 2px solid var(--lite-accent);
  outline-offset: 2px;
}

@media (hover: none) and (pointer: coarse) {
  .lite-bar-btn:active,
  .lite-ref-btn:active,
  .lite-bottom-bar .header-version-cta:active {
    transform: scale(0.98);
  }
}

@media (prefers-reduced-motion: reduce) {
  .lite-list-wrap {
    transition-duration: 0.01ms;
  }
  .lite-bar-btn:active,
  .lite-ref-btn:active,
  .lite-bottom-bar .header-version-cta:active {
    transform: none;
  }
}
