@font-face {
  font-family: 'SL Gothic';
  src: url('fonts/slgothictext2-regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'SL Gothic';
  src: url('fonts/slgothictext2-bold.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: 'SL Gothic Display';
  src: url('fonts/slgothicdisplay-bold.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

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

html,
body {
  height: 100%;
  background: #0a0a1a;
  color: #e8e8f0;
  font-family: 'SL Gothic', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* Hide scrollbar */
body {
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

body::-webkit-scrollbar {
  display: none;
}

.updated {
  font-size: 0.75rem;
  color: #6b6b80;
  text-align: center;
  padding: 12px 16px 24px;
}

main {
  max-width: 500px;
  margin: 0 auto;
  padding: 16px 16px 24px;
}

.stop-section {
  background: #141428;
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
}

.stop-header {
  padding: 8px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  gap: 8px;
}

.add-line-section {
  background: transparent;
  border: 1px dashed rgba(255, 255, 255, 0.15);
  cursor: pointer;
}

.add-line-header {
  background: transparent !important;
  justify-content: center;
  color: rgba(255, 255, 255, 0.3);
  font-size: 1.2rem;
}

.add-line-section:not(.disabled):hover {
  border-color: rgba(255, 255, 255, 0.3);
}

.add-line-section:not(.disabled):hover .add-line-header {
  color: rgba(255, 255, 255, 0.6);
}

.add-line-section.disabled {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

.timetable-link {
  color: rgba(255, 255, 255, 0.4);
  text-decoration: none;
  font-size: 0.75rem;
}

.departure-row {
  display: flex;
  align-items: center;
  padding: 8px 14px;
  gap: 10px;
}

.departure-row:nth-child(odd) {
  background: rgba(255, 255, 255, 0.03);
}

.destination {
  flex: 1;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.time {
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
  color: #e8e8f0;
  flex-shrink: 0;
}

.time-min {
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  color: #e8e8f0;
  flex-shrink: 0;
  margin-right: 8px;
}

.time.now {
  font-weight: 700;
}

.direction-header {
  padding: 6px 14px 2px;
  font-size: 0.7rem;
  color: #6b6b80;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.no-departures {
  padding: 12px 14px;
  color: #6b6b80;
  font-size: 0.85rem;
}

/* Pulsating urgency animation */
@keyframes pulse-urgency {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.time-pulse {
  animation: pulse-urgency 1.5s ease-in-out infinite;
}

.deviation-banner {
  padding: 6px 14px;
  font-size: 0.75rem;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.08);
  border-bottom: 1px solid rgba(245, 158, 11, 0.15);
  line-height: 1.4;
}

.route-title {
  padding: 8px 14px 4px;
  font-size: 0.75rem;
  color: #6b6b80;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Route card */
#route-card {
  max-width: 500px;
  margin: 0 auto;
  padding: 0 16px;
}

.route-card {
  background: #141428;
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
}

.route-journey {
  padding: 10px 14px;
}

.route-journey + .route-journey {
  border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.route-times {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.route-dep {
  font-weight: 700;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.route-dur {
  font-size: 0.75rem;
  color: #6b6b80;
  flex: 1;
  text-align: center;
}

.route-arr {
  font-weight: 700;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.route-legs {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.route-legs::-webkit-scrollbar {
  display: none;
}

.route-leg {
  font-size: 0.8rem;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

.route-leg.transit {
  background: rgba(255, 255, 255, 0.08);
}

.route-leg.walk {
  color: #6b6b80;
}

.route-arrow {
  color: #6b6b80;
  font-size: 0.7rem;
}

/* Line header elements */
.line-name {
  font-family: 'SL Gothic Display', 'SL Gothic', sans-serif;
  font-weight: 700;
}

.line-input {
  background: none;
  border: none;
  color: #fff;
  font-family: 'SL Gothic Display', 'SL Gothic', sans-serif;
  font-weight: 700;
  font-size: inherit;
  width: 100%;
  outline: none;
  padding: 0;
}

.line-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.line-input.input-error {
  color: #ef4444;
}

.line-input.input-error::placeholder {
  color: #ef4444;
}

.line-ok {
  cursor: pointer;
  margin-left: auto;
  font-size: 0.8rem;
  font-weight: 700;
  opacity: 0.6;
  padding: 4px 20px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  display: none;
}

@media (min-width: 600px) {
  .line-ok {
    display: inline;
  }
}

.line-ok:hover {
  opacity: 1;
}

.line-ok.hidden {
  visibility: hidden;
}

.station-pick {
  cursor: pointer;
  opacity: 0.8;
  font-size: 0.8rem;
}

.station-pick:hover {
  opacity: 1;
  text-decoration: underline;
}

.header-sep {
  opacity: 0.4;
  margin: 0 4px;
  font-size: 0.8rem;
}

.route-pick {
  cursor: pointer;
  opacity: 0.8;
  font-size: 0.85rem;
}

.route-pick:hover {
  opacity: 1;
  text-decoration: underline;
}

.route-swap {
  cursor: pointer;
  opacity: 0.5;
  font-size: 0.85rem;
  padding: 0 2px;
}

.route-swap:hover {
  opacity: 1;
}

.line-clear {
  margin-left: auto;
  cursor: pointer;
  opacity: 0.4;
  font-size: 1.3rem;
  padding: 0 6px;
}

.line-clear:hover {
  opacity: 1;
}

/* Search modal */
.search-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 20vh;
}

.search-box {
  width: 90%;
  max-width: 400px;
  background: #1a1a2e;
  border-radius: 12px;
  overflow: hidden;
}

.search-input {
  width: 100%;
  padding: 14px 16px;
  background: #252540;
  border: none;
  color: #fff;
  font-size: 1rem;
  outline: none;
  box-sizing: border-box;
}

.search-results {
  max-height: 300px;
  overflow-y: auto;
}

.search-result {
  padding: 12px 16px;
  color: #ccc;
  cursor: pointer;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.search-result:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* Tablet+ */
@media (min-width: 600px) {
  main {
    max-width: 700px;
    padding: 12px 24px 32px;
  }

  #route-card {
    max-width: 700px;
    padding: 24px 24px 0;
  }

  .departure-row {
    padding: 10px 18px;
  }

  .destination {
    font-size: 0.95rem;
  }

  .time {
    font-size: 0.95rem;
  }

  .route-journey {
    padding: 12px 18px;
  }

  .route-dep,
  .route-arr {
    font-size: 1rem;
  }

  .route-leg {
    font-size: 0.85rem;
    padding: 3px 8px;
  }
}

/* Settings bar */
.settings-bar {
  max-width: 500px;
  margin: 0 auto;
  padding: 8px 16px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 0.75rem;
  color: #6b6b80;
}

.settings-bar label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.settings-bar select {
  background: #141428;
  color: #e8e8f0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.75rem;
  font-family: inherit;
  outline: none;
}

/* Desktop */
@media (min-width: 900px) {
  main {
    max-width: 800px;
    padding: 16px 32px 40px;
  }

  #route-card {
    max-width: 800px;
    padding: 32px 32px 0;
  }

  .departure-row {
    padding: 12px 20px;
  }

  .destination {
    font-size: 1rem;
  }

  .time {
    font-size: 1rem;
  }

  .route-dep,
  .route-arr {
    font-size: 1.1rem;
  }

  .route-dur {
    font-size: 0.85rem;
  }

  .route-leg {
    font-size: 0.9rem;
    padding: 4px 10px;
  }

  .route-arrow {
    font-size: 0.8rem;
  }
}
