html, body {
      height: 100%;
      margin: 0;
      font-family: 'Segoe UI', Arial, sans-serif;
      background: #f5f7fa;
    }

    #map {
      width: 100vw;
      height: 100vh;
    }

    #controls {
      position: absolute;
      top: 24px;
      left: 56px;
      z-index: 1000;
      background: rgba(255,255,255,0.97);
      padding: 18px 22px 14px 22px;
      border-radius: 12px;
      box-shadow: 0 4px 24px rgba(0,0,0,0.13);
      display: flex;
      flex-direction: column;
      gap: 10px;
      max-width: 400px;  
    }

    #controls label,
    .main-menu-filters label {
      display: flex;
      flex-direction: column;
      align-items: flex-start;   
      gap: 2px;
      font-size: 1rem;
      margin-bottom: 2px;
      text-align: left;
    }

    #controls select {
      border-radius: 6px;
      border: 1px solid #b0b0b0;
      padding: 4px 8px;
      font-size: 1rem;
      background: #f9f9f9;
      transition: border 0.2s;
    }
    #controls select:focus {
      border: 1.5px solid #0078d7;
      outline: none;
    }

    button {
      background: linear-gradient(90deg, #0078d7 60%, #00b4d8 100%);
      color: #fff;
      border: none;
      border-radius: 6px;
      padding: 7px 16px;
      font-size: 1rem;
      font-weight: 500;
      cursor: pointer;
      margin-right: 6px;
      box-shadow: 0 2px 8px rgba(0,120,215,0.07);
      transition: background 0.2s, transform 0.1s;
    }
    button:hover {
      background: linear-gradient(90deg, #005fa3 60%, #0096c7 100%);
      transform: translateY(-2px) scale(1.03);
    }

    #transitScoreValue {
      font-size: 2.4em;
      font-weight: bold;
      color: #185a9d;
      align-items: center;
      margin: 24px 0 12px 0;
      transition: color 0.3s;
    } 

    #timeDisplay {
      font-size: 1.15rem;
      color: #0078d7;
      letter-spacing: 1px;
      margin-left: 10px;
      font-weight: bold;
    }

    .row-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 2px;
    margin-bottom: 2px;
    }

    .row-buttons {
    display: flex;
    gap: 10px;
    margin-top: 4px;
    margin-bottom: 4px;
    }

    .tooltip {
    position: relative;
    overflow:visible;
    cursor: pointer;
    }

    .tooltiptext {
    visibility: hidden;
    width: 300px;
    background-color: #222;
    color: #fff;
    text-align: left;
    border-radius: 6px;
    padding: 7px 10px;
    position: absolute;
    z-index: 2000;
    bottom: 10%; 
    left: 150%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 0.95rem;
    pointer-events: none;          
    white-space: normal;
    }

    .tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
    }

.main-menu-panel {
  position: absolute;
  top: 24px;
  left: 24px;
  width: 340px;
  max-width: 95vw;
  background: rgba(255,255,255,0.96);
  border-radius: 14px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.13);
  padding: 18px 18px 14px 18px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.main-menu-title {
  font-family: 'Fredoka One', 'Segoe UI', Arial, sans-serif;
  font-size: 1.5rem;
  font-weight: bold;
  margin-left: 60px;
  margin-bottom: 2px;
  color: #0078d7;
  letter-spacing: 0.5px;
}

.main-menu-upload {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gtfs-source-row {
  display: flex;
  align-items: baseline;
  gap: 6px;  
}

#uploadGtfsBtn {
  background: linear-gradient(90deg, #24b0ec 0%, #185a9d 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}
#uploadGtfsBtn:hover {
  background: linear-gradient(90deg, #24b0ec 0%, #3485e2 100%);
}


#progressBarContainer {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5000;
  width: 400px;
  height: 28px;
  background: #f8fafc;
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
  display: flex;
  align-items: center;
  padding: 4px;
}

#progressBar {
  height: 100%;
  width: 0%;
  background: #0078d7;
  border-radius: 6px;
  transition: width 0.3s;
}

