  * { margin: 0; padding: 0; box-sizing: border-box; }

  html, body {
    height: 100%;
    margin: 0;
  }

  body {
    font-family: Helvetica, Arial, sans-serif;
    background: #f4f4f4;
    color: #111;
    display: flex;
    flex-direction: row;
    min-height: 100vh;
  }

  .page-container {
    display: flex;
    flex: 1;
    min-height: 0;
    width: 100%;
  }

  .left-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    max-width: 50%;
  }

  .right-panel {
    width: 50%;
    background: #fff;
    border-left: 1px solid #ddd;
    display: flex;
    flex-direction: column;
  }

  .right-panel-header {
    background: #fff;
    border-bottom: 4px solid rgb(128, 39, 108);
    padding: 26px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
  }

  .panel-logo {
    height: 52px;
    width: auto;
    display: block;
  }

  .right-panel-header .panel-logo:last-child {
    height: 34px;
  }

  .right-panel-body {
    display: flex;
    flex: 1;
    min-height: 0;
  }

  .right-panel-rail {
    width: 148px;
    flex-shrink: 0;
    border-right: 1px solid #e8e8e8;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 8px 0;
  }

  .rail-item {
    padding: 10px 14px;
    cursor: pointer;
    border-left: 3px solid transparent;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
    transition: background 0.12s, border-color 0.12s;
    user-select: none;
  }

  .rail-item:hover {
    background: #f0f0f0;
  }

  .rail-item.active {
    border-left-color: rgb(128, 39, 108);
    background: rgba(128, 39, 108, 0.06);
    color: rgb(128, 39, 108);
  }

  .right-panel-content {
    flex: 1;
    padding: 0;
    overflow-y: auto;
    min-height: 0;
  }

  .content-section {
    padding: 0 24px;
    scroll-margin-top: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
  }

  .content-section + .content-section {
    border-top: none;
  }

  .content-section:first-child {
    padding-top: 0;
  }

  .content-section:first-child .section-heading {
    padding-top: 28px;
  }

  .section-heading {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgb(128, 39, 108);
    margin-bottom: 14px;
    position: sticky;
    top: 0;
    background: #fff;
    padding: 28px 0 14px;
    z-index: 10;
  }

  .content-section p {
    font-size: 16px;
    color: #444;
    line-height: 1.65;
    margin-bottom: 0;
    min-height: 80vh;
    padding-bottom: 20vh;
  }

  .content-section p:last-child {
    padding-bottom: 40vh;
  }

  #map {
    flex: 1;
    min-height: 0;
    width: 100%;
  }

  header {
    position: absolute;
    top: 0; left: 0; right: 0;
    max-width: 100%;
    z-index: 1000;
    padding: 18px 24px 14px;
    display: grid;
    grid-template-columns: max-content max-content;
    grid-template-rows: auto 12px auto;
    gap: 16px;
    pointer-events: none;
  }

  .title-block {
    grid-column: 1;
    grid-row: 1;
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(10px);
    padding: 12px 18px;
    border-left: 4px solid rgb(128, 39, 108);
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .title-block h1 {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #111;
    text-transform: uppercase;
  }

  .title-block p {
    font-size: 11px;
    color: #444;
    margin-top: 2px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .legend {
    grid-column: 2;
    grid-row: 1;
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(10px);
    padding: 12px 18px;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 11px;
    color: #333;
  }
  .legend-item:last-child { margin-bottom: 0; }

  .legend-line {
    width: 28px; height: 3px;
    border-radius: 2px;
    background: rgb(128, 39, 108);
  }

  .legend-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 0 1px rgba(128, 39, 108, 0.75);
    background: rgb(128, 39, 108);
    flex-shrink: 0;
  }

  .destination-container {
    grid-column: 1;
    grid-row: 2 / -1;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    padding: 12px 18px;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .destination-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #333;
    margin-bottom: 8px;
    text-align: center;
  }

  .line-selector {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    display: flex;
    overflow: hidden;
    pointer-events: auto;
    justify-content: center;
  }

  .line-btn {
    padding: 10px 18px;
    font-family: Helvetica, Arial, sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #555;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
  }

  .line-btn.active {
    background: rgb(128, 39, 108);
    color: white;
  }

  .footer-nav {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    pointer-events: auto;
  }

  .back-button {
    display: inline-block;
    padding: 10px 18px;
    font-family: Helvetica, Arial, sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #555;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    text-decoration: none;
    border: 1px solid rgb(128, 39, 108);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
  }

  .back-button:hover {
    background: rgb(128, 39, 108);
    color: white;
  }

  /* Basemap toggle button - Google Maps style */
  .basemap-toggle {
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
    width: 56px;
    height: 56px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    border: 2px solid white;
    background: white;
    pointer-events: auto;
    transition: box-shadow 0.2s;
  }

  .basemap-toggle:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.35);
  }

  .basemap-preview {
    position: absolute;
    width: 100%;
    height: 100%;
  }

  /* Carto (street map) preview - actual tile image centered on eastern MA */
  .carto-preview {
    background-image: url('https://a.basemaps.cartocdn.com/light_all/6/19/23.png');
    background-size: cover;
    background-position: center;
    opacity: 0;
  }

  /* Satellite preview - actual tile image centered on eastern MA (grayscale) */
  .satellite-preview {
    background-image: url('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/6/23/19');
    background-size: cover;
    background-position: center;
    opacity: 0;
    filter: grayscale(60%) brightness(0.9);
  }

  /* Dark preview - actual tile image centered on eastern MA */
  .dark-preview {
    background-image: url('https://a.basemaps.cartocdn.com/dark_all/6/19/23.png');
    background-size: cover;
    background-position: center;
    opacity: 0;
  }

  /* When carto is active, show satellite preview (next option) */
  .basemap-toggle.carto .satellite-preview {
    opacity: 1;
  }
  .basemap-toggle.carto .carto-preview {
    opacity: 0;
  }
  .basemap-toggle.carto .dark-preview {
    opacity: 0;
  }

  /* When satellite is active, show dark preview (next option) */
  .basemap-toggle.satellite .dark-preview {
    opacity: 1;
  }
  .basemap-toggle.satellite .satellite-preview {
    opacity: 0;
  }
  .basemap-toggle.satellite .carto-preview {
    opacity: 0;
  }

  /* When dark is active, show carto preview (next option) */
  .basemap-toggle.dark .carto-preview {
    opacity: 1;
  }
  .basemap-toggle.dark .dark-preview {
    opacity: 0;
  }
  .basemap-toggle.dark .satellite-preview {
    opacity: 0;
  }

  /* Desaturate satellite imagery when satellite mode is active */
  body.basemap-satellite .leaflet-tile-pane {
    filter: saturate(0.85) contrast(0.95);
  }

  .locator-container {
    position: absolute;
    top: 96px;
    left: 24px;
    padding: 12px 18px;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    z-index: 1000;
    width: 240px;
    height: 240px;
    background: rgba(255,255,255,0.98);
  }

  /* Custom tooltip styling */
  .leaflet-tooltip {
    font-family: Helvetica, Arial, sans-serif;
    font-size: 12px;
    font-weight: 700;
    background: rgba(255,255,255,0.98);
    border: none;
    border-left: 3px solid rgb(128, 39, 108);
    border-radius: 0;
    padding: 5px 9px;
    color: #111;
    letter-spacing: 0.01em;
    box-shadow: 0 2px 14px rgba(0,0,0,0.14);
    white-space: nowrap;
  }
  .leaflet-tooltip-top:before { border-top-color: transparent; }
  .leaflet-tooltip::before { display: none; }

  /* Move zoom controls to bottom left within zoom area */
  .leaflet-control-zoom {
    top: auto !important;
    bottom: 20px !important;
    left: 20px !important;
  }

  /* Custom station markers with labels */
  .custom-station-icon {
    pointer-events: none;
  }

  .leaflet-top.leaflet-left {
  top: auto !important;
  bottom: 12px !important;
  }
  
