html,
body {
  margin: 0;
  height: 100%;
  font-family: "Space Grotesk", "Avenir Next", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, #dde7ff 0, rgba(221, 231, 255, 0) 38%),
    radial-gradient(circle at 80% 20%, #d6f8f4 0, rgba(214, 248, 244, 0) 35%),
    #eef2f7;
  color: #0f172a;
}

.app-shell {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  box-sizing: border-box;
}

.panel {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #cfd8e6;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.top-bar h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1;
  letter-spacing: 0.02em;
}

.top-bar p {
  margin: 6px 0 0;
  color: #475569;
  font-size: 14px;
}

.graph-meta {
  font-size: 13px;
  color: #334155;
  font-weight: 600;
  background: #f8fafc;
  border: 1px solid #d9e2f0;
  border-radius: 999px;
  padding: 6px 10px;
}

.hud-grid {
  display: grid;
  grid-template-columns: minmax(300px, 1.8fr) minmax(180px, 0.9fr) minmax(220px, 1.2fr) minmax(190px, 0.95fr);
  gap: 14px;
  align-items: stretch;
}

.panel-title {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #334155;
}

.controls-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: center;
}

#start-round-btn {
  width: 100%;
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  box-shadow: 0 8px 24px rgba(29, 78, 216, 0.35);
}

button {
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: #ffffff;
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(30, 64, 175, 0.3);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
  box-shadow: none;
}

.controls-help {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: #475569;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #dde5f2;
  padding: 10px;
}

.status {
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
  color: #166534;
  font-weight: 600;
}

.status.error {
  color: #b42318;
}

.timer-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px solid #b5c6ea;
  background:
    radial-gradient(circle at 20% 20%, rgba(191, 219, 254, 0.45) 0, rgba(191, 219, 254, 0) 70%),
    #ffffff;
}

.timer-label {
  font-size: 12px;
  color: #475569;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.countdown {
  font-size: 62px;
  font-weight: 900;
  line-height: 1;
  color: #b91c1c;
  letter-spacing: 0.04em;
}

body.round-active .timer-panel {
  border-color: #3b82f6;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.22);
}

body.timer-urgent .timer-panel {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.18), 0 12px 26px rgba(185, 28, 28, 0.25);
}

body.timer-urgent .countdown {
  color: #991b1b;
}

.result-panel {
  border: 1px solid #d6deeb;
  background:
    linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.result-panel p {
  margin: 8px 0;
  font-size: 14px;
  color: #1e293b;
}

.result-panel strong {
  font-size: 16px;
}

.gtfs-panel {
  background: #f8fafc;
  border: 1px solid #d5e0f0;
}

.legend-row {
  margin: 7px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #334155;
  font-weight: 600;
}

.legend-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: inline-block;
}

.legend-dot.bus {
  background: #f97316;
}

.legend-dot.trolley {
  background: #7c3aed;
}

.legend-dot.tram {
  background: #0891b2;
}

.legend-dot.other {
  background: #4b5563;
}

#map {
  width: 100%;
  min-height: 560px;
  height: calc(100vh - 190px);
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.1);
}

.player-triangle-icon {
  background: transparent;
  border: none;
}

.player-triangle {
  width: 0;
  height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 18px solid #d92d20;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
  transform-origin: 50% 64%;
}

.gtfs-icon {
  background: transparent;
  border: none;
}

.gtfs-marker {
  min-width: 26px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  padding: 0 5px;
  position: relative;
  overflow: visible;
}

.gtfs-label {
  display: inline-block;
  letter-spacing: 0.2px;
}

.gtfs-dir {
  position: absolute;
  right: -7px;
  top: 4px;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 8px solid #111827;
  transform-origin: 50% 70%;
  filter: drop-shadow(0 1px 1px rgba(255, 255, 255, 0.45));
}

.gtfs-marker.bus {
  background: #f97316;
}

.gtfs-marker.trolley {
  background: #7c3aed;
}

.gtfs-marker.tram {
  background: #0891b2;
}

.gtfs-marker.other {
  background: #4b5563;
}

.gtfs-cluster {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.84);
  border: 2px solid rgba(255, 255, 255, 0.95);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(2, 6, 23, 0.3);
}

@media (max-width: 980px) {
  .app-shell {
    padding: 10px;
    gap: 10px;
  }

  .hud-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .controls-panel {
    grid-column: 1 / -1;
  }

  .timer-panel {
    min-height: 118px;
  }

  #map {
    min-height: 62vh;
    height: 62vh;
  }
}

@media (max-width: 680px) {
  .top-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .hud-grid {
    grid-template-columns: 1fr;
  }
}
