:root {
  --bg: #eef5f5;
  --surface: #ffffff;
  --primary: #1e6f5c;
  --primary-dark: #155a49;
  --accent: #f9b23f;
  --accent-dark: #e09d2c;
  --text: #1e2f3e;
  --text-light: #5a6f88;
  --border: #dce6ec;
  --radius-card: 20px;
  --radius-btn: 48px;
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.05);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  padding: 16px;
  color: var(--text);
}

.app {
  max-width: 600px;
  margin: 0 auto;
  background: var(--surface);
  border-radius: 32px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

/* header */
.top-bar {
  background: linear-gradient(105deg, var(--primary), var(--primary-dark));
  padding: 20px 18px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bus-icon {
  background: rgba(255,255,255,0.15);
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 28px;
  font-size: 1.8rem;
  color: white;
}

.title h1 {
  font-size: 1.7rem;
  font-weight: 800;
  color: white;
  letter-spacing: -0.3px;
}

.title p {
  font-size: 0.7rem;
  color: #ffdfaa;
  font-weight: 500;
}

/* live cards */
.live-strip {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  background: white;
  border-bottom: 1px solid var(--border);
}

.live-card {
  background: #fafcff;
  border-radius: 24px;
  padding: 14px 18px;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  border: 1px solid var(--border);
}

.live-card .label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--primary);
  background: #e0f0ec;
  padding: 4px 12px;
  border-radius: 40px;
}

.live-card .label i {
  margin-right: 4px;
  font-size: 0.7rem;
}

.live-card .value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  margin-left: auto;
  letter-spacing: -0.2px;
}

.live-card .small {
  font-size: 0.75rem;
  color: var(--text-light);
  width: 100%;
  margin-top: 6px;
  font-weight: 500;
}

/* controls */
.controls {
  padding: 16px 18px;
  background: white;
  border-bottom: 1px solid var(--border);
}

.stop-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  background: #f8fafd;
  padding: 8px 16px;
  border-radius: 60px;
}

.stop-picker label {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--primary);
}

.stop-picker label i {
  margin-right: 6px;
}

select {
  flex: 1;
  background: white;
  border: 1px solid #cde0d8;
  border-radius: 40px;
  padding: 12px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--text);
  outline: none;
}

.route-switch {
  display: flex;
  gap: 12px;
}

.route-btn {
  flex: 1;
  background: #eff3f8;
  border: none;
  padding: 14px 8px;
  border-radius: 60px;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--primary);
  text-align: center;
  cursor: pointer;
  transition: 0.2s;
  font-family: inherit;
  white-space: nowrap;
  overflow-x: auto;
}

.route-btn i {
  margin: 0 4px;
}

.route-btn.active {
  background: var(--accent);
  color: #1f3b4c;
  box-shadow: 0 4px 12px rgba(249, 178, 63, 0.3);
}

/* timetable */
.timetable {
  padding: 0 0 20px 0;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: white;
}

table {
  border-collapse: collapse;
  font-size: 0.75rem;
  min-width: 600px;
  width: 100%;
}

thead th {
  background: var(--primary);
  color: white;
  padding: 14px 8px;
  font-weight: 600;
  text-align: center;
  border-right: 1px solid #308a74;
  white-space: nowrap;
}

tbody td {
  padding: 12px 6px;
  text-align: center;
  border-bottom: 1px solid #eef2f8;
  border-right: 1px solid #eef2f8;
  white-space: nowrap;
  font-weight: 500;
}

tbody td:first-child {
  background: #f7fafd;
  font-weight: 800;
  color: var(--primary-dark);
  border-right: 2px solid var(--accent);
  position: sticky;
  left: 0;
  z-index: 2;
}

/* highlight next trip row */
.next-trip-highlight td {
  background: #fff1cf !important;
  box-shadow: inset 0 0 0 2px var(--accent);
}

.next-trip-highlight td:first-child {
  background: #ffe3a4 !important;
}

.halt-badge {
  background: #fee2e2;
  color: #c23d1c;
  padding: 2px 10px;
  border-radius: 40px;
  font-weight: 800;
  font-size: 0.65rem;
  white-space: nowrap;
}

.empty-time {
  color: #b9cee8;
}

footer {
  text-align: center;
  padding: 18px;
  font-size: 0.7rem;
  color: var(--text-light);
  border-top: 1px solid var(--border);
  background: #fdfdfd;
}

footer i {
  margin-right: 6px;
  color: var(--accent);
}

/* larger screens */
@media (min-width: 600px) {
  body {
    padding: 24px;
  }
  .app {
    max-width: 1200px;
  }
  .live-strip {
    flex-direction: row;
    gap: 16px;
  }
  .live-card {
    flex: 1;
  }
  .live-card .value {
    font-size: 1.7rem;
  }
  table {
    font-size: 0.85rem;
  }
}

/* touch targets */
button, select, .route-btn {
  cursor: pointer;
}

button:active {
  transform: scale(0.97);
}