#progressBarText {
  position: absolute;
  width: 100%;
  text-align: center;
  left: 0;
  top: 0;
  line-height: 28px;
  font-weight: bold;
  color: #000000;
  font-size: 1.1em;
  pointer-events: none;
}
#uiBlockOverlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,0.5);
  z-index: 4000;
  cursor: wait;
}

.main-menu-filters {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.main-menu-filters label {
  font-size: 0.98rem;
  color: #222;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.main-menu-filters select {
  border-radius: 6px;
  border: 1px solid #cfd8dc;
  padding: 6px 8px;
  font-size: 1rem;
  background: #f8fafc;
  transition: border 0.2s;
  align-items: flex-start;
}
.main-menu-filters select:focus {
  border: 1.5px solid #0078d7;
  outline: none;
}

#routeStatsTableWrapper,
#compareServiceDatesTableWrapper {  
  flex: 1 1 auto;
  min-height: 0;
  width: calc(100% - 24px);
  overflow-y: auto;
  overflow-x: auto;
  border-radius: 8px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.07);
  background: #f8fafc;
  margin-top: 10px;
  margin-right: 300px;
}

#timeDistanceChartWrapper {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.07);
  background: #fff;
  margin-top: 10px;
}

.time-distance-controls {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.time-distance-controls label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: #1c3557;
  font-weight: 600;
}

.time-distance-controls select {
  min-height: 36px;
  border: 1.5px solid #c8d7ea;
  border-radius: 8px;
  padding: 6px 10px;
  background: #fff;
  color: #18324e;
}

.time-distance-summary {
  margin-top: 10px;
  color: #36506b;
  font-size: 0.92rem;
}

.time-distance-empty-state {
  margin-top: 10px;
  padding: 18px;
  border: 1px dashed #b9cce2;
  border-radius: 8px;
  background: #f8fbff;
  color: #58718d;
}

#timeDistanceTab.active {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#timeDistancePlot {
  min-height: 420px !important;
}

#routeStatsTable table, #compareServiceDatesTable table {
  width: 100%;  
  border-collapse: collapse;
  font-size: 0.78rem;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 6px rgba(0,0,0,0.07);
}


#routeStatsTable table {
  min-width: 700px;
}



#routeStatsTable th, #routeStatsTable td, #compareServiceDatesTable th, #compareServiceDatesTable td {
  padding: 8px 12px;
  text-wrap: balance;
  text-align: center;
  border-bottom: 1px solid #e3e8ee;
  border-right: 1px solid #e3e8ee;   
  min-width: 70px;
}

#routeStatsTable th, #compareServiceDatesTable th {
  background: #0078d7;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 2;
}

#routeStatsTable tr:nth-child(even), #compareServiceDatesTable tr:nth-child(even) {
  background: #f5f7fa;
}

#routeStatsTable tr:hover, #compareServiceDatesTable tr:hover {
  background: #e3f2fd;
}

#GenerateStat {
  margin-bottom: 10px;
  margin-top: 0;
  max-width: 320px;
  font-size: 1rem;
  border-radius: 8px;
}

:root{  
  --ribbon-height: 56px;
  --ribbon-gap: 8px; 
}



#map {
  width: 100vw;
  height: calc(100vh - (var(--ribbon-height) + env(safe-area-inset-bottom)));
}

.ribbon-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 12px;
  position: relative;
}

.ribbon-icon {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 4px 18px rgba(0,120,215,0.18);
  font-size: 2.3rem;
  color: #0078d7;
  border: 3px solid #0078d7;       
  cursor: pointer;
  margin-bottom: 0px; 
  z-index: 2;
  position: relative;
  transition: box-shadow 0.2s, transform 0.1s;
}

.ribbon-icon.active,
.ribbon-icon:focus {
  box-shadow: 0 5px 20px rgba(39, 134, 212, 0.28);
  background: #e3f2fd;
  color: #2196ea;
}

.ribbon-label {
  font-size: 0.95em;
  color: #fff;
  margin-top: 2px;
  margin-bottom: 5px; 
  text-align: center;
  z-index: 1;
  pointer-events: none;
  font-family: 'Segoe UI', Arial, sans-serif;
  text-shadow: 0 1px 4px rgba(0,0,0,0.18);
  white-space: nowrap; 
}

