:root { --bg:#0b0f13; --panel:#121820; --text:#eaf2ff; --muted:#9fb0c3; --brand:#6ee7b7; --accent:#60a5fa; }
*{box-sizing:border-box}
html, body { height: 100%; margin: 0; padding: 0; }
body{margin:0; background:var(--bg); color:var(--text); font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Helvetica,Arial,sans-serif}
#app{display:grid; grid-template-columns:360px 1fr; height:100vh}
#sidebar{background:var(--panel); border-right:1px solid #1f2b38; display:flex; flex-direction:column}
header{padding:16px; border-bottom:1px solid #1f2b38; display:flex; align-items:center; gap:10px}
header h1{font-size:18px; margin:0; letter-spacing:0.2px}
header .badge{font-size:11px; background:#1b2633; color:var(--muted); padding:2px 8px; border-radius:999px}
.controls{padding:12px 16px; display:grid; gap:12px}
.group{display:grid; gap:6px}
.label{font-size:12px; color:var(--muted)}
.label.ghost {
  background: transparent;
  border: 1.5px solid #2b3b4e;
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text);
  font-weight: 600;
  transition: background 0.15s, border 0.15s;
  margin-bottom: 2px;
}
.label.ghost:hover, .label.ghost:focus {
  background: #1b2633;
  border-color: var(--accent);
  color: var(--brand);
}
.row{display:flex; gap:8px; align-items:center}
input[type="number"], input[type="text"], select{width:100%; background:#0f141b; border:1px solid #283546; color:var(--text); padding:10px 12px; border-radius:12px}
button{background:var(--accent); color:white; border:none; padding:10px 12px; border-radius:12px; cursor:pointer; font-weight:600}
button.secondary{background:#1b2633; color:var(--text)}
button.ghost{background:transparent; border:1px solid #2b3b4e}
button.danger{background:#ef4444}
.muted{color:var(--muted)}
#map{height:100%; width:100%}
.sectionTitle{padding:8px 16px; font-size:12px; letter-spacing:.4px; color:var(--muted)}
.list{padding:8px 8px 24px 8px; overflow:auto}
.card{background:#0f141b; border:1px solid #243244; border-radius:16px; padding:12px; margin:8px; display:grid; gap:8px}
.pubTitle{font-weight:700}
.pill{font-size:11px; padding:3px 8px; border-radius:999px; background:#17202a; color:var(--muted)}
.flex{display:flex; align-items:center; gap:8px}
.space{justify-content:space-between}
.wrap{flex-wrap:wrap}
.tiny{font-size:11px}
.hr{height:1px; background:#1f2b38; margin:6px -12px}
.link{color:#93c5fd; text-decoration:none}
.footer{padding:8px 16px; border-top:1px solid #1f2b38; font-size:12px; color:var(--muted)}
#rideonSummary{padding:8px 16px; font-size:12px; color:var(--muted); border-top:1px solid #1f2b38;}
@media (max-width: 900px){ #app{grid-template-columns:1fr; grid-template-rows:48% 52%} #sidebar{order:2} #map{order:1} }
.toast{position:fixed; top:16px; left:50%; transform:translateX(-50%); background:#0f141b; color:var(--text); padding:10px 14px; border:1px solid #2b3b4e; border-radius:12px; z-index:10000; display:none}
.popupContent{font: 12px/1.4 system-ui;}
.popupContent .title{font-weight:700; font-size:14px;}
.popupContent .sub{color:#688199}

/* Make Leaflet Routing Machine text darker */
.leaflet-routing-container,
.leaflet-routing-container * {
  color: #222 !important;
}

#rideonDropdownContent {
  transition: max-height 0.25s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}

/* Welcome Overlay Styles */
#welcomeOverlay {
  position: fixed;
  z-index: 99999;
  inset: 0;
  background: #111418; /* Dark but not pure black */
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  transition: opacity 0.4s;
}
.welcome-content {
  max-width: 1200px; /* Much wider */
  width: 90vw;
  margin: 0 auto;
  background: transparent; /* Remove panel background */
  border-radius: 40px;
  box-shadow: none;
  padding: 20px 0 40px 0; /* more breathing room */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 48px; /* increased spacing */
}
.welcome-title { margin-top: 0; margin-bottom: 0; }
.welcome-sub { margin-top: 8px; margin-bottom: 4px; }
.welcome-steps { gap: 44px; }
.welcome-step { padding: 34px 38px 30px 38px; min-height: 160px; }
#welcomeContinueBtn { padding: 18px 56px; }
/* mobile-scroll is hidden by default (desktop) */
.mobile-scroll{display:none}
.welcome-title {
  font-size: 2.7rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  margin-top: -40px;
  margin-bottom: -40px;
  color: var(--brand);
}
.welcome-sub {
  font-size: 1.25rem;
  color: var(--muted);
  margin-bottom: 0px;
  margin-top: 4px;
  text-align: center;
}
.welcome-steps {
  display: flex;
  gap: 36px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}
.welcome-step {
  background: #1b1f24;
  border: 2px solid #2b3b4e;
  border-radius: 28px;
  padding: 32px 38px 28px 38px;
  min-width: 260px;
  max-width: 340px;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  box-shadow: 0 4px 24px #0003;
  transition: border 0.2s, box-shadow 0.2s;
  flex: 1 1 300px;
}
.welcome-step:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 32px #60a5fa22;
}
.step-num {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 1.3rem;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  box-shadow: 0 2px 8px #60a5fa33;
}
.step-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--brand);
  text-align: left;
}
.step-desc {
  font-size: 1.05rem;
  color: var(--text);
  text-align: left;
}
#welcomeContinueBtn {
  margin-top: 10px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 16px;
  padding: 16px 48px;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 12px #60a5fa33;
  transition: background 0.18s;
}
#welcomeContinueBtn:hover {
  background: var(--brand);
  color: #222;
}
@media (max-width: 1100px) {
  .welcome-content { max-width: 98vw; }
  .welcome-steps { flex-direction: column; gap: 24px; }
  .welcome-step { min-width: 0; max-width: 100%; width: 100%; align-items: flex-start; }
}

/* Mobile (phone) adjustments */
@media (max-width: 600px) {
  /* Layout */
  /* Map sits in the top row and sidebar below on small screens */
  #app { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  #map{order:1}
  #sidebar{order:2; width:100%; height:auto; border-right:none; border-bottom:1px solid #1f2b38; }
  header { padding:12px; }

  /* Controls and inputs */
  .controls { padding:12px; gap:10px; }
  .row { flex-direction:column; align-items:stretch; gap:10px; }
  input[type="text"], input[type="number"], select { padding:12px 14px; font-size:16px; }

  /* Buttons and touch targets */
  button, .button { width:100%; display:block; padding:12px 14px; font-size:16px; }
  button.ghost, .button.ghost { box-sizing:border-box; }

  /* Sidebar list and footer */
  .list { padding-bottom:48px; }
  .footer { padding:12px; font-size:13px; }

  /* Toast and overlays */
  .toast { left:16px; right:16px; transform:none; }
  #welcomeOverlay .welcome-content { width:95vw; padding:20px; gap:22px }
  /* give mobile welcome sections a little more space */
  .mobile-scroll{margin-bottom:18px}
  .welcome-step{padding:22px 20px; min-height:120px}

  /* Mobile welcome scroll */
  .mobile-scroll{display:block;background:#0f141b;border:1px solid #243244;border-radius:12px;padding:10px;max-height:44vh;overflow-y:auto;-webkit-overflow-scrolling:touch;margin-bottom:12px}
  .mobile-scroll .scroll-title{font-weight:700;margin:0 0 6px;color:var(--brand)}
  .mobile-scroll .scroll-step{display:flex;gap:10px;align-items:flex-start;padding:8px 6px;border-bottom:1px solid #17202a}
  .mobile-scroll .scroll-step:last-child{border-bottom:none}
  .mobile-scroll .step-num{width:32px;height:32px;border-radius:50%;display:flex;align-items:center;justify-content:center;background:var(--accent);color:#fff;font-weight:700}
  .mobile-scroll .step-text strong{display:block;font-weight:700}
  .mobile-scroll .step-text .tiny{color:var(--muted);font-size:0.95rem}
  /* Hide original grid on mobile to avoid duplication */
  .welcome-steps{display:none}

  /* Mobile toolbar overlay: bottom third scrollable toolbar */
  .mobile-toolbar{display:block; position:fixed; bottom:0; left:0; right:0; height:33vh; z-index:99998; background:var(--panel); border-top:1px solid #1f2b38; box-shadow: 0 -6px 24px #0006; overflow-y:auto; -webkit-overflow-scrolling:touch;}
  .mobile-toolbar-inner{padding:12px 16px}
  .mobile-toolbar .controls{padding:8px 8px}
  /* make selected list scrollable inside the toolbar (if long) and style footer */
  .mobile-toolbar #selectedList{max-height:18vh; overflow:auto; margin-bottom:8px}
  .mobile-toolbar .footer{border-top:1px solid #17202a; padding-top:12px; margin-top:12px; color:var(--muted)}
  /* a small handle to reopen if collapsed */
  .mobile-toolbar-toggle{position:fixed; bottom:8px; right:12px; z-index:99999; background:#0f141b; border:1px solid #2b3b4e; color:var(--text); padding:6px 8px; border-radius:10px; font-weight:700}
}