html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#map {
  position: absolute;
  inset: 0;
}

#panel {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 10;
  background: rgba(20, 20, 25, 0.9);
  color: #f2f2f2;
  padding: 14px 16px;
  border-radius: 10px;
  width: 300px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  max-height: calc(100vh - 24px);
  overflow-y: auto;
}

#panel h1 {
  font-size: 15px;
  margin: 0 0 10px 0;
  font-weight: 600;
}

.clock {
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin: 4px 0 10px 0;
}

#controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

#playBtn {
  background: #3b82f6;
  border: none;
  color: white;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
}

#speedSel {
  background: #333;
  color: #eee;
  border: 1px solid #555;
  border-radius: 6px;
  font-size: 12px;
  padding: 3px 4px;
}

#slider {
  flex: 1;
}

.section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #999;
  margin: 10px 0 4px 0;
  border-top: 1px solid #3a3a3a;
  padding-top: 8px;
}

#runningList {
  font-size: 12px;
  line-height: 1.6;
}

#runningList .ka-row {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

#runningList .ka-name {
  color: #fff;
}

#runningList .ka-status {
  color: #9ad;
  white-space: nowrap;
}

#eventLog {
  font-size: 12px;
  line-height: 1.5;
  max-height: 160px;
  overflow-y: auto;
}

#eventLog .event-row {
  padding: 4px 0;
  border-bottom: 1px solid #333;
}

#eventLog .event-row.silang { color: #ff9d5c; }
#eventLog .event-row.susul { color: #7fd7ff; }

#eventLog .event-row .event-time {
  color: #888;
  font-size: 11px;
  margin-right: 4px;
}

#legend {
  font-size: 11px;
  color: #999;
  margin-top: 10px;
  border-top: 1px solid #3a3a3a;
  padding-top: 8px;
}

.maplibregl-popup-content {
  background: #1c1c22;
  color: #f2f2f2;
  font-size: 12px;
  border-radius: 6px;
}

/* --- Card bawah: detail KA saat diklik --- */
#trainCard {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 10;
  max-width: 640px;
  margin: 0 auto;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22);
  display: none;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
}

#trainCard.visible {
  display: flex;
}

.tc-badge {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #1e3a8a;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tc-main {
  flex: 1;
  min-width: 0;
}

.tc-name {
  font-weight: 700;
  font-size: 14px;
  color: #111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tc-status {
  font-size: 12px;
  color: #16a34a;
  margin-top: 2px;
}

.tc-status b { color: #111; }

.tc-progress-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.tc-progress-track {
  flex: 1;
  height: 4px;
  background: #e5e7eb;
  border-radius: 2px;
  overflow: hidden;
}

.tc-progress-bar {
  height: 100%;
  background: #16a34a;
  border-radius: 2px;
  width: 0%;
  transition: width 0.2s linear;
}

.tc-progress-pct {
  font-size: 11px;
  color: #888;
  width: 32px;
  text-align: right;
}

.tc-sub {
  font-size: 11px;
  color: #888;
  margin-top: 4px;
  display: flex;
  gap: 10px;
}

.tc-right {
  flex-shrink: 0;
  text-align: right;
}

.tc-clock {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #111;
}

.tc-btns {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.tc-btns button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid #ddd;
  background: #fafafa;
  cursor: pointer;
  font-size: 13px;
  color: #555;
}

.tc-btns button:hover {
  background: #eee;
}