#ribbonPanel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--ribbon-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 12px;
  background: rgba(30,34,44,0.97);
  box-shadow: 0 -2px 12px rgba(0,0,0,0.18);
  z-index: 99999;
  pointer-events: auto;
  padding-left: 24px;  
  padding-right: 24px; 
}

@media (hover: hover) and (pointer: fine) {
  .ribbon-icon:hover {
    opacity: 1;
    background: #0078d7;
    color: #fff;
    box-shadow: 0 4px 18px rgba(0,120,215,0.25);
    transform: scale(1.25) translateY(-8px);
    font-size: 2.7rem;
    z-index: 10;
  }
}

.floating-canvas {
  position: fixed;
  z-index: 1500;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#animationCanvas.floating-canvas {
  left: 56px;
  bottom: 80px; 
  width: 360px;
  max-width: 96vw;
  max-height: 38vh;
}

#animationCanvas .row-controls label,
#animationCanvas .row-controls select,
#animationCanvas .row-controls span {
  font-size: 1.2rem;
  margin-bottom: 8px;
}


/* Graphs: top right */
#graphsCanvas.floating-canvas {
  right: 24px;
  top: 24px;
  width: 540px;
  max-width: 96vw;
  max-height: 90vh;
}

/* Stats: below graphs, top right */
#statsCanvas.floating-canvas {
  right: 24px;
  top: 340px; 
  width: 540px;
  max-width: 96vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;  
  height: 40vh; 
}

#statsCanvas .canvas-content {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.canvas-header {
  background: #0078d7;
  color: #fff;
  padding: 0px 10px;
  font-size: 1.1rem;
  font-weight: bold;
  display: flex;  
  align-items: center; 
  flex: 0 0 auto; 
}

.canvas-header .tab-btn {
  background: #bad9ff;
  border: 1.5px solid #b0b8c7;
  border-bottom: none;
  color: #0078d7;
  font-size: 1rem;
  margin-right: 8px;
  padding: 7px 18px 6px 18px;
  border-radius: 8px 8px 0 0;
  opacity: 0.85;
  cursor: pointer;
  transition: 
    background 0.18s, 
    opacity 0.18s, 
    color 0.18s, 
    box-shadow 0.18s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
  position: relative;
  top: 2px;
}

.canvas-header .tab-btn:hover {
  background: #f5f7fa;
  color: #005fa3;
  opacity: 1;
  box-shadow: 0 4px 12px rgba(0,120,215,0.10);
}

.canvas-header .tab-btn.active {
  background: #fff;
  color: #0078d7;
  border-bottom: 2.5px solid #fff;
  opacity: 1;
  font-weight: bold;
  z-index: 2;
  box-shadow: 0 6px 18px rgba(0,120,215,0.08);
}

.canvas-content {
  flex: 1;
  background: #f8fafc;
  padding: 18px 10px 10px 10px;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.canvas-content canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Roster tab specific styling */
#rosterTab {
  height: 100%;  
  overflow-y: auto;
  overflow-x: hidden;
}

#rosterPlot {
  min-height: 500px !important;
  /* allow drag gestures to reach chartjs-plugin-zoom (pan) */
  touch-action: none;
}

#helpCanvas.floating-canvas {
  position: fixed;
  right: 32px;
  bottom: 80px; 
  width: 600px;
  height: 60vh;
  max-width: 96vw;
  max-height: 60vh;
  flex-direction: column;
}

#helpCanvas .canvas-content {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  padding: 18px 10px 10px 10px;
  background: #f8fafc;
  display: block;
  flex-direction: column;  
  height: auto;
}
#helpCanvas ul {
  margin-left: 0.1em;
  margin-bottom: 1em;
}
#helpCanvas h3, #helpCanvas h4 {
  margin-top: 0.5em;
  margin-bottom: 0em;
  color: #0078d7;
}

.resizable-canvas {  
  resize: both;
  overflow: auto;
  min-width: 300px;
  min-height: 200px;
  max-width: 100vw;  
  border: 1px solid #aaa;
  background: #fff;
}