.station-marker {
  position: relative;
  display: inline-block;
  overflow: visible;
  padding: 0;
  margin: 0;
}

.station-circle {
  position: absolute;
  border-radius: 50%;
  background: rgb(128, 39, 108);
  border: 2px solid white;
  box-shadow: 0 0 0 1px rgba(128, 39, 108, 0.75);
  z-index: 1;
}

.station-label {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 10px;
  font-weight: 700;
  color: #111;
  text-align: left;
  white-space: nowrap;
  margin: 0;
  background: rgba(255, 255, 255, 0.96);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  z-index: 2;
}

.station-circle.shaded {
  background: #b0b0b0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
}

.station-label.shaded {
  color: #999;
  border-color: rgba(0, 0, 0, 0.04);
}

.other-cr-label {
  font-family: Helvetica, Arial, sans-serif;
  font-size: 9px;
  font-weight: 600;
  color: #777;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.88);
  padding: 1px 4px;
  border-radius: 2px;
  display: block;
  pointer-events: none;
}

.locator-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#locator-map {
  width: 100%;
  height: 80px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.1);
  aspect-ratio: 1;
}

/* Scale bar styling */
.leaflet-control-scale {
  background: rgba(255, 255, 255, 0.98) !important;
  backdrop-filter: blur(10px) !important;
  padding: 4px 8px !important;
  border-radius: 4px !important;
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  font-family: Helvetica, Arial, sans-serif !important;
  font-size: 10px !important;
  font-weight: 600 !important;
  color: #333 !important;
  margin: 20px !important;
  z-index: 1000 !important;
  display: block !important;
  visibility: visible !important;
}

/* Station popup styling */
.station-popup .leaflet-popup-content-wrapper {
  border-radius: 4px;
  padding: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  min-width: 60px;
}

.station-popup .leaflet-popup-content {
  margin: 0;
  padding: 4px 24px 4px 8px;
  font-family: Helvetica, Arial, sans-serif;
  font-size: 10px;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
}

.station-popup .leaflet-popup-tip {
  background: white;
}

.station-popup .leaflet-popup-close-button {
  padding: 4px 8px;
  font-size: 16px;
  color: #666;
  line-height: 1;
}