:root {
  --bg: #0b0e14;
  --panel: rgba(15, 19, 27, 0.94);
  --card: rgba(24, 30, 42, 0.85);
  --border: rgba(255, 255, 255, 0.11);
  --text: #eef2f8;
  --muted: #93a0b8;
  --blue: #0a84ff;
  --cyan: #38bdf8;
  --green: #34d399;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body,
#map {
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  overflow: hidden;
}

.leaflet-container {
  background: #0d1016;
  font-family: inherit;
}

/* NeoTSC blue railway track look over dark basemap */
.rail-overlay-blue {
  filter: hue-rotate(192deg) saturate(1.45) brightness(1.05) contrast(1.08);
  opacity: 0.72;
}

.hud-top-left,
.hud-top-right {
  position: fixed;
  top: 14px;
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 10px;
}

.hud-top-left {
  left: 14px;
  flex-wrap: wrap;
}

.hud-top-right {
  right: 14px;
}

.brand-pill,
.live-pill,
.layer-bar,
.mode-switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 7px 12px;
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.42);
  text-decoration: none;
  color: inherit;
}

.brand-pill img {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}

.brand-name {
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.06em;
  background: linear-gradient(90deg, #38bdf8, #0a84ff);
  -webkit-background-clip: text;
  color: transparent;
}

.brand-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: -1px;
}

.layer-bar,
.mode-switch {
  padding: 4px;
  gap: 3px;
}

.layer-bar button,
.mode-switch button {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.layer-bar button:hover,
.mode-switch button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.layer-bar button.on,
.mode-switch button.on {
  background: var(--blue);
  color: #fff;
}

.rail-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 8px 0 6px;
  border-left: 1px solid var(--border);
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.rail-check input {
  accent-color: var(--cyan);
}

.live-pill {
  padding: 8px 14px;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 600;
}

.pulse-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--blue);
}

.pulse-dot.real {
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
}

.live-count {
  color: var(--cyan);
}

.sep {
  color: var(--border);
}

.clock {
  color: var(--text);
}

/* Right-side ElevateX-style drawer */
.inspector {
  position: fixed;
  top: 66px;
  right: 14px;
  bottom: 14px;
  width: min(370px, calc(100vw - 28px));
  z-index: 910;
  background: var(--panel);
  border: 1px solid rgba(56, 189, 248, 0.24);
  border-radius: 16px;
  backdrop-filter: blur(16px);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.58);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.inspector.hidden {
  transform: translateX(400px);
  opacity: 0;
  pointer-events: none;
}

.insp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px 10px;
}

.insp-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.service-badge {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #fff;
}

.demo-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 99px;
  background: rgba(10, 132, 255, 0.2);
  color: var(--cyan);
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.close-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.photo-box {
  position: relative;
  height: 172px;
  background: linear-gradient(135deg, #10192b, #0c121e);
  flex: none;
  overflow: hidden;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.photo-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.photo-box.loaded img {
  display: block;
}

.photo-box.loaded .photo-fallback {
  display: none;
}

.photo-fallback {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--cyan);
  font-size: 12px;
  opacity: 0.85;
}

.photo-overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: 18px 12px 6px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.78));
  font-size: 11px;
  color: #dbe4f2;
  display: flex;
  justify-content: space-between;
}

.route-progress-card {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 132, 255, 0.05);
}

.endpoints {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}

.ep.right {
  text-align: right;
}

.ep .code {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--cyan);
  line-height: 1.1;
}

.ep .name {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.arrow-mid {
  color: var(--muted);
  font-size: 16px;
}

.pbar-wrap {
  position: relative;
  height: 5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.12);
  margin: 12px 0 8px;
}

.pbar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
}

.pbar-dot {
  position: absolute;
  top: 50%;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid var(--blue);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 8px var(--blue);
}

.pbar-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.specs-grid {
  padding: 12px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.spec-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.spec.right {
  text-align: right;
}

.spec label,
.spec-full label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 2px;
}

.spec b,
.spec-full b {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--text);
}

.spec-full {
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.hl-blue {
  color: var(--cyan) !important;
}

.hl-green {
  color: var(--green) !important;
}

.train-pin {
  background: none;
  border: 0;
}

.train-marker-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translate(-50%, -50%);
}

.train-chevron {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 2px 6px rgba(10, 132, 255, 0.75));
  transition: transform 0.3s linear;
}

.train-label {
  margin-top: 1px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(11, 14, 20, 0.88);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
  white-space: nowrap;
}

.train-marker-wrap.selected .train-label {
  background: #0a84ff;
  color: #fff;
  border-color: #fff;
}

.empty-live {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 900;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--muted);
  backdrop-filter: blur(10px);
}

.hidden {
  display: none !important;
}