.resizer {
  position: absolute;
  right: 0; bottom: 0;
  width: 18px;
  height: 18px;
  cursor: se-resize;

  background: 
    radial-gradient(circle, rgba(0,120,215,0.9) 22%, transparent 24%) 2px 2px/6px 6px;
  border-radius: 0 0 6px 0;
  opacity: 0.85;

  box-shadow: inset 0 0 3px rgba(0,0,0,0.15);
  z-index: 1000;
}

.resizer:hover {
  opacity: 1;
  background:
    radial-gradient(circle, rgba(0,120,215,1) 22%, transparent 24%) 2px 2px/6px 6px,
    radial-gradient(circle, rgba(0,120,215,0.85) 22%, transparent 24%) 6px 6px/6px 6px;
}

#transitScoreCanvas.floating-canvas {
  right: 32px;
  bottom: 80px;
  width: 380px;
  max-width: 96vw;
  max-height: 38vh;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.12);
  border: 1px solid #ddd;
}

.close-canvas-btn {
  margin-left: auto !important;
  background: none !important;
  border: none !important;
  color: #fff !important;
  font-size: 1.3em !important;
  cursor: pointer !important;
  opacity: 0.7 !important;
  transition: opacity 0.2s !important;
}
.close-canvas-btn:hover {
  opacity: 1 !important;
  color: #ff5252 !important;
}


.main-menu-title-row {  
  display: flex;
  align-items: center;
  position: relative;
}

#mainLogo {
  position: absolute;
  top: 0px;  
  width: 80px;  
  margin-left: -22px; 
  margin-top: -45px;
  z-index: 1100;
  pointer-events: none;
}

#controls label.inline-checkbox,
.main-menu-filters label.inline-checkbox {
  display: inline-flex;     
  flex-direction: row;      
  align-items: center;      
  margin-bottom: -10px;    
  gap: 6px;
  white-space: nowrap;     
}

#controls .inline-checkbox input,
.main-menu-filters .inline-checkbox input {
  display: inline-block;
  margin: 0;
  vertical-align: middle;
}

#transitScorePopup {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  min-width: 220px;
  max-width: 200vw;
  background: #185a9d;
  color: #fff;
  padding: 14px 28px;
  border-radius: 8px;
  font-size: 1.15em;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  opacity: 0;
  transition: opacity 0.4s;
  z-index: 9999;
  pointer-events: none;
}
#transitScorePopup.show {
  opacity: 1;
}

.filter-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;  
  flex-wrap: wrap; 
}

.filter-label {
  flex: 0 0 auto;
  min-width: 26%;
  max-width: 40%;
  white-space: nowrap;
  text-overflow: ellipsis;
  margin: 0;
  padding-right: 6px;
  font-size: 1rem;
  order: 0; 
}

.select-all-btn {
  flex: 0 0 auto;
  margin-left: 6px;
  padding: 8px 10px;
  font-size: 0.95rem;
  white-space: nowrap;  
  display: inline-flex;
  align-items: center;
  justify-content: center;
  order: 1; 
}
.select-all-btn:hover {
  background: #005fa3;
}

.filter-select {
  flex: 0 0 100%;     
  width: 100%;
  box-sizing: border-box;  
  padding: 8px 10px;
  border-radius: 8px;
  order: 2;           
  height: auto;       
  max-height: 40vh; 
  overflow-y: auto;
}

#shapeInfoCanvas.floating-canvas {
  right: 32px;
  top: 80px;
  min-width: 220px;
  max-width: 90vw;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.12);
  border: 1px solid #ddd;
  display: flex;
  flex-direction: column;
}

.route-shape-list-header {
  font-size: 0.9em;
  color: #444;  
}

.route-shape-list {
  font-size: 0.7em;
  margin: 0;
  padding-left: 18px;
}

#updateMapBtn {
  width: 60%;  
}

/* added: resize helper visuals (arrow + label) */
.resize-helper {
  position: absolute;
  right: 12px;
  bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 5000;
  pointer-events: none; /* don't block interactions */
  animation: resize-helper-pulse 1s ease-in-out infinite;
  transform-origin: center;
}

.resize-helper .resize-arrow {
  width: 18px;
  height: 18px;
  background: #ffcf4d;
  transform: rotate(45deg);
  box-shadow: 0 4px 10px rgba(0,0,0,0.18);
  border-radius: 3px;
  display: inline-block;
  margin-left: 2px;
}

.resize-helper .resize-label {
  background: #ffcf4d;
  color: #2b2b2b;
  padding: 6px 10px;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.15);
  white-space: nowrap;
}

/* subtle pulsing fade to draw attention */
@keyframes resize-helper-pulse {
  0%   { opacity: 1; transform: scale(1); }
  50%  { opacity: 0.35; transform: scale(0.95); }
  100% { opacity: 1; transform: scale(1); }
}

/* utility class to force-hide quickly if needed */
.resize-helper.hide { display: none !important; }
















/* ============== Mobile  ============== */
@media (max-width: 900px) and (orientation: portrait){
  .canvas-header {    
    font-size: 0.9rem;             
    margin-top: -5px;
    margin-bottom: -5px;
  }


  .canvas-header .tab-btn {
    white-space: nowrap;
    font-size: clamp(0.8rem, 2.5vw, 1rem);
  }


  .ribbon-icon {
    font-size: 1.55em;
    min-height: unset;
    padding: 4px 4px;
    border-radius: 10px;    
  }

  #mainLogo {
    width: 64px;
    height: 64px;
    object-fit: contain;
    margin-right: -18px;
    margin-left: -32px;
    z-index: 1201;
    position: absolute !important;
    margin-left: -10px;
  }

  .main-menu-title {
    position: relative;
    font-size: 1.1rem;
    margin-left: 50px;
  }

  #controls select,
  #controls input[type="text"],
  #controls input[type="file"],
  .main-menu-filters select {
    width: 100%;
    box-sizing: border-box;
    font-size: 1rem;
  }

    
  #controls {
    position: fixed;
    left: 0;
    right: 0;
    top: auto;         
    bottom: calc(var(--ribbon-height) + env(safe-area-inset-bottom));
    z-index: 2200 !important;
    margin: 0;
    border-radius: 16px 16px 0 0;
    padding: 12px;
    padding-bottom: calc(var(--ribbon-height) + env(safe-area-inset-bottom) - 10px) !important;
    max-height: 50vh; 
    max-width: 600px;
    overflow-y: visible;
    background: linear-gradient(#ffffff, #f6f9fb);
    box-shadow: 0 -8px 30px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    transform: translateZ(0);
  }



  .resizable-canvas {
    resize: none !important;
    min-width: unset;
    width: 96vw !important;
  }

  .resizer { display: none !important; }

  #animationCanvas.floating-canvas,
  #transitScoreCanvas.floating-canvas {
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    min-width: 0 !important;
    max-width: 100vw !important;
    bottom: calc(var(--ribbon-height) + env(safe-area-inset-bottom)) !important;
    top: auto !important;      
    max-height: 40vh !important;
    border-radius: 16px 16px 0 0;
    margin: 0;
    padding: 0;
    box-shadow: 0 -8px 30px rgba(0,0,0,0.18);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateZ(0);
  }



  #animationCanvas.floating-canvas {
    z-index: 2450;
    height: auto !important;     
  }

 #animationCanvas .canvas-content {
    flex-direction: row !important;
    align-items: center !important;    
    justify-content:center !important;    
    gap: 12px !important;     
    padding-top: 10px !important; 
    padding-bottom: 25px !important; 
  }

  #animationCanvas .row-controls label,
  #animationCanvas .row-controls select,
  #animationCanvas .row-controls span {    
    align-items: center !important;
    vertical-align: middle !important;
    margin-bottom: 0 !important;
    font-size: 1.0rem;    
  }

  #animationCanvas .row-buttons button {
    font-size: 1.9rem !important;
    padding-bottom: 2px;
    white-space: nowrap;
    background: none !important;
    box-shadow: none !important;
    border: none !important;
  }
  #animationCanvas .row-buttons .btn-label {
    font-size: 0.7em !important;  
    display: none !important;
    padding-bottom: 2px;
    white-space: nowrap;
  }

  #transitScoreCanvas.floating-canvas {
    z-index: 2400;
    height: 40vh !important; 
  }

  #transitScoreCanvas .canvas-content {
    padding-top: 0px !important;
    padding-bottom: 0px !important;
  }

  #transitScoreValue {
    font-size: 2em !important; 
    font-weight: bold;    
    color: #185a9d;
    align-items: center;
    margin: 6px 0 6px 0 !important;
    transition: color 0.3s;
  } 

  #transitScoreSub{
    font-size: 0.9rem !important; 
    margin-top: -6px;
    margin-bottom: 12px;
    padding-bottom: 12px;
  }

  #helpCanvas.floating-canvas{
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    min-width: 0 !important;
    max-width: 100vw !important;
    top: 0 !important;
    bottom: auto !important;
    height: 50vh !important;
    max-height: 50vh !important;
    border-radius: 0 0 16px 16px;
    z-index: 2400;
    margin: 0;
    padding: 0;
    box-shadow: 0 8px 30px rgba(0,0,0,0.18);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: #0000001a 2px solid !important;
  }

  #helpCanvas .canvas-content {
    background: #ddf4d8 !important;   
  }

  #helpCanvas .canvas-content,
  #helpCanvas .canvas-content h3,
  #helpCanvas .canvas-content h4,
  #helpCanvas .canvas-content ul,
  #helpCanvas .canvas-content li {
    font-size: 0.85rem !important;
  }
  #helpCanvas .canvas-content ul,
  #helpCanvas .canvas-content ul li {
    padding-left: 0 !important;
    margin-left: 10px !important;     
  }


  #graphsCanvas.floating-canvas,  #statsCanvas.floating-canvas {
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    min-width: 0 !important;
    max-width: 100vw !important;
    min-height: 35vh !important;
    bottom: calc(var(--ribbon-height) + env(safe-area-inset-bottom)) !important;
    padding-bottom: calc(var(--ribbon-height) + env(safe-area-inset-bottom) - 10px) !important;
    top: auto !important;    
    height:auto !important;
    max-height: 50vh !important;
    border-radius: 16px 16px 0 0;
    z-index: 2400;
    margin: 0;
    padding: 0;
    box-shadow: 0 -8px 30px rgba(0,0,0,0.18);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-end; 
    transform: translateZ(0);  
  }


  .close-canvas-btn {
    padding: 10px;
    margin-right: 8px;
  }

  #ribbonPanel {
    max-height: 55px;
    gap: 4px !important;
  }

  .ribbon-label {
    font-size: 0.70em; 
  }


 .filter-row {
    flex-wrap: nowrap;  
    align-items: center;
    gap: 8px;
  }

  .filter-label {
    flex: 0 0 auto;
    min-width: 26%;       
    max-width: 40%;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    order: 0;             
    font-size: 0.95rem;
  }

  .filter-select {
    order: 1;             
    flex: 1 1 auto;        
    width: auto !important; 
    min-width: 0;         
    margin-top: 0;        
    padding: 8px 10px;    
    max-height: 44px;
    overflow-y: auto;     
    max-width: fit-content;
  }

  .select-all-btn {
    order: 2;              
    flex: 0 0 auto;    
    flex-wrap: nowrap;    
    margin-left: 6px;    
  }

  #tripsPerHourAnnotation {
    font-size: 0.7rem !important;
  }


  #map { height: calc(100vh - (var(--ribbon-height) + env(safe-area-inset-bottom))); }
}




































/* ============== Mobile Landscape ============== */
@media (max-width: 900px) and (orientation: landscape) {
  .canvas-header {    
    font-size: 0.8rem;             
    margin-top: -5px;
    margin-bottom: -5px;
  }

  .canvas-header .tab-btn {
    white-space: nowrap;
    font-size: clamp(0.8rem, 2.5vw, 1rem);
  }

  /* larger tap targets for all buttons */
  .ribbon-icon {
    font-size:  0.85rem!important;
    padding: 4px 4px;
    border-radius: 10px;    
  }

  #mainLogo {
    width: 64px;
    height: 64px;
    object-fit: contain;
    margin-right: -18px; 
    margin-left: -32px;  
    z-index: 1201;
    position: absolute !important;
    margin-left: -10px;
  }

  /* small header style inside left-sheet (was bottom-sheet in portrait) */
  .main-menu-title {
    position: relative;
    font-size: 1.1rem;
    margin-left: 50px;
  }

  
  #controls select,
  #controls input[type="text"],
  #controls input[type="file"],
  .main-menu-filters select {
    width: 100%;
    box-sizing: border-box;
    font-size: 1rem;
  }

  #controls {
    position: fixed;
    left: 0;                /* keep controls accessible on left (like a left-sheet) */
    top: 0;
    width: auto;
    max-width: 350px;
    z-index: 2200 !important;
    margin: 0;
    border-radius: 0 16px 16px 0; 
    padding: 12px;
    max-height: 100vh; 
    overflow-y: auto;
    background: linear-gradient(#ffffff, #f6f9fb);
    box-shadow: 8px 0 30px rgba(0,0,0,0.18); 
    display: flex;
    flex-direction: column;
    justify-content: flex-end; 
    transform: translateZ(0);
  }

  /* disable resizable behaviour on small screens */
  .resizable-canvas {
    resize: none !important;
    min-width: unset;
    width: 48vw !important; /* changed: occupy left ~half in landscape */
  }

  #updateButtonRow{
    margin-bottom: 60px;        
  }

  /* Hide the resizer grip on mobile */
  .resizer { display: none !important; }

  /* Animation and Transit Score canvases: occupy left half-ish in landscape */
  #animationCanvas.floating-canvas,
  #transitScoreCanvas.floating-canvas {
    /* changed from full-width bottom to left-column */
    left: 0 !important;    
    bottom: 0 !important;
    width: 48vw !important;          /* occupy left ~half */
    min-width: 0 !important;
    max-width: 400px !important;
    min-height: 80vh !important; /* ensure minimum height */
    border-radius: 0 16px 16px 0;   
    margin: 0;
    padding: 0;
    box-shadow: 8px 0 30px rgba(0,0,0,0.18); /* shadow to the right */
    display: flex;
    flex-direction: column;
    transform: translateZ(0);
    margin-bottom: 35px;
  }

  #animationCanvas.floating-canvas {
    z-index: 2450;
  }

  /* adjust internal layout to vertical stack in a narrow left column */
  #animationCanvas .canvas-content {
    flex-direction: column !important;     /* changed: column to suit tall left column */
    align-items: stretch !important;    
    justify-content: flex-start !important;    
    gap: 10px !important;     
    padding-top: 6px !important;
    padding-bottom: 2px !important;    
  }

  #animationCanvas .row-controls label,
  #animationCanvas .row-controls select,
  #animationCanvas .row-controls span {    
    align-items: center !important;
    vertical-align: middle !important;
    font-size: 1.0rem;        
  }

  #animationCanvas .row-controls {
    margin-top: 10px !important;
    margin-bottom: 0 !important;
    gap: 6px !important; /* reduce gap between controls */
  }


  #animationCanvas .row-buttons .btn-label {
    font-size: 0.9em !important;
  }

  #transitScoreCanvas.floating-canvas {
    z-index: 2400;
    height: 100vh !important; /* changed to full height to match left column */
  }

  #transitScoreCanvas .canvas-content {
    padding-top: 8px !important;
    padding-bottom: 8px !important;
  }

  #transitScoreValue {
    font-size: 2em !important;
    font-weight: bold;    
    color: #185a9d;
    align-items: center;
    margin: 6px 0 6px 0 !important;
    transition: color 0.3s;
  } 

  #transitScoreSub{
    font-size: 0.9rem !important;
    margin-top: -6px;
    margin-bottom: 12px;
    padding-bottom: 12px;
  }

  /* Help canvas moves to left column and becomes tall instead of bottom sheet */
  #helpCanvas.floating-canvas{
    left: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    width: 48vw !important;           /* changed: left-half */
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 16px 16px 0;
    z-index: 2400;
    margin: 0;
    padding: 0;
    box-shadow: 8px 0 30px rgba(0,0,0,0.18);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: #0000001a 2px solid !important;
  }

  #helpCanvas .canvas-content {
    background: #ddf4d8 !important;    
  }

  #helpCanvas .canvas-content,
  #helpCanvas .canvas-content h3,
  #helpCanvas .canvas-content h4,
  #helpCanvas .canvas-content ul,
  #helpCanvas .canvas-content li {
    font-size: 0.85rem !important;
  }
  #helpCanvas .canvas-content ul,
  #helpCanvas .canvas-content ul li {
    padding-left: 0 !important;
    margin-left: 10px !important;     
  }

  /* Graphs and stats move to left column too */
  #graphsCanvas.floating-canvas,  #statsCanvas.floating-canvas {
    left: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    width: 48vw !important;        /* changed: left half */
    min-width: 0 !important;
    max-width: 48vw !important;
    min-height: 100vh !important;
    height: 100vh !important;
    padding-bottom: 0 !important;
    border-radius: 0 16px 16px 0;
    z-index: 2400;
    margin: 0;
    padding: 0;
    box-shadow: 8px 0 30px rgba(0,0,0,0.18);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    transform: translateZ(0);  
  }

  #graphsCanvas .canvas-header .tab-btn[data-tab] {
    font-size: 0.75rem !important;
    padding: 6px 12px !important;
  }

  #statsCanvas .canvas-header .tab-btn[data-tab] {
    font-size: 0.75rem !important;
    padding: 6px 12px !important;
  }

  #statsCanvas .canvas-content button,
  #statsCanvas .tab-content button {
    font-size: 0.75rem !important;
    padding: 6px 12px !important;
    margin: 2px 4px 2px 0 !important;
  }

  .time-distance-controls {
    gap: 6px;
  }

  .time-distance-controls label {
    width: 100%;
  }

  #timeDistancePlot {
    min-height: 320px !important;
  }


  /* bigger close button touch target */
  .close-canvas-btn {
    padding: 10px;
    margin-right: 8px;
  }

  #ribbonPanel {
    gap: 4px !important;
    max-height: 30px;
    flex-direction: row;
    justify-content: flex-end;
  }


  .ribbon-label {
    font-size: 0.60em;
  }

  .filter-row {
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
  }

  .filter-label {
    flex: 0 0 auto;
    min-width: 26%;
    max-width: 40%;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    order: 0;
    font-size: 0.95rem;
  }

  .filter-select {
    order: 1;
    flex: 1 1 auto;
    width: auto !important;
    min-width: 0;
    margin-top: 0;
    padding: 8px 10px;    
    max-height: 44px;
    overflow-y: auto;
    max-width: fit-content;
  }

  .select-all-btn {
    order: 2;
    flex: 0 0 auto;    
    flex-wrap: nowrap;
    margin-left: 6px;    
  }

  #tripsPerHourAnnotation {
    font-size: 0.7rem !important;
  }

  /* keep map visible by giving it left padding equal to the left-sheet width (approximately) */
  /* changed: in portrait we reduce height to leave space for bottom sheet; in landscape we shift main area to the right */
  #map {
    height: 100vh;
    margin-left: 48vw; /* push map to the right of the left-column canvases */
  }
}






















html, body, #controls, .canvas-content {
  -webkit-overflow-scrolling: touch;
  touch-action: manipulation;
}

/* Headway help icon (placed over trips-per-hour chart) */
.trips-per-hour-chart-wrapper { position: relative; }

.headway-help {
  position: absolute;
  top: 8px;
  right: 12px;
  width: 28px;
  height: 28px;
  line-height: 28px;
  text-align: center;
  border-radius: 50%;
  background: #0078d7;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: default;
  z-index: 2200;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  outline: none;
}

/* tooltip box (hidden by default) */
.headway-help .help-tooltiptext {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 300px;
  max-width: calc(100vw - 40px);
  background: rgba(54, 113, 158, 0.95);
  color: #ffffff;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.95rem;
  line-height: 1.3;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  transition: opacity 0.15s ease, visibility 0.15s;
  pointer-events: none;
  white-space: normal;
  text-align: left;
}

/* show tooltip on hover/focus only on hover-capable (desktop) devices */
@media (hover: hover) and (pointer: fine) {
  .headway-help:hover .help-tooltiptext,
  .headway-help:focus .help-tooltiptext {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
  }
}

/* hide the help icon on small screens (touch devices) */
@media (max-width: 900px) {
  .headway-help { display: none !important; }

}